@Override public WindowInsetsCompat onApplyWindowInsets(final View v, final WindowInsetsCompat insets) { int left = insets.getSystemWindowInsetLeft(); int top = insets.getSystemWindowInsetTop(); int right = insets.getSystemWindowInsetRight(); int bottom = insets.getSystemWindowInsetBottom(); tabSwitcher.setPadding(left, top, right, bottom); float touchableAreaTop = top; if (tabSwitcher.getLayout() == Layout.TABLET) { touchableAreaTop += getResources() .getDimensionPixelSize(R.dimen.tablet_tab_container_height); } RectF touchableArea = new RectF(left, touchableAreaTop, getDisplayWidth(MainActivity.this) - right, touchableAreaTop + ThemeUtil.getDimensionPixelSize(MainActivity.this, R.attr.actionBarSize)); tabSwitcher.addDragGesture( new SwipeGesture.Builder().setTouchableArea(touchableArea).create()); tabSwitcher.addDragGesture( new PullDownGesture.Builder().setTouchableArea(touchableArea).create()); return insets; }
/** * 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(); }