ViewPager pagesView = (ViewPager) findViewById(R.id.pages); PageSplitter pageSplitter = new PageSplitter(pagesView.getWidth(), pagesView.getHeight(), 1, 0);
@OnClick(R.id.ivHome) void showViewPagerWithTransition() { TransitionManager.beginDelayedTransition(rootFrame); viewPager.setVisibility(View.VISIBLE); ivHome.setVisibility(View.INVISIBLE); rlWhere.setVisibility(View.INVISIBLE); mMap.setPadding(0, 0, 0, viewPager.getHeight()); }
@NonNull private ValueAnimator getCollposValueAnimator() { ValueAnimator collapsVa = ValueAnimator.ofFloat(1, mMinHeight / mViewpager.getHeight()); collapsVa.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float percent = (Float) valueAnimator.getAnimatedValue(); mViewpager.setScaleX(percent); mViewpager.setScaleY(percent); mViewpager.setY((1 - percent) / 2 * mViewpager.getHeight()); } }); collapsVa.setDuration(mDuration); return collapsVa; }
@NonNull private ValueAnimator getExpandValueAnimator() { ValueAnimator expandXVa = ValueAnimator.ofFloat(mMinHeight / mViewpager.getHeight(), 1); expandXVa.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float percent = (Float) valueAnimator.getAnimatedValue(); mViewpager.setScaleX(percent); mViewpager.setScaleY(percent); mViewpager.setY((1 - percent) / 2 * mViewpager.getHeight()); } }); expandXVa.setDuration(mDuration); return expandXVa; }
@Override public void onGlobalLayout() { viewPager.getViewTreeObserver().removeGlobalOnLayoutListener( this); imageHeight = viewPager.getHeight(); scrollView.setScrollViewListener(BannerActivity.this); } });
@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float percent = (Float) valueAnimator.getAnimatedValue(); mViewpager.setScaleX(percent); mViewpager.setScaleY(percent); mViewpager.setY((1 - percent) / 2 * mViewpager.getHeight()); } });
@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float percent = (Float) valueAnimator.getAnimatedValue(); mViewpager.setScaleX(percent); mViewpager.setScaleY(percent); mViewpager.setY((1 - percent) / 2 * mViewpager.getHeight()); } });
Picasso.with(mContext) .load(urls.get(i)) .resize(mVpMoveImgs.getWidth(), mVpMoveImgs.getHeight()) .placeholder(R.drawable.placeholder) .into((ImageView) view.findViewById(R.id.iv_img)); Picasso.with(mContext) .load(urls.get(i)) .resize(mVpMoveImgs.getWidth(), mVpMoveImgs.getHeight()) .placeholder(R.drawable.placeholder) .into(imageView);
int height = mPager.getHeight(); int width = mPager.getWidth();
if (height > mViewPager.getHeight()) { resize(height);
public void run() { // ...and update the console's height... // We need to use this in case the message area is partially off the screen // This is the DESIRED height, not the ACTUAL height message = getTextViewHeight(getApplicationContext(), messageArea.getText().toString(), messageArea.getTextSize(), messageArea.getWidth(), messageArea.getPaddingTop()); ((LinearLayout) findViewById(R.id.buffer)).getLayoutParams().height = message; // Obtain some references View console = findViewById(R.id.console_scroller); View content = findViewById(R.id.content); if (isSelectedCodeAreaInitialized()) { // We can't shrink the console if it's hidden (like when the keyboard is visible)... // ...so shrink the code area instead if (console.getHeight() <= 0) { codePager.setLayoutParams(new LinearLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, content.getHeight() - message - (extraHeaderView != null ? extraHeaderView.getHeight() : 0) - tabBarContainer.getHeight())); } else { console.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, content.getHeight() - codePager.getHeight() - message - (extraHeaderView != null ? extraHeaderView.getHeight() : 0) - tabBarContainer.getHeight())); } } } });
@Override public boolean dispatchTouchEvent(MotionEvent ev) { Fragment listFragment = getSupportFragmentManager().findFragmentByTag( "android:switcher:" + R.id.pager + ":" + (mainPager.getCurrentItem())); mainPager.getChildAt(mainPager.getCurrentItem()); if (listFragment == null) return super.dispatchTouchEvent(ev); ViewPager embeddedPager = (ViewPager) listFragment.getView().findViewById(R.id.videopager); if (embeddedPager != null) { int[] position = new int[2]; embeddedPager.getLocationOnScreen(position); if (ev.getY() > position[1] && ev.getY() < position[1] + embeddedPager.getHeight()) { mainPager.requestDisallowInterceptTouchEvent(true); if (embeddedPager.getScrollX() % embeddedPager.getWidth() != 0) { ListView listView = (ListView) listFragment.getView().findViewById( android.R.id.list); listView.requestDisallowInterceptTouchEvent(true); } } } return super.dispatchTouchEvent(ev); }
public void initCodeAreaAndConsoleDimensions() { ScrollView console = getConsoleScroller(); // Initialize in case we have the layout weights instead of actual values codePager.getLayoutParams().height = codePager.getHeight(); console.getLayoutParams().height = console.getHeight(); }
if (!mLeftEdge.isFinished()) { final int restoreCount = canvas.save(); final int height = getHeight() - getPaddingTop() - getPaddingBottom(); final int width = getWidth(); final int restoreCount = canvas.save(); final int width = getWidth(); final int height = getHeight() - getPaddingTop() - getPaddingBottom();
if (!mLeftEdge.isFinished()) { final int restoreCount = canvas.save(); final int height = getHeight() - getPaddingTop() - getPaddingBottom(); final int restoreCount = canvas.save(); final int width = getWidth(); final int height = getHeight() - getPaddingTop() - getPaddingBottom(); final int itemCount = mAdapter != null ? mAdapter.getCount() : 1;
oldCodeHeight = codePager.getHeight(); firstResize = false; } else { oldCodeHeight = codePager.getHeight(); consoleArea.startAnimation(new ResizeAnimation<LinearLayout>(consoleArea, ResizeAnimation.DEFAULT, totalHeight - codePager.getHeight(), ResizeAnimation.DEFAULT, totalHeight - oldCodeHeight, false)); consoleArea.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, totalHeight - codePager.getHeight()));
if (codePager.getHeight() >= height) { resizeCode = new ResizeAnimation<LinearLayout>(codePager, LinearLayout.LayoutParams.MATCH_PARENT, codePager.getHeight(), LinearLayout.LayoutParams.MATCH_PARENT, codePager.getHeight() - height, false); resizeConsole = null; } else { resizeCode = new ResizeAnimation<LinearLayout>(codePager, LinearLayout.LayoutParams.MATCH_PARENT, ResizeAnimation.DEFAULT, LinearLayout.LayoutParams.MATCH_PARENT, 0, false); resizeConsole = new ResizeAnimation<LinearLayout>(console, LinearLayout.LayoutParams.MATCH_PARENT, ResizeAnimation.DEFAULT, LinearLayout.LayoutParams.MATCH_PARENT, console.getHeight() - (height - codePager.getHeight()), false);
public void close() { if (findReplaceToolbar != null) { ViewPager codePager = context.getEditor().getCodePager(); ResizeAnimation<LinearLayout> resize = new ResizeAnimation<LinearLayout>(findReplaceToolbar, LinearLayout.LayoutParams.MATCH_PARENT, ResizeAnimation.DEFAULT, LinearLayout.LayoutParams.MATCH_PARENT, 0); resize.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { contentView.removeView(findReplaceToolbar); context.getEditor().setExtraHeaderView(null); // context.getEditor().refreshMessageAreaLocation(); clearHighlights(); context.getCodeArea().removeTextChangedListener(codeWatcher); } @Override public void onAnimationRepeat(Animation animation) {} }); findReplaceToolbar.startAnimation(resize); codePager.startAnimation(new ResizeAnimation<LinearLayout>(codePager, LinearLayout.LayoutParams.MATCH_PARENT, ResizeAnimation.DEFAULT, LinearLayout.LayoutParams.MATCH_PARENT, codePager.getHeight() + findReplaceToolbar.getHeight())); } }
.setInterpolator(new AccelerateInterpolator()) .scaleX((float) thumbnailWidth / mViewPager.getWidth()) .scaleY((float) thumbnailHeight / mViewPager.getHeight()) .translationX(thumbnailLeft) .translationY(thumbnailTop)
ViewHelper.setPivotY(mViewPager, 0); ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth()); ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight()); ViewHelper.setTranslationX(mViewPager, thumbnailLeft); ViewHelper.setTranslationY(mViewPager, thumbnailTop);