diff options
| author | 2014-04-29 20:49:26 +0000 | |
|---|---|---|
| committer | 2014-04-29 20:49:26 +0000 | |
| commit | 6eb2bc52a56d05eca03518bce1a65a7c496d27bf (patch) | |
| tree | 348b6829897e95d9f35caeeca767cf3e996b9dd8 | |
| parent | d0b12fe4a2deadd78141ada10818c531226ac9d2 (diff) | |
| parent | f976c3d42bc2f14333bae5ed26d96c45d207a443 (diff) | |
Merge "Add ability to exclude Views in transition XML."
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/transition/Transition.java | 3 | ||||
| -rw-r--r-- | core/java/android/transition/TransitionInflater.java | 26 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 4 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 2 |
5 files changed, 28 insertions, 9 deletions
diff --git a/api/current.txt b/api/current.txt index 30f1c9e6db7e..150af9a32bb7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -501,7 +501,9 @@ package android { field public static final int entries = 16842930; // 0x10100b2 field public static final int entryValues = 16843256; // 0x10101f8 field public static final int eventsInterceptionEnabled = 16843389; // 0x101027d + field public static final int excludeClass = 16843854; // 0x101044e field public static final int excludeFromRecents = 16842775; // 0x1010017 + field public static final int excludeId = 16843853; // 0x101044d field public static final int exitFadeDuration = 16843533; // 0x101030d field public static final int expandableListPreferredChildIndicatorLeft = 16842834; // 0x1010052 field public static final int expandableListPreferredChildIndicatorRight = 16842835; // 0x1010053 diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java index c67d6fa9cbd4..d8392f5812c0 100644 --- a/core/java/android/transition/Transition.java +++ b/core/java/android/transition/Transition.java @@ -89,7 +89,8 @@ import java.util.List; * transition uses a fadingMode of {@link Fade#OUT} instead of the default * out-in behavior. Finally, note the use of the <code>targets</code> sub-tag, which * takes a set of {@link android.R.styleable#TransitionTarget target} tags, each - * of which lists a specific <code>targetId</code> which this transition acts upon. + * of which lists a specific <code>targetId</code>, <code>excludeId</code>, or + * <code>excludeClass</code>, which this transition acts upon. * Use of targets is optional, but can be used to either limit the time spent checking * attributes on unchanging views, or limiting the types of animations run on specific views. * In this case, we know that only the <code>grayscaleContainer</code> will be diff --git a/core/java/android/transition/TransitionInflater.java b/core/java/android/transition/TransitionInflater.java index 14ecc1532581..1aa412a3c4d8 100644 --- a/core/java/android/transition/TransitionInflater.java +++ b/core/java/android/transition/TransitionInflater.java @@ -210,7 +210,6 @@ public class TransitionInflater { int type; int depth = parser.getDepth(); - ArrayList<Integer> targetIds = new ArrayList<Integer>(); while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) { @@ -225,18 +224,29 @@ public class TransitionInflater { int id = a.getResourceId( com.android.internal.R.styleable.TransitionTarget_targetId, -1); if (id >= 0) { - targetIds.add(id); + transition.addTarget(id); + } else { + id = a.getResourceId( + com.android.internal.R.styleable.TransitionTarget_excludeId, -1); + if (id >= 0) { + transition.excludeTarget(id, true); + } else { + String className = a.getString( + com.android.internal.R.styleable.TransitionTarget_excludeClass); + if (className != null) { + try { + Class clazz = Class.forName(className); + transition.excludeTarget(clazz, true); + } catch (ClassNotFoundException e) { + throw new RuntimeException("Could not create " + className, e); + } + } + } } } else { throw new RuntimeException("Unknown scene name: " + parser.getName()); } } - int numTargets = targetIds.size(); - if (numTargets > 0) { - for (int i = 0; i < numTargets; ++i) { - transition.addTarget(targetIds.get(i)); - } - } } private Transition loadTransition(Transition transition, AttributeSet attrs) diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index abac60e17978..e35239fa43fd 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -5025,6 +5025,10 @@ <declare-styleable name="TransitionTarget"> <!-- The id of a target on which this transition will animate changes. --> <attr name="targetId" format="reference" /> + <!-- The id of a target to exclude from this transition. --> + <attr name="excludeId" format="reference" /> + <!-- The fully-qualified name of the Class to exclude from this transition. --> + <attr name="excludeClass" format="string" /> </declare-styleable> <!-- Use <code>set</code> as the root tag of the XML resource that diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 85ef004123ae..c7f446bc8a7c 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2164,6 +2164,8 @@ <public type="attr" name="sessionService" /> <public type="attr" name="switchStyle" /> <public type="attr" name="elevation" /> + <public type="attr" name="excludeId" /> + <public type="attr" name="excludeClass" /> <public-padding type="dimen" name="l_resource_pad" end="0x01050010" /> |