private HashSet preParse()

in ConstraintLayoutExamples/CycleEditor/src/com/google/androidstudio/motionlayoutcycles/CycleSetModel.java [251:314]


  private HashSet<CycleView.Prop> preParse(String str) {
    HashSet<CycleView.Prop> props = new HashSet<>();
    try {
      InputStream inputStream = new ByteArrayInputStream(str.getBytes(Charset.forName("UTF-8")));
      SAXParserFactory factory = SAXParserFactory.newInstance();
      SAXParser saxParser = factory.newSAXParser();
      saxParser.parse(inputStream, new DefaultHandler() {
        public void startElement(String uri, String localName,
            String qName, Attributes attributes)
            throws SAXException {
          if ("KeyCycle".equals(qName)) {

            for (int i = 0; i < attributes.getLength(); i++) {
              String str = attributes.getQName(i);
              CycleView.Prop valueType;

              switch (str) {
                case "motion:transitionPathRotate":
                  props.add(CycleView.Prop.PATH_ROTATE);
                  break;
                case "android:alpha":
                  props.add(CycleView.Prop.ALPHA);
                  break;
                case "android:elevation":
                  props.add(CycleView.Prop.ELEVATION);
                  break;
                case "android:rotation":
                  props.add(CycleView.Prop.ROTATION);
                  break;
                case "android:rotationX":
                  props.add(CycleView.Prop.ROTATION_X);
                  break;
                case "android:rotationY":
                  props.add(CycleView.Prop.ROTATION_Y);
                  break;
                case "android:scaleX":
                  props.add(CycleView.Prop.SCALE_X);
                  break;
                case "android:scaleY":
                  props.add(CycleView.Prop.SCALE_Y);
                  break;
                case "android:translationX":
                  props.add(CycleView.Prop.TRANSLATION_X);
                  break;
                case "android:translationY":
                  props.add(CycleView.Prop.TRANSLATION_Y);
                  break;
                case "android:translationZ":
                  props.add(CycleView.Prop.TRANSLATION_Z);
                  break;
                case "motion:progress":
                  props.add(CycleView.Prop.PROGRESS);
                  break;
              }
            }
          }
        }
      });

    } catch (Exception e) {
      e.printStackTrace();
    }
    return props;
  }