Java Code Examples for android.view.View#TRANSLATION_Y

The following examples show how to use android.view.View#TRANSLATION_Y . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: adt-leanback-support   File: Slide.java    License: 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 Project: magellan   File: DefaultTransition.java    License: 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
private Property<View, Float> getTranslateProperty() {
    if (mOrientation == LinearLayoutManager.VERTICAL) {
        return View.TRANSLATION_Y;
    } else {
        return View.TRANSLATION_X;
    }
}
 
Example 4
public AnimationAttributesVertical() {
    mProperty = View.TRANSLATION_Y;
}
 
Example 5
public AnimationAttributesVertical() {
    mProperty = View.TRANSLATION_Y;
}
 
Example 6
Source Project: adt-leanback-support   File: Slide.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Property<View, Float> getProperty() {
    return View.TRANSLATION_Y;
}