Skip to content

Commit dc6f79b

Browse files
author
Winson Chung
committed
Updating activity/task transition animations.
Change-Id: I0d4295d269222310a5a6594fb379b9592dd9ced0
1 parent 69c1a57 commit dc6f79b

17 files changed

+98
-133
lines changed

core/java/android/widget/RemoteViews.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
package android.widget;
1818

19-
import java.lang.annotation.ElementType;
20-
import java.lang.annotation.Retention;
21-
import java.lang.annotation.RetentionPolicy;
22-
import java.lang.annotation.Target;
23-
import java.lang.reflect.Method;
24-
import java.util.ArrayList;
25-
19+
import android.app.ActivityOptions;
2620
import android.app.PendingIntent;
2721
import android.appwidget.AppWidgetHostView;
2822
import android.content.Context;
@@ -40,13 +34,20 @@
4034
import android.text.TextUtils;
4135
import android.util.Log;
4236
import android.view.LayoutInflater;
37+
import android.view.LayoutInflater.Filter;
4338
import android.view.RemotableViewMethod;
4439
import android.view.View;
45-
import android.view.ViewGroup;
46-
import android.view.LayoutInflater.Filter;
4740
import android.view.View.OnClickListener;
41+
import android.view.ViewGroup;
4842
import android.widget.AdapterView.OnItemClickListener;
4943

44+
import java.lang.annotation.ElementType;
45+
import java.lang.annotation.Retention;
46+
import java.lang.annotation.RetentionPolicy;
47+
import java.lang.annotation.Target;
48+
import java.lang.reflect.Method;
49+
import java.util.ArrayList;
50+
5051

5152
/**
5253
* A class that describes a view hierarchy that can be displayed in
@@ -140,14 +141,18 @@ public void updateMemoryUsageEstimate(MemoryUsageCounter counter) {
140141
return;
141142
}
142143

143-
protected boolean startIntentSafely(Context context, PendingIntent pendingIntent,
144+
protected boolean startIntentSafely(View view, PendingIntent pendingIntent,
144145
Intent fillInIntent) {
145146
try {
146147
// TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
148+
Context context = view.getContext();
149+
ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(view,
150+
0, 0,
151+
view.getMeasuredWidth(), view.getMeasuredHeight());
147152
context.startIntentSender(
148153
pendingIntent.getIntentSender(), fillInIntent,
149154
Intent.FLAG_ACTIVITY_NEW_TASK,
150-
Intent.FLAG_ACTIVITY_NEW_TASK, 0);
155+
Intent.FLAG_ACTIVITY_NEW_TASK, 0, opts.toBundle());
151156
} catch (IntentSender.SendIntentException e) {
152157
android.util.Log.e(LOG_TAG, "Cannot send pending intent: ", e);
153158
return false;
@@ -263,7 +268,7 @@ public void onClick(View v) {
263268
rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f);
264269

265270
fillInIntent.setSourceBounds(rect);
266-
startIntentSafely(v.getContext(), pendingIntent, fillInIntent);
271+
startIntentSafely(v, pendingIntent, fillInIntent);
267272
}
268273

269274
};
@@ -341,7 +346,7 @@ public void onItemClick(AdapterView<?> parent, View view,
341346

342347
final Intent intent = new Intent();
343348
intent.setSourceBounds(rect);
344-
startIntentSafely(view.getContext(), pendingIntentTemplate, fillInIntent);
349+
startIntentSafely(view, pendingIntentTemplate, fillInIntent);
345350
}
346351
}
347352
};
@@ -479,7 +484,7 @@ public void onClick(View v) {
479484

480485
final Intent intent = new Intent();
481486
intent.setSourceBounds(rect);
482-
startIntentSafely(v.getContext(), pendingIntent, intent);
487+
startIntentSafely(v, pendingIntent, intent);
483488
}
484489
};
485490
}

core/res/res/anim/activity_close_enter.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,5 @@
2020
<set xmlns:android="http://schemas.android.com/apk/res/android" android:zAdjustment="normal">
2121
<alpha android:fromAlpha="1.0" android:toAlpha="1.0"
2222
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
23-
android:duration="@android:integer/config_shortAnimTime"/>
24-
<scale android:fromXScale=".95" android:toXScale="1.0"
25-
android:fromYScale=".95" android:toYScale="1.0"
26-
android:pivotX="50%p" android:pivotY="50%p"
27-
android:interpolator="@interpolator/accelerate_quint"
28-
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
29-
android:duration="@android:integer/config_shortAnimTime"/>
30-
23+
android:duration="300"/>
3124
</set>

core/res/res/anim/activity_close_exit.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
2323
android:interpolator="@interpolator/decelerate_cubic"
2424
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
25-
android:duration="@android:integer/config_shortAnimTime"/>
26-
<scale android:fromXScale="1.0" android:toXScale="1.1"
27-
android:fromYScale="1.0" android:toYScale="1.1"
25+
android:duration="300"/>
26+
<scale android:fromXScale="1.0" android:toXScale=".8"
27+
android:fromYScale="1.0" android:toYScale=".8"
2828
android:pivotX="50%p" android:pivotY="50%p"
29-
android:interpolator="@interpolator/decelerate_quint"
29+
android:interpolator="@interpolator/decelerate_cubic"
3030
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
31-
android:duration="@android:integer/config_shortAnimTime"/>
31+
android:duration="300"/>
3232
</set>

core/res/res/anim/activity_open_enter.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
android:interpolator="@interpolator/decelerate_cubic"
2525
android:fillEnabled="true"
2626
android:fillBefore="false" android:fillAfter="false"
27-
android:duration="@android:integer/config_shortAnimTime"/>
28-
<scale android:fromXScale="1.1" android:toXScale="1.0"
29-
android:fromYScale="1.1" android:toYScale="1.0"
27+
android:duration="300"/>
28+
<scale android:fromXScale=".8" android:toXScale="1.0"
29+
android:fromYScale=".8" android:toYScale="1.0"
3030
android:pivotX="50%p" android:pivotY="50%p"
31-
android:interpolator="@interpolator/decelerate_quint"
31+
android:interpolator="@interpolator/decelerate_cubic"
3232
android:fillEnabled="true"
3333
android:fillBefore="false" android:fillAfter="false"
34-
android:duration="@android:integer/config_shortAnimTime"/>
34+
android:duration="300"/>
3535
</set>

core/res/res/anim/activity_open_exit.xml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,8 @@
1818
-->
1919

2020
<set xmlns:android="http://schemas.android.com/apk/res/android" android:zAdjustment="normal">
21-
<alpha android:fromAlpha="1.0" android:toAlpha="1.0"
21+
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
2222
android:fillEnabled="true" android:fillBefore="false" android:fillAfter="false"
23-
android:duration="@android:integer/config_shortAnimTime"/>
24-
<scale android:fromXScale="1.0" android:toXScale=".95"
25-
android:fromYScale="1.0" android:toYScale=".95"
26-
android:pivotX="50%p" android:pivotY="50%p"
2723
android:interpolator="@interpolator/decelerate_quint"
28-
android:fillEnabled="true"
29-
android:fillBefore="false" android:fillAfter="false"
30-
android:duration="@android:integer/config_shortAnimTime"/>
31-
24+
android:duration="300"/>
3225
</set>

core/res/res/anim/lock_screen_behind_enter.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@
1919

2020
<set xmlns:android="http://schemas.android.com/apk/res/android"
2121
android:background="#ff000000" android:shareInterpolator="false">
22-
<scale
23-
android:fromXScale="0.90" android:toXScale="1.0"
24-
android:fromYScale="0.90" android:toYScale="1.0"
25-
android:pivotX="50%p" android:pivotY="50%p"
26-
android:fillEnabled="true" android:fillBefore="true"
27-
android:interpolator="@interpolator/decelerate_cubic"
28-
android:startOffset="@android:integer/config_shortAnimTime"
29-
android:duration="@android:integer/config_shortAnimTime" />
3022
<alpha
3123
android:fromAlpha="0.0" android:toAlpha="1.0"
3224
android:fillEnabled="true" android:fillBefore="true"

core/res/res/anim/lock_screen_exit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
android:zAdjustment="top"
2323
android:shareInterpolator="false">
2424
<scale
25-
android:fromXScale="1.0" android:toXScale="1.15"
26-
android:fromYScale="1.0" android:toYScale="1.15"
25+
android:fromXScale="1.0" android:toXScale="1.10"
26+
android:fromYScale="1.0" android:toYScale="1.10"
2727
android:pivotX="50%p" android:pivotY="50%p"
2828
android:fillEnabled="true" android:fillAfter="true"
2929
android:interpolator="@interpolator/accelerate_quint"

core/res/res/anim/lock_screen_wallpaper_behind_enter.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@
1919

2020
<set xmlns:android="http://schemas.android.com/apk/res/android"
2121
android:detachWallpaper="true" android:shareInterpolator="false">
22-
<scale
23-
android:fromXScale="0.95" android:toXScale="1.0"
24-
android:fromYScale="0.95" android:toYScale="1.0"
25-
android:pivotX="50%p" android:pivotY="50%p"
26-
android:fillEnabled="true" android:fillBefore="true"
27-
android:interpolator="@interpolator/decelerate_cubic"
28-
android:startOffset="@android:integer/config_shortAnimTime"
29-
android:duration="@android:integer/config_shortAnimTime" />
3022
<alpha
3123
android:fromAlpha="0.0" android:toAlpha="1.0"
3224
android:fillEnabled="true" android:fillBefore="true"

core/res/res/anim/task_close_enter.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,21 @@
1919

2020
<set xmlns:android="http://schemas.android.com/apk/res/android"
2121
android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="normal">
22-
<scale android:fromXScale="0.95" android:toXScale="1.0"
23-
android:fromYScale="0.95" android:toYScale="1.0"
22+
<alpha android:fromAlpha="0" android:toAlpha="1"
23+
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
24+
android:interpolator="@interpolator/decelerate_cubic"
25+
android:startOffset="600"
26+
android:duration="200"/>
27+
<scale android:fromXScale="0.6" android:toXScale="1.0"
28+
android:fromYScale="0.6" android:toYScale="1.0"
2429
android:pivotX="50%p" android:pivotY="50%p"
2530
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
26-
android:interpolator="@interpolator/decelerate_quint"
27-
android:startOffset="200"
28-
android:duration="300" />
29-
<alpha android:fromAlpha="0" android:toAlpha="1.0"
31+
android:interpolator="@interpolator/decelerate_cubic"
32+
android:startOffset="350"
33+
android:duration="400" />
34+
<translate android:fromYDelta="-100%" android:toYDelta="0"
3035
android:interpolator="@interpolator/decelerate_cubic"
3136
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
32-
android:startOffset="200"
33-
android:duration="300"/>
37+
android:startOffset="350"
38+
android:duration="400"/>
3439
</set>

core/res/res/anim/task_close_exit.xml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919

2020
<set xmlns:android="http://schemas.android.com/apk/res/android"
2121
android:background="#ff000000" android:shareInterpolator="false" android:zAdjustment="top">
22-
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
23-
android:interpolator="@interpolator/accelerate_cubic"
24-
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
25-
android:duration="200" />
26-
<scale android:fromXScale="1.0" android:toXScale="1.2"
27-
android:fromYScale="1.0" android:toYScale="0.8"
28-
android:pivotX="50%p" android:pivotY="50%p"
29-
android:interpolator="@interpolator/accelerate_quint"
30-
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
31-
android:duration="200" />
32-
<!-- This is needed to keep the animation running while task_close_enter completes -->
33-
<alpha android:fromAlpha="1.0" android:toAlpha="1.0"
34-
android:duration="500" />
22+
<scale android:fromXScale="1.0" android:toXScale=".8"
23+
android:fromYScale="1.0" android:toYScale=".8"
24+
android:pivotX="50%p" android:pivotY="50%p"
25+
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
26+
android:interpolator="@interpolator/decelerate_cubic"
27+
android:duration="300" />
28+
<alpha android:fromAlpha="1.0" android:toAlpha="0"
29+
android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true"
30+
android:interpolator="@interpolator/decelerate_cubic"
31+
android:duration="300"/>
32+
33+
<!-- This is needed to keep the animation running while task_close_enter completes -->
34+
<alpha android:fromAlpha="1.0" android:toAlpha="1.0"
35+
android:duration="600" />
3536
</set>

0 commit comments

Comments
 (0)