public class ActivityOptions extends Object
Context.startActivity(Intent, Bundle)
and related methods.Modifier and Type | Class and Description |
---|---|
static interface |
ActivityOptions.OnAnimationStartedListener
Callback for use with
makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int)
to find out when the given animation has started running. |
Modifier and Type | Field and Description |
---|---|
static int |
ANIM_CUSTOM |
static int |
ANIM_NONE |
static int |
ANIM_SCALE_UP |
static int |
ANIM_THUMBNAIL_SCALE_DOWN |
static int |
ANIM_THUMBNAIL_SCALE_UP |
static String |
KEY_ANIM_ENTER_RES_ID
Custom enter animation resource ID.
|
static String |
KEY_ANIM_EXIT_RES_ID
Custom exit animation resource ID.
|
static String |
KEY_ANIM_START_HEIGHT
Initial height of the animation.
|
static String |
KEY_ANIM_START_LISTENER
Callback for when animation is started.
|
static String |
KEY_ANIM_START_WIDTH
Initial width of the animation.
|
static String |
KEY_ANIM_START_X
Start X position of thumbnail animation.
|
static String |
KEY_ANIM_START_Y
Start Y position of thumbnail animation.
|
static String |
KEY_ANIM_THUMBNAIL
Bitmap for thumbnail animation.
|
static String |
KEY_ANIM_TYPE
Type of animation that arguments specify.
|
static String |
KEY_PACKAGE_NAME
The package name that created the options.
|
Constructor and Description |
---|
ActivityOptions(Bundle opts) |
Modifier and Type | Method and Description |
---|---|
void |
abort() |
static void |
abort(Bundle options) |
int |
getAnimationType() |
int |
getCustomEnterResId() |
int |
getCustomExitResId() |
IRemoteCallback |
getOnAnimationStartListener() |
String |
getPackageName() |
int |
getStartHeight() |
int |
getStartWidth() |
int |
getStartX() |
int |
getStartY() |
Bitmap |
getThumbnail() |
static ActivityOptions |
makeCustomAnimation(Context context,
int enterResId,
int exitResId)
Create an ActivityOptions specifying a custom animation to run when
the activity is displayed.
|
static ActivityOptions |
makeCustomAnimation(Context context,
int enterResId,
int exitResId,
Handler handler,
ActivityOptions.OnAnimationStartedListener listener)
Create an ActivityOptions specifying a custom animation to run when
the activity is displayed.
|
static ActivityOptions |
makeScaleUpAnimation(View source,
int startX,
int startY,
int startWidth,
int startHeight)
Create an ActivityOptions specifying an animation where the new
activity is scaled from a small originating area of the screen to
its final full representation.
|
static ActivityOptions |
makeThumbnailScaleDownAnimation(View source,
Bitmap thumbnail,
int startX,
int startY,
ActivityOptions.OnAnimationStartedListener listener)
Create an ActivityOptions specifying an animation where an activity window
is scaled from a given position to a thumbnail at a specified location.
|
static ActivityOptions |
makeThumbnailScaleUpAnimation(View source,
Bitmap thumbnail,
int startX,
int startY)
Create an ActivityOptions specifying an animation where a thumbnail
is scaled from a given position to the new activity window that is
being started.
|
static ActivityOptions |
makeThumbnailScaleUpAnimation(View source,
Bitmap thumbnail,
int startX,
int startY,
ActivityOptions.OnAnimationStartedListener listener)
Create an ActivityOptions specifying an animation where a thumbnail
is scaled from a given position to the new activity window that is
being started.
|
Bundle |
toBundle()
Returns the created options as a Bundle, which can be passed to
Context.startActivity(Intent, Bundle) and related methods. |
void |
update(ActivityOptions otherOptions)
Update the current values in this ActivityOptions from those supplied
in otherOptions.
|
public static final String KEY_PACKAGE_NAME
public static final String KEY_ANIM_TYPE
public static final String KEY_ANIM_ENTER_RES_ID
public static final String KEY_ANIM_EXIT_RES_ID
public static final String KEY_ANIM_THUMBNAIL
public static final String KEY_ANIM_START_X
public static final String KEY_ANIM_START_Y
public static final String KEY_ANIM_START_WIDTH
public static final String KEY_ANIM_START_HEIGHT
public static final String KEY_ANIM_START_LISTENER
public static final int ANIM_NONE
public static final int ANIM_CUSTOM
public static final int ANIM_SCALE_UP
public static final int ANIM_THUMBNAIL_SCALE_UP
public static final int ANIM_THUMBNAIL_SCALE_DOWN
public ActivityOptions(Bundle opts)
public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId)
context
- Who is defining this. This is the application that the
animation resources will be loaded from.enterResId
- A resource ID of the animation resource to use for
the incoming activity. Use 0 for no animation.exitResId
- A resource ID of the animation resource to use for
the outgoing activity. Use 0 for no animation.public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId, Handler handler, ActivityOptions.OnAnimationStartedListener listener)
context
- Who is defining this. This is the application that the
animation resources will be loaded from.enterResId
- A resource ID of the animation resource to use for
the incoming activity. Use 0 for no animation.exitResId
- A resource ID of the animation resource to use for
the outgoing activity. Use 0 for no animation.handler
- If listener is non-null this must be a valid
Handler on which to dispatch the callback; otherwise it should be null.listener
- Optional OnAnimationStartedListener to find out when the
requested animation has started running. If for some reason the animation
is not executed, the callback will happen immediately.public static ActivityOptions makeScaleUpAnimation(View source, int startX, int startY, int startWidth, int startHeight)
If the Intent this is being used with has not set its
Intent.setSourceBounds
,
those bounds will be filled in for you based on the initial
bounds passed in here.
source
- The View that the new activity is animating from. This
defines the coordinate space for startX and startY.startX
- The x starting location of the new activity, relative to source.startY
- The y starting location of the activity, relative to source.startWidth
- The initial width of the new activity.startHeight
- The initial height of the new activity.public static ActivityOptions makeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY)
If the Intent this is being used with has not set its
Intent.setSourceBounds
,
those bounds will be filled in for you based on the initial
thumbnail location and size provided here.
source
- The View that this thumbnail is animating from. This
defines the coordinate space for startX and startY.thumbnail
- The bitmap that will be shown as the initial thumbnail
of the animation.startX
- The x starting location of the bitmap, relative to source.startY
- The y starting location of the bitmap, relative to source.public static ActivityOptions makeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY, ActivityOptions.OnAnimationStartedListener listener)
source
- The View that this thumbnail is animating from. This
defines the coordinate space for startX and startY.thumbnail
- The bitmap that will be shown as the initial thumbnail
of the animation.startX
- The x starting location of the bitmap, relative to source.startY
- The y starting location of the bitmap, relative to source.listener
- Optional OnAnimationStartedListener to find out when the
requested animation has started running. If for some reason the animation
is not executed, the callback will happen immediately.public static ActivityOptions makeThumbnailScaleDownAnimation(View source, Bitmap thumbnail, int startX, int startY, ActivityOptions.OnAnimationStartedListener listener)
source
- The View that this thumbnail is animating to. This
defines the coordinate space for startX and startY.thumbnail
- The bitmap that will be shown as the final thumbnail
of the animation.startX
- The x end location of the bitmap, relative to source.startY
- The y end location of the bitmap, relative to source.listener
- Optional OnAnimationStartedListener to find out when the
requested animation has started running. If for some reason the animation
is not executed, the callback will happen immediately.public String getPackageName()
public int getAnimationType()
public int getCustomEnterResId()
public int getCustomExitResId()
public Bitmap getThumbnail()
public int getStartX()
public int getStartY()
public int getStartWidth()
public int getStartHeight()
public IRemoteCallback getOnAnimationStartListener()
public void abort()
public static void abort(Bundle options)
public void update(ActivityOptions otherOptions)
public Bundle toBundle()
Context.startActivity(Intent, Bundle)
and related methods.
Note that the returned Bundle is still owned by the ActivityOptions
object; you must not modify it, but can supply it to the startActivity
methods that take an options Bundle.