public class TabletContentRecyclerAdapterWrapper extends de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void> implements Restorable, Tab.Callback, Model.Listener
ContentRecyclerAdapter
, which allows to inflate the
views, which are used to visualize the content views of the tabs of a TabSwitcher
. The
wrapper enables to adapt the views for use with the tablet layout.Constructor and Description |
---|
TabletContentRecyclerAdapterWrapper(TabSwitcher tabSwitcher,
TabSwitcherStyle style,
de.mrapp.android.util.view.AttachedViewRecycler<Tab,?> viewRecycler,
ContentRecyclerAdapter encapsulatedAdapter)
Creates a new wrapper, which encapsulates a
ContentRecyclerAdapter , which allows to
inflate the views, which are used to visualize the content views of the tabs of a TabSwitcher . |
Modifier and Type | Method and Description |
---|---|
int |
getViewType(Tab item) |
int |
getViewTypeCount() |
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 |
onApplyPaddingToTabsChanged(boolean applyPaddingToTabs)
The method, which is invoked, when it has been changed, whether the padding of the tab
switcher is applied to the content of its tabs, or not.
|
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.
|
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.
|
android.view.View |
onInflateView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
Tab item,
int viewType,
java.lang.Void... params) |
void |
onLogLevelChanged(de.mrapp.android.util.logging.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,
Tab item) |
void |
onSelectionChanged(int previousIndex,
int index,
Tab selectedTab,
boolean switcherHidden)
The method, which is invoked, when the currently selected tab has been changed.
|
void |
onShowView(android.content.Context context,
android.view.View view,
Tab item,
boolean inflated,
java.lang.Void... 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,
android.support.v7.widget.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 |
restoreInstanceState(android.os.Bundle savedInstanceState)
Restores a previously saved state.
|
void |
saveInstanceState(android.os.Bundle outState)
Saves the current state.
|
public TabletContentRecyclerAdapterWrapper(@NonNull TabSwitcher tabSwitcher, @NonNull TabSwitcherStyle style, @NonNull de.mrapp.android.util.view.AttachedViewRecycler<Tab,?> viewRecycler, @NonNull ContentRecyclerAdapter encapsulatedAdapter)
ContentRecyclerAdapter
, which allows to
inflate the views, which are used to visualize the content views of the tabs of a TabSwitcher
.tabSwitcher
- The tab switcher, the recycler adapter belongs to, as an instance of the class TabSwitcher
. The tab switcher may not be nullstyle
- The style, which allows to retrieve style attributes of the tab switcher, as an
instance of the class TabSwitcherStyle
. The style may not be nullviewRecycler
- The view recycler, the adapter is attached to, as an instance of the class
AttachedViewRecycler. The view recycler may not be nullencapsulatedAdapter
- The view recycler adapter, which should be encapsulated, as an instance of the class
ContentRecyclerAdapter
. The recycler adapter may not be null@NonNull public final android.view.View onInflateView(@NonNull android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup parent, @NonNull Tab item, int viewType, @NonNull java.lang.Void... params)
onInflateView
in class de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void>
public final void onShowView(@NonNull android.content.Context context, @NonNull android.view.View view, @NonNull Tab item, boolean inflated, @NonNull java.lang.Void... params)
onShowView
in class de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void>
public final void onRemoveView(@NonNull android.view.View view, @NonNull Tab item)
onRemoveView
in class de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void>
public final int getViewTypeCount()
getViewTypeCount
in class de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void>
public final int getViewType(@NonNull Tab item)
getViewType
in class de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void>
public final void saveInstanceState(@NonNull android.os.Bundle outState)
Restorable
saveInstanceState
in interface Restorable
outState
- The bundle, which should be used to store the saved state, as an instance of the
class Bundle
. The bundle may not be nullpublic final void restoreInstanceState(@Nullable android.os.Bundle savedInstanceState)
Restorable
restoreInstanceState
in interface Restorable
savedInstanceState
- The saved state as an instance of the class Bundle
or null, if no saved state
is availablepublic final void onTitleChanged(@NonNull Tab tab)
Tab.Callback
onTitleChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onIconChanged(@NonNull Tab tab)
Tab.Callback
onIconChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onCloseableChanged(@NonNull Tab tab)
Tab.Callback
onCloseableChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onCloseButtonIconChanged(@NonNull Tab tab)
Tab.Callback
onCloseButtonIconChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onBackgroundColorChanged(@NonNull Tab tab)
Tab.Callback
onBackgroundColorChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onContentBackgroundColorChanged(@NonNull Tab tab)
Tab.Callback
onContentBackgroundColorChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onTitleTextColorChanged(@NonNull Tab tab)
Tab.Callback
onTitleTextColorChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onProgressBarVisibilityChanged(@NonNull Tab tab)
Tab.Callback
onProgressBarVisibilityChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onProgressBarColorChanged(@NonNull Tab tab)
Tab.Callback
onProgressBarColorChanged
in interface Tab.Callback
tab
- The observed tab as an instance of the class Tab
. The tab may not be
nullpublic final void onLogLevelChanged(@NonNull de.mrapp.android.util.logging.LogLevel logLevel)
Model.Listener
onLogLevelChanged
in interface Model.Listener
logLevel
- The log level, which has been set, as a value of the enum LogLevel. The log level
may not be nullpublic final void onDecoratorChanged(@NonNull TabSwitcherDecorator decorator)
Model.Listener
onDecoratorChanged
in interface Model.Listener
decorator
- The decorator, which has been set, as an instance of the class TabSwitcherDecorator
. The decorator may not be nullpublic final void onSwitcherShown()
Model.Listener
onSwitcherShown
in interface Model.Listener
public final void onSwitcherHidden()
Model.Listener
onSwitcherHidden
in interface Model.Listener
public final void onSelectionChanged(int previousIndex, int index, @Nullable Tab selectedTab, boolean switcherHidden)
Model.Listener
onSelectionChanged
in interface Model.Listener
previousIndex
- 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, @NonNull Tab tab, int previousSelectedTabIndex, int selectedTabIndex, boolean switcherVisibilityChanged, @NonNull Animation animation)
Model.Listener
onTabAdded
in interface Model.Listener
index
- 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, @NonNull Tab[] tabs, int previousSelectedTabIndex, int selectedTabIndex, @NonNull Animation animation)
Model.Listener
onAllTabsAdded
in interface Model.Listener
index
- 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, @NonNull Tab tab, int previousSelectedTabIndex, int selectedTabIndex, @NonNull Animation animation)
Model.Listener
onTabRemoved
in interface Model.Listener
index
- 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(@NonNull Tab[] tabs, @NonNull Animation animation)
Model.Listener
onAllTabsRemoved
in interface Model.Listener
tabs
- 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 final void onPaddingChanged(int left, int top, int right, int bottom)
Model.Listener
onPaddingChanged
in interface Model.Listener
left
- 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 onApplyPaddingToTabsChanged(boolean applyPaddingToTabs)
Model.Listener
onApplyPaddingToTabsChanged
in interface Model.Listener
applyPaddingToTabs
- True, if the padding of the tab switcher is applied to the content of its tabs,
false otherwisepublic final void onTabIconChanged(@Nullable android.graphics.drawable.Drawable icon)
Model.Listener
onTabIconChanged
in interface Model.Listener
icon
- The icon, which has been set, as an instance of the class Drawable
or
null, if no icon is setpublic final void onTabBackgroundColorChanged(@Nullable android.content.res.ColorStateList colorStateList)
Model.Listener
onTabBackgroundColorChanged
in interface Model.Listener
colorStateList
- 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 onTabContentBackgroundColorChanged(int color)
Model.Listener
onTabContentBackgroundColorChanged
in interface Model.Listener
color
- The color, which has been set, as an Integer
value or -1, if the default
color should be usedpublic final void onTabTitleColorChanged(@Nullable android.content.res.ColorStateList colorStateList)
Model.Listener
onTabTitleColorChanged
in interface Model.Listener
colorStateList
- 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(@Nullable android.graphics.drawable.Drawable icon)
Model.Listener
onTabCloseButtonIconChanged
in interface Model.Listener
icon
- 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.Listener
onTabProgressBarColorChanged
in interface Model.Listener
color
- 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.Listener
onAddTabButtonVisibilityChanged
in interface Model.Listener
visible
- True, if the button, which allows to add a new tab, should be shown, false
otherwisepublic final void onAddTabButtonColorChanged(@Nullable android.content.res.ColorStateList colorStateList)
Model.Listener
onAddTabButtonColorChanged
in interface Model.Listener
colorStateList
- 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.Listener
onToolbarVisibilityChanged
in interface Model.Listener
visible
- True, if the toolbars should be shown, when the tab switcher is shown, false
otherwisepublic final void onToolbarTitleChanged(@Nullable java.lang.CharSequence title)
Model.Listener
onToolbarTitleChanged
in interface Model.Listener
title
- The title, which has been set, as an instance of the type CharSequence
or
null, if no title is setpublic final void onToolbarNavigationIconChanged(@Nullable android.graphics.drawable.Drawable icon, @Nullable android.view.View.OnClickListener listener)
Model.Listener
onToolbarNavigationIconChanged
in interface Model.Listener
icon
- 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(@MenuRes int resourceId, @Nullable android.support.v7.widget.Toolbar.OnMenuItemClickListener listener)
Model.Listener
onToolbarMenuInflated
in interface Model.Listener
resourceId
- 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(@Nullable android.view.View view, long animationDuration)
Model.Listener
onEmptyViewChanged
in interface Model.Listener
view
- 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 used