public class TabSwitcherDrawable extends android.graphics.drawable.Drawable implements TabSwitcherListener
TabSwitcher
. It must be registered at a TabSwitcher
instance in order to keep the
displayed label up to date. It therefore implements the interface TabSwitcherListener
.Constructor and Description |
---|
TabSwitcherDrawable(android.content.Context context)
Creates a new drawable, which allows to display the number of tabs, which are currently
contained by a
TabSwitcher . |
Modifier and Type | Method and Description |
---|---|
void |
draw(android.graphics.Canvas canvas) |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getOpacity() |
void |
onAllTabsRemoved(TabSwitcher tabSwitcher,
Tab[] tab,
Animation animation)
The method, which is invoked, when all tabs have been removed from the tab switcher.
|
void |
onSelectionChanged(TabSwitcher tabSwitcher,
int selectedTabIndex,
Tab selectedTab)
The method, which is invoked, when the currently selected tab has been changed.
|
void |
onSwitcherHidden(TabSwitcher tabSwitcher)
The method, which is invoked, when the tab switcher has been hidden.
|
void |
onSwitcherShown(TabSwitcher tabSwitcher)
The method, which is invoked, when the tab switcher has been shown.
|
void |
onTabAdded(TabSwitcher tabSwitcher,
int index,
Tab tab,
Animation animation)
The method, which is invoked, when a tab has been added to the tab switcher.
|
void |
onTabRemoved(TabSwitcher tabSwitcher,
int index,
Tab tab,
Animation animation)
The method, which is invoked, when a tab has been removed from the tab switcher.
|
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter colorFilter) |
void |
setCount(int count)
Updates the drawable to display a specific value.
|
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getAlpha, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isStateful, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintList, setTintMode, setVisible, unscheduleSelf
public TabSwitcherDrawable(@NonNull android.content.Context context)
TabSwitcher
.context
- The context, which should be used by the drawable, as an instance of the class Context
. The context may not be nullpublic final void setCount(int count)
count
- The value, which should be displayed, as an Integer
value. The value must be
at least 0public final void draw(@NonNull android.graphics.Canvas canvas)
draw
in class android.graphics.drawable.Drawable
public final int getIntrinsicWidth()
getIntrinsicWidth
in class android.graphics.drawable.Drawable
public final int getIntrinsicHeight()
getIntrinsicHeight
in class android.graphics.drawable.Drawable
public final void setAlpha(int alpha)
setAlpha
in class android.graphics.drawable.Drawable
public final void setColorFilter(@Nullable android.graphics.ColorFilter colorFilter)
setColorFilter
in class android.graphics.drawable.Drawable
public final int getOpacity()
getOpacity
in class android.graphics.drawable.Drawable
public final void onSwitcherShown(@NonNull TabSwitcher tabSwitcher)
TabSwitcherListener
onSwitcherShown
in interface TabSwitcherListener
tabSwitcher
- The observed tab switcher as an instance of the class TabSwitcher
. The tab
switcher may not be nullpublic final void onSwitcherHidden(@NonNull TabSwitcher tabSwitcher)
TabSwitcherListener
onSwitcherHidden
in interface TabSwitcherListener
tabSwitcher
- The observed tab switcher as an instance of the class TabSwitcher
. The tab
switcher may not be nullpublic final void onSelectionChanged(@NonNull TabSwitcher tabSwitcher, int selectedTabIndex, @Nullable Tab selectedTab)
TabSwitcherListener
onSelectionChanged
in interface TabSwitcherListener
tabSwitcher
- The observed tab switcher as an instance of the class TabSwitcher
. The tab
switcher may not be nullselectedTabIndex
- The index of the currently selected tab as an Integer
value or -1, if the tab
switcher does not contain any tabsselectedTab
- The currently selected tab as an instance of the class Tab
or null, if the
tab switcher does not contain any tabspublic final void onTabAdded(@NonNull TabSwitcher tabSwitcher, int index, @NonNull Tab tab, @NonNull Animation animation)
TabSwitcherListener
onTabAdded
in interface TabSwitcherListener
tabSwitcher
- The observed tab switcher as an instance of the class TabSwitcher
. The tab
switcher may not be nullindex
- The index of the tab, which has been added, as an Integer
valuetab
- The tab, which has been added, as an instance of the class Tab
. The tab may
not be nullanimation
- The animation, which has been used to add the tab, as an instance of the class Animation
. The animation may not be nullpublic final void onTabRemoved(@NonNull TabSwitcher tabSwitcher, int index, @NonNull Tab tab, @NonNull Animation animation)
TabSwitcherListener
onTabRemoved
in interface TabSwitcherListener
tabSwitcher
- The observed tab switcher as an instance of the class TabSwitcher
. The tab
switcher may not be nullindex
- The index of the tab, which has been removed, as an Integer
valuetab
- The tab, which has been removed, as an instance of the class Tab
. The tab may
not be nullanimation
- The animation, which has been used to remove the tab, as an instance of the class
Animation
. The animation may not be nullpublic final void onAllTabsRemoved(@NonNull TabSwitcher tabSwitcher, @NonNull Tab[] tab, @NonNull Animation animation)
TabSwitcherListener
onAllTabsRemoved
in interface TabSwitcherListener
tabSwitcher
- The observed tab switcher as an instance of the class TabSwitcher
. The tab
switcher may not be nulltab
- An array, which contains the tabs, which have been removed, as an array of the type
Tab
or an empty array, if no tabs have been removedanimation
- The animation, which has been used to remove the tabs, as an instance of the class
Animation
. The animation may not be null