Loading core/java/android/transition/Transition.java +5 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,11 @@ import java.util.List; * * {@sample development/samples/ApiDemos/res/transition/explode_move_together.xml MultipleTransform} * * <p>Custom transition classes may be instantiated with a <code>transition</code> tag:</p> * <pre><transition class="my.app.transition.CustomTransition"/></pre> * <p>Custom transition classes loaded from XML must have a public nullary (no argument) * constructor.</p> * * <p>Note that attributes for the transition are not required, just as they are * optional when declared in code; Transitions created from XML resources will use * the same defaults as their code-created equivalents. Here is a slightly more Loading core/java/android/transition/TransitionInflater.java +25 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,8 @@ public class TransitionInflater { createTransitionFromXml(parser, attrs, ((TransitionSet) transition)); a.recycle(); newTransition = true; } else if ("transition".equals(name)) { transition = createCustomTransition(attrs); } else if ("targets".equals(name)) { if (parser.getDepth() - 1 > depth && transition != null) { // We're inside the child tag - add targets to the child Loading @@ -205,6 +207,29 @@ public class TransitionInflater { return transition; } private Transition createCustomTransition(AttributeSet attrs) { String className = attrs.getAttributeValue(null, "class"); if (className == null) { throw new RuntimeException("transition tag must have a 'class' attribute"); } try { Class c = Class.forName(className); if (!Transition.class.isAssignableFrom(c)) { throw new RuntimeException("transition class must be a Transition: " + className); } return (Transition) c.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("Could not instantiate transition class", e); } catch (IllegalAccessException e) { throw new RuntimeException("Could not access default constructor for transition class " + className, e); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not find transition class " + className, e); } } private Slide createSlideTransition(AttributeSet attrs) { TypedArray a = mContext.obtainStyledAttributes(attrs, com.android.internal.R.styleable.Slide); Loading Loading
core/java/android/transition/Transition.java +5 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,11 @@ import java.util.List; * * {@sample development/samples/ApiDemos/res/transition/explode_move_together.xml MultipleTransform} * * <p>Custom transition classes may be instantiated with a <code>transition</code> tag:</p> * <pre><transition class="my.app.transition.CustomTransition"/></pre> * <p>Custom transition classes loaded from XML must have a public nullary (no argument) * constructor.</p> * * <p>Note that attributes for the transition are not required, just as they are * optional when declared in code; Transitions created from XML resources will use * the same defaults as their code-created equivalents. Here is a slightly more Loading
core/java/android/transition/TransitionInflater.java +25 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,8 @@ public class TransitionInflater { createTransitionFromXml(parser, attrs, ((TransitionSet) transition)); a.recycle(); newTransition = true; } else if ("transition".equals(name)) { transition = createCustomTransition(attrs); } else if ("targets".equals(name)) { if (parser.getDepth() - 1 > depth && transition != null) { // We're inside the child tag - add targets to the child Loading @@ -205,6 +207,29 @@ public class TransitionInflater { return transition; } private Transition createCustomTransition(AttributeSet attrs) { String className = attrs.getAttributeValue(null, "class"); if (className == null) { throw new RuntimeException("transition tag must have a 'class' attribute"); } try { Class c = Class.forName(className); if (!Transition.class.isAssignableFrom(c)) { throw new RuntimeException("transition class must be a Transition: " + className); } return (Transition) c.newInstance(); } catch (InstantiationException e) { throw new RuntimeException("Could not instantiate transition class", e); } catch (IllegalAccessException e) { throw new RuntimeException("Could not access default constructor for transition class " + className, e); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not find transition class " + className, e); } } private Slide createSlideTransition(AttributeSet attrs) { TypedArray a = mContext.obtainStyledAttributes(attrs, com.android.internal.R.styleable.Slide); Loading