public class ContentRecyclerAdapter extends de.mrapp.android.util.view.AbstractViewRecycler.Adapter<Tab,java.lang.Void> implements Restorable, TabSwitcherListener
TabSwitcher
, by encapsulating a TabSwitcherDecorator
.Constructor and Description |
---|
ContentRecyclerAdapter(TabSwitcher tabSwitcher,
TabSwitcherDecorator decorator)
Creates a new view recycler adapter, which allows to inflate views, which are associated with
the tabs of a
TabSwitcher , by encapsulating a TabSwitcherDecorator . |
Modifier and Type | Method and Description |
---|---|
void |
clearAllSavedStates()
Clears the saved states of all tabs.
|
void |
clearSavedState(Tab tab)
Clears the saved state of a specific tab.
|
int |
getViewType(Tab item) |
int |
getViewTypeCount() |
void |
onAllTabsRemoved(TabSwitcher tabSwitcher,
Tab[] tabs,
Animation animation)
The method, which is invoked, when all tabs have been removed from the tab switcher.
|
android.view.View |
onInflateView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
Tab item,
int viewType,
java.lang.Void... params) |
void |
onRemoveView(android.view.View view,
Tab item) |
void |
onSelectionChanged(TabSwitcher tabSwitcher,
int selectedTabIndex,
Tab selectedTab)
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(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 |
restoreInstanceState(android.os.Bundle savedInstanceState)
Restores a previously saved state.
|
void |
saveInstanceState(android.os.Bundle outState)
Saves the current state.
|
public ContentRecyclerAdapter(@NonNull TabSwitcher tabSwitcher, @NonNull TabSwitcherDecorator decorator)
TabSwitcher
, by encapsulating a TabSwitcherDecorator
.tabSwitcher
- The tab switcher, which contains the tabs, whose associated views are inflated by the
adapter, correspond to, as an instance of the class TabSwitcher
. The tab
switcher may not be nulldecorator
- The decorator, which should be used to inflate the associated views, as an instance
of the class TabSwitcherDecorator
. The decorator may not be nullpublic void clearSavedState(@NonNull Tab tab)
tab
- The tab, whose saved state should be cleared, as an instance of the class Tab
. The tab may not be nullpublic void clearAllSavedStates()
@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 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[] tabs, @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 nulltabs
- 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