diff options
author | Chet Haase <chet@google.com> | 2015-02-11 15:08:38 -0800 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2015-02-13 11:00:55 -0800 |
commit | 10e23ab61b820fb3149b2f89003753d98ebd6a80 (patch) | |
tree | 3559c25e9ecb3a11c69efe6275d90f9b179d2191 /core/java/android/app/ActivityOptions.java | |
parent | ae0fdaf5e864ab755e54243006e7116fbb375a7b (diff) | |
download | frameworks_base-10e23ab61b820fb3149b2f89003753d98ebd6a80.zip frameworks_base-10e23ab61b820fb3149b2f89003753d98ebd6a80.tar.gz frameworks_base-10e23ab61b820fb3149b2f89003753d98ebd6a80.tar.bz2 |
Add ClipReveal window transition for application launch
Issue #19362772 Better material launch animations
Change-Id: Ic94fde910b6b5554ee954dfbbf374949f9eb189d
Diffstat (limited to 'core/java/android/app/ActivityOptions.java')
-rw-r--r-- | core/java/android/app/ActivityOptions.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 39ae65c..8909b28 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -140,6 +140,8 @@ public class ActivityOptions { public static final int ANIM_THUMBNAIL_ASPECT_SCALE_DOWN = 9; /** @hide */ public static final int ANIM_CUSTOM_IN_PLACE = 10; + /** @hide */ + public static final int ANIM_CLIP_REVEAL = 11; private String mPackageName; private int mAnimationType = ANIM_NONE; @@ -291,6 +293,33 @@ public class ActivityOptions { } /** + * Create an ActivityOptions specifying an animation where the new + * activity is revealed from a small originating area of the screen to + * its final full representation. + * + * @param source The View that the new activity is animating from. This + * defines the coordinate space for <var>startX</var> and <var>startY</var>. + * @param startX The x starting location of the new activity, relative to <var>source</var>. + * @param startY The y starting location of the activity, relative to <var>source</var>. + * @param width The initial width of the new activity. + * @param height The initial height of the new activity. + * @return Returns a new ActivityOptions object that you can use to + * supply these options as the options Bundle when starting an activity. + */ + public static ActivityOptions makeClipRevealAnimation(View source, + int startX, int startY, int width, int height) { + ActivityOptions opts = new ActivityOptions(); + opts.mAnimationType = ANIM_CLIP_REVEAL; + int[] pts = new int[2]; + source.getLocationOnScreen(pts); + opts.mStartX = pts[0] + startX; + opts.mStartY = pts[1] + startY; + opts.mWidth = width; + opts.mHeight = height; + return opts; + } + + /** * Create an ActivityOptions specifying an animation where a thumbnail * is scaled from a given position to the new activity window that is * being started. @@ -582,6 +611,7 @@ public class ActivityOptions { break; case ANIM_SCALE_UP: + case ANIM_CLIP_REVEAL: mStartX = opts.getInt(KEY_ANIM_START_X, 0); mStartY = opts.getInt(KEY_ANIM_START_Y, 0); mWidth = opts.getInt(KEY_ANIM_WIDTH, 0); @@ -809,6 +839,7 @@ public class ActivityOptions { b.putInt(KEY_ANIM_IN_PLACE_RES_ID, mCustomInPlaceResId); break; case ANIM_SCALE_UP: + case ANIM_CLIP_REVEAL: b.putInt(KEY_ANIM_START_X, mStartX); b.putInt(KEY_ANIM_START_Y, mStartY); b.putInt(KEY_ANIM_WIDTH, mWidth); |