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)); } } }
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(); }