Java 类android.transition.TransitionValues 实例源码

项目:GitHub    文件:TextSizeTransition.java   
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }

    Float startSize = (Float) startValues.values.get(PROPNAME_TEXT_SIZE);
    Float endSize = (Float) endValues.values.get(PROPNAME_TEXT_SIZE);
    if (startSize == null || endSize == null || startSize.floatValue() == endSize.floatValue()) {
        return null;
    }

    TextView view = (TextView) endValues.view;
    view.setTextSize(TypedValue.COMPLEX_UNIT_PX, startSize);
    return ObjectAnimator.ofFloat(view, TEXT_SIZE_PROPERTY, startSize, endSize);
}
项目:GitHub    文件:TextSizeTransition.java   
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }

    Float startSize = (Float) startValues.values.get(PROPNAME_TEXT_SIZE);
    Float endSize = (Float) endValues.values.get(PROPNAME_TEXT_SIZE);
    if (startSize == null || endSize == null || startSize.floatValue() == endSize.floatValue()) {
        return null;
    }

    TextView view = (TextView) endValues.view;
    view.setTextSize(TypedValue.COMPLEX_UNIT_PX, startSize);
    return ObjectAnimator.ofFloat(view, TEXT_SIZE_PROPERTY, startSize, endSize);
}
项目:Hello-Music-droid    文件:PlayTransition.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    captureValues(transitionValues);
    Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),
            Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    view.draw(canvas);
    transitionValues.values.put(PROPERTY_IMAGE, bitmap);
}
项目:PokeMusic    文件:StartAnimatable.java   
@Override
public Animator createAnimator(ViewGroup sceneRoot,
                               TransitionValues startValues,
                               TransitionValues endValues) {
    if (animatable == null || endValues == null
            || !(endValues.view instanceof ImageView)) return null;

    ImageView iv = (ImageView) endValues.view;
    iv.setImageDrawable((Drawable) animatable);

    // need to return a non-null Animator even though we just want to listen for the start
    ValueAnimator transition = ValueAnimator.ofInt(0, 1);
    transition.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            animatable.start();
        }
    });
    return transition;
}
项目:Melophile    文件:StartAnimatable.java   
@Override
public Animator createAnimator(ViewGroup sceneRoot,
                               TransitionValues startValues,
                               TransitionValues endValues) {
    if (animatable == null || endValues == null
            || !(endValues.view instanceof ImageView)) return null;

    ImageView iv = (ImageView) endValues.view;
    iv.setImageDrawable((Drawable) animatable);

    // need to return a non-null Animator even though we just want to listen for the start
    ValueAnimator transition = ValueAnimator.ofInt(0, 1);
    transition.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            animatable.start();
        }
    });
    return transition;
}
项目:Melophile    文件:BackgroundScale.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
                         TransitionValues startValues,
                         TransitionValues endValues) {
    view.setPivotX(view.getWidth());
    view.setPivotY(view.getHeight()/2);
    return ObjectAnimator.ofFloat(view,View.SCALE_X,0,1).setDuration(400);
}
项目:Huahui-Android    文件:MorphTransition.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    super.captureEndValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, endColor);//ContextCompat.getColor(view.getContext(), R.color.dialog_background_color)
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius);
}
项目:Mysplash    文件:CoverTransition.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    super.captureEndValues(transitionValues);
    Photo photo = Mysplash.getInstance().getPhoto();
    if (photo != null) {
        int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
        int[] sizes = FreedomImageView.getMeasureSize(
                context, screenWidth, photo.width, photo.height, true);
        Rect bounds = (Rect) transitionValues.values.get(PROPNAME_BOUNDS);
        bounds.left = 0;
        bounds.top = 0;
        bounds.right = sizes[0];
        bounds.bottom = sizes[1];
        transitionValues.values.put(PROPNAME_BOUNDS, bounds);
    }
}
项目:AndroidFlipCardTransition    文件:CardFlipTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, View view,
                         TransitionValues startValues, TransitionValues endValues) {

    view.setRotationY(-90);
    Animator rotateY = ObjectAnimator.ofFloat(view, "rotationY", 0);
    rotateY.setDuration(1000);
    rotateY.setStartDelay(500);
    CardFlipRotationListener listener = new CardFlipRotationListener(view);
    rotateY.addListener(listener);
    addListener(listener);
    rotateY.addPauseListener(listener);
    // set Interpolator later

    return rotateY;
}
项目:android_packages_apps_tv    文件:FadeAndShortSlide.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
        TransitionValues endValues) {
    if (endValues == null) {
        return null;
    }
    int[] position = (int[]) endValues.values.get(PROPNAME_SCREEN_POSITION);
    int left = position[0];
    float endX = view.getTranslationX();
    float startX = mSlideCalculator.getGoneX(sceneRoot, view, position, mDistance);
    final Animator slideAnimator = TranslationAnimationCreator.createAnimation(view, endValues,
            left, startX, endX, APPEAR_INTERPOLATOR, this);
    if (slideAnimator == null) {
        return null;
    }
    mFade.setInterpolator(APPEAR_INTERPOLATOR);
    final AnimatorSet set = new AnimatorSet();
    set.play(slideAnimator).with(mFade.onAppear(sceneRoot, view, startValues, endValues));
    Long delay = (Long ) endValues.values.get(PROPNAME_DELAY);
    if (delay != null) {
        set.setStartDelay(delay);
    }
    return set;
}
项目:FabTransformingSample    文件:ImageFade.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
                            TransitionValues endValues) {
    if (!(view instanceof ImageView)) {
        return null;
    }

    final ImageView iv = (ImageView) view;
    final Drawable drawable = iv.getDrawable();

    if (drawable == null) {
        return null;
    }

    final ValueAnimator anim = ValueAnimator.ofInt(255, 0);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            final int alpha = (int) valueAnimator.getAnimatedValue();
            drawable.setAlpha(alpha);
        }
    });
    return anim;
}
项目:S1-Next    文件:StartAnimatable.java   
@Override
public Animator createAnimator(ViewGroup sceneRoot,
                               TransitionValues startValues,
                               TransitionValues endValues) {
    if (animatable == null || endValues == null
            || !(endValues.view instanceof ImageView)) return null;

    ImageView iv = (ImageView) endValues.view;
    iv.setImageDrawable((Drawable) animatable);

    // need to return a non-null Animator even though we just want to listen for the start
    ValueAnimator transition = ValueAnimator.ofInt(0, 1);
    transition.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            animatable.start();
        }
    });
    return transition;
}
项目:ClouldReader    文件:CustomChangeBounds.java   
@Override
    public Animator createAnimator(final ViewGroup sceneRoot,
                                   TransitionValues startValues,
                                   final TransitionValues endValues) {

        Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
        if (startValues == null || endValues == null || changeBounds == null)
            return null;

//        if (endValues.view instanceof ViewGroup) {
//            ViewGroup vg = (ViewGroup) endValues.view;
//            float offset = vg.getHeight() / 3;
//            for (int i = 0; i < vg.getChildCount(); i++) {
//                View v = vg.getChildAt(i);
//                v.setTranslationY(offset);
//                v.setAlpha(0f);
//                v.animate()
//                        .alpha(1f)
//                        .translationY(0f)
//                        .setDuration(150)
//                        .setStartDelay(150)
//                        .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
//                                android.R.interpolator.fast_out_slow_in));
//                offset *= 1.8f;
//            }
//        }

        changeBounds.setDuration(500);
        changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
                android.R.interpolator.fast_out_slow_in));
        return changeBounds;
    }
