Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f976c3d4 authored by George Mount's avatar George Mount
Browse files

Add ability to exclude Views in transition XML.

Bug 14259955

Change-Id: I47bb10c530c9fec8910ddd96156fc38d6027e1f6
parent 7592afea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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
+18 −8
Original line number Diff line number Diff line
@@ -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,16 +224,27 @@ 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 {
                throw new RuntimeException("Unknown scene name: " + parser.getName());
                    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);
                            }
                        }
        int numTargets = targetIds.size();
        if (numTargets > 0) {
            for (int i = 0; i < numTargets; ++i) {
                transition.addTarget(targetIds.get(i));
                    }
                }
            } else {
                throw new RuntimeException("Unknown scene name: " + parser.getName());
            }
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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" />