Пример #1
0
  /**
   * This method takes some view and the values by which its top and bottom bounds should be changed
   * by. Given these params, an animation which will animate these bound changes is created and
   * returned.
   */
  private Animator getAnimation(final View view, float translateTop, float translateBottom) {

    int top = view.getTop();
    int bottom = view.getBottom();

    int endTop = (int) (top + translateTop);
    int endBottom = (int) (bottom + translateBottom);

    PropertyValuesHolder translationTop = PropertyValuesHolder.ofInt("top", top, endTop);
    PropertyValuesHolder translationBottom =
        PropertyValuesHolder.ofInt("bottom", bottom, endBottom);

    return ObjectAnimator.ofPropertyValuesHolder(view, translationTop, translationBottom);
  }
Пример #2
0
 @Override
 public void setIntValues(int... values) {
   if (mValues == null || mValues.length == 0) {
     // No values yet - this animator is being constructed piecemeal. Init the values with
     // whatever the current propertyName is
     if (mProperty != null) {
       setValues(PropertyValuesHolder.ofInt(mProperty, values));
     } else {
       setValues(PropertyValuesHolder.ofInt(mPropertyName, values));
     }
   } else {
     super.setIntValues(values);
   }
 }