public class TabletTabSwitcherLayout extends AbstractTabSwitcherLayout implements Tab.Callback
TabSwitcher on tablets.AbstractTabSwitcherLayout.AnimationListenerWrapper, AbstractTabSwitcherLayout.Callback, AbstractTabSwitcherLayout.InitialItemIterator, AbstractTabSwitcherLayout.InitialItemIteratorBuilder, AbstractTabSwitcherLayout.LayoutListenerWrapper| Constructor and Description |
|---|
TabletTabSwitcherLayout(TabSwitcher tabSwitcher,
TabSwitcherModel model,
Arithmetics arithmetics,
TabSwitcherStyle style,
TouchEventDispatcher touchEventDispatcher)
Creates a new layout, which implements the functionality of a
TabSwitcher on tablets. |
| Modifier and Type | Method and Description |
|---|---|
protected float |
calculateMaxEndPosition(int index)
The method, which is invoked on implementing subclasses in order to retrieve the maximum
position of a specific item, when dragging towards the end.
|
protected float |
calculateMinStartPosition(int index)
The method, which is invoked on implementing subclasses in order to retrieve the minimum
position of a specific item, when dragging towards the start.
|
protected <any> |
calculatePositionAndStateWhenStackedAtEnd(int index)
The method, which is invoked on implementing subclasses in order to retrieve the position and
state of a specific item, when stacked at the end.
|
protected <any> |
calculatePositionAndStateWhenStackedAtStart(int count,
int index,
State predecessorState)
The method, which is invoked on implementing subclasses in order to retrieve the position and
state of a specific item, when stacked at the start.
|
protected float |
calculatePredecessorPosition(AbstractItem item,
AbstractItem successor)
Calculates the position of an item in relation to the position of its successor.
|
protected float |
calculateSuccessorPosition(AbstractItem item,
AbstractItem predecessor)
Calculates the position of an item in relation to the position of its predecessor.
|
protected <any> |
getContentViewRecycler()
The method, which is invoked on implementing subclasses in order to retrieve the view
recycler, which allows to recycle the views, which are associated with tabs.
|
AbstractDragTabsEventHandler<?> |
getDragHandler()
The method, which is invoked on implementing subclasses in order to retrieve the drag
handler, which is used by the layout.
|
protected int |
getStackedTabCount()
The method, which is invoked on implementing subclasses in order to retrieve the number of
tabs, which are contained by a stack.
|
android.view.ViewGroup |
getTabContainer()
Returns the view group, which contains the tab switcher's tabs.
|
protected AbstractTabRecyclerAdapter |
getTabRecyclerAdapter()
The method, which is invoked on implementing subclasses in order to retrieve the adapter of
the view recycler, which allows to inflate the views, which are used to visualize the tabs.
|
protected <any> |
getTabViewRecycler()
The method, which is invoked on implementing subclasses in order to retrieve the view
recycler, which allows to inflate the views, which are used to visualize the tabs.
|
Toolbar[] |
getToolbars()
Returns the toolbars, which are shown, when the tab switcher is shown.
|
protected void |
inflateAndUpdateView(AbstractItem item,
boolean dragging,
android.view.ViewTreeObserver.OnGlobalLayoutListener listener)
The method, which is invoked on implementing subclasses in order to inflate and update the
view, which is used to visualize a specific item.
|
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 <any> |
onCreateContentRecyclerAdapter()
The method, which is invoked on implementing subclasses in order to create the view recycler
adapter, which allows to inflate the views, which are associated with tabs.
|
protected <any> |
onDetachLayout(boolean tabsOnly)
The method, which is invoked on implementing subclasses in order to detach the layout.
|
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 |
onGlobalLayout() |
void |
onIconChanged(Tab tab)
The method, which is invoked, when the tab's icon has been changed.
|
protected void |
onInflateLayout(android.view.LayoutInflater inflater,
boolean tabsOnly)
The method, which is invoked on implementing subclasses in order to inflate the layout.
|
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 |
onSelectionChanged(int previousIndex,
int index,
Tab selectedTab,
boolean switcherHidden)
The method, which is invoked, when the currently selected tab has been changed.
|
void |
onSwitchingBetweenTabs(int selectedTabIndex,
float distance)
The method, which is invoked, when switching between neighboring tabs.
|
void |
onSwitchingBetweenTabsEnded(int selectedTabIndex,
int previousSelectedTabIndex,
float velocity,
long animationDuration)
The method, which is invoked, when switching between neighboring tabs ended.
|
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 |
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 |
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.
|
protected void |
secondLayoutPass(AbstractItemIterator.AbstractBuilder builder)
The method, which is called when dragging after the positions and states of all tabs have
been calculated.
|
protected void |
updateView(AbstractItem item,
boolean dragging)
Updates the view, which is used to visualize a specific item.
|
calculateAttachedPosition, calculatePositionAndStateWhenStackedAtStart, clipPosition, clipPosition, detachLayout, getArithmetics, getContext, getFirstVisibleIndex, getItemCount, getLogger, getModel, getStackedTabSpacing, getStyle, getTabSwitcher, getToolbarMenu, inflateLayout, inflateOrRemoveView, inflateView, isAnimationRunning, isOvershootingAtEnd, isOvershootingAtStart, isStackedAtStart, onAddedEventHandler, onAddTabButtonColorChanged, onCancelFling, onClick, onDecoratorChanged, onDrag, onFling, onLogLevelChanged, onPressEnded, onPressStarted, onPulledDown, onRemovedEventHandler, onRevertEndOvershoot, onRevertStartOvershoot, onSwipe, onSwipeEnded, onSwitcherHidden, onSwitcherShown, onTabCloseButtonIconChanged, onTabContentBackgroundColorChanged, onTabIconChanged, onTabProgressBarColorChanged, onTabTitleColorChanged, onToolbarMenuInflated, onToolbarNavigationIconChanged, onToolbarTitleChanged, onToolbarVisibilityChanged, setCallback, setFirstVisibleIndexpublic TabletTabSwitcherLayout(TabSwitcher tabSwitcher, TabSwitcherModel model, Arithmetics arithmetics, TabSwitcherStyle style, TouchEventDispatcher touchEventDispatcher)
TabSwitcher on tablets.tabSwitcher - The tab switcher, the layout belongs to, as an instance of the class TabSwitcher. The tab switcher may not be nullmodel - The model of the tab switcher, the layout belongs to, as an instance of the class
TabSwitcherModel. The model may not be nullarithmetics - The arithmetics, which should be used by the layout, as an instance of the type
Arithmetics. The arithmetics 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 nulltouchEventDispatcher - The dispatcher, which is used to dispatch touch events to event handlers, as an
instance of the class TouchEventDispatcher. The dispatcher may not be nullpublic final AbstractDragTabsEventHandler<?> getDragHandler()
AbstractTabSwitcherLayoutgetDragHandler in class AbstractTabSwitcherLayoutAbstractDragTabsEventHandler or null, if the drag handler has not been initialized yetprotected final void onInflateLayout(android.view.LayoutInflater inflater,
boolean tabsOnly)
AbstractTabSwitcherLayoutonInflateLayout in class AbstractTabSwitcherLayoutinflater - The layout inflater, which should be used, as an instance of the class LayoutInflater. The layout inflater may not be nulltabsOnly - True, if only the tabs should be inflated, false otherwiseprotected final <any> onDetachLayout(boolean tabsOnly)
AbstractTabSwitcherLayoutonDetachLayout in class AbstractTabSwitcherLayouttabsOnly - True, if only the tabs should be detached, false otherwiseprotected final <any> getContentViewRecycler()
AbstractTabSwitcherLayoutgetContentViewRecycler in class AbstractTabSwitcherLayoutprotected final <any> getTabViewRecycler()
AbstractTabSwitcherLayoutgetTabViewRecycler in class AbstractTabSwitcherLayoutprotected final AbstractTabRecyclerAdapter getTabRecyclerAdapter()
AbstractTabSwitcherLayoutgetTabRecyclerAdapter in class AbstractTabSwitcherLayoutAbstractTabRecyclerAdapter or
null, if the view recycler has not been initialized yetprotected final void inflateAndUpdateView(AbstractItem item, boolean dragging, android.view.ViewTreeObserver.OnGlobalLayoutListener listener)
AbstractTabSwitcherLayoutinflateAndUpdateView in class AbstractTabSwitcherLayoutitem - The item, whose view should be inflated, as an instance of the class AbstractItem. The item may not be nulldragging - True, if the view is currently being dragged, false otherwiselistener - The layout listener, which should be notified, when the view has been inflated, as an
instance of the type ViewTreeObserver.OnGlobalLayoutListener or null, if no listener should be
notifiedprotected final int getStackedTabCount()
AbstractTabSwitcherLayoutgetStackedTabCount in class AbstractTabSwitcherLayoutInteger valueprotected final <any> calculatePositionAndStateWhenStackedAtStart(int count,
int index,
State predecessorState)
AbstractTabSwitcherLayoutcalculatePositionAndStateWhenStackedAtStart in class AbstractTabSwitcherLayoutcount - The total number of items, which are currently contained by the tab switcher, as an
Integer valueindex - The index of the item, whose position and state should be returned, as an Integer valuepredecessorState - The state of the predecessor of the given item as a value of the enum State
or null, if the item does not have a predecessorprotected final <any> calculatePositionAndStateWhenStackedAtEnd(int index)
AbstractTabSwitcherLayoutcalculatePositionAndStateWhenStackedAtEnd in class AbstractTabSwitcherLayoutindex - The index of the item, whose position and state should be returned, as an Integer valueprotected final float calculateMinStartPosition(int index)
AbstractTabSwitcherLayoutcalculateMinStartPosition in class AbstractTabSwitcherLayoutindex - The index of the item, whose position should be calculated, as an Integer
valueFloat value or -1, if no
minimum position is availableprotected final float calculateMaxEndPosition(int index)
AbstractTabSwitcherLayoutcalculateMaxEndPosition in class AbstractTabSwitcherLayoutindex - The index of the item, whose position should be calculated, as an Integer
valueFloat value or -1, if no
maximum position is availableprotected final float calculateSuccessorPosition(AbstractItem item, AbstractItem predecessor)
AbstractTabSwitcherLayoutcalculateSuccessorPosition in class AbstractTabSwitcherLayoutitem - The item, whose position should be calculated, as an instance of the class AbstractItem. The item may not be nullpredecessor - The predecessor as an instance of the class AbstractItem. The predecessor may
not be nullFloat valueprotected final float calculatePredecessorPosition(AbstractItem item, AbstractItem successor)
AbstractTabSwitcherLayoutcalculatePredecessorPosition in class AbstractTabSwitcherLayoutitem - The item, whose position should be calculated, as an instance of the class AbstractItem. The item may not be nullsuccessor - The successor as an instance of the class AbstractItem. The successor may not
be nullFloat valueprotected final void secondLayoutPass(AbstractItemIterator.AbstractBuilder builder)
AbstractTabSwitcherLayoutsecondLayoutPass in class AbstractTabSwitcherLayoutbuilder - The builder, which allows to create the iterator, which should be used to iterate the
tabs, as an instance of the class AbstractItemIterator.AbstractBuilder. The
builder may not be nullprotected final <any> onCreateContentRecyclerAdapter()
AbstractTabSwitcherLayoutonCreateContentRecyclerAdapter in class AbstractTabSwitcherLayoutpublic final void onGlobalLayout()
onGlobalLayout in interface android.view.ViewTreeObserver.OnGlobalLayoutListenerpublic final android.view.ViewGroup getTabContainer()
TabSwitcherLayoutgetTabContainer in interface TabSwitcherLayoutViewGroup or null, if the view has not been laid out yetpublic final Toolbar[] getToolbars()
TabSwitcherLayoutTabSwitcher.PRIMARY_TOOLBAR_INDEX
of the returned array corresponds to the primary toolbar and the index TabSwitcher.SECONDARY_TOOLBAR_INDEX corresponds to the secondary toolbar.getToolbars in interface TabSwitcherLayoutpublic 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 otherwiseprotected final void updateView(AbstractItem item, boolean dragging)
AbstractTabSwitcherLayoutupdateView in class AbstractTabSwitcherLayoutitem - The item, whose view should be updated, as an instance of the class AbstractItem. The item may not be nulldragging - True, if the item is currently being dragged, 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 final 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 void onTabBackgroundColorChanged(android.content.res.ColorStateList colorStateList)
Model.ListeneronTabBackgroundColorChanged in interface Model.ListeneronTabBackgroundColorChanged in class AbstractTabSwitcherLayoutcolorStateList - 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 onAddTabButtonVisibilityChanged(boolean visible)
Model.ListeneronAddTabButtonVisibilityChanged in interface Model.ListeneronAddTabButtonVisibilityChanged in class AbstractTabSwitcherLayoutvisible - True, if the button, which allows to add a new tab, should be shown, false
otherwisepublic 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 onSwitchingBetweenTabs(int selectedTabIndex,
float distance)
SwipeGestureEventHandler.CallbackonSwitchingBetweenTabs in interface SwipeGestureEventHandler.CallbackselectedTabIndex - The index of the currently selected tab as an Integer valuedistance - The distance, the currently selected tab is swiped by, in pixels as a Float valuepublic final void onSwitchingBetweenTabsEnded(int selectedTabIndex,
int previousSelectedTabIndex,
float velocity,
long animationDuration)
SwipeGestureEventHandler.CallbackonSwitchingBetweenTabsEnded in interface SwipeGestureEventHandler.CallbackselectedTabIndex - The index of the tab, which should become selected, as an Integer valuepreviousSelectedTabIndex - The index of the previously selected tab as an Integer valuevelocity - The velocity of the swipe gesture in pixels per second as a Float valueanimationDuration - The duration of the swipe animation in milliseconds as a Long valuepublic 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 final 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
null