am 8e11051a: Merge "Tweak anim API to automatically call Intent.setSourceBounds()." into jb-dev
* commit '8e11051a06b3362b7d7cda654f8dcb5ca3760494': Tweak anim API to automatically call Intent.setSourceBounds().
This commit is contained in:
@@ -147,12 +147,17 @@ public class ActivityOptions {
|
|||||||
* activity is scaled from a small originating area of the screen to
|
* activity is scaled from a small originating area of the screen to
|
||||||
* its final full representation.
|
* its final full representation.
|
||||||
*
|
*
|
||||||
|
* <p>If the Intent this is being used with has not set its
|
||||||
|
* {@link android.content.Intent#setSourceBounds Intent.setSourceBounds},
|
||||||
|
* those bounds will be filled in for you based on the initial
|
||||||
|
* bounds passed in here.
|
||||||
|
*
|
||||||
* @param source The View that the new activity is animating from. This
|
* @param source The View that the new activity is animating from. This
|
||||||
* defines the coordinate space for <var>startX</var> and <var>startY</var>.
|
* 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 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 startY The y starting location of the activity, relative to <var>source</var>.
|
||||||
* @param startWidth The initial width of the new activity.
|
* @param startWidth The initial width of the new activity.
|
||||||
* @param startWidth The initial height of the new activity.
|
* @param startHeight The initial height of the new activity.
|
||||||
* @return Returns a new ActivityOptions object that you can use to
|
* @return Returns a new ActivityOptions object that you can use to
|
||||||
* supply these options as the options Bundle when starting an activity.
|
* supply these options as the options Bundle when starting an activity.
|
||||||
*/
|
*/
|
||||||
@@ -175,6 +180,11 @@ public class ActivityOptions {
|
|||||||
* is scaled from a given position to the new activity window that is
|
* is scaled from a given position to the new activity window that is
|
||||||
* being started.
|
* being started.
|
||||||
*
|
*
|
||||||
|
* <p>If the Intent this is being used with has not set its
|
||||||
|
* {@link android.content.Intent#setSourceBounds Intent.setSourceBounds},
|
||||||
|
* those bounds will be filled in for you based on the initial
|
||||||
|
* thumbnail location and size provided here.
|
||||||
|
*
|
||||||
* @param source The View that this thumbnail is animating from. This
|
* @param source The View that this thumbnail is animating from. This
|
||||||
* defines the coordinate space for <var>startX</var> and <var>startY</var>.
|
* defines the coordinate space for <var>startX</var> and <var>startY</var>.
|
||||||
* @param thumbnail The bitmap that will be shown as the initial thumbnail
|
* @param thumbnail The bitmap that will be shown as the initial thumbnail
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.content.pm.ApplicationInfo;
|
|||||||
import android.content.res.CompatibilityInfo;
|
import android.content.res.CompatibilityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -562,12 +563,26 @@ final class ActivityRecord {
|
|||||||
service.mWindowManager.overridePendingAppTransitionScaleUp(
|
service.mWindowManager.overridePendingAppTransitionScaleUp(
|
||||||
pendingOptions.getStartX(), pendingOptions.getStartY(),
|
pendingOptions.getStartX(), pendingOptions.getStartY(),
|
||||||
pendingOptions.getStartWidth(), pendingOptions.getStartHeight());
|
pendingOptions.getStartWidth(), pendingOptions.getStartHeight());
|
||||||
|
if (intent.getSourceBounds() == null) {
|
||||||
|
intent.setSourceBounds(new Rect(pendingOptions.getStartX(),
|
||||||
|
pendingOptions.getStartY(),
|
||||||
|
pendingOptions.getStartX()+pendingOptions.getStartWidth(),
|
||||||
|
pendingOptions.getStartY()+pendingOptions.getStartHeight()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ActivityOptions.ANIM_THUMBNAIL:
|
case ActivityOptions.ANIM_THUMBNAIL:
|
||||||
service.mWindowManager.overridePendingAppTransitionThumb(
|
service.mWindowManager.overridePendingAppTransitionThumb(
|
||||||
pendingOptions.getThumbnail(),
|
pendingOptions.getThumbnail(),
|
||||||
pendingOptions.getStartX(), pendingOptions.getStartY(),
|
pendingOptions.getStartX(), pendingOptions.getStartY(),
|
||||||
pendingOptions.getOnAnimationStartListener());
|
pendingOptions.getOnAnimationStartListener());
|
||||||
|
if (intent.getSourceBounds() == null) {
|
||||||
|
intent.setSourceBounds(new Rect(pendingOptions.getStartX(),
|
||||||
|
pendingOptions.getStartY(),
|
||||||
|
pendingOptions.getStartX()
|
||||||
|
+ pendingOptions.getThumbnail().getWidth(),
|
||||||
|
pendingOptions.getStartY()
|
||||||
|
+ pendingOptions.getThumbnail().getHeight()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pendingOptions = null;
|
pendingOptions = null;
|
||||||
|
|||||||
@@ -63,9 +63,10 @@ class TaskRecord extends ThumbnailHolder {
|
|||||||
// If this Intent has a selector, we want to clear it for the
|
// If this Intent has a selector, we want to clear it for the
|
||||||
// recent task since it is not relevant if the user later wants
|
// recent task since it is not relevant if the user later wants
|
||||||
// to re-launch the app.
|
// to re-launch the app.
|
||||||
if (_intent.getSelector() != null) {
|
if (_intent.getSelector() != null || _intent.getSourceBounds() != null) {
|
||||||
_intent = new Intent(_intent);
|
_intent = new Intent(_intent);
|
||||||
_intent.setSelector(null);
|
_intent.setSelector(null);
|
||||||
|
_intent.setSourceBounds(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intent = _intent;
|
intent = _intent;
|
||||||
@@ -78,6 +79,7 @@ class TaskRecord extends ThumbnailHolder {
|
|||||||
Intent targetIntent = new Intent(_intent);
|
Intent targetIntent = new Intent(_intent);
|
||||||
targetIntent.setComponent(targetComponent);
|
targetIntent.setComponent(targetComponent);
|
||||||
targetIntent.setSelector(null);
|
targetIntent.setSelector(null);
|
||||||
|
targetIntent.setSourceBounds(null);
|
||||||
intent = targetIntent;
|
intent = targetIntent;
|
||||||
realActivity = targetComponent;
|
realActivity = targetComponent;
|
||||||
origActivity = _intent.getComponent();
|
origActivity = _intent.getComponent();
|
||||||
|
|||||||
Reference in New Issue
Block a user