项目:GitHub    文件:CustomChangeBounds.java   
@Override
    public Animator createAnimator(final ViewGroup sceneRoot,
                                   TransitionValues startValues,
                                   final TransitionValues endValues) {

        Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
        if (startValues == null || endValues == null || changeBounds == null)
            return null;

//        if (endValues.view instanceof ViewGroup) {
//            ViewGroup vg = (ViewGroup) endValues.view;
//            float offset = vg.getHeight() / 3;
//            for (int i = 0; i < vg.getChildCount(); i++) {
//                View v = vg.getChildAt(i);
//                v.setTranslationY(offset);
//                v.setAlpha(0f);
//                v.animate()
//                        .alpha(1f)
//                        .translationY(0f)
//                        .setDuration(150)
//                        .setStartDelay(150)
//                        .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
//                                android.R.interpolator.fast_out_slow_in));
//                offset *= 1.8f;
//            }
//        }

        changeBounds.setDuration(500);
        changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
                android.R.interpolator.fast_out_slow_in));
        return changeBounds;
    }
项目:GitHub    文件:ExplodeFadeExitTransition.java   
@Override public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
    TransitionValues endValues) {

  senderNameView.setVisibility(View.INVISIBLE);
  senderMailView.setVisibility(View.INVISIBLE);
  separatorLine.setVisibility(View.INVISIBLE);
  return super.createAnimator(sceneRoot, startValues, endValues);
}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
                         TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
        0, 1000);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
                            TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
       1000, 0);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
            mSmallRadius, mBigRadius);
    animator.setDuration(mDuration);
    return new PauseableAnimator(animator);
}
项目:GitHub    文件:RevealTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
            mBigRadius, mSmallRadius);
    animator.setDuration(mDuration);
    return new PauseableAnimator(animator);
}
项目:GitHub    文件:DraweeTransition.java   
private void captureValues(TransitionValues transitionValues) {
  if (transitionValues.view instanceof GenericDraweeView) {
    transitionValues.values.put(
        PROPNAME_BOUNDS,
        new Rect(0, 0, transitionValues.view.getWidth(), transitionValues.view.getHeight()));
  }
}
项目:GitHub    文件:ExplodeFadeExitTransition.java   
@Override public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues,
    TransitionValues endValues) {

  senderNameView.setVisibility(View.INVISIBLE);
  senderMailView.setVisibility(View.INVISIBLE);
  separatorLine.setVisibility(View.INVISIBLE);
  return super.createAnimator(sceneRoot, startValues, endValues);
}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
                         TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
        0, 1000);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
                            TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
       1000, 0);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
            mSmallRadius, mBigRadius);
    animator.setDuration(mDuration);
    return new PauseableAnimator(animator);
}
项目:GitHub    文件:RevealTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
            mBigRadius, mSmallRadius);
    animator.setDuration(mDuration);
    return new PauseableAnimator(animator);
}
项目:SunmiUI    文件:CustomTransition.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    View view = transitionValues.view;
    Rect rect = new Rect();
    view.getHitRect(rect);
    transitionValues.values.put(RECT, rect);
}
项目:SunmiUI    文件:CustomTransition.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    View view = transitionValues.view;
    Rect rect = new Rect();
    view.getHitRect(rect);
    transitionValues.values.put(RECT, rect);
}
项目:Android-Code-Demos    文件:CustomChangeBounds.java   
/**
 * @param sceneRoot   屏幕根View,即DecorView,第二个Activity的DecorView。
 * @param startValues 属性动画的起始属性值,TransitionValues 对象内部有各Map类型的属性values,
 *                    用于保存需要执行属性动画的属性。这个里面的属性值是在函数captureStartValues
 *                    里放置,因此你可以重写captureStartValues函数,并把你自定义的属性动画中的属
 *                    性放进去。
 * @param endValues   与startValues类似,表示属性动画结束时的属性值。可以通过重写captureEndValues
 *                    函数,并把你自定义的属性动画里面的最终属性值放进去。
 * @return
 */
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {

    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null)
        return null;


    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        float offset = vg.getHeight() / 3;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.setTranslationY(offset);
            v.setAlpha(0f);
            v.animate()
                    .alpha(1f)
                    .translationY(0f)
                    .setDuration(150)
                    .setStartDelay(150)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
                            android.R.interpolator.fast_out_slow_in));
            offset *= 1.8f;
        }
    }

    changeBounds.setDuration(300);
    /* 设置插值器 - 慢进快出 */
    changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
            android.R.interpolator.fast_out_slow_in));
    return changeBounds;
}
项目:ScrollShapeUI    文件:CustomChangeBounds.java   
@Override
    public Animator createAnimator(final ViewGroup sceneRoot,
                                   TransitionValues startValues,
                                   final TransitionValues endValues) {

        Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
        if (startValues == null || endValues == null || changeBounds == null)
            return null;

//        if (endValues.view instanceof ViewGroup) {
//            ViewGroup vg = (ViewGroup) endValues.view;
//            float offset = vg.getHeight() / 3;
//            for (int i = 0; i < vg.getChildCount(); i++) {
//                View v = vg.getChildAt(i);
//                v.setTranslationY(offset);
//                v.setAlpha(0f);
//                v.animate()
//                        .alpha(1f)
//                        .translationY(0f)
//                        .setDuration(150)
//                        .setStartDelay(150)
//                        .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
//                                android.R.interpolator.fast_out_slow_in));
//                offset *= 1.8f;
//            }
//        }

        changeBounds.setDuration(500);
        changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
                android.R.interpolator.fast_out_slow_in));
        return changeBounds;
    }
