Java Code Examples for android.view.View#TRANSLATION_Y

The following examples show how to use android.view.View#TRANSLATION_Y . 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: Slide.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
private Animator createAnimation(final View view, Property<View, Float> property,
        float start, float end, float terminalValue, TimeInterpolator interpolator,
        int finalVisibility) {
    float[] startPosition = (float[]) view.getTag(R.id.lb_slide_transition_value);
    if (startPosition != null) {
        start = View.TRANSLATION_Y == property ? startPosition[1] : startPosition[0];
        view.setTag(R.id.lb_slide_transition_value, null);
    }
    final ObjectAnimator anim = ObjectAnimator.ofFloat(view, property, start, end);

    SlideAnimatorListener listener = new SlideAnimatorListener(view, property, terminalValue, end,
            finalVisibility);
    anim.addListener(listener);
    anim.addPauseListener(listener);
    anim.setInterpolator(interpolator);
    return anim;
}
 
Example 2
Source File: DefaultTransition.java    From magellan with Apache License 2.0 5 votes vote down vote up
private AnimatorSet createAnimator(View from, View to, NavigationType navType, Direction direction) {
  Property<View, Float> axis;
  int fromTranslation;
  int toTranslation;
  int sign = direction.sign();

  switch (navType) {
    case GO:
      axis = View.TRANSLATION_X;
      fromTranslation = sign * -from.getWidth();
      toTranslation = sign * to.getWidth();
      break;
    case SHOW:
      axis = View.TRANSLATION_Y;
      fromTranslation = direction == FORWARD ? 0 : from.getHeight();
      toTranslation = direction == BACKWARD ? 0 : to.getHeight();
      break;
    default:
      axis = View.TRANSLATION_X;
      fromTranslation = 0;
      toTranslation = 0;
      break;
  }
  AnimatorSet set = new AnimatorSet();
  if (from != null) {
    set.play(ObjectAnimator.ofFloat(from, axis, 0, fromTranslation));
  }
  set.play(ObjectAnimator.ofFloat(to, axis, toTranslation, 0));
  return set;
}
 
Example 3
Source File: PinchZoomItemTouchListener.java    From RecyclerViewExtensions with MIT License 5 votes vote down vote up
private Property<View, Float> getTranslateProperty() {
    if (mOrientation == LinearLayoutManager.VERTICAL) {
        return View.TRANSLATION_Y;
    } else {
        return View.TRANSLATION_X;
    }
}
 
Example 4
Source File: VerticalElasticityBounceEffect.java    From elasticity with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AnimationAttributesVertical() {
    mProperty = View.TRANSLATION_Y;
}
 
Example 5
Source File: VerticalOverScrollBounceEffectDecorator.java    From overscroll-decor with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AnimationAttributesVertical() {
    mProperty = View.TRANSLATION_Y;
}
 
Example 6
Source File: Slide.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
@Override
public Property<View, Float> getProperty() {
    return View.TRANSLATION_Y;
}