File tree Expand file tree Collapse file tree 1 file changed +22
-11
lines changed
constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget Expand file tree Collapse file tree 1 file changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -91,19 +91,30 @@ public KeyFrames(Context context, XmlPullParser parser) {
9191 tagName = parser .getName ();
9292
9393 if (sKeyMakers .containsKey (tagName )) {
94- try {
95- Constructor <? extends Key > keyMaker = sKeyMakers .get (tagName );
96- if (keyMaker != null ) {
97- key = keyMaker .newInstance ();
98- key .load (context , Xml .asAttributeSet (parser ));
99- addKey (key );
100- } else {
94+
95+ switch (tagName ) {
96+ case KeyAttributes .NAME :
97+ key = new KeyAttributes ();
98+ break ;
99+ case KeyPosition .NAME :
100+ key = new KeyPosition ();
101+ break ;
102+ case KeyCycle .NAME :
103+ key = new KeyCycle ();
104+ break ;
105+ case KeyTimeCycle .NAME :
106+ key = new KeyTimeCycle ();
107+ break ;
108+ case KeyTrigger .NAME :
109+ key = new KeyTrigger ();
110+ break ;
111+ default :
101112 throw new NullPointerException (
102- "Keymaker for " + tagName + " not found" );
103- }
104- } catch (Exception e ) {
105- Log .e (TAG , "unable to create " , e );
113+ "Key " + tagName + " not found" );
106114 }
115+ key .load (context , Xml .asAttributeSet (parser ));
116+ addKey (key );
117+
107118 } else if (tagName .equalsIgnoreCase (CUSTOM_ATTRIBUTE )) {
108119 if (key != null && key .mCustomConstraints != null ) {
109120 ConstraintAttribute .parse (context , parser , key .mCustomConstraints );
You can’t perform that action at this time.
0 commit comments