当前位置: 首页>>代码示例>>Java>>正文


Java MorphDrawable类代码示例

本文整理汇总了Java中io.plaidapp.ui.drawable.MorphDrawable的典型用法代码示例。如果您正苦于以下问题:Java MorphDrawable类的具体用法?Java MorphDrawable怎么用?Java MorphDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MorphDrawable类属于io.plaidapp.ui.drawable包,在下文中一共展示了MorphDrawable类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAnimator

import io.plaidapp.ui.drawable.MorphDrawable; //导入依赖的package包/类
@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, background.COLOR, endColor);
    Animator corners = ObjectAnimator.ofFloat(background, background.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(getFastOutLinearInInterpolator(vg.getContext()))
                    .start();
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(300);
    transition.setInterpolator(getFastOutSlowInInterpolator(sceneRoot.getContext()));
    return transition;
}
 
开发者ID:liulinbo,项目名称:Amumu,代码行数:48,代码来源:MorphDialogToFab.java

示例2: createAnimator

import io.plaidapp.ui.drawable.MorphDrawable; //导入依赖的package包/类
@Override
public Animator createAnimator(final ViewGroup sceneRoot,
                               final TransitionValues startValues,
                               final TransitionValues endValues) {
    final Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
    if (changeBounds == null) return null;

    TimeInterpolator interpolator = getInterpolator();
    if (interpolator == null) {
        interpolator = AnimUtils.getFastOutSlowInInterpolator(sceneRoot.getContext());
    }

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

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

    // ease in the dialog's child views (fade in & staggered slide up)
    if (endValues.view instanceof ViewGroup) {
        final ViewGroup vg = (ViewGroup) endValues.view;
        final long duration = getDuration() / 2;
        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(duration)
                    .setStartDelay(duration)
                    .setInterpolator(interpolator);
            offset *= 1.8f;
        }
    }

    final AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(getDuration());
    transition.setInterpolator(interpolator);
    return transition;
}
 
开发者ID:liulinbo,项目名称:Amumu,代码行数:45,代码来源:MorphTransform.java

示例3: createAnimator

import io.plaidapp.ui.drawable.MorphDrawable; //导入依赖的package包/类
@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(getFastOutLinearInInterpolator(vg.getContext()))
                    .start();
        }
    }

    AnimatorSet transition = new AnimatorSet();
    transition.playTogether(changeBounds, corners, color);
    transition.setDuration(300);
    transition.setInterpolator(getFastOutSlowInInterpolator(sceneRoot.getContext()));
    return transition;
}
 
开发者ID:nickbutcher,项目名称:plaid,代码行数:48,代码来源:MorphDialogToFab.java


注:本文中的io.plaidapp.ui.drawable.MorphDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。