- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {}
private int computeInitialViewPagerScroll(MotionEvent downEvent) { // ViewPager can be in intermediate position, we should compute correct initial scroll int scroll = viewPager.getScrollX(); int pageWidth = viewPager.getWidth() + viewPager.getPageMargin(); // After state restore ViewPager can return negative scroll, let's fix it while (scroll < 0) { scroll += pageWidth; } int touchedItem = (int) ((scroll + downEvent.getX()) / pageWidth); return pageWidth * touchedItem - scroll; }
@Override public void run() { Activity activity = fragment.getActivity(); if (fragment.isAdded() && activity != null) { fragment.mRecyclerView.startAnimation(AnimationUtils.loadAnimation( activity, R.anim.slide_in_bottom)); int cx = fragment.mViewPager.getWidth(); SupportAnimator animator = ViewAnimationUtils.createCircularReveal( fragment.mViewPager, cx / 2, 0, 0, cx); animator.addListener(new SupportAnimator.SimpleAnimatorListener() { @Override public void onAnimationStart() { super.onAnimationStart(); fragment.mViewPager.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd() { super.onAnimationEnd(); fragment.mViewPagerShadow.setVisibility(View.VISIBLE); } }); animator.setDuration(400); animator.start(); } } });