List of usage examples for android.view View getTranslationY
@ViewDebug.ExportedProperty(category = "drawing") public float getTranslationY()
From source file:app.umitems.greenclock.widget.sgv.StaggeredGridView.java
/** * Add animators for animating out stale views * @param animationOutMode The animation mode to play for stale views *//* w w w . j a v a 2 s .c o m*/ private void addOutAnimatorsForStaleViews(List<Animator> animators, AnimationOut animationOutMode) { if (animationOutMode == AnimationOut.NONE) { return; } for (final View v : mViewsToAnimateOut) { // For each stale view to animate out, retrieve the animators for the view, then attach // the StaleViewAnimationEndListener which checks to see if the view should be recycled // at the end of the animation. final List<Animator> viewAnimators = new ArrayList<Animator>(); switch (animationOutMode) { case SLIDE: final LayoutParams lp = (LayoutParams) v.getLayoutParams(); // Bias towards sliding right, but depending on the column that this view // is laid out in, slide towards the nearest side edge. int endTranslation = (int) (v.getWidth() * 1.5); if (lp.column < (mColCount / 2)) { endTranslation = -endTranslation; } SgvAnimationHelper.addSlideOutAnimators(viewAnimators, v, (int) v.getTranslationX(), endTranslation); break; case COLLAPSE: SgvAnimationHelper.addCollapseOutAnimators(viewAnimators, v); break; case FLY_DOWN: SgvAnimationHelper.addFlyOutAnimators(viewAnimators, v, (int) v.getTranslationY(), getHeight()); break; case FADE: SgvAnimationHelper.addFadeAnimators(viewAnimators, v, v.getAlpha(), 0 /* end alpha */); break; default: throw new IllegalStateException("Unknown animationOutMode: " + animationOutMode); } if (viewAnimators.size() > 0) { addStaleViewAnimationEndListener(v, viewAnimators); animators.addAll(viewAnimators); } } }
From source file:com.deepak.myclock.widget.sgv.StaggeredGridView.java
/** * Add animators for animating out stale views * @param animationOutMode The animation mode to play for stale views *//*www . ja v a 2 s . c om*/ private void addOutAnimatorsForStaleViews(List<Animator> animators, SgvAnimationHelper.AnimationOut animationOutMode) { if (animationOutMode == SgvAnimationHelper.AnimationOut.NONE) { return; } for (final View v : mViewsToAnimateOut) { // For each stale view to animate out, retrieve the animators for the view, then attach // the StaleViewAnimationEndListener which checks to see if the view should be recycled // at the end of the animation. final List<Animator> viewAnimators = new ArrayList<Animator>(); switch (animationOutMode) { case SLIDE: final LayoutParams lp = (LayoutParams) v.getLayoutParams(); // Bias towards sliding right, but depending on the column that this view // is laid out in, slide towards the nearest side edge. int endTranslation = (int) (v.getWidth() * 1.5); if (lp.column < (mColCount / 2)) { endTranslation = -endTranslation; } SgvAnimationHelper.addSlideOutAnimators(viewAnimators, v, (int) v.getTranslationX(), endTranslation); break; case COLLAPSE: SgvAnimationHelper.addCollapseOutAnimators(viewAnimators, v); break; case FLY_DOWN: SgvAnimationHelper.addFlyOutAnimators(viewAnimators, v, (int) v.getTranslationY(), getHeight()); break; case FADE: SgvAnimationHelper.addFadeAnimators(viewAnimators, v, v.getAlpha(), 0 /* end alpha */); break; default: throw new IllegalStateException("Unknown animationOutMode: " + animationOutMode); } if (viewAnimators.size() > 0) { addStaleViewAnimationEndListener(v, viewAnimators); animators.addAll(viewAnimators); } } }