summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt7
-rw-r--r--core/java/android/app/ActivityOptions.java179
-rw-r--r--core/java/android/transition/Scene.java11
-rw-r--r--core/java/android/view/Window.java11
-rw-r--r--core/res/res/values/attrs.xml20
-rw-r--r--core/res/res/values/public.xml4
-rw-r--r--core/res/res/values/styles.xml10
-rw-r--r--core/res/res/values/themes.xml7
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java56
9 files changed, 272 insertions, 33 deletions
diff --git a/api/current.txt b/api/current.txt
index 9f80ef6..8ec81b7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1207,6 +1207,8 @@ package android {
field public static final int windowBackground = 16842836; // 0x1010054
field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b
field public static final int windowContentOverlay = 16842841; // 0x1010059
+ field public static final int windowContentTransitionManager = 16843765; // 0x10103f5
+ field public static final int windowContentTransitions = 16843764; // 0x10103f4
field public static final int windowDisablePreview = 16843298; // 0x1010222
field public static final int windowEnableSplitTouch = 16843543; // 0x1010317
field public static final int windowEnterAnimation = 16842932; // 0x10100b4
@@ -1810,6 +1812,7 @@ package android {
field public static final int Theme_NoTitleBar_Fullscreen = 16973831; // 0x1030007
field public static final int Theme_NoTitleBar_OverlayActionModes = 16973930; // 0x103006a
field public static final int Theme_Panel = 16973913; // 0x1030059
+ field public static final int Theme_Quantum = 16974318; // 0x10301ee
field public static final int Theme_Translucent = 16973839; // 0x103000f
field public static final int Theme_Translucent_NoTitleBar = 16973840; // 0x1030010
field public static final int Theme_Translucent_NoTitleBar_Fullscreen = 16973841; // 0x1030011
@@ -26251,7 +26254,8 @@ package android.transition {
public final class Scene {
ctor public Scene(android.view.ViewGroup);
- ctor public Scene(android.view.ViewGroup, android.view.ViewGroup);
+ ctor public Scene(android.view.ViewGroup, android.view.View);
+ ctor public deprecated Scene(android.view.ViewGroup, android.view.ViewGroup);
method public void enter();
method public void exit();
method public static android.transition.Scene getSceneForLayout(android.view.ViewGroup, int, android.content.Context);
@@ -29311,6 +29315,7 @@ package android.view {
field public static final int FEATURE_ACTION_BAR = 8; // 0x8
field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9
field public static final int FEATURE_ACTION_MODE_OVERLAY = 10; // 0xa
+ field public static final int FEATURE_CONTENT_TRANSITIONS = 11; // 0xb
field public static final int FEATURE_CONTEXT_MENU = 6; // 0x6
field public static final int FEATURE_CUSTOM_TITLE = 7; // 0x7
field public static final int FEATURE_INDETERMINATE_PROGRESS = 5; // 0x5
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 87b1e24..44f6859 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -90,6 +90,35 @@ public class ActivityOptions {
*/
public static final String KEY_ANIM_START_LISTENER = "android:animStartListener";
+ /**
+ * A string array of names for the destination scene. This defines an API in the same
+ * way that intent action or extra names do and should follow a similar convention:
+ * "com.example.scene.FOO"
+ *
+ * @hide
+ */
+ public static final String KEY_DEST_SCENE_NAMES = "android:destSceneNames";
+
+ /**
+ * A string indicating the destination scene name that was chosen by the target.
+ * Used by {@link OnSceneTransitionStartedListener}.
+ * @hide
+ */
+ public static final String KEY_DEST_SCENE_NAME_CHOSEN = "android:destSceneNameChosen";
+
+ /**
+ * Callback for when scene transition is started.
+ * @hide
+ */
+ public static final String KEY_SCENE_TRANSITION_START_LISTENER =
+ "android:sceneTransitionStartListener";
+
+ /**
+ * Arguments for the scene transition about to begin.
+ * @hide
+ */
+ public static final String KEY_SCENE_TRANSITION_ARGS = "android:sceneTransitionArgs";
+
/** @hide */
public static final int ANIM_NONE = 0;
/** @hide */
@@ -100,6 +129,8 @@ public class ActivityOptions {
public static final int ANIM_THUMBNAIL_SCALE_UP = 3;
/** @hide */
public static final int ANIM_THUMBNAIL_SCALE_DOWN = 4;
+ /** @hide */
+ public static final int ANIM_SCENE_TRANSITION = 5;
private String mPackageName;
private int mAnimationType = ANIM_NONE;
@@ -110,7 +141,10 @@ public class ActivityOptions {
private int mStartY;
private int mStartWidth;
private int mStartHeight;
+ private String[] mDestSceneNames;
+ private Bundle mTransitionArgs;
private IRemoteCallback mAnimationStartedListener;
+ private IRemoteCallback mSceneTransitionStartedListener;
/**
* Create an ActivityOptions specifying a custom animation to run when
@@ -156,11 +190,12 @@ public class ActivityOptions {
opts.mAnimationType = ANIM_CUSTOM;
opts.mCustomEnterResId = enterResId;
opts.mCustomExitResId = exitResId;
- opts.setListener(handler, listener);
+ opts.setOnAnimationStartedListener(handler, listener);
return opts;
}
- private void setListener(Handler handler, OnAnimationStartedListener listener) {
+ private void setOnAnimationStartedListener(Handler handler,
+ OnAnimationStartedListener listener) {
if (listener != null) {
final Handler h = handler;
final OnAnimationStartedListener finalListener = listener;
@@ -176,6 +211,24 @@ public class ActivityOptions {
}
}
+ private void setOnSceneTransitionStartedListener(Handler handler,
+ OnSceneTransitionStartedListener listener) {
+ if (listener != null) {
+ final Handler h = handler;
+ final OnSceneTransitionStartedListener l = listener;
+ mSceneTransitionStartedListener = new IRemoteCallback.Stub() {
+ @Override public void sendResult(final Bundle data) throws RemoteException {
+ h.post(new Runnable() {
+ public void run() {
+ l.onSceneTransitionStarted(data != null ?
+ data.getString(KEY_DEST_SCENE_NAME_CHOSEN) : null);
+ }
+ });
+ }
+ };
+ }
+ }
+
/**
* Callback for use with {@link ActivityOptions#makeThumbnailScaleUpAnimation}
* to find out when the given animation has started running.
@@ -186,6 +239,15 @@ public class ActivityOptions {
}
/**
+ * Callback for use with {@link ActivityOptions#makeSceneTransitionAnimation}
+ * to find out when a transition is about to begin.
+ * @hide
+ */
+ public interface OnSceneTransitionStartedListener {
+ void onSceneTransitionStarted(String destSceneName);
+ }
+
+ /**
* 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.
@@ -298,7 +360,23 @@ public class ActivityOptions {
source.getLocationOnScreen(pts);
opts.mStartX = pts[0] + startX;
opts.mStartY = pts[1] + startY;
- opts.setListener(source.getHandler(), listener);
+ opts.setOnAnimationStartedListener(source.getHandler(), listener);
+ return opts;
+ }
+
+ /**
+ * Create an ActivityOptions specifying an animation where an activity window is asked
+ * to perform animations within the window content.
+ *
+ * @hide
+ */
+ public static ActivityOptions makeSceneTransitionAnimation(String[] destSceneNames,
+ Bundle args, OnSceneTransitionStartedListener listener, Handler handler) {
+ ActivityOptions opts = new ActivityOptions();
+ opts.mAnimationType = ANIM_SCENE_TRANSITION;
+ opts.mDestSceneNames = destSceneNames;
+ opts.mTransitionArgs = args;
+ opts.setOnSceneTransitionStartedListener(handler, listener);
return opts;
}
@@ -309,23 +387,36 @@ public class ActivityOptions {
public ActivityOptions(Bundle opts) {
mPackageName = opts.getString(KEY_PACKAGE_NAME);
mAnimationType = opts.getInt(KEY_ANIM_TYPE);
- if (mAnimationType == ANIM_CUSTOM) {
- mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0);
- mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0);
- mAnimationStartedListener = IRemoteCallback.Stub.asInterface(
- opts.getIBinder(KEY_ANIM_START_LISTENER));
- } else if (mAnimationType == ANIM_SCALE_UP) {
- mStartX = opts.getInt(KEY_ANIM_START_X, 0);
- mStartY = opts.getInt(KEY_ANIM_START_Y, 0);
- mStartWidth = opts.getInt(KEY_ANIM_START_WIDTH, 0);
- mStartHeight = opts.getInt(KEY_ANIM_START_HEIGHT, 0);
- } else if (mAnimationType == ANIM_THUMBNAIL_SCALE_UP ||
- mAnimationType == ANIM_THUMBNAIL_SCALE_DOWN) {
- mThumbnail = (Bitmap)opts.getParcelable(KEY_ANIM_THUMBNAIL);
- mStartX = opts.getInt(KEY_ANIM_START_X, 0);
- mStartY = opts.getInt(KEY_ANIM_START_Y, 0);
- mAnimationStartedListener = IRemoteCallback.Stub.asInterface(
- opts.getIBinder(KEY_ANIM_START_LISTENER));
+ switch (mAnimationType) {
+ case ANIM_CUSTOM:
+ mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0);
+ mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0);
+ mAnimationStartedListener = IRemoteCallback.Stub.asInterface(
+ opts.getBinder(KEY_ANIM_START_LISTENER));
+ break;
+
+ case ANIM_SCALE_UP:
+ mStartX = opts.getInt(KEY_ANIM_START_X, 0);
+ mStartY = opts.getInt(KEY_ANIM_START_Y, 0);
+ mStartWidth = opts.getInt(KEY_ANIM_START_WIDTH, 0);
+ mStartHeight = opts.getInt(KEY_ANIM_START_HEIGHT, 0);
+ break;
+
+ case ANIM_THUMBNAIL_SCALE_UP:
+ case ANIM_THUMBNAIL_SCALE_DOWN:
+ mThumbnail = (Bitmap)opts.getParcelable(KEY_ANIM_THUMBNAIL);
+ mStartX = opts.getInt(KEY_ANIM_START_X, 0);
+ mStartY = opts.getInt(KEY_ANIM_START_Y, 0);
+ mAnimationStartedListener = IRemoteCallback.Stub.asInterface(
+ opts.getBinder(KEY_ANIM_START_LISTENER));
+ break;
+
+ case ANIM_SCENE_TRANSITION:
+ mDestSceneNames = opts.getStringArray(KEY_DEST_SCENE_NAMES);
+ mTransitionArgs = opts.getBundle(KEY_SCENE_TRANSITION_ARGS);
+ mSceneTransitionStartedListener = IRemoteCallback.Stub.asInterface(
+ opts.getBinder(KEY_SCENE_TRANSITION_START_LISTENER));
+ break;
}
}
@@ -375,11 +466,26 @@ public class ActivityOptions {
}
/** @hide */
+ public String[] getDestSceneNames() {
+ return mDestSceneNames;
+ }
+
+ /** @hide */
+ public Bundle getSceneTransitionArgs() {
+ return mTransitionArgs;
+ }
+
+ /** @hide */
public IRemoteCallback getOnAnimationStartListener() {
return mAnimationStartedListener;
}
/** @hide */
+ public IRemoteCallback getOnSceneTransitionStartedListener() {
+ return mSceneTransitionStartedListener;
+ }
+
+ /** @hide */
public void abort() {
if (mAnimationStartedListener != null) {
try {
@@ -411,13 +517,16 @@ public class ActivityOptions {
mCustomEnterResId = otherOptions.mCustomEnterResId;
mCustomExitResId = otherOptions.mCustomExitResId;
mThumbnail = null;
- if (otherOptions.mAnimationStartedListener != null) {
+ if (mAnimationStartedListener != null) {
try {
- otherOptions.mAnimationStartedListener.sendResult(null);
+ mAnimationStartedListener.sendResult(null);
} catch (RemoteException e) {
}
}
mAnimationStartedListener = otherOptions.mAnimationStartedListener;
+ mSceneTransitionStartedListener = null;
+ mTransitionArgs = null;
+ mDestSceneNames = null;
break;
case ANIM_SCALE_UP:
mAnimationType = otherOptions.mAnimationType;
@@ -425,13 +534,16 @@ public class ActivityOptions {
mStartY = otherOptions.mStartY;
mStartWidth = otherOptions.mStartWidth;
mStartHeight = otherOptions.mStartHeight;
- if (otherOptions.mAnimationStartedListener != null) {
+ if (mAnimationStartedListener != null) {
try {
- otherOptions.mAnimationStartedListener.sendResult(null);
+ mAnimationStartedListener.sendResult(null);
} catch (RemoteException e) {
}
}
mAnimationStartedListener = null;
+ mSceneTransitionStartedListener = null;
+ mTransitionArgs = null;
+ mDestSceneNames = null;
break;
case ANIM_THUMBNAIL_SCALE_UP:
case ANIM_THUMBNAIL_SCALE_DOWN:
@@ -439,13 +551,28 @@ public class ActivityOptions {
mThumbnail = otherOptions.mThumbnail;
mStartX = otherOptions.mStartX;
mStartY = otherOptions.mStartY;
- if (otherOptions.mAnimationStartedListener != null) {
+ if (mAnimationStartedListener != null) {
try {
- otherOptions.mAnimationStartedListener.sendResult(null);
+ mAnimationStartedListener.sendResult(null);
} catch (RemoteException e) {
}
}
mAnimationStartedListener = otherOptions.mAnimationStartedListener;
+ mSceneTransitionStartedListener = null;
+ mTransitionArgs = null;
+ mDestSceneNames = null;
+ break;
+ case ANIM_SCENE_TRANSITION:
+ mAnimationType = otherOptions.mAnimationType;
+ if (mSceneTransitionStartedListener != null) {
+ try {
+ mSceneTransitionStartedListener.sendResult(null);
+ } catch (RemoteException e) {
+ }
+ }
+ mSceneTransitionStartedListener = otherOptions.mSceneTransitionStartedListener;
+ mDestSceneNames = otherOptions.mDestSceneNames;
+ mAnimationStartedListener = null;
break;
}
}
diff --git a/core/java/android/transition/Scene.java b/core/java/android/transition/Scene.java
index e1f1896..401f4c4 100644
--- a/core/java/android/transition/Scene.java
+++ b/core/java/android/transition/Scene.java
@@ -34,7 +34,7 @@ public final class Scene {
private Context mContext;
private int mLayoutId = -1;
private ViewGroup mSceneRoot;
- private ViewGroup mLayout; // alternative to layoutId
+ private View mLayout; // alternative to layoutId
Runnable mEnterAction, mExitAction;
/**
@@ -114,6 +114,15 @@ public final class Scene {
* @param layout The view hierarchy of this scene, added as a child
* of sceneRoot when this scene is entered.
*/
+ public Scene(ViewGroup sceneRoot, View layout) {
+ mSceneRoot = sceneRoot;
+ mLayout = layout;
+ }
+
+ /**
+ * @deprecated use {@link Scene(ViewGroup, View)}.
+ */
+ @Deprecated
public Scene(ViewGroup sceneRoot, ViewGroup layout) {
mSceneRoot = sceneRoot;
mLayout = layout;
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index a940f73..bddfc63 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -91,12 +91,21 @@ public abstract class Window {
* If overlay is enabled, the action mode UI will be allowed to cover existing window content.
*/
public static final int FEATURE_ACTION_MODE_OVERLAY = 10;
+ /**
+ * Flag for requesting that window content changes should be represented
+ * with scenes and transitions.
+ *
+ * TODO Add docs
+ *
+ * @see #setContentView
+ */
+ public static final int FEATURE_CONTENT_TRANSITIONS = 11;
/**
* Max value used as a feature ID
* @hide
*/
- public static final int FEATURE_MAX = FEATURE_ACTION_MODE_OVERLAY;
+ public static final int FEATURE_MAX = FEATURE_CONTENT_TRANSITIONS;
/** Flag for setting the progress bar's visibility to VISIBLE */
public static final int PROGRESS_VISIBILITY_ON = -1;
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 7254403..28f5796 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -447,6 +447,15 @@
to {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION}. -->
<attr name="windowTranslucentNavigation" format="boolean" />
+ <!-- Flag indicating whether this window requests that content changes be performed
+ as scene changes with transitions. Corresponds to
+ {@link android.view.Window#FEATURE_CONTENT_TRANSITIONS}. -->
+ <attr name="windowContentTransitions" format="boolean" />
+
+ <!-- Reference to a TransitionManager XML resource defining the desired
+ transitions between different window content. -->
+ <attr name="windowContentTransitionManager" format="reference" />
+
<!-- ============ -->
<!-- Alert Dialog styles -->
<!-- ============ -->
@@ -1618,6 +1627,9 @@
<attr name="windowCloseOnTouchOutside" />
<attr name="windowTranslucentStatus" />
<attr name="windowTranslucentNavigation" />
+ <attr name="windowContentTransitions" />
+ <attr name="windowContentTransitionManager" />
+
<!-- The minimum width the window is allowed to be, along the major
axis of the screen. That is, when in landscape. Can be either
an absolute dimension or a fraction of the screen size in that
@@ -4675,6 +4687,14 @@
<attr name="fromScene" format="reference" />
<!-- The destination scene in this scene change. -->
<attr name="toScene" format="reference" />
+ <!-- The name of the originating scene in this scene change.
+ Apps should treat this name as an API in the same sense
+ that an Intent action or extra key is. -->
+ <attr name="fromSceneName" format="string" />
+ <!-- The name of the destination scene in this scene change.
+ Apps should treat this name as an API in the same sense
+ that an Intent action or extra key is. -->
+ <attr name="toSceneName" format="string" />
</declare-styleable>
<!-- ========================== -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index dcaf6b3..090702d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2094,6 +2094,8 @@
<public type="attr" name="fragmentBreadCrumbsStyle" />
<public type="attr" name="fastScrollStyle" />
+ <public type="attr" name="windowContentTransitions" />
+ <public type="attr" name="windowContentTransitionManager" />
<public type="style" name="Widget.Holo.FragmentBreadCrumbs" />
<public type="style" name="Widget.Holo.Light.FragmentBreadCrumbs" />
@@ -2105,4 +2107,6 @@
<public type="style" name="Widget.DeviceDefault.FastScroll" />
<public type="style" name="Widget.DeviceDefault.Light.FastScroll" />
+ <public type="style" name="Theme.Quantum" />
+
</resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index b1a86f8c..3af5d6d 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -2408,6 +2408,16 @@ please see styles_device_defaults.xml.
<style name="Animation.Holo.Dialog" parent="Animation.Dialog">
</style>
+ <style name="Animation.Quantum" parent="Animation.Holo">
+ </style>
+
+ <style name="Animation.Quantum.Activity" parent="Animation.Holo.Activity">
+ <item name="activityOpenEnterAnimation">@null</item>
+ <item name="activityOpenExitAnimation">@null</item>
+ <item name="activityCloseEnterAnimation">@null</item>
+ <item name="activityCloseExitAnimation">@anim/fade_out</item>
+ </style>
+
<!-- Dialog styles -->
<style name="AlertDialog.Holo" parent="AlertDialog">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index b79f916..cb706ec 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -1925,4 +1925,11 @@ please see themes_device_defaults.xml.
<style name="Theme.Holo.Wallpaper.NoTitleBar">
<item name="android:windowNoTitle">true</item>
</style>
+
+ <!-- Default Quantum Paper theme. -->
+ <style name="Theme.Quantum" parent="@android:style/Theme.Holo.Light">
+ <item name="android:windowContentTransitions">true</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Quantum.Activity</item>
+ </style>
+
</resources>
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 44fc1f8..5e62fbf 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -22,6 +22,10 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static android.view.WindowManager.LayoutParams.*;
+import android.transition.Scene;
+import android.transition.Transition;
+import android.transition.TransitionInflater;
+import android.transition.TransitionManager;
import android.view.ViewConfiguration;
import com.android.internal.R;
@@ -146,6 +150,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private ActionMenuPresenterCallback mActionMenuPresenterCallback;
private PanelMenuPresenterCallback mPanelMenuPresenterCallback;
+ private TransitionManager mTransitionManager;
+
// The icon resource has been explicitly set elsewhere
// and should not be overwritten with a default.
static final int FLAG_RESOURCE_SET_ICON = 1 << 0;
@@ -282,12 +288,22 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override
public void setContentView(int layoutResID) {
+ // Note: FEATURE_CONTENT_TRANSITIONS may be set in the process of installing the window
+ // decor, when theme attributes and the like are crystalized. Do not check the feature
+ // before this happens.
if (mContentParent == null) {
installDecor();
- } else {
+ } else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
mContentParent.removeAllViews();
}
- mLayoutInflater.inflate(layoutResID, mContentParent);
+
+ if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
+ final Scene newScene = Scene.getSceneForLayout(mContentParent, layoutResID,
+ getContext());
+ mTransitionManager.transitionTo(newScene);
+ } else {
+ mLayoutInflater.inflate(layoutResID, mContentParent);
+ }
final Callback cb = getCallback();
if (cb != null && !isDestroyed()) {
cb.onContentChanged();
@@ -301,12 +317,22 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
+ // Note: FEATURE_CONTENT_TRANSITIONS may be set in the process of installing the window
+ // decor, when theme attributes and the like are crystalized. Do not check the feature
+ // before this happens.
if (mContentParent == null) {
installDecor();
- } else {
+ } else if (!hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
mContentParent.removeAllViews();
}
- mContentParent.addView(view, params);
+
+ if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
+ view.setLayoutParams(params);
+ final Scene newScene = new Scene(mContentParent, view);
+ mTransitionManager.transitionTo(newScene);
+ } else {
+ mContentParent.addView(view, params);
+ }
final Callback cb = getCallback();
if (cb != null && !isDestroyed()) {
cb.onContentChanged();
@@ -318,6 +344,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if (mContentParent == null) {
installDecor();
}
+ if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) {
+ // TODO Augment the scenes/transitions API to support this.
+ throw new UnsupportedOperationException(
+ "addContentView does not support content transitions");
+ }
mContentParent.addView(view, params);
final Callback cb = getCallback();
if (cb != null && !isDestroyed()) {
@@ -2890,6 +2921,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
a.getValue(com.android.internal.R.styleable.Window_windowFixedHeightMinor,
mFixedHeightMinor);
}
+ if (a.getBoolean(com.android.internal.R.styleable.Window_windowContentTransitions, false)) {
+ requestFeature(FEATURE_CONTENT_TRANSITIONS);
+ }
final Context context = getContext();
final int targetSdk = context.getApplicationInfo().targetSdkVersion;
@@ -3179,6 +3213,20 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
});
}
}
+
+ // Only inflate or create a new TransitionManager if the caller hasn't
+ // already set a custom one.
+ if (hasFeature(FEATURE_CONTENT_TRANSITIONS) && mTransitionManager == null) {
+ final int transitionRes = getWindowStyle().getResourceId(
+ com.android.internal.R.styleable.Window_windowContentTransitionManager, 0);
+ if (transitionRes != 0) {
+ final TransitionInflater inflater = TransitionInflater.from(getContext());
+ mTransitionManager = inflater.inflateTransitionManager(transitionRes,
+ mContentParent);
+ } else {
+ mTransitionManager = new TransitionManager();
+ }
+ }
}
}