protected override void UpdateAttributes(XmlDocument document)
 {
     UpdateOptionalAttribute(document, "icon", !icon.Equals(""), icon);
     UpdateOptionalAttribute(document, "label", !label.Equals(""), label);
     UpdateOptionalAttribute(document, "priority", priority != 0, priority + "");
     for (int i = 0; i < actionList.Count; i++)
     {
         ManifestAction action = actionList[i];
         if (action.ElementEditStatus == EditStatus.REMOVED)
         {
             actionList.RemoveAt(i);
         }
         action.ApplyChanges(document);
     }
     for (int i = 0; i < categoryList.Count; i++)
     {
         ManifestCategory category = categoryList[i];
         if (category.ElementEditStatus == EditStatus.REMOVED)
         {
             categoryList.RemoveAt(i);
         }
         category.ApplyChanges(document);
     }
     for (int i = 0; i < dataList.Count; i++)
     {
         ManifestData data = dataList[i];
         if (data.ElementEditStatus == EditStatus.REMOVED)
         {
             dataList.RemoveAt(i);
         }
         data.ApplyChanges(document);
     }
 }
 private void Initialize()
 {
     if (node.HasAttribute("android:icon"))
     {
         icon = node.Attributes["android:icon"].Value;
     }
     if (node.HasAttribute("android:label"))
     {
         label = node.Attributes["android:label"].Value;
     }
     if (node.HasAttribute("android:priority"))
     {
         priority = Convert.ToInt32(node.Attributes["android:name"].Value);
     }
     foreach (XmlNode child in node.ChildNodes)
     {
         if (child.Name.Equals("action"))
         {
             actionList.Add(ManifestAction.CreateInstance(node, child));
         }
         else if (child.Name.Equals("category"))
         {
             categoryList.Add(ManifestCategory.CreateInstance(node, child));
         }
         else if (child.Name.Equals("data"))
         {
             dataList.Add(ManifestData.CreateInstance(node, child));
         }
     }
 }
Ejemplo n.º 3
0
        //Constructed by editor window
        public static ManifestData CreateInstance()
        {
            ManifestData data = ScriptableObject.CreateInstance <ManifestData> ();

            data.node = null;
            data.elementEditStatus = EditStatus.NONE;
            return(data);
        }
Ejemplo n.º 4
0
        //Constructed from existing entry in AndroidManifest or constructed as child of an Activity
        public static ManifestData CreateInstance(XmlNode parent, XmlNode node = null)
        {
            ManifestData data = ScriptableObject.CreateInstance <ManifestData> ();

            data.parent            = (XmlElement)parent;
            data.node              = (XmlElement)node;
            data.elementEditStatus = EditStatus.NONE;
            if (node != null)
            {
                data.Initialize();
            }
            return(data);
        }
 public override void OnGUI()
 {
     display = EditorGUILayout.Foldout(display, "Intent-Filter: " + name);
     if (!display)
     {
         return;
     }
     EditorGUI.BeginChangeCheck();
     BBGuiHelper.BeginIndent();
     {
         icon     = EditorGUILayout.TextField("Icon: ", icon);
         label    = EditorGUILayout.TextField("Label: ", label);
         priority = EditorGUILayout.IntField("Priority: ", priority);
         for (int i = 0; i < actionList.Count; i++)
         {
             Undo.RecordObject(actionList[i], "Action");
             if (actionList[i].ElementEditStatus != EditStatus.REMOVED)
             {
                 actionList[i].OnGUI();
             }
         }
         for (int i = 0; i < categoryList.Count; i++)
         {
             Undo.RecordObject(categoryList[i], "Category");
             if (categoryList[i].ElementEditStatus != EditStatus.REMOVED)
             {
                 categoryList[i].OnGUI();
             }
         }
         if (EditorGUI.EndChangeCheck())
         {
             elementEditStatus = EditStatus.EDITED;
         }
         for (int i = 0; i < dataList.Count; i++)
         {
             Undo.RecordObject(dataList[i], "Data");
             if (dataList[i].ElementEditStatus != EditStatus.REMOVED)
             {
                 dataList[i].OnGUI();
             }
             if (dataList[i].ElementEditStatus != EditStatus.NONE)
             {
                 elementEditStatus = EditStatus.EDITED;
             }
         }
         EditorGUI.BeginChangeCheck();
         GUILayout.BeginHorizontal();
         {
             if (GUILayout.Button("New Action: "))
             {
                 actionList.Add(ManifestAction.CreateInstance(node));
             }
             if (GUILayout.Button("New Category: "))
             {
                 categoryList.Add(ManifestCategory.CreateInstance(node));
             }
             if (GUILayout.Button("New Data: "))
             {
                 dataList.Add(ManifestData.CreateInstance(node));
             }
         }
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         {
             if (EditorGUI.EndChangeCheck())
             {
                 elementEditStatus = EditStatus.EDITED;
             }
             if (GUILayout.Button("Remove Intent-Filter"))
             {
                 elementEditStatus = EditStatus.REMOVED;
             }
         }
         GUILayout.EndHorizontal();
     }
     BBGuiHelper.EndIndent();
 }