2016-07-16 11 views
0

私はランチャーを書いています。 マシュマロアニメーションを表示するアクティビティを開始するにはどうすればよいですか?Marshmallowオープンアクティビティアニメーションを作成するにはどうすればよいですか?

私はAOSP Launcher3ソースを見て、だけでは、この使用することを発見した:

:その後、

task_open_enterアニメーションは次のようになります
startActivity(context, optsBundle); 

に供給を受ける

if (useLaunchAnimation) { 
      ActivityOptions opts = Utilities.isLmpOrAbove() ? 
        ActivityOptions.makeCustomAnimation(this, R.anim.task_open_enter, R.anim.no_anim) : 
        ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); 
      optsBundle = opts.toBundle(); 
     } 

<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:background="#ff000000" 
    android:shareInterpolator="false" 
    android:zAdjustment="top"> 
    <alpha 
     android:duration="167" 
     android:fillAfter="true" 
     android:fillBefore="true" 
     android:fillEnabled="true" 
     android:fromAlpha="0" 
     android:interpolator="@interpolator/decelerate_quart" 
     android:startOffset="0" 
     android:toAlpha="1.0" /> 
    <translate 
     android:duration="417" 
     android:fillAfter="true" 
     android:fillBefore="true" 
     android:fillEnabled="true" 
     android:fromYDelta="110%" 
     android:interpolator="@interpolator/decelerate_quint" 
     android:startOffset="0" 
     android:toYDelta="0" /> 
</set> 

残念ながら、これらは私が探しているマシュマロアニメーションと同じではありません

(GIFが遅くなる3回)

Marshmallow Open Activity Animation

答えて

3

私はランチャーのソースコードhereで答えが見つかりました::どのようなバックアニメーションを行くことについて

Bundle optsBundle = null; 
      ActivityOptions opts = null; 
      if (Utilities.ATLEAST_MARSHMALLOW) { 
       int left = 0, top = 0; 
       int width = v.getMeasuredWidth(), height = v.getMeasuredHeight(); 
//     if (v instanceof TextView) { 
//      // Launch from center of icon, not entire view 
//      Drawable icon = Workspace.getTextViewIcon((TextView) v); 
//      if (icon != null) { 
//       Rect bounds = icon.getBounds(); 
//       left = (width - bounds.width())/2; 
//       top = v.getPaddingTop(); 
//       width = bounds.width(); 
//       height = bounds.height(); 
//      } 
//     } 
       opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height); 
      } else if (!Utilities.ATLEAST_LOLLIPOP) { 
       // Below L, we use a scale up animation 
       opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); 
      } else if (Utilities.ATLEAST_LOLLIPOP_MR1) { 
       // On L devices, we use the device default slide-up transition. 
       // On L MR1 devices, we use a custom version of the slide-up transition which 
       // doesn't have the delay present in the device default. 
       opts = ActivityOptions.makeCustomAnimation(context, R.anim.task_open_enter, R.anim.no_anim); 
      } 
      optsBundle = opts != null ? opts.toBundle() : null; 

      context.startActivity(intent, optsBundle); 
+0

を以下に示すように、のために? – CBeTJlu4ok

関連する問題