/** * Returns the adapter, which allows to inflate the views, which are associated with tabs. * * @return The adapter, which allows to inflate the views, which are associated with tabs, as an * instance of the class {@link ContentRecyclerAdapter} */ public final ContentRecyclerAdapter getContentRecyclerAdapter() { Condition.INSTANCE.ensureNotNull(contentRecyclerAdapter, "No decorator has been set", IllegalStateException.class); return contentRecyclerAdapter; }
@Override public final void setTabPreviewFadeDuration(final long duration) { Condition.INSTANCE.ensureAtLeast(duration, 0, "The duration must be at least 0"); this.tabPreviewFadeDuration = duration; }
/** * Adds a new callback, which should be notified, when the tab's properties have been changed. * * @param callback * The callback, which should be added, as an instance of the type {@link Callback}. The * callback may not be null */ public final void addCallback(@NonNull final Callback callback) { Condition.INSTANCE.ensureNotNull(callback, "The callback may not be null"); this.callbacks.add(callback); }
/** * Sets the view recycler, which allows to inflate the views, which are used to visualize tabs. * * @param viewRecycler * The view recycler, which should be set, as an instance of the class * AttachedViewRecycler. The view recycler may not be null */ public final void setViewRecycler( @NonNull final AttachedViewRecycler<AbstractItem, Integer> viewRecycler) { Condition.INSTANCE.ensureNotNull(viewRecycler, "The view recycler may not be null"); this.viewRecycler = viewRecycler; }
@Override public final void setTabPreviewFadeThreshold(final long threshold) { Condition.INSTANCE.ensureAtLeast(threshold, 0, "The threshold must be at least 0"); this.tabPreviewFadeThreshold = threshold; }
/** * Creates a new builder, which allows to configure and create instances of the class {@link * InitialItemIterator}. * * @param backingArray * The backing array, which should be used to store items, once their initial * position and state has been calculated. The backing array may not be null */ public InitialItemIteratorBuilder(@NonNull final AbstractItem[] backingArray) { Condition.INSTANCE.ensureNotNull(backingArray, "The backing array may not be null"); this.backingArray = backingArray; }
/** * Creates a new animation. * * @param duration * The duration of the animation in milliseconds as a {@link Long} value or -1, if the * default duration should be used * @param interpolator * The interpolator, which should be used by the animation, as an instance of the type * {@link Interpolator} or null, if the default interpolator should be used */ protected Animation(final long duration, @Nullable final Interpolator interpolator) { Condition.INSTANCE.ensureAtLeast(duration, -1, "The duration must be at least -1"); this.duration = duration; this.interpolator = interpolator; }
/** * Sets the state of the tab. * * @param state * The state, which should be set, as a value of the enum {@link State}. The state may * not be null */ public final void setState(@NonNull final State state) { Condition.INSTANCE.ensureNotNull(state, "The state may not be null"); this.state = state; }
/** * Creates a new item, which contains information about a child view of a {@link TabSwitcher}. * * @param index * The index of the item as an {@link Integer} value. The index must be at least 0 */ public AbstractItem(final int index) { Condition.INSTANCE.ensureAtLeast(index, 0, "The index must be at least 0"); this.index = index; this.view = null; this.tag = new Tag(); }
/** * Creates a new state of a specific tab. * * @param tab * The tab, the state should correspond to, as an instance of the class {@link Tab}. The * tab may not be null */ public AbstractState(@NonNull final Tab tab) { Condition.INSTANCE.ensureNotNull(tab, "The tab may not be null"); this.tab = tab; }
/** * Sets the duration of the swipe animation of the gestures, which are created by the * builder. * * @param animationDuration * The duration, which should be set, in milliseconds as a {@link Long} value or -1, * if the default duration should be used * @return The builder, this method has been called upon, as an instance of the generic type * BuilderType. The builder may not be null */ public Builder setAnimationDuration(final long animationDuration) { Condition.INSTANCE.ensureAtLeast(animationDuration, -1, "The animation duration must be at least -1"); this.animationDuration = animationDuration; return self(); }
/** * Sets the tag, which is associated with the item. * * @param tag * The tag, which should be set, as an instance of the class {@link Tag}. The tag may * not be null */ public final void setTag(@NonNull final Tag tag) { Condition.INSTANCE.ensureNotNull(tag, "The tag may not be null"); this.tag = tag; }
/** * Sets the state of the currently performed drag gesture. * * @param dragState * The state, which should be set, as a value of the enum {@link DragState}. The state * may not be null */ public final void setDragState(@NonNull final DragState dragState) { Condition.INSTANCE.ensureNotNull(dragState, "The drag state may not be null"); this.dragState = dragState; }
/** * Creates a new comparator, which allows to compare two instances of the class {@link * AbstractItem}. * * @param tabSwitcher * The tab switcher, the tab items, which should be compared by the comparator, belong * to, as a instance of the class {@link TabSwitcher}. The tab switcher may not be null */ public ItemComparator(@NonNull final TabSwitcher tabSwitcher) { Condition.INSTANCE.ensureNotNull(tabSwitcher, "The tab switcher may not be null"); this.tabSwitcher = tabSwitcher; }
/** * Creates a new class, which provides methods, which allow to calculate the position, size and * rotation of a {@link TabSwitcher}'s tabs. * * @param tabSwitcher * The tab switcher, the arithmetics should be calculated for, as an instance of the * class {@link TabSwitcher}. The tab switcher may not be null */ public AbstractArithmetics(@NonNull final TabSwitcher tabSwitcher) { Condition.INSTANCE.ensureNotNull(tabSwitcher, "The tab switcher may not be null"); this.tabSwitcher = tabSwitcher; }
/** * Creates a new factory, which allows to create instances of the class {@link * AbstractDragGestureEventHandler}. * * @param tabSwitcher * The tab switcher, the event handler should be created for, as an instance of the * class {@link TabSwitcher}. The tab switcher may not be null */ public DragGestureEventHandlerFactory(@NonNull final TabSwitcher tabSwitcher) { Condition.INSTANCE.ensureNotNull(tabSwitcher, "The tab switcher may not be null"); this.tabSwitcher = tabSwitcher; }
/** * Returns the view recycler, the adapter is bound to, or throws an {@link * IllegalStateException}, if no view recycler has been set. * * @return The view recycler, the adapter is bound to, as an instance of the class * AttachedViewRecycler. The view recycler may not be null */ @NonNull protected final AttachedViewRecycler<AbstractItem, Integer> getViewRecyclerOrThrowException() { Condition.INSTANCE.ensureNotNull(viewRecycler, "No view recycler has been set", IllegalStateException.class); return viewRecycler; }
/** * Creates a new item, which contains information about a tab of a {@link TabSwitcher}. By * default, the item is neither associated with a view, nor with a view holder. * * @param index * The index of the item as an {@link Integer} value. The index must be at least 0 * @param tab * The tab as an instance of the class {@link Tab}. The tab may not be null */ private TabItem(final int index, @NonNull final Tab tab) { super(index); Condition.INSTANCE.ensureNotNull(tab, "The tab may not be null"); this.tab = tab; this.viewHolder = null; }
/** * Adds a new listener, which should be notified about the model's events. * * @param listener * The listener, which should be added, as an instance of the type {@link Listener}. The * listener may not be null */ public final void addListener(@NonNull final Listener listener) { Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null"); listeners.add(listener); }
@Override public void onGlobalLayout() { Condition.INSTANCE.ensureNotNull(getDecorator(), "No decorator has been set", IllegalStateException.class); initializeLayout(getLayout(), inflateTabsOnly); }