项目:Morphing-Material-Dialogs    文件:MorphDialogToFab.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    super.captureStartValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, backgroundColor);
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources()
            .getDimensionPixelSize(R.dimen.dialog_corners));
}
项目:Morphing-Material-Dialogs    文件:MorphDialogToFab.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    super.captureEndValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.accent));
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getHeight() / 2);//view.getHeight() / 2
}
项目:Morphing-Material-Dialogs    文件:MorphDialogToFab.java   
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    transition.setDuration(300);
    return transition;
}
项目:Morphing-Material-Dialogs    文件:MorphTransition.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    super.captureStartValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, startColor);
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, startCornerRadius);//view.getHeight() / 2
}
项目:Morphing-Material-Dialogs    文件:MorphTransition.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    super.captureEndValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, endColor);//ContextCompat.getColor(view.getContext(), R.color.dialog_background_color)
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius);
}
项目:Morphing-Material-Dialogs    文件:MorphFabToDialog.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    super.captureStartValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.accent));
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getHeight() / 2);//view.getHeight() / 2
}
项目:Morphing-Material-Dialogs    文件:MorphFabToDialog.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    super.captureEndValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, backgroundColor);
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources().getDimensionPixelSize(R.dimen.dialog_corners));
}
项目:Morphing-Material-Dialogs    文件:MorphDialogToFab.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    super.captureStartValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, backgroundColor);
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources()
            .getDimensionPixelSize(R.dimen.default_dialog_corners));
}
项目:Morphing-Material-Dialogs    文件:MorphDialogToFab.java   
@Override
public void captureEndValues(TransitionValues transitionValues) {
    super.captureEndValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, MorphFabToDialog.fetchAccentColor(view.getContext()));
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getHeight() / 2);//view.getHeight() / 2
}
项目:Morphing-Material-Dialogs    文件:MorphDialogToFab.java   
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (startValues == null || endValues == null || changeBounds == null) {
        return null;
    }

    Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR);
    Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS);
    Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR);
    Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS);

    if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) {
        return null;
    }

    MorphDrawable background = new MorphDrawable(startColor, startCornerRadius);
    endValues.view.setBackground(background);

    Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.CORNER_RADIUS, endCornerRadius);

    // hide child views (offset down & fade out)
    if (endValues.view instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) endValues.view;
        for (int i = 0; i < vg.getChildCount(); i++) {
            View v = vg.getChildAt(i);
            v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L)
                    .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in))
                    .start();
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in));
    transition.setDuration(300);
    return transition;
}
项目:Morphing-Material-Dialogs    文件:MorphTransition.java   
@Override
public void captureStartValues(TransitionValues transitionValues) {
    super.captureStartValues(transitionValues);
    final View view = transitionValues.view;
    if (view.getWidth() <= 0 || view.getHeight() <= 0) {
        return;
    }
    transitionValues.values.put(PROPERTY_COLOR, startColor);
    transitionValues.values.put(PROPERTY_CORNER_RADIUS, startCornerRadius);//view.getHeight() / 2
}