public abstract class AbstractTabRecyclerAdapter extends <any> implements Tab.Callback, Model.Listener
TabSwitcher.| Constructor and Description |
|---|
AbstractTabRecyclerAdapter(TabSwitcher tabSwitcher,
TabSwitcherModel model,
TabSwitcherStyle style)
Creates a new view recycler adapter, which allows to inflate the views, which are used to
visualize the tabs of a
TabSwitcher. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Layout |
getLayout()
The method, which is invoked on implementing subclasses in order to retrieve the layout,
which is used by the tab switcher.
|
protected TabSwitcherModel |
getModel()
Returns the model of the tab switcher.
|
protected TabSwitcherStyle |
getStyle()
Returns the style, which allow to retrieve style attributes of the tab switcher.
|
protected TabItem |
getTabItem(Tab tab)
Returns the tab item, which corresponds to a specific tab.
|
protected TabSwitcher |
getTabSwitcher()
Returns the tab switcher, which contains the tabs.
|
protected <any> |
getViewRecyclerOrThrowException()
Returns the view recycler, the adapter is bound to, or throws an
IllegalStateException, if no view recycler has been set. |
int |
getViewType(AbstractItem item) |
protected void |
onAdaptBackgroundColor(int color,
TabItem tabItem)
The method, which is invoked on implementing subclasses, when the background color of a tab
has been changed.
|
void |
onAddTabButtonColorChanged(android.content.res.ColorStateList colorStateList)
The method, which is invoked, when the color of the button, which allows to add a new
tab, has been changed.
|
void |
onAddTabButtonVisibilityChanged(boolean visible)
The method, which is invoked, when it has been changed, whether the button, which allows
to add a new tab, should be shown, or not.
|
void |
onAllTabsAdded(int index,
Tab[] tabs,
int previousSelectedTabIndex,
int selectedTabIndex,
Animation animation)
The method, which is invoked, when multiple tabs have been added to the model.
|
void |
onAllTabsRemoved(Tab[] tabs,
Animation animation)
The method, which is invoked, when all tabs have been removed from the tab switcher.
|
void |
onBackgroundColorChanged(Tab tab)
The method, which is invoked, when the tab's background color has been changed.
|
void |
onCloseableChanged(Tab tab)
The method, which is invoked, when it has been changed, whether the tab is closeable, or
not.
|
void |
onCloseButtonIconChanged(Tab tab)
The method, which is invoked, when the icon of the tab's close button has been changed.
|
void |
onContentBackgroundColorChanged(Tab tab)
The method, which is invoked, when the background color of the tab's content has been
changed.
|
protected abstract AbstractTabViewHolder |
onCreateTabViewHolder()
The method, which is invoked on implementing subclasses in order to create the view holder,
which should be associated with an inflated view.
|
void |
onDecoratorChanged(TabSwitcherDecorator decorator)
The method, which is invoked, when the decorator has been changed.
|
void |
onEmptyViewChanged(android.view.View view,
long animationDuration)
The method, which is invoked, when the view, which is shown, when the tab switcher is
empty, has been changed.
|
void |
onIconChanged(Tab tab)
The method, which is invoked, when the tab's icon has been changed.
|
protected abstract android.view.View |
onInflateTabView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
AbstractTabViewHolder viewHolder)
The method, which is invoked on implementing subclasses in order to inflate the view, which
is used to visualize tabs.
|
android.view.View |
onInflateView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
AbstractItem item,
int viewType,
java.lang.Integer... params) |
void |
onLogLevelChanged(LogLevel logLevel)
The method, which is invoked, when the log level has been changed.
|
void |
onPaddingChanged(int left,
int top,
int right,
int bottom)
The method, which is invoked, when the padding has been changed.
|
void |
onProgressBarColorChanged(Tab tab)
The method, which is invoked, when the color of the tab's progress bar has been changed.
|
void |
onProgressBarVisibilityChanged(Tab tab)
The method, which is invoked, when the visibility of the tab's progress bar has been
changed.
|
void |
onRemoveView(android.view.View view,
AbstractItem item) |
void |
onSelectionChanged(int previousIndex,
int index,
Tab selectedTab,
boolean switcherHidden)
The method, which is invoked, when the currently selected tab has been changed.
|
protected abstract void |
onShowTabView(android.view.View view,
TabItem tabItem,
java.lang.Integer... params)
The method, which is invoked on implementing subclasses in order to adapt the appearance of a
view, which is used to visualize a tab.
|
void |
onShowView(android.content.Context context,
android.view.View view,
AbstractItem item,
boolean inflated,
java.lang.Integer... params) |
void |
onSwitcherHidden()
The method, which is invoked, when the tab switcher has been hidden.
|
void |
onSwitcherShown()
The method, which is invoked, when the tab switcher has been shown.
|
void |
onTabAdded(int index,
Tab tab,
int previousSelectedTabIndex,
int selectedTabIndex,
boolean switcherVisibilityChanged,
Animation animation)
The method, which is invoked, when a tab has been added to the model.
|
void |
onTabBackgroundColorChanged(android.content.res.ColorStateList colorStateList)
The method, which is invoked, when the background color of a tab has been changed.
|
void |
onTabCloseButtonIconChanged(android.graphics.drawable.Drawable icon)
The method, which is invoked, when the icon of a tab's close button has been changed.
|
void |
onTabContentBackgroundColorChanged(int color)
The method, which is invoked, when the background color of a tab's content has been
changed.
|
void |
onTabIconChanged(android.graphics.drawable.Drawable icon)
The method, which is invoked, when the default icon of a tab has been changed.
|
void |
onTabProgressBarColorChanged(int color)
The method, which is invoked, when the color of a tab's progress bar has been changed.
|
void |
onTabRemoved(int index,
Tab tab,
int previousSelectedTabIndex,
int selectedTabIndex,
Animation animation)
The method, which is invoked, when a tab has been removed from the model.
|
void |
onTabTitleColorChanged(android.content.res.ColorStateList colorStateList)
The method, which is invoked, when the text color of a tab's title has been changed.
|
void |
onTitleChanged(Tab tab)
The method, which is invoked, when the tab's title has been changed.
|
void |
onTitleTextColorChanged(Tab tab)
The method, which is invoked, when the text color of the tab's title has been changed.
|
void |
onToolbarMenuInflated(int resourceId,
Toolbar.OnMenuItemClickListener listener)
The method, which is invoked, when the menu of the toolbar, which is shown, when the tab
switcher is shown, has been inflated.
|
void |
onToolbarNavigationIconChanged(android.graphics.drawable.Drawable icon,
android.view.View.OnClickListener listener)
The method, which is invoked, when the navigation icon of the toolbar, which is shown,
when the tab switcher is shown, has been changed.
|
void |
onToolbarTitleChanged(java.lang.CharSequence title)
The method, which is invoked, when the title of the toolbar, which is shown, when the tab
switcher is shown, has been changed.
|
void |
onToolbarVisibilityChanged(boolean visible)
The method, which is invoked, when it has been changed, whether the toolbars should be
shown, when the tab switcher is shown, or not.
|
void |
setViewRecycler(<any> viewRecycler)
Sets the view recycler, which allows to inflate the views, which are used to visualize tabs.
|
public AbstractTabRecyclerAdapter(TabSwitcher tabSwitcher, TabSwitcherModel model, TabSwitcherStyle style)
TabSwitcher.tabSwitcher - The tab switcher as an instance of the class TabSwitcher. The tab switcher
may not be nullmodel - The model, which belongs to the tab switcher, as an instance of the class TabSwitcherModel. The model may not be nullstyle - The style, which allows to retrieve style attributes of the tab switcher switcher, as
an instance of the class TabSwitcherStyle. The style may not be nullprotected final TabSwitcher getTabSwitcher()
TabSwitcher. The tab switcher may not be nullprotected final TabSwitcherModel getModel()
TabSwitcherModel.
The model may not be nullprotected final TabSwitcherStyle getStyle()
TabSwitcherStyle. The style may not be nullprotected final TabItem getTabItem(Tab tab)
protected final <any> getViewRecyclerOrThrowException()
IllegalStateException, if no view recycler has been set.protected void onAdaptBackgroundColor(int color,
TabItem tabItem)
color - The color, which has been set, as an Integer valuetabItem - The tab item, which corresponds to the tab, whose background color has been changed,
as an instance of the class TabItem. The tab item may not be nullprotected abstract android.view.View onInflateTabView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
AbstractTabViewHolder viewHolder)
inflater - The layout inflater, which should be used, as an instance of the class LayoutInflater. The layout inflater may not be nullparent - The parent of the view, which should be inflated, as an instance of the class ViewGroup or null, if no parent is availableviewHolder - The view holder, which should hold references to the child views of the view, which
should be inflated, as an instance of the class AbstractTabViewHolder. The
view holder may not be nullView. The view
may not be nullprotected abstract void onShowTabView(android.view.View view,
TabItem tabItem,
java.lang.Integer... params)
view - The view, which is used to visualize the tab, as an instance of the class View. The view may not be nulltabItem - The tab item, which corresponds to the tab, which is visualized by the given view, as
an instance of the class TabItem. The tab item may not be nullparams - An array, which may contain optional parameters, as an array of the generic type
ParamType or an empty array, if no optional parameters are availableprotected abstract AbstractTabViewHolder onCreateTabViewHolder()
AbstractTabViewHolder. The view holder may not be nullprotected abstract Layout getLayout()
Layout.
The layout may not be nullpublic final void setViewRecycler(<any> viewRecycler)
viewRecycler - The view recycler, which should be set, as an instance of the class
AttachedViewRecycler. The view recycler may not be nullpublic void onLogLevelChanged(LogLevel logLevel)
Model.ListeneronLogLevelChanged in interface Model.ListenerlogLevel - The log level, which has been set, as a value of the enum LogLevel. The log level
may not be nullpublic final void onDecoratorChanged(TabSwitcherDecorator decorator)
Model.ListeneronDecoratorChanged in interface Model.Listenerdecorator - The decorator, which has been set, as an instance of the class TabSwitcherDecorator. The decorator may not be nullpublic final void onSwitcherShown()
Model.ListeneronSwitcherShown in interface Model.Listenerpublic final void onSwitcherHidden()
Model.ListeneronSwitcherHidden in interface Model.Listenerpublic final void onSelectionChanged(int previousIndex,
int index,
Tab selectedTab,
boolean switcherHidden)
Model.ListeneronSelectionChanged in interface Model.ListenerpreviousIndex - The index of the previously selected tab as an Integer value or -1, if no
tab was previously selectedindex - 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 tabsswitcherHidden - True, if selecting the tab caused the tab switcher to be hidden, false otherwisepublic final void onTabAdded(int index,
Tab tab,
int previousSelectedTabIndex,
int selectedTabIndex,
boolean switcherVisibilityChanged,
Animation animation)
Model.ListeneronTabAdded in interface Model.Listenerindex - 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 nullpreviousSelectedTabIndex - The index of the previously selected tab as an Integer value or -1, if no
tab was selectedselectedTabIndex - The index of the currently selected tab as an Integer value or -1, if the
tab switcher does not contain any tabsswitcherVisibilityChanged - True, if adding the tab caused the visibility of the tab switcher to be changed,
false otherwiseanimation - 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 onAllTabsAdded(int index,
Tab[] tabs,
int previousSelectedTabIndex,
int selectedTabIndex,
Animation animation)
Model.ListeneronAllTabsAdded in interface Model.Listenerindex - The index of the first tab, which has been added, as an Integer valuetabs - An array, which contains the tabs, which have been added, as an array of the type
Tab or an empty array, if no tabs have been addedpreviousSelectedTabIndex - The index of the previously selected tab as an Integer value or -1, if no
tab was selectedselectedTabIndex - The index of the currently selected tab as an Integer value or -1, if the
tab switcher does not contain any tabsanimation - The animation, which has been used to add the tabs, as an instance of the class
Animation. The animation may not be nullpublic final void onTabRemoved(int index,
Tab tab,
int previousSelectedTabIndex,
int selectedTabIndex,
Animation animation)
Model.ListeneronTabRemoved in interface Model.Listenerindex - 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 nullpreviousSelectedTabIndex - The index of the previously selected tab as an Integer value or -1, if no
tab was selectedselectedTabIndex - The index of the currently selected tab as an Integer value or -1, if the
tab switcher does not contain any tabsanimation - 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(Tab[] tabs, Animation animation)
Model.ListeneronAllTabsRemoved in interface Model.Listenertabs - 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 nullpublic void onPaddingChanged(int left,
int top,
int right,
int bottom)
Model.ListeneronPaddingChanged in interface Model.Listenerleft - The left padding, which has been set, in pixels as an Integer valuetop - The top padding, which has been set, in pixels as an Integer valueright - The right padding, which has been set, in pixels as an Integer valuebottom - The bottom padding, which has been set, in pixels as an Integer valuepublic final void onTabIconChanged(android.graphics.drawable.Drawable icon)
Model.ListeneronTabIconChanged in interface Model.Listenericon - The icon, which has been set, as an instance of the class Drawable or
null, if no icon is setpublic void onTabBackgroundColorChanged(android.content.res.ColorStateList colorStateList)
Model.ListeneronTabBackgroundColorChanged in interface Model.ListenercolorStateList - The color state list, which has been set, as an instance of the class ColorStateList or null, if the default color should be usedpublic void onTabContentBackgroundColorChanged(int color)
Model.ListeneronTabContentBackgroundColorChanged in interface Model.Listenercolor - The color, which has been set, as an Integer value or -1, if the default
color should be usedpublic final void onTabTitleColorChanged(android.content.res.ColorStateList colorStateList)
Model.ListeneronTabTitleColorChanged in interface Model.ListenercolorStateList - The color state list, which has been set, as an instance of the class ColorStateList or null, if the default color should be usedpublic final void onTabCloseButtonIconChanged(android.graphics.drawable.Drawable icon)
Model.ListeneronTabCloseButtonIconChanged in interface Model.Listenericon - The icon, which has been set, as an instance of the class Drawable or
null, if the default icon should be usedpublic final void onTabProgressBarColorChanged(int color)
Model.ListeneronTabProgressBarColorChanged in interface Model.Listenercolor - The color, which has been set, as an Integer value or -1, if the default
color should be usedpublic final void onAddTabButtonVisibilityChanged(boolean visible)
Model.ListeneronAddTabButtonVisibilityChanged in interface Model.Listenervisible - True, if the button, which allows to add a new tab, should be shown, false
otherwisepublic void onAddTabButtonColorChanged(android.content.res.ColorStateList colorStateList)
Model.ListeneronAddTabButtonColorChanged in interface Model.ListenercolorStateList - The color, which has been set, as an instance of the class ColorStateList
or null, if the default color should be usedpublic final void onToolbarVisibilityChanged(boolean visible)
Model.ListeneronToolbarVisibilityChanged in interface Model.Listenervisible - True, if the toolbars should be shown, when the tab switcher is shown, false
otherwisepublic final void onToolbarTitleChanged(java.lang.CharSequence title)
Model.ListeneronToolbarTitleChanged in interface Model.Listenertitle - The title, which has been set, as an instance of the type CharSequence or
null, if no title is setpublic final void onToolbarNavigationIconChanged(android.graphics.drawable.Drawable icon,
android.view.View.OnClickListener listener)
Model.ListeneronToolbarNavigationIconChanged in interface Model.Listenericon - The navigation icon, which has been set, as an instance of the class Drawable or null, if no navigation icon is 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 notifiedpublic final void onToolbarMenuInflated(int resourceId,
Toolbar.OnMenuItemClickListener listener)
Model.ListeneronToolbarMenuInflated in interface Model.ListenerresourceId - The resource id of the menu, which has been inflated, as an Integer
value. The resource id must correspond to a valid menu resourcelistener - The listener, which has been registered to be notified, when an item of the menu
has been clicked, as an instance of the type OnMenuItemClickListener or null, if
no listener should be notifiedpublic final void onEmptyViewChanged(android.view.View view,
long animationDuration)
Model.ListeneronEmptyViewChanged in interface Model.Listenerview - The view, which has been 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 usedpublic final void onTitleChanged(Tab tab)
Tab.CallbackonTitleChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onIconChanged(Tab tab)
Tab.CallbackonIconChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onCloseableChanged(Tab tab)
Tab.CallbackonCloseableChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onCloseButtonIconChanged(Tab tab)
Tab.CallbackonCloseButtonIconChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onBackgroundColorChanged(Tab tab)
Tab.CallbackonBackgroundColorChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic void onContentBackgroundColorChanged(Tab tab)
Tab.CallbackonContentBackgroundColorChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onTitleTextColorChanged(Tab tab)
Tab.CallbackonTitleTextColorChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onProgressBarVisibilityChanged(Tab tab)
Tab.CallbackonProgressBarVisibilityChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic final void onProgressBarColorChanged(Tab tab)
Tab.CallbackonProgressBarColorChanged in interface Tab.Callbacktab - The observed tab as an instance of the class Tab. The tab may not be
nullpublic int getViewType(AbstractItem item)
public android.view.View onInflateView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
AbstractItem item,
int viewType,
java.lang.Integer... params)
public void onShowView(android.content.Context context,
android.view.View view,
AbstractItem item,
boolean inflated,
java.lang.Integer... params)
public void onRemoveView(android.view.View view,
AbstractItem item)