com.nineoldandroids.view.ViewPropertyAnimator Java Examples
The following examples show how to use
com.nineoldandroids.view.ViewPropertyAnimator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlidingUpBaseActivity.java From Android-ObservableScrollView with Apache License 2.0 | 6 votes |
private void showFab(boolean animated) { if (mFab == null) { return; } if (!mFabIsShown) { if (animated) { ViewPropertyAnimator.animate(mFab).cancel(); ViewPropertyAnimator.animate(mFab).scaleX(1).scaleY(1).setDuration(200).start(); } else { ViewHelper.setScaleX(mFab, 1); ViewHelper.setScaleY(mFab, 1); } mFabIsShown = true; } else { // Ensure that FAB is shown ViewHelper.setScaleX(mFab, 1); ViewHelper.setScaleY(mFab, 1); } }
Example #2
Source File: FloatingLabelLayout.java From FloatingLabelLayout with Apache License 2.0 | 6 votes |
/** * Hide the label using an animation */ private void hideLabel() { ViewHelper.setAlpha(mLabel, 1f); ViewHelper.setTranslationY(mLabel, 0f); ViewPropertyAnimator.animate(mLabel) .alpha(0f) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLabel.setVisibility(View.GONE); } }).start(); }
Example #3
Source File: AutoHideButtonFloat.java From MaterialDesignLibrary with Apache License 2.0 | 6 votes |
@Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (mLastFirstVisibleItem < firstVisibleItem) { if (floatShowing) floatShowing = false; if (!floatHiding) { ViewPropertyAnimator.animate(view).translationY(500).setDuration(300); floatHiding = true; } } if (mLastFirstVisibleItem > firstVisibleItem) { if (floatHiding) { floatHiding = false; } if (!floatShowing) { ViewPropertyAnimator.animate(view).translationY(0).setDuration(300); floatShowing = true; } } mLastFirstVisibleItem = firstVisibleItem; if (onScrollListener != null) onScrollListener.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount); }
Example #4
Source File: ToolbarControlRecyclerViewActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { mBaseTranslationY = 0; float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (scrollState == ScrollState.UP) { if (toolbarHeight < mRecyclerView.getCurrentScrollY()) { if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } } } else if (scrollState == ScrollState.DOWN) { if (toolbarHeight < mRecyclerView.getCurrentScrollY()) { if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } } } }
Example #5
Source File: FloatingLabelEditText.java From FloatingLabelLayout with Apache License 2.0 | 6 votes |
/** * Hide the label using an animation */ private void hideLabel() { ViewHelper.setAlpha(mLabel, 1f); ViewHelper.setTranslationY(mLabel, 0f); ViewPropertyAnimator.animate(mLabel) .alpha(0f) .translationY(mLabel.getHeight()) .setDuration(ANIMATION_DURATION) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLabel.setVisibility(View.GONE); } }).start(); }
Example #6
Source File: StickyHeaderWebViewActivity.java From Android-ObservableScrollView with Apache License 2.0 | 6 votes |
@Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { if (mDragging) { int toolbarHeight = mToolbarView.getHeight(); if (mFirstScroll) { mFirstScroll = false; float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY) { mBaseTranslationY = scrollY; } } float headerTranslationY = ScrollUtils.getFloat(-(scrollY - mBaseTranslationY), -toolbarHeight, 0); ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewHelper.setTranslationY(mHeaderView, headerTranslationY); } }
Example #7
Source File: MainActivity.java From google-io-2014-compat with Apache License 2.0 | 6 votes |
private void startActivityGingerBread(View view, Intent intent, int resId) { int[] screenLocation = new int[2]; view.getLocationOnScreen(screenLocation); intent. putExtra("left", screenLocation[0]). putExtra("top", screenLocation[1]). putExtra("width", view.getWidth()). putExtra("height", view.getHeight()); startActivity(intent); // Override transitions: we don't want the normal window animation in addition to our // custom one overridePendingTransition(0, 0); // The detail activity handles the enter and exit animations. Both animations involve a // ghost view animating into its final or initial position respectively. Since the detail // activity starts translucent, the clicked view needs to be invisible in order for the // animation to look correct. ViewPropertyAnimator.animate(findViewById(resId)).alpha(0.0f); }
Example #8
Source File: ThemeFragment.java From 4pdaClient-plus with Apache License 2.0 | 6 votes |
private void showBody(String body) throws Exception { super.showBody(); try { setScrollElement(); setTitle(m_Topic.getTitle()); if (getSupportActionBar() != null) setSubtitle(m_Topic.getCurrentPage() + "/" + m_Topic.getPagesCount()); //webView.loadDataWithBaseURL(m_LastUrl, body, "text/html", "UTF-8", null); webView.loadDataWithBaseURL("https://4pda.ru/forum/", body, "text/html", "UTF-8", null); TopicsHistoryTable.addHistory(m_Topic, m_LastUrl); if (buttonsPanel.getTranslationY() != 0) ViewPropertyAnimator.animate(buttonsPanel) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(500) .translationY(0); } catch (Exception ex) { AppLog.e(getMainActivity(), ex); } }
Example #9
Source File: ScrollFromBottomRecyclerViewActivity.java From Android-ObservableScrollView with Apache License 2.0 | 6 votes |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { mBaseTranslationY = 0; float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (scrollState == ScrollState.UP) { if (toolbarHeight < mRecyclerView.getCurrentScrollY()) { if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } } } else if (scrollState == ScrollState.DOWN) { if (toolbarHeight < mRecyclerView.getCurrentScrollY()) { if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } } } }
Example #10
Source File: ToolbarControlListViewActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { mBaseTranslationY = 0; float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (scrollState == ScrollState.UP) { if (toolbarHeight < mListView.getCurrentScrollY()) { if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } } } else if (scrollState == ScrollState.DOWN) { if (toolbarHeight < mListView.getCurrentScrollY()) { if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } } } }
Example #11
Source File: ScrollFromBottomListViewActivity.java From Android-ObservableScrollView with Apache License 2.0 | 6 votes |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { mBaseTranslationY = 0; float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (scrollState == ScrollState.UP) { if (toolbarHeight < mListView.getCurrentScrollY()) { if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } } } else if (scrollState == ScrollState.DOWN) { if (toolbarHeight < mListView.getCurrentScrollY()) { if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } } } }
Example #12
Source File: AbstractDetailActivity.java From google-io-2014-compat with Apache License 2.0 | 6 votes |
private void toggleStarView() { final AnimatedPathView starContainer = (AnimatedPathView) findViewById(R.id.star_container); if (starContainer.getVisibility() == View.INVISIBLE) { ViewPropertyAnimator.animate(hero).alpha(0.2f); ViewPropertyAnimator.animate(starContainer).alpha(1); starContainer.setVisibility(View.VISIBLE); starContainer.reveal(); } else { ViewPropertyAnimator.animate(hero).alpha(1); ViewPropertyAnimator.animate(starContainer).alpha(0).setListener(new AnimatorListener() { @Override public void onAnimationEnd(Animator animation) { starContainer.setVisibility(View.INVISIBLE); ViewPropertyAnimator.animate(starContainer).setListener(null); } }); } }
Example #13
Source File: ToolbarControlScrollViewActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { mBaseTranslationY = 0; float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (scrollState == ScrollState.UP) { if (toolbarHeight < mScrollView.getCurrentScrollY()) { if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } } } else if (scrollState == ScrollState.DOWN) { if (toolbarHeight < mScrollView.getCurrentScrollY()) { if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } } } }
Example #14
Source File: ViewAnimationUtils.java From material-sheet-fab with MIT License | 6 votes |
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param duration aniamtion duration * @param startDelay start delay before animation begin */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, view.getHeight() / 3); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .setStartDelay(startDelay) .rotationX(0) .translationY(0) .start(); }
Example #15
Source File: TestFragment.java From CardView with MIT License | 6 votes |
public void show(final View view,Bundle bundle){ view.setEnabled(false); this.view = view; String text = bundle.getString("text"); tv.setText(text); ViewHelper.setRotationY(view, 0); ViewHelper.setRotationY(root, -90); root.setVisibility(View.VISIBLE); ViewPropertyAnimator.animate(view).rotationY(90) .setDuration(300).setListener(null) .setInterpolator(new AccelerateInterpolator()); ViewPropertyAnimator.animate(root) .rotationY(0).setDuration(200).setStartDelay(300) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { ViewHelper.setRotationY(view, 0); } }); }
Example #16
Source File: ViewAnimationUtils.java From RecyclerView-Animation-Demo with Apache License 2.0 | 6 votes |
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param fromY initial Y position of view * @param duration aniamtion duration * @param startDelay start delay before animation begin */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, fromY); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .setStartDelay(startDelay) .rotationX(0) .translationY(0) .start(); }
Example #17
Source File: SwipeDismissListViewTouchListener.java From android-open-project-demo with Apache License 2.0 | 6 votes |
@SuppressWarnings("UnusedParameters") private boolean handleCancelEvent(final MotionEvent motionEvent) { if (mVelocityTracker == null) { return false; } if (mCurrentDismissData != null && mSwiping) { ViewPropertyAnimator.animate(mCurrentDismissData.view) .translationX(0) .alpha(1) .setDuration(mAnimationTime) .setListener(null); } mVelocityTracker.recycle(); mVelocityTracker = null; mDownX = 0; mDownY = 0; mCurrentDismissData = null; mSwiping = false; return false; }
Example #18
Source File: ToolbarControlWebViewActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public void onUpOrCancelMotionEvent(ScrollState scrollState) { mDragging = false; mBaseTranslationY = 0; float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (scrollState == ScrollState.UP) { if (toolbarHeight < mScrollView.getCurrentScrollY()) { if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } } } else if (scrollState == ScrollState.DOWN) { if (toolbarHeight < mScrollView.getCurrentScrollY()) { if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } } } }
Example #19
Source File: ViewAnimationUtils.java From fab-transformation with MIT License | 6 votes |
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param duration aniamtion duration * @param startDelay start delay before animation begin */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay) { ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, view.getHeight() / 3); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .setStartDelay(startDelay) .rotationX(0) .translationY(0) .start(); }
Example #20
Source File: ScrollFromBottomRecyclerViewActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { if (dragging) { int toolbarHeight = mToolbarView.getHeight(); if (firstScroll) { float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (-toolbarHeight < currentHeaderTranslationY && toolbarHeight < scrollY) { mBaseTranslationY = scrollY; } } int headerTranslationY = Math.min(0, Math.max(-toolbarHeight, -(scrollY - mBaseTranslationY))); ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewHelper.setTranslationY(mHeaderView, headerTranslationY); } }
Example #21
Source File: FloatingActionsMenu.java From NewFastFrame with Apache License 2.0 | 5 votes |
private void toggle(final boolean visible, final boolean animate, boolean force) { if (mVisible != visible || force) { mVisible = visible; int height = getHeight(); if (height == 0 && !force) { ViewTreeObserver vto = getViewTreeObserver(); if (vto.isAlive()) { vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { ViewTreeObserver currentVto = getViewTreeObserver(); if (currentVto.isAlive()) { currentVto.removeOnPreDrawListener(this); } toggle(visible, animate, true); return true; } }); return; } } int translationY = visible ? 0 : height + mAddButton.getMarginBottom(); if (animate) { ViewPropertyAnimator.animate(this).setInterpolator(mInterpolator) .setDuration(TRANSLATE_DURATION_MILLIS) .translationY(translationY); } else { ViewHelper.setTranslationY(this, translationY); } // On pre-Honeycomb a translated view is still clickable, so we need to disable clicks manually if (!hasHoneycombApi()) { setClickable(visible); } } }
Example #22
Source File: StickyHeaderListViewActivity.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
private void hideToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } }
Example #23
Source File: ViewPagerTabActivity.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
private void showToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } propagateToolbarState(true); }
Example #24
Source File: ViewPagerTabListViewActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { if (dragging) { int toolbarHeight = mToolbarView.getHeight(); float currentHeaderTranslationY = ViewHelper.getTranslationY(mHeaderView); if (firstScroll) { if (-toolbarHeight < currentHeaderTranslationY) { mBaseTranslationY = scrollY; } } int headerTranslationY = Math.min(0, Math.max(-toolbarHeight, -(scrollY - mBaseTranslationY))); ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewHelper.setTranslationY(mHeaderView, headerTranslationY); } }
Example #25
Source File: StickyHeaderWebViewActivity.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
private void hideToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } }
Example #26
Source File: ViewAnimationUtils.java From material-sheet-fab with MIT License | 5 votes |
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param duration aniamtion duration */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, int duration){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, view.getHeight() / 3); ViewPropertyAnimator .animate(view) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(duration) .rotationX(0) .translationY(0) .start(); }
Example #27
Source File: ViewAnimationUtils.java From Mover with Apache License 2.0 | 5 votes |
/** * Lifting view * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param fromY initial Y position of view * @param duration aniamtion duration * @param startDelay start delay before animation begin */ public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){ ViewHelper.setRotationX(view, baseRotation); ViewHelper.setTranslationY(view, fromY); ViewPropertyAnimator .animate(view) .setInterpolator(ACCELERATE_DECELERATE) .setDuration(duration) .setStartDelay(startDelay) .rotationX(0) .translationY(0) .start(); }
Example #28
Source File: StickyHeaderListViewActivity.java From Android-ObservableScrollView with Apache License 2.0 | 5 votes |
private void showToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); if (headerTranslationY != 0) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start(); } }
Example #29
Source File: ViewPagerTabScrollViewActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void hideToolbar() { float headerTranslationY = ViewHelper.getTranslationY(mHeaderView); int toolbarHeight = mToolbarView.getHeight(); if (headerTranslationY != -toolbarHeight) { ViewPropertyAnimator.animate(mHeaderView).cancel(); ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start(); } propagateToolbarState(false); }
Example #30
Source File: CardView.java From CardView with MIT License | 5 votes |
/** * 将下一个视图移到前边 * * @param view */ private void bringToTop(final View view) { topPosition++; float scaleX = ViewHelper.getScaleX(view) + ((float) 1 / mMaxVisible) * 0.2f; float tranlateY = ViewHelper.getTranslationY(view) + itemSpace; ViewPropertyAnimator.animate(view).translationY(tranlateY) .scaleX(scaleX).setDuration(200).alpha(1) .setInterpolator(new AccelerateInterpolator()); }