/** * Creates a new layout listener, which encapsulates another listener, which is notified, * when the listener has been invoked a specific number of times. * * @param count * The number of times, the listener should be invoked until the encapsulated * listener is notified, as an {@link Integer} value. The count must be greater than * 0 * @param listener * The encapsulated listener, which should be notified, when the listener has been * notified the given number of times, as an instance of the type {@link * OnGlobalLayoutListener} or null, if no listener should be notified */ CompoundLayoutListener(final int count, @Nullable final OnGlobalLayoutListener listener) { Condition.INSTANCE.ensureGreater(count, 0, "The count must be greater than 0"); this.count = count; this.listener = listener; }
/** * Sets the bounds of the onscreen area, which should be taken into consideration for * recognizing the drag gestures, which are create by the builder. drag gestures. * * @param left * The coordinate of the left edge in pixels as a {@link Float} value. The * coordinate must be at least 0 * @param top * The coordinate of the top edge in pixels as a {@link Float} value. The coordinate * must be at least 0 * @param right * The coordinate of the right edge in pixels as a {@link Float} value. The * coordinate must be greater than the coordinate of the left edge * @param bottom * The coordinate of the bottom edge in pixels as a {@link Float} value. The * coordinate must be greater than the coordinate of the top edge * @return The builder, this method has been called upon, as an instance of the generic type * BuilderType. The builder may not be null */ @NonNull public final BuilderType setTouchableArea(final float left, final float top, final float right, final float bottom) { Condition.INSTANCE.ensureAtLeast(left, 0, "The left coordinate must be at least 0"); Condition.INSTANCE.ensureAtLeast(top, 0, "The top coordinate must be at least 0"); Condition.INSTANCE.ensureGreater(right, left, "The right coordinate must be greater than " + left); Condition.INSTANCE.ensureGreater(bottom, top, "The bottom coordinate must be greater than " + top); return setTouchableArea(new RectF(left, top, right, bottom)); }
/** * Sets the width of the navigation, when using the split screen layout. * * @param width * The width, which should be set, in pixels as an {@link Integer} value. The width must * be greater than 0 */ public final void setNavigationWidth(@Px final int width) { Condition.INSTANCE.ensureGreater(width, 0, "The width must be greater than 0"); this.navigationWidth = width; adaptNavigationWidth(); }
/** * Sets the maximum value, the preference should allow to choose. * * @param maxValue * The maximum value, which should be set, as an {@link Integer} value. The value must * be greater than the minimum value, that preference allows to choose */ public final void setMaxValue(final int maxValue) { Condition.INSTANCE.ensureGreater(maxValue, getMinValue(), "The maximum value must be greater than the minimum value"); this.maxValue = maxValue; setValue(Math.min(getValue(), maxValue)); }
/** * Sets the maximum number, the preference allows to choose. * * @param maxNumber * The maximum number, which should be set, as an {@link Integer} value. The number must * be greater than the minimum number */ public final void setMaxNumber(final int maxNumber) { Condition.INSTANCE.ensureGreater(maxNumber, getMinNumber(), "The maximum number must be greater than the minimum number"); this.maxNumber = maxNumber; setNumber(Math.min(getNumber(), maxNumber)); }
/** * Creates a new scroll listener, which allows to animate a view to become hidden or shown * depending on the observed list view's scrolling direction. * * @param view * The view, which should be animated by the listener, as an instance of the class * {@link View}. The view may not be null * @param direction * The direction, which should be be used to translate the view in order to hide it, as * a value of the enum {@link Direction}. The direction may either be <code>UP</code> * or * <code>DOWN</code> * @param animationDuration * The duration of the animation, which is used to show or hide the view, in * milliseconds as a {@link Long} value. The duration must be greater than 0 */ public HideViewOnScrollAnimation(@NonNull final View view, @NonNull final Direction direction, final long animationDuration) { Condition.INSTANCE.ensureNotNull(view, "The view may not be null"); Condition.INSTANCE.ensureNotNull(direction, "The direction may not be null"); Condition.INSTANCE.ensureGreater(animationDuration, 0, "The animation duration must be greater than 0"); this.animatedView = view; this.direction = direction; this.animationDuration = animationDuration; this.listeners = new ListenerList<>(); }
/** * Sets the width of the navigation. * * @param width * The width, which should be set, in pixels as an {@link Integer} value. The width must * be greater than 0 */ public final void setNavigationWidth(@Px final int width) { Condition.INSTANCE.ensureGreater(width, 0, "The width must be greater than 0"); this.navigationWidth = width; if (!isNavigationHidden()) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) toolbar.getLayoutParams(); layoutParams.width = width; toolbar.requestLayout(); } }