summaryrefslogtreecommitdiffstats
path: root/core/java/android/transition/Scene.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/transition/Scene.java')
-rw-r--r--core/java/android/transition/Scene.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/transition/Scene.java b/core/java/android/transition/Scene.java
index f81eeef..d798abe 100644
--- a/core/java/android/transition/Scene.java
+++ b/core/java/android/transition/Scene.java
@@ -157,11 +157,11 @@ public final class Scene {
public void enter() {
// Apply layout change, if any
- if (mLayoutId >= 0 || mLayout != null) {
+ if (mLayoutId > 0 || mLayout != null) {
// empty out parent container before adding to it
getSceneRoot().removeAllViews();
- if (mLayoutId >= 0) {
+ if (mLayoutId > 0) {
LayoutInflater.from(mContext).inflate(mLayoutId, mSceneRoot);
} else {
mSceneRoot.addView(mLayout);
@@ -242,4 +242,19 @@ public final class Scene {
mExitAction = action;
}
+
+ /**
+ * Returns whether this Scene was created by a layout resource file, determined
+ * by the layoutId passed into
+ * {@link #getSceneForLayout(android.view.ViewGroup, int, android.content.Context)}.
+ * This is called by TransitionManager to determine whether it is safe for views from
+ * this scene to be removed from their parents when the scene is exited, which is
+ * used by {@link Fade} to fade these views out (the views must be removed from
+ * their parent in order to add them to the overlay for fading purposes). If a
+ * Scene is not based on a resource file, then the impact of removing views
+ * arbitrarily is unknown and should be avoided.
+ */
+ boolean isCreatedFromLayoutResource() {
+ return (mLayoutId > 0);
+ }
} \ No newline at end of file