|
16 | 16 |
|
17 | 17 | package android.widget; |
18 | 18 |
|
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; |
26 | 20 | import android.app.PendingIntent; |
27 | 21 | import android.appwidget.AppWidgetHostView; |
28 | 22 | import android.content.Context; |
|
40 | 34 | import android.text.TextUtils; |
41 | 35 | import android.util.Log; |
42 | 36 | import android.view.LayoutInflater; |
| 37 | +import android.view.LayoutInflater.Filter; |
43 | 38 | import android.view.RemotableViewMethod; |
44 | 39 | import android.view.View; |
45 | | -import android.view.ViewGroup; |
46 | | -import android.view.LayoutInflater.Filter; |
47 | 40 | import android.view.View.OnClickListener; |
| 41 | +import android.view.ViewGroup; |
48 | 42 | import android.widget.AdapterView.OnItemClickListener; |
49 | 43 |
|
| 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 | + |
50 | 51 |
|
51 | 52 | /** |
52 | 53 | * A class that describes a view hierarchy that can be displayed in |
@@ -140,14 +141,18 @@ public void updateMemoryUsageEstimate(MemoryUsageCounter counter) { |
140 | 141 | return; |
141 | 142 | } |
142 | 143 |
|
143 | | - protected boolean startIntentSafely(Context context, PendingIntent pendingIntent, |
| 144 | + protected boolean startIntentSafely(View view, PendingIntent pendingIntent, |
144 | 145 | Intent fillInIntent) { |
145 | 146 | try { |
146 | 147 | // 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()); |
147 | 152 | context.startIntentSender( |
148 | 153 | pendingIntent.getIntentSender(), fillInIntent, |
149 | 154 | Intent.FLAG_ACTIVITY_NEW_TASK, |
150 | | - Intent.FLAG_ACTIVITY_NEW_TASK, 0); |
| 155 | + Intent.FLAG_ACTIVITY_NEW_TASK, 0, opts.toBundle()); |
151 | 156 | } catch (IntentSender.SendIntentException e) { |
152 | 157 | android.util.Log.e(LOG_TAG, "Cannot send pending intent: ", e); |
153 | 158 | return false; |
@@ -263,7 +268,7 @@ public void onClick(View v) { |
263 | 268 | rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f); |
264 | 269 |
|
265 | 270 | fillInIntent.setSourceBounds(rect); |
266 | | - startIntentSafely(v.getContext(), pendingIntent, fillInIntent); |
| 271 | + startIntentSafely(v, pendingIntent, fillInIntent); |
267 | 272 | } |
268 | 273 |
|
269 | 274 | }; |
@@ -341,7 +346,7 @@ public void onItemClick(AdapterView<?> parent, View view, |
341 | 346 |
|
342 | 347 | final Intent intent = new Intent(); |
343 | 348 | intent.setSourceBounds(rect); |
344 | | - startIntentSafely(view.getContext(), pendingIntentTemplate, fillInIntent); |
| 349 | + startIntentSafely(view, pendingIntentTemplate, fillInIntent); |
345 | 350 | } |
346 | 351 | } |
347 | 352 | }; |
@@ -479,7 +484,7 @@ public void onClick(View v) { |
479 | 484 |
|
480 | 485 | final Intent intent = new Intent(); |
481 | 486 | intent.setSourceBounds(rect); |
482 | | - startIntentSafely(v.getContext(), pendingIntent, intent); |
| 487 | + startIntentSafely(v, pendingIntent, intent); |
483 | 488 | } |
484 | 489 | }; |
485 | 490 | } |
|
0 commit comments