@Override public void setNestedScrollingEnabled(boolean enabled) { // mManualNestedScrolling = true; mNestedChild.setNestedScrollingEnabled(enabled); }
ViewPager pager = findViewById(R.id.viewpager); FragmentStatePagerAdapter a = (FragmentStatePagerAdapter) pager.getAdapter(); MyFragment f49 = (MyFragment) a.instantiateItem(pager, 49)
private void animateIconScale(float scale) { ViewCompat.animate(iconView) .setDuration(ANIMATION_DURATION) .scaleX(scale) .scaleY(scale) .start(); }
@Override public int getTabIndicatorCount() { return mViewPager.getAdapter().getCount(); }
public static void fadeOut(View view, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) { //fade to alpha=0 ViewCompat.animate(view) .alpha(0) .setDuration(fadeDuration) .withLayer() .setInterpolator(new DecelerateInterpolator()) .setListener(listener); }
@Override public CharSequence getText(int position) { return mViewPager.getAdapter().getPageTitle(position); }
private void animateIcon(float alpha, float scale) { ViewCompat.animate(iconView) .setDuration(ANIMATION_DURATION) .alpha(alpha) .start(); if (isTitleless && type == Type.SHIFTING) { animateIconScale(scale); } }
private void ensureOrCancelAnimator(V child) { if (mTranslationAnimator == null) { mTranslationAnimator = ViewCompat.animate(child); mTranslationAnimator.setDuration(300); mTranslationAnimator.setInterpolator(INTERPOLATOR); } else { mTranslationAnimator.cancel(); } }
@Override public void onPageScrollStateChanged(int state) { mScrollState = state; if (mViewPagerPageChangeListener != null) { mViewPagerPageChangeListener.onPageScrollStateChanged(state); } }
@Override public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes) { // Reset the counter of how much leftover scroll needs to be consumed. mNestedParent.onNestedScrollAccepted(child, target, axes); // Dispatch up to the nested parent mNestedChild.startNestedScroll(axes & ViewCompat.SCROLL_AXIS_VERTICAL); mTotalUnconsumed = mSpinner;//0; mNestedInProgress = true; interceptAnimatorByAction(MotionEvent.ACTION_DOWN); }
@Override public void onStopNestedScroll(@NonNull View target) { mNestedParent.onStopNestedScroll(target); mNestedInProgress = false; // Finish the spinner for nested scrolling if we ever consumed any // unconsumed nested scroll mTotalUnconsumed = 0; overSpinner(); // Dispatch up our nested parent mNestedChild.stopNestedScroll(); } //</editor-fold>
@Override public boolean isNestedScrollingEnabled() { return mNestedChild.isNestedScrollingEnabled(); }
@Override public int getNestedScrollAxes() { return mNestedParent.getNestedScrollAxes(); }
@Override protected boolean canScroll(final View v, final boolean checkV, final int dx, final int x, final int y) { return super.canScroll(v, checkV, dx, x, y); } }
public static void fadeIn(View view, float alpha, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) { //fade to alpha=0 ViewCompat.animate(view) .alpha(alpha) .setDuration(fadeDuration) .withLayer() .setInterpolator(new AccelerateInterpolator()) .setListener(listener); }