public interface Model extends java.lang.Iterable<Tab>
TabSwitcher must
implement.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Model.Listener
Defines the interface, a class, which should be notified about the model's events, must
implement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllTabs(java.util.Collection<? extends Tab> tabs)
Adds all tabs, which are contained by a collection, to the tab switcher.
|
void |
addAllTabs(java.util.Collection<? extends Tab> tabs,
int index)
Adds all tabs, which are contained by a collection, to the tab switcher, starting at a
specific index.
|
void |
addAllTabs(java.util.Collection<? extends Tab> tabs,
int index,
Animation animation)
Adds all tabs, which are contained by a collection, to the tab switcher, starting at a
specific index.
|
void |
addAllTabs(Tab[] tabs)
Adds all tabs, which are contained by an array, to the tab switcher.
|
void |
addAllTabs(Tab[] tabs,
int index)
Adds all tabs, which are contained by an array, to the tab switcher, starting at a specific
index.
|
void |
addAllTabs(Tab[] tabs,
int index,
Animation animation)
Adds all tabs, which are contained by an array, to the tab switcher, starting at a
specific index.
|
void |
addCloseTabListener(TabCloseListener listener)
Adds a new listener, which should be notified, when a tab is about to be closed by clicking
its close button.
|
void |
addTab(Tab tab)
Adds a new tab to the tab switcher.
|
void |
addTab(Tab tab,
int index)
Adds a new tab to the tab switcher at a specific index.
|
void |
addTab(Tab tab,
int index,
Animation animation)
Adds a new tab to the tab switcher at a specific index.
|
void |
addTabPreviewListener(TabPreviewListener listener)
Adds a new listener, which should be notified, when the preview of a tab is about to be
loaded.
|
boolean |
areToolbarsShown()
Returns, whether the toolbars are shown, when the tab switcher is shown, or not.
|
void |
clear()
Removes all tabs from the tab switcher.
|
void |
clear(Animation animation)
Removes all tabs from the tab switcher.
|
android.content.res.ColorStateList |
getAddTabButtonColor()
Returns the color of the button, which allows to add a new tab.
|
android.content.Context |
getContext()
Returns the context, which is used by the tab switcher.
|
int |
getCount()
Returns the number of tabs, which are contained by the tab switcher.
|
TabSwitcherDecorator |
getDecorator()
Returns the decorator, which allows to inflate the views, which correspond to the tabs of the
tab switcher.
|
android.view.View |
getEmptyView()
Returns the view, which is shown, when the tab switcher is empty.
|
LogLevel |
getLogLevel()
Returns the log level, which is used for logging.
|
int |
getPaddingBottom()
Returns the bottom padding of the tab switcher.
|
int |
getPaddingEnd()
Returns the end padding of the tab switcher.
|
int |
getPaddingLeft()
Returns the left padding of the tab switcher.
|
int |
getPaddingRight()
Returns the right padding of the tab switcher.
|
int |
getPaddingStart()
Returns the start padding of the tab switcher.
|
int |
getPaddingTop()
Returns the top padding of the tab switcher.
|
Tab |
getSelectedTab()
Returns the currently selected tab.
|
int |
getSelectedTabIndex()
Returns the index of the currently selected tab.
|
Tab |
getTab(int index)
Returns the tab at a specific index.
|
android.content.res.ColorStateList |
getTabBackgroundColor()
Returns the default background color of a tab.
|
android.graphics.drawable.Drawable |
getTabCloseButtonIcon()
Returns the default icon of a tab's close button.
|
int |
getTabContentBackgroundColor()
Returns the default background color of a tab's content.
|
android.graphics.drawable.Drawable |
getTabIcon()
Returns the default icon of a tab.
|
int |
getTabProgressBarColor()
Returns the color of a tab's progress bar.
|
android.content.res.ColorStateList |
getTabTitleTextColor()
Returns the default text color of a tab's title.
|
android.graphics.drawable.Drawable |
getToolbarNavigationIcon()
Returns the navigation icon of the toolbar, which is shown, when the tab switcher is shown.
|
java.lang.CharSequence |
getToolbarTitle()
Returns the title of the toolbar, which is shown, when the tab switcher is shown.
|
void |
hideSwitcher()
Hides the tab switcher by using an animation, if it is currently shown.
|
int |
indexOf(Tab tab)
Returns the index of a specific tab.
|
void |
inflateToolbarMenu(int resourceId,
OnMenuItemClickListener listener)
Inflates the menu of the toolbar, which is shown, when the tab switcher is shown.
|
boolean |
isAddTabButtonShown()
Returns, whether a button, which allows to add a new tab, is shown.
|
boolean |
isEmpty()
Returns, whether the tab switcher is empty, or not.
|
boolean |
isSwitcherShown()
Returns, whether the tab switcher is currently shown.
|
void |
removeCloseTabListener(TabCloseListener listener)
Removes a specific listener, which should not be notified, when a tab is about to be closed
by clicking its close button, anymore.
|
void |
removeTab(Tab tab)
Removes a specific tab from the tab switcher.
|
void |
removeTab(Tab tab,
Animation animation)
Removes a specific tab from the tab switcher.
|
void |
removeTabPreviewListener(TabPreviewListener listener)
Removes a specific listener, which should not be notified, when the preview of a tab is about
to be loaded.
|
void |
selectTab(int index)
Selects the tab as a specific index.
|
void |
selectTab(Tab tab)
Selects a specific tab.
|
void |
setAddTabButtonColor(android.content.res.ColorStateList colorStateList)
Sets the color of the button, which allows to add a new tab.
|
void |
setAddTabButtonColor(int color)
Sets the color of the button, which allows to add a new tab.
|
void |
setDecorator(TabSwitcherDecorator decorator)
Sets the decorator, which allows to inflate the views, which correspond to the tabs of the
tab switcher.
|
void |
setEmptyView(int resourceId)
Sets the view, which should be shown, when the tab switcher is empty.
|
void |
setEmptyView(int resourceId,
long animationDuration)
Sets the view, which should be shown, when the tab switcher is empty.
|
void |
setEmptyView(android.view.View view)
Sets the view, which should be shown, when the tab switcher is empty.
|
void |
setEmptyView(android.view.View view,
long animationDuration)
Sets the view, which should be shown, when the tab switcher is empty.
|
void |
setLogLevel(LogLevel logLevel)
Sets the log level, which should be used for logging.
|
void |
setPadding(int left,
int top,
int right,
int bottom)
Sets the padding of the tab switcher.
|
void |
setTabBackgroundColor(android.content.res.ColorStateList colorStateList)
Sets the default background color of a tab.
|
void |
setTabBackgroundColor(int color)
Sets the default background color of a tab.
|
void |
setTabCloseButtonIcon(android.graphics.Bitmap icon)
Sets the default icon of a tab's close button.
|
void |
setTabCloseButtonIcon(int resourceId)
Sets the default icon of a tab's close button.
|
void |
setTabContentBackgroundColor(int color)
Sets the default background color of a tab's content.
|
void |
setTabIcon(android.graphics.Bitmap icon)
Sets the default icon of a tab.
|
void |
setTabIcon(int resourceId)
Sets the default icon of a tab.
|
void |
setTabProgressBarColor(int color)
Sets the color of a tab's progress bar.
|
void |
setTabTitleTextColor(android.content.res.ColorStateList colorStateList)
Sets the default text color of a tab's title.
|
void |
setTabTitleTextColor(int color)
Sets the default text color of a tab's title.
|
void |
setToolbarNavigationIcon(android.graphics.drawable.Drawable icon,
android.view.View.OnClickListener listener)
Sets the navigation icon of the toolbar, which is shown, when the tab switcher is shown.
|
void |
setToolbarNavigationIcon(int resourceId,
android.view.View.OnClickListener listener)
Sets the navigation icon of the toolbar, which is shown, when the tab switcher is shown.
|
void |
setToolbarTitle(java.lang.CharSequence title)
Sets the title of the toolbar, which is shown, when the tab switcher is shown.
|
void |
setToolbarTitle(int resourceId)
Sets the title of the toolbar, which is shown, when the tab switcher is shown.
|
void |
showAddTabButton(AddTabButtonListener listener)
Sets, whether a button, which allows to add a new tab, should be shown.
|
void |
showSwitcher()
Shows the tab switcher by using an animation, if it is not already shown.
|
void |
showToolbars(boolean show)
Sets, whether the toolbars should be shown, when the tab switcher is shown, or not.
|
void |
toggleSwitcherVisibility()
Toggles the visibility of the tab switcher by using an animation, i.e.
|
android.content.Context getContext()
Context. The context may not be nullvoid setDecorator(TabSwitcherDecorator decorator)
decorator - The decorator, which should be set, as an instance of the class TabSwitcherDecorator. The decorator may not be nullTabSwitcherDecorator getDecorator()
TabSwitcherDecorator or null, if no
decorator has been setLogLevel getLogLevel()
void setLogLevel(LogLevel logLevel)
logLevel - The log level, which should be set, as a value of the enum LogLevel. The log level
may not be nullboolean isEmpty()
int getCount()
Integer
valueTab getTab(int index)
index - The index of the tab, which should be returned, as an Integer value. The
index must be at least 0 and at maximum getCount() - 1, otherwise a
IndexOutOfBoundsException will be thrownTab. The tab may not be nullint indexOf(Tab tab)
tab - The tab, whose index should be returned, as an instance of the class Tab. The
tab may not be nullInteger value or -1, if the given tab is not
contained by the tab switchervoid addTab(Tab tab)
SwipeAnimation with direction SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If
an animation is currently running, the tab will be added once all previously started
animations have been finished.tab - The tab, which should be added, as an instance of the class Tab. The tab may
not be nullvoid addTab(Tab tab, int index)
SwipeAnimation with
direction SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently
running, the tab will be added once all previously started animations have been finished.tab - The tab, which should be added, as an instance of the class Tab. The tab may
not be nullindex - The index, the tab should be added at, as an Integer value. The index must be
at least 0 and at maximum getCount(), otherwise an IndexOutOfBoundsException will be thrownvoid addTab(Tab tab, int index, Animation animation)
tab - The tab, which should be added, as an instance of the class Tab. The tab may
not be nullindex - The index, the tab should be added at, as an Integer value. The index must be
at least 0 and at maximum getCount(), otherwise an IndexOutOfBoundsException will be thrownanimation - The animation, which should be used to add the tab, as an instance of the class
Animation. The animation may not be nullvoid addAllTabs(java.util.Collection<? extends Tab> tabs)
SwipeAnimation with direction SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently running, the tabs will
be added once all previously started animations have been finished.tabs - A collection, which contains the tabs, which should be added, as an instance of the
type Collection or an empty collection, if no tabs should be addedvoid addAllTabs(java.util.Collection<? extends Tab> tabs, int index)
SwipeAnimation with direction SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently running, the tabs will
be added once all previously started animations have been finished.tabs - A collection, which contains the tabs, which should be added, as an instance of the
type Collection or an empty collection, if no tabs should be addedindex - The index, the first tab should be started at, as an Integer value. The index
must be at least 0 and at maximum getCount(), otherwise an IndexOutOfBoundsException will be thrownvoid addAllTabs(java.util.Collection<? extends Tab> tabs, int index, Animation animation)
tabs - A collection, which contains the tabs, which should be added, as an instance of the
type Collection or an empty collection, if no tabs should be addedindex - The index, the first tab should be started at, as an Integer value. The index
must be at least 0 and at maximum getCount(), otherwise an IndexOutOfBoundsException will be thrownanimation - The animation, which should be used to add the tabs, as an instance of the class
Animation. The animation may not be nullvoid addAllTabs(Tab[] tabs)
SwipeAnimation with direction SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently running, the tabs will
be added once all previously started animations have been finished.tabs - An array, which contains the tabs, which should be added, as an array of the type
Tab or an empty array, if no tabs should be addedvoid addAllTabs(Tab[] tabs, int index)
SwipeAnimation with direction SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently running, the tabs will
be added once all previously started animations have been finished.tabs - An array, which contains the tabs, which should be added, as an array of the type
Tab or an empty array, if no tabs should be addedindex - The index, the first tab should be started at, as an Integer value. The index
must be at least 0 and at maximum getCount(), otherwise an IndexOutOfBoundsException will be thrownvoid addAllTabs(Tab[] tabs, int index, Animation animation)
tabs - An array, which contains the tabs, which should be added, as an array of the type
Tab or an empty array, if no tabs should be addedindex - The index, the first tab should be started at, as an Integer value. The index
must be at least 0 and at maximum getCount(), otherwise an IndexOutOfBoundsException will be thrownanimation - The animation, which should be used to add the tabs, as an instance of the class
Animation. The animation may not be nullvoid removeTab(Tab tab)
SwipeAnimation with direction
SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently running, the tab
will be removed once all previously started animations have been finished.tab - The tab, which should be removed, as an instance of the class Tab. The tab
may not be nullvoid removeTab(Tab tab, Animation animation)
void clear()
SwipeAnimation with direction
SwipeAnimation.SwipeDirection.RIGHT_OR_BOTTOM is used. If an animation is currently running, the
tabs will be removed once all previously started animations have been finished.void clear(Animation animation)
animation - The animation, which should be used to remove the tabs, as an instance of the class
Animation. The animation may not be nullboolean isSwitcherShown()
void showSwitcher()
void hideSwitcher()
void toggleSwitcherVisibility()
Tab getSelectedTab()
Tab or null, if no tab
is currently selectedint getSelectedTabIndex()
Integer value or -1, if no tab
is currently selectedvoid selectTab(Tab tab)
tab - The tab, which should be selected, as an instance of the class Tab. The tab
may not be null. If the tab is not contained by the tab switcher, a NoSuchElementException will be thrownvoid selectTab(int index)
index - The index of the tab, which should be selected, as an Integer value. The
index must be at least 0 and at maximum getCount() - 1, otherwise a
IndexOutOfBoundsException will be thrownvoid setPadding(int left,
int top,
int right,
int bottom)
left - The left padding, which should be set, in pixels as an Integer valuetop - The top padding, which should be set, in pixels as an Integer valueright - The right padding, which should be set, in pixels as an Integer valuebottom - The bottom padding, which should be set, in pixels as an Integer valueint getPaddingLeft()
Integer valueint getPaddingTop()
Integer valueint getPaddingRight()
Integer valueint getPaddingBottom()
Integer valueint getPaddingStart()
Integer valueint getPaddingEnd()
Integer valueandroid.graphics.drawable.Drawable getTabIcon()
Drawable or null, if no
icon is setvoid setTabIcon(int resourceId)
resourceId - The resource id of the icon, which should be set, as an Integer value. The
resource id must correspond to a valid drawable resourcevoid setTabIcon(android.graphics.Bitmap icon)
icon - The icon, which should be set, as an instance of the class Bitmap or null, if
no icon should be setandroid.content.res.ColorStateList getTabBackgroundColor()
ColorStateList or null, if the default color is usedvoid setTabBackgroundColor(int color)
color - The color, which should be set, as an Integer value or -1, if the default
color should be usedvoid setTabBackgroundColor(android.content.res.ColorStateList colorStateList)
colorStateList - The color, which should be set, as an instance of the class ColorStateList or
null, if the default color should be usedint getTabContentBackgroundColor()
Integer valuevoid setTabContentBackgroundColor(int color)
color - The color, which should be set, as an Integer value or -1, if the default
color should be usedandroid.content.res.ColorStateList getTabTitleTextColor()
ColorStateList or null, if the default color is usedvoid setTabTitleTextColor(int color)
color - The color, which should be set, as an Integer value or -1, if the default
color should be usedvoid setTabTitleTextColor(android.content.res.ColorStateList colorStateList)
colorStateList - The color state list, which should be set, as an instance of the class ColorStateList or null, if the default color should be usedandroid.graphics.drawable.Drawable getTabCloseButtonIcon()
Drawable
or null, if the default icon is usedint getTabProgressBarColor()
Integer value or -1, if the default
color is usedvoid setTabProgressBarColor(int color)
color - The color, which should be set, as an Integer value or -1, if the default
color should be usedvoid setTabCloseButtonIcon(int resourceId)
resourceId - The resource id of the icon, which should be set, as an Integer value. The
resource id must correspond to a valid drawable resourcevoid setTabCloseButtonIcon(android.graphics.Bitmap icon)
icon - The icon, which should be set, as an instance of the class Bitmap or null, if
the default icon should be usedboolean isAddTabButtonShown()
void showAddTabButton(AddTabButtonListener listener)
listener - The listener, which should be notified, when the button has been clicked, as an
instance of the type AddTabButtonListener or null, if the button should not
be shownandroid.content.res.ColorStateList getAddTabButtonColor()
ColorStateList or null, if the default color is usedvoid setAddTabButtonColor(int color)
color - The color, which should be set, as an Integer value or -1, if the default
color should be usedvoid setAddTabButtonColor(android.content.res.ColorStateList colorStateList)
colorStateList - The color, which should be set, as an instance of the class ColorStateList or
null, if the default color should be usedboolean areToolbarsShown()
void showToolbars(boolean show)
show - True, if the toolbars should be shown, false otherwisejava.lang.CharSequence getToolbarTitle()
CharSequence or null, if no title is setvoid setToolbarTitle(int resourceId)
resourceId - The resource id of the title, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcevoid setToolbarTitle(java.lang.CharSequence title)
title - The title, which should be set, as an instance of the type CharSequence or
null, if no title should be setandroid.graphics.drawable.Drawable getToolbarNavigationIcon()
Drawable or null, if no icon is setvoid setToolbarNavigationIcon(int resourceId,
android.view.View.OnClickListener listener)
resourceId - The resource id of the icon, which should be set, as an Integer value. The
resource id must correspond to a valid drawable resourcelistener - The listener, which should be notified, when the navigation item has been clicked, as
an instance of the type View.OnClickListener or null, if no listener should be
notifiedvoid setToolbarNavigationIcon(android.graphics.drawable.Drawable icon,
android.view.View.OnClickListener listener)
icon - The icon, which should be set, as an instance of the class Drawable or null,
if no icon should be setlistener - The listener, which should be notified, when the navigation item has been clicked, as
an instance of the type View.OnClickListener or null, if no listener should be
notifiedvoid inflateToolbarMenu(int resourceId,
OnMenuItemClickListener listener)
resourceId - The resource id of the menu, which should be inflated, as an Integer value.
The resource id must correspond to a valid menu resourcelistener - The listener, which should be notified, when an menu item has been clicked, as an
instance of the type OnMenuItemClickListener or null, if no listener should be
notifiedandroid.view.View getEmptyView()
View or null, if no view is shownvoid setEmptyView(android.view.View view)
view - The view, which should be set, as an instance of the class View or null, if
no view should be shown, when the tab switcher is emptyvoid setEmptyView(android.view.View view,
long animationDuration)
view - The view, which should be set, as an instance of the class View or null, if
no view should be shown, when the tab switcher is emptyanimationDuration - The duration of the fade animation, which is used to show or hide the view, in
milliseconds as a Long value. The duration must be at least 0 or -1, if the
default duration should be usedvoid setEmptyView(int resourceId)
resourceId - The resource id of the view, which should be set, as an Integer value. The
resource id must correspond to a valid layout resourcevoid setEmptyView(int resourceId,
long animationDuration)
resourceId - The resource id of the view, which should be set, as an Integer value. The
resource id must correspond to a valid layout resourceanimationDuration - The duration of the fade animation, which is used to show or hide the view, in
milliseconds as a Long value. The duration must be at least 0 or -1, if the
default duration should be usedvoid addCloseTabListener(TabCloseListener listener)
listener - The listener, which should be added, as an instance of the type TabCloseListener. The listener may not be nullvoid removeCloseTabListener(TabCloseListener listener)
listener - The listener, which should be removed, as an instance of the type TabCloseListener. The listener may not be nullvoid addTabPreviewListener(TabPreviewListener listener)
listener - The listener, which should be added, as an instance of the type TabPreviewListener. The listener may not be nullvoid removeTabPreviewListener(TabPreviewListener listener)
listener - The listener, which should be removed, as an instance of the type TabPreviewListener. The listener may not be null