コード例 #1
0
 protected override void UpdateAttributes(XmlDocument document)
 {
     for (int i = 0; i < intentFilterList.Count; i++)
     {
         ManifestIntentFilter intentFIlter = intentFilterList[i];
         if (intentFIlter.ElementEditStatus == EditStatus.REMOVED)
         {
             intentFilterList.RemoveAt(i);
             i--;
         }
         intentFIlter.ApplyChanges(document);
     }
     for (int i = 0; i < metaDataList.Count; i++)
     {
         ManifestMetaData metaData = metaDataList[i];
         if (metaData.ElementEditStatus == EditStatus.REMOVED)
         {
             metaDataList.RemoveAt(i);
             i--;
         }
         metaData.ApplyChanges(document);
     }
     CreateAndroidAttribute(document, "name", name);
     UpdateOptionalAttribute(document, "enabled", !enabled, "false");
     UpdateOptionalAttribute(document, "exported", !exported, "false");
     UpdateOptionalAttribute(document, "icon", !icon.Equals(""), icon);
     UpdateOptionalAttribute(document, "label", !label.Equals(""), label);
     UpdateOptionalAttribute(document, "permission", !permission.Equals(""), permission);
     UpdateOptionalAttribute(document, "process", !process.Equals(""), process);
 }
コード例 #2
0
        //Constructed by editor window
        public static ManifestMetaData CreateInstance()
        {
            ManifestMetaData metaData = ScriptableObject.CreateInstance <ManifestMetaData> ();

            metaData.node = null;
            metaData.elementEditStatus = EditStatus.EDITED;
            return(metaData);
        }
コード例 #3
0
        private void Initialize()
        {
            foreach (XmlNode element in node.ChildNodes)
            {
                if (element.Name.Equals("meta-data"))
                {
                    metaDataList.Add(ManifestMetaData.CreateInstance(node, element));
                }
                else if (element.Name.Equals("grant-uri-permission"))
                {
                    grantUriPermissionList.Add(ManifestGrantUriPermission.CreateInstance(node, element));
                }
                else if (element.Name.Equals("path-permission"))
                {
                    pathPermissionList.Add(ManifestPathPermission.CreateInstance(node, element));
                }
            }
            if (node.HasAttribute("android:name"))
            {
                name = node.Attributes["android:name"].Value;
            }

            InitializeAuthorities();
            enabled             = InitializeBoolAttribute("android:enabled", true);
            exported            = InitializeBoolAttribute("android:exported", true);
            grantUriPermissions = InitializeBoolAttribute("android:grantUriPermissions", false);
            if (node.HasAttribute("android:icon"))
            {
                icon = node.Attributes["android:icon"].Value;
            }
            if (node.HasAttribute("android:initOrder"))
            {
                initOrder = System.Convert.ToInt32(node.Attributes["android:icon"].Value);
            }
            if (node.HasAttribute("android:label"))
            {
                label = node.Attributes["android:label"].Value;
            }
            multiProcess = InitializeBoolAttribute("android:multiprocess", false);
            if (node.HasAttribute("android:permission"))
            {
                permission = node.Attributes["android:permission"].Value;
            }
            if (node.HasAttribute("android:process"))
            {
                process = node.Attributes["android:process"].Value;
            }
            if (node.HasAttribute("android:readPermission"))
            {
                readPermission = node.Attributes["android:readPermission"].Value;
            }
            syncable = InitializeBoolAttribute("android:syncable", false);
            if (node.HasAttribute("android:writePermission"))
            {
                writePermission = node.Attributes["android:writePermission"].Value;
            }
        }
コード例 #4
0
        //Constructed from existing entry in AndroidManifest or constructed as child of an Activity
        public static ManifestMetaData CreateInstance(XmlNode parent, XmlNode node = null)
        {
            ManifestMetaData metaData = ScriptableObject.CreateInstance <ManifestMetaData> ();

            metaData.parent            = (XmlElement)parent;
            metaData.node              = (XmlElement)node;
            metaData.elementEditStatus = EditStatus.NONE;
            if (node != null)
            {
                metaData.Initialize();
            }
            return(metaData);
        }
コード例 #5
0
 protected override void UpdateAttributes(XmlDocument document)
 {
     if (node.OwnerDocument != document)
     {
         CopyNode(document);
     }
     for (int i = 0; i < intentFilterList.Count; i++)
     {
         ManifestIntentFilter intentFIlter = intentFilterList[i];
         if (intentFIlter.ElementEditStatus == EditStatus.REMOVED)
         {
             intentFilterList.RemoveAt(i);
             i--;
         }
         intentFIlter.ApplyChanges(document);
     }
     for (int i = 0; i < metaDataList.Count; i++)
     {
         ManifestMetaData metaData = metaDataList[i];
         if (metaData.ElementEditStatus == EditStatus.REMOVED)
         {
             metaDataList.RemoveAt(i);
             i--;
         }
         metaData.ApplyChanges(document);
     }
     CreateAndroidAttribute(document, "name", name);
     UpdateOptionalAttribute(document, "allowTaskReparenting", allowTaskReparenting, "true");
     UpdateOptionalAttribute(document, "alwaysRetainTaskState", alwaysRetainTaskState, "true");
     UpdateOptionalAttribute(document, "clearTaskOnLaunch", clearTaskOnLaunch, "true");
     UpdateOptionalAttribute(document, "configChanges", configChanges != 0, ConfigChangesToString());
     UpdateOptionalAttribute(document, "enabled", !enabled, "false");
     UpdateOptionalAttribute(document, "excludeFromRecents", excludeFromRecents, "true");
     UpdateOptionalAttribute(document, "exported", !exported, "false");
     UpdateOptionalAttribute(document, "finishOnTaskLaunch", finishOnTaskLaunch, "true");
     UpdateOptionalAttribute(document, "hardwareAccelerated", hardwareAccelerated, "true");
     UpdateOptionalAttribute(document, "icon", !icon.Equals(""), icon);
     UpdateOptionalAttribute(document, "label", !label.Equals(""), label);
     UpdateOptionalAttribute(document, "launchMode", launchMode != launchModeArray[0], launchMode);
     UpdateOptionalAttribute(document, "multiprocess", multiprocess, "true");
     UpdateOptionalAttribute(document, "noHistory", noHistory, "true");
     UpdateOptionalAttribute(document, "permission", !permission.Equals(""), permission);
     UpdateOptionalAttribute(document, "process", !process.Equals(""), process);
     UpdateOptionalAttribute(document, "screenOrientation", screenOrientation != screenOrientationArray [0], screenOrientation);
     UpdateOptionalAttribute(document, "stateNotNeeded", stateNotNeeded, "true");
     UpdateOptionalAttribute(document, "taskAffinity", !taskAffinity.Equals(""), taskAffinity);
     UpdateOptionalAttribute(document, "theme", !theme.Equals(""), theme);
     UpdateOptionalAttribute(document, "uiOptions", !uiOptions.Equals(uiOptionsArray[0]), uiOptions);
     UpdateOptionalAttribute(document, "windowSoftInputMode", windowSoftInputMode != 0, WindowSoftInputModeToString());
 }
コード例 #6
0
 protected override void UpdateAttributes(XmlDocument document)
 {
     for (int i = 0; i < metaDataList.Count; i++)
     {
         ManifestMetaData metaData = metaDataList[i];
         if (metaData.ElementEditStatus == EditStatus.REMOVED)
         {
             metaDataList.RemoveAt(i);
             i--;
         }
         metaData.ApplyChanges(document);
     }
     for (int i = 0; i < grantUriPermissionList.Count; i++)
     {
         ManifestGrantUriPermission uriPermission = grantUriPermissionList[i];
         if (uriPermission.ElementEditStatus == EditStatus.REMOVED)
         {
             grantUriPermissionList.RemoveAt(i);
             i--;
         }
         uriPermission.ApplyChanges(document);
     }
     for (int i = 0; i < pathPermissionList.Count; i++)
     {
         ManifestPathPermission pathPermission = pathPermissionList[i];
         if (pathPermission.ElementEditStatus == EditStatus.REMOVED)
         {
             pathPermissionList.RemoveAt(i);
             i--;
         }
         pathPermission.ApplyChanges(document);
     }
     CreateAndroidAttribute(document, "name", name);
     CreateAndroidAttribute(document, "authorities", AuthoritiesToString());
     UpdateOptionalAttribute(document, "enabled", !enabled, "false");
     UpdateOptionalAttribute(document, "exported", !exported, "false");
     UpdateOptionalAttribute(document, "grantUriPermissions", grantUriPermissions, "true");
     UpdateOptionalAttribute(document, "icon", !icon.Equals(""), icon);
     UpdateOptionalAttribute(document, "initOrder", initOrder != 0, "" + initOrder);
     UpdateOptionalAttribute(document, "label", !label.Equals(""), label);
     UpdateOptionalAttribute(document, "multiprocess", multiProcess, "true");
     UpdateOptionalAttribute(document, "permission", !permission.Equals(""), permission);
     UpdateOptionalAttribute(document, "process", !process.Equals(""), process);
     UpdateOptionalAttribute(document, "readPermission", !readPermission.Equals(""), readPermission);
     UpdateOptionalAttribute(document, "syncable", syncable, "true");
     UpdateOptionalAttribute(document, "writePermission", !writePermission.Equals(""), writePermission);
 }
コード例 #7
0
 private void BuildIManifestElement(XmlNode node)
 {
     if (node.Name.Equals("uses-permission"))
     {
         usesPermissionList.Add(ManifestUsesPermission.CreateInstance(node));
     }
     else if (node.Name.Equals("uses-feature") && ((XmlElement)node).HasAttribute("android:name"))
     {
         usesFeatureList.Add(ManifestUsesFeature.CreateInstance(node));
     }
     else if (node.Name.Equals("permission"))
     {
         permissionList.Add(ManifestPermission.CreateInstance(node));
     }
     else if (node.Name.Equals("activity"))
     {
         activityList.Add(ManifestActivity.CreateInstance(node));
     }
     else if (node.Name.Equals("receiver"))
     {
         receiverList.Add(ManifestReceiver.CreateInstance(node));
     }
     else if (node.Name.Equals("service"))
     {
         serviceList.Add(ManifestService.CreateInstance(node));
     }
     else if (node.Name.Equals("provider"))
     {
         providerList.Add(ManifestProvider.CreateInstance(node));
     }
     else if (node.Name.Equals("meta-data") && node.ParentNode.Name.Equals("application"))
     {
         metaDataList.Add(ManifestMetaData.CreateInstance(node.ParentNode, node));
     }
     else if (node.Name.Equals("uses-library"))
     {
         usesLibraryList.Add(ManifestUsesLibrary.CreateInstance(node));
     }
     else if (node.Name.Equals("application"))
     {
         application = ManifestApplication.CreateInstance(node);
     }
 }
コード例 #8
0
        private void Initialize()
        {
            foreach (XmlNode element in node.ChildNodes)
            {
                if (element.Name.Equals("meta-data"))
                {
                    metaDataList.Add(ManifestMetaData.CreateInstance(node, element));
                }
                if (element.Name.Equals("intent-filter"))
                {
                    intentFilterList.Add(ManifestIntentFilter.CreateInstance(node, element));
                }
            }

            if (node.HasAttribute("android:name"))
            {
                name = node.Attributes["android:name"].Value;
            }

            enabled  = InitializeBoolAttribute("android:enabled", true);
            exported = InitializeBoolAttribute("android:exported", true);
            if (node.HasAttribute("android:icon"))
            {
                icon = node.Attributes["android:icon"].Value;
            }
            isolatedProcess = InitializeBoolAttribute("android:isolatedProcess", false);
            if (node.HasAttribute("android:label"))
            {
                label = node.Attributes["android:label"].Value;
            }
            if (node.HasAttribute("android:permission"))
            {
                permission = node.Attributes["android:permission"].Value;
            }
            if (node.HasAttribute("android:process"))
            {
                process = node.Attributes["android:process"].Value;
            }
        }
コード例 #9
0
        public override void OnGUI()
        {
            bool changed = false;

            display = EditorGUILayout.Foldout(display, "Provider: " + (!display ? name : ""));
            EditorGUI.BeginChangeCheck();
            if (display)
            {
                name     = EditorGUILayout.TextField("Name: ", name);
                changed |= EditorGUI.EndChangeCheck();
                BBGuiHelper.BeginIndent();
                {
                    #region attributes
                    displayAttributes = EditorGUILayout.Foldout(displayAttributes, "Attributes: ");
                    if (displayAttributes)
                    {
                        EditorGUI.BeginChangeCheck();
                        BBGuiHelper.BeginIndent();
                        {
                            for (int i = 0; i < authorities.Count; i++)
                            {
                                EditorGUILayout.BeginHorizontal();
                                {
                                    authorities[i] = EditorGUILayout.TextField(authorities[i]);
                                    if (GUILayout.Button("Remove"))
                                    {
                                        authorities.RemoveAt(i--);
                                    }
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            enabled             = EditorGUILayout.Toggle("Enabled: ", enabled);
                            exported            = EditorGUILayout.Toggle("Exported: ", exported);
                            grantUriPermissions = EditorGUILayout.Toggle("Grant URI Permissions: ", grantUriPermissions);
                            icon            = EditorGUILayout.TextField("Icon: ", icon);
                            initOrder       = EditorGUILayout.IntField("Init Order: ", initOrder);
                            label           = EditorGUILayout.TextField("Label: ", label);
                            multiProcess    = EditorGUILayout.Toggle("Multiprocess: ", multiProcess);
                            permission      = EditorGUILayout.TextField("Permission: ", permission);
                            process         = EditorGUILayout.TextField("Process: ", process);
                            readPermission  = EditorGUILayout.TextField("Read Permission: ", readPermission);
                            syncable        = EditorGUILayout.Toggle("Syncable: ", syncable);
                            writePermission = EditorGUILayout.TextField("Write Permission: ", writePermission);
                        }
                        BBGuiHelper.EndIndent();
                        changed |= EditorGUI.EndChangeCheck();
                    }
                    #endregion
                    #region metadata
                    displayMetaData = EditorGUILayout.Foldout(displayMetaData, "Meta-Data: (" + metaDataList.Count + ")");
                    if (displayMetaData)
                    {
                        for (int i = 0; i < metaDataList.Count; i++)
                        {
                            Undo.RecordObject(metaDataList[i], "Meta-Data");
                            if (metaDataList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                metaDataList[i].OnGUI();
                            }
                            if (metaDataList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                        BBGuiHelper.EndIndent();
                        GUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            if (GUILayout.Button("New Meta-Data", BBGuiHelper.ButtonWidth()))
                            {
                                metaDataList.Add(ManifestMetaData.CreateInstance(node));
                                changed = true;
                            }
                        }
                        GUILayout.EndHorizontal();
                        BBGuiHelper.BeginIndent();
                    }
                    #endregion
                    #region granturipermission
                    displayGrantUriPermissions = EditorGUILayout.Foldout(displayGrantUriPermissions, "Grant-Uri-Permissions: (" + grantUriPermissionList.Count + ")");
                    if (displayGrantUriPermissions)
                    {
                        for (int i = 0; i < grantUriPermissionList.Count; i++)
                        {
                            Undo.RecordObject(grantUriPermissionList[i], "Grant-Uri-Permissions");
                            if (grantUriPermissionList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                grantUriPermissionList[i].OnGUI();
                            }
                            if (grantUriPermissionList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                        BBGuiHelper.EndIndent();
                        GUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            if (GUILayout.Button("New Grant-Uri-Permission", BBGuiHelper.ButtonWidth()))
                            {
                                grantUriPermissionList.Add(ManifestGrantUriPermission.CreateInstance(node));
                                changed = true;
                            }
                        }
                        GUILayout.EndHorizontal();
                        BBGuiHelper.BeginIndent();
                    }
                    #endregion
                    #region pathpermission
                    displayPathPermissions = EditorGUILayout.Foldout(displayPathPermissions, "Path-Permissions: (" + pathPermissionList.Count + ")");
                    if (displayPathPermissions)
                    {
                        for (int i = 0; i < pathPermissionList.Count; i++)
                        {
                            Undo.RecordObject(pathPermissionList[i], "Path-Permissions");
                            if (pathPermissionList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                pathPermissionList[i].OnGUI();
                            }
                            if (pathPermissionList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                        BBGuiHelper.EndIndent();
                        GUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            if (GUILayout.Button("New Path-Permission", BBGuiHelper.ButtonWidth()))
                            {
                                pathPermissionList.Add(ManifestPathPermission.CreateInstance(node));
                                changed = true;
                            }
                        }
                        GUILayout.EndHorizontal();
                        BBGuiHelper.BeginIndent();
                    }
                    #endregion
                }
                BBGuiHelper.EndIndent();
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.Space();
                    if (changed)
                    {
                        elementEditStatus = EditStatus.EDITED;
                    }
                    if (GUILayout.Button("Remove Provider", BBGuiHelper.ButtonWidth()))
                    {
                        elementEditStatus = EditStatus.REMOVED;
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
コード例 #10
0
        public override void OnGUI()
        {
            bool changed = false;

            display = EditorGUILayout.Foldout(display, "Receiver: " + (!display ? name : ""));
            if (display)
            {
                EditorGUI.BeginChangeCheck();
                name     = EditorGUILayout.TextField("Name: ", name);
                changed |= EditorGUI.EndChangeCheck();
                BBGuiHelper.BeginIndent();
                {
                    #region attributes
                    displayAttributes = EditorGUILayout.Foldout(displayAttributes, "Attributes: ");
                    if (displayAttributes)
                    {
                        EditorGUI.BeginChangeCheck();
                        BBGuiHelper.BeginIndent();
                        {
                            enabled    = EditorGUILayout.Toggle("Enabled: ", enabled);
                            exported   = EditorGUILayout.Toggle("Exported: ", exported);
                            icon       = EditorGUILayout.TextField("Icon: ", icon);
                            label      = EditorGUILayout.TextField("Label: ", label);
                            permission = EditorGUILayout.TextField("Permission: ", permission);
                            process    = EditorGUILayout.TextField("Process: ", process);
                        }
                        BBGuiHelper.EndIndent();
                        changed |= EditorGUI.EndChangeCheck();
                    }
                    #endregion
                    #region intentfilter
                    displayIntentFilter = EditorGUILayout.Foldout(displayIntentFilter, "Intent-Filters: (" + intentFilterList.Count + ")");
                    if (displayIntentFilter)
                    {
                        for (int i = 0; i < intentFilterList.Count; i++)
                        {
                            Undo.RecordObject(intentFilterList[i], "Intent-Filter");
                            if (intentFilterList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                intentFilterList[i].OnGUI();
                            }
                            if (intentFilterList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                        BBGuiHelper.EndIndent();
                        GUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            if (GUILayout.Button("New Intent-Filter", BBGuiHelper.ButtonWidth()))
                            {
                                intentFilterList.Add(ManifestIntentFilter.CreateInstance(node));
                                changed = true;
                            }
                        }
                        GUILayout.EndHorizontal();
                        BBGuiHelper.BeginIndent();
                    }
                    #endregion
                    #region metadata
                    displayMetaData = EditorGUILayout.Foldout(displayMetaData, "Meta-Data: (" + intentFilterList.Count + ")");
                    if (displayMetaData)
                    {
                        for (int i = 0; i < metaDataList.Count; i++)
                        {
                            Undo.RecordObject(metaDataList[i], "Meta-Data");
                            if (metaDataList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                metaDataList[i].OnGUI();
                            }
                            if (metaDataList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                        BBGuiHelper.EndIndent();
                        GUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            if (GUILayout.Button("New Meta-Data", BBGuiHelper.ButtonWidth()))
                            {
                                metaDataList.Add(ManifestMetaData.CreateInstance(node));
                                changed = true;
                            }
                        }
                        GUILayout.EndHorizontal();
                        BBGuiHelper.BeginIndent();
                    }
                    #endregion
                }
                BBGuiHelper.EndIndent();
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.Space();
                    if (changed)
                    {
                        elementEditStatus = EditStatus.EDITED;
                    }
                    if (GUILayout.Button("Remove Receiver", BBGuiHelper.ButtonWidth()))
                    {
                        elementEditStatus = EditStatus.REMOVED;
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
コード例 #11
0
        private void Initialize()
        {
            foreach (XmlNode element in node.ChildNodes)
            {
                if (element.Name.Equals("meta-data"))
                {
                    metaDataList.Add(ManifestMetaData.CreateInstance(node, element));
                }
                if (element.Name.Equals("intent-filter"))
                {
                    intentFilterList.Add(ManifestIntentFilter.CreateInstance(node, element));
                }
            }

            if (node.HasAttribute("android:name"))
            {
                name = node.Attributes["android:name"].Value;
            }
            allowTaskReparenting  = InitializeBoolAttribute("android:allowTaskReparenting", false);
            alwaysRetainTaskState = InitializeBoolAttribute("android:alwaysRetainTaskState", false);
            clearTaskOnLaunch     = InitializeBoolAttribute("android:clearTaskOnLaunch", false);
            InitializeConfigChanges();
            enabled             = InitializeBoolAttribute("android:enabled", true);
            excludeFromRecents  = InitializeBoolAttribute("android:excludeFromRecents", false);
            exported            = InitializeBoolAttribute("android:exported", true);
            finishOnTaskLaunch  = InitializeBoolAttribute("android:finishOnTaskLaunch", false);
            hardwareAccelerated = InitializeBoolAttribute("android:hardwareAccelerated", false);
            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:launchMode"))
            {
                launchMode = node.Attributes["android:launchMode"].Value;
            }
            multiprocess = InitializeBoolAttribute("android:multiprocess", false);
            noHistory    = InitializeBoolAttribute("android:noHistory", false);
            if (node.HasAttribute("android:permission"))
            {
                permission = node.Attributes["android:permission"].Value;
            }
            if (node.HasAttribute("android:process"))
            {
                process = node.Attributes["android:process"].Value;
            }
            if (node.HasAttribute("android:screenOrientation"))
            {
                screenOrientation = node.Attributes["android:screenOrientation"].Value;
            }
            stateNotNeeded = InitializeBoolAttribute("android:stateNotNeeded", false);
            if (node.HasAttribute("android:taskAffinity"))
            {
                taskAffinity = node.Attributes["android:taskAffinity"].Value;
            }
            if (node.HasAttribute("android:theme"))
            {
                theme = node.Attributes["android:theme"].Value;
            }
            if (node.HasAttribute("android:uiOptions"))
            {
                uiOptions = node.Attributes["android:uiOptions"].Value;
            }
            InitializeWindowSoftInputMode();
        }
コード例 #12
0
        public override void OnGUI()
        {
            bool changed = false;

            display = EditorGUILayout.Foldout(display, "Activity: " + (!display ? name : ""));
            if (display)
            {
                EditorGUI.BeginChangeCheck();
                name     = EditorGUILayout.TextField("Name: ", name);
                changed |= EditorGUI.EndChangeCheck();
                #region attributes
                displayAttributes = EditorGUILayout.Foldout(displayAttributes, "Attributes: ");
                if (displayAttributes)
                {
                    EditorGUI.BeginChangeCheck();
                    BBGuiHelper.BeginIndent();
                    {
                        allowTaskReparenting  = EditorGUILayout.Toggle("Allow Task Reparenting: ", allowTaskReparenting);
                        alwaysRetainTaskState = EditorGUILayout.Toggle("Always Retain Task State: ", alwaysRetainTaskState);
                        clearTaskOnLaunch     = EditorGUILayout.Toggle("Clear Task On Launch: ", clearTaskOnLaunch);
                        configChanges         = EditorGUILayout.MaskField("Config Changes: ", configChanges, configChangesArray);
                        enabled             = EditorGUILayout.Toggle("Enabled: ", enabled);
                        excludeFromRecents  = EditorGUILayout.Toggle("Exclude From Recents: ", excludeFromRecents);
                        exported            = EditorGUILayout.Toggle("Exported: ", exported);
                        hardwareAccelerated = EditorGUILayout.Toggle("Hardware Accelerated: ", hardwareAccelerated);
                        icon                = EditorGUILayout.TextField("Icon: ", icon);
                        label               = EditorGUILayout.TextField("Label: ", label);
                        launchMode          = launchModeArray[EditorGUILayout.Popup("Launch Mode: ", Array.IndexOf(launchModeArray, launchMode), launchModeArray)];
                        multiprocess        = EditorGUILayout.Toggle("Multiprocess: ", multiprocess);
                        noHistory           = EditorGUILayout.Toggle("No History: ", noHistory);
                        permission          = EditorGUILayout.TextField("Permission: ", permission);
                        process             = EditorGUILayout.TextField("Process: ", process);
                        screenOrientation   = screenOrientationArray[EditorGUILayout.Popup("Screen Orientation: ", Array.IndexOf(screenOrientationArray, screenOrientation), screenOrientationArray)];
                        stateNotNeeded      = EditorGUILayout.Toggle("State Not Needed", stateNotNeeded);
                        taskAffinity        = EditorGUILayout.TextField("Task Affinity: ", taskAffinity);
                        theme               = EditorGUILayout.TextField("Theme: ", theme);
                        uiOptions           = uiOptionsArray[EditorGUILayout.Popup("UI Options: ", Array.IndexOf(uiOptionsArray, uiOptions), uiOptionsArray)];
                        windowSoftInputMode = EditorGUILayout.MaskField("Window Soft Input Mode: ", windowSoftInputMode, windowSoftInputModeArray);
                    }
                    BBGuiHelper.EndIndent();
                    changed |= EditorGUI.EndChangeCheck();
                }
                #endregion
                #region intentfilter
                displayIntentFilter = EditorGUILayout.Foldout(displayIntentFilter, "Intent-Filters: (" + intentFilterList.Count + ")");
                if (displayIntentFilter)
                {
                    BBGuiHelper.BeginIndent();
                    {
                        for (int i = 0; i < intentFilterList.Count; i++)
                        {
                            Undo.RecordObject(intentFilterList[i], "Intent-Filter");
                            if (intentFilterList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                intentFilterList[i].OnGUI();
                            }
                            if (intentFilterList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                    }
                    BBGuiHelper.EndIndent();
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.Space();
                        if (GUILayout.Button("New Intent-Filter", BBGuiHelper.ButtonWidth()))
                        {
                            intentFilterList.Add(ManifestIntentFilter.CreateInstance(node));
                            changed = true;
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                #endregion
                #region metadata
                displayMetaData = EditorGUILayout.Foldout(displayMetaData, "Meta-Data: (" + metaDataList.Count + ")");
                if (displayMetaData)
                {
                    BBGuiHelper.BeginIndent();
                    {
                        for (int i = 0; i < metaDataList.Count; i++)
                        {
                            Undo.RecordObject(metaDataList[i], "Meta-Data");
                            if (metaDataList[i].ElementEditStatus != EditStatus.REMOVED)
                            {
                                metaDataList[i].OnGUI();
                            }
                            if (metaDataList[i].ElementEditStatus != EditStatus.NONE)
                            {
                                changed = true;
                            }
                        }
                    }
                    BBGuiHelper.EndIndent();
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.Space();
                        if (GUILayout.Button("New Meta-Data", BBGuiHelper.ButtonWidth()))
                        {
                            metaDataList.Add(ManifestMetaData.CreateInstance(node));
                            changed = true;
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                #endregion
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.Space();
                    if (changed)
                    {
                        elementEditStatus = EditStatus.EDITED;
                    }
                    if (GUILayout.Button("Remove Activity", BBGuiHelper.ButtonWidth()))
                    {
                        elementEditStatus = EditStatus.REMOVED;
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
コード例 #13
0
        public void Merge(AndroidWindowData data)
        {
            XmlElement applicationElement = document.GetElementsByTagName("application") [0] as XmlElement;
            XmlElement manifestElement    = document.GetElementsByTagName("manifest") [0] as XmlElement;

            foreach (ManifestActivity activity in data.activityList)
            {
                activity.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(activity.node, true) as XmlElement;
                applicationElement.AppendChild(element);
                ManifestActivity newActivity = ManifestActivity.CreateInstance(element);
                for (int i = 0; i < activityList.Count; i++)
                {
                    if (activityList[i].name.Equals(newActivity.name))
                    {
                        activityList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                activityList.Add(newActivity);
            }
            foreach (ManifestReceiver receiver in data.receiverList)
            {
                receiver.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(receiver.node, true) as XmlElement;
                applicationElement.AppendChild(element);
                ManifestReceiver newReceiver = ManifestReceiver.CreateInstance(element);
                for (int i = 0; i < receiverList.Count; i++)
                {
                    if (receiverList[i].name.Equals(newReceiver.name))
                    {
                        receiverList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                receiverList.Add(newReceiver);
            }
            foreach (ManifestProvider provider in data.providerList)
            {
                provider.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(provider.node, true) as XmlElement;
                applicationElement.AppendChild(element);
                ManifestProvider newProvier = ManifestProvider.CreateInstance(element);
                for (int i = 0; i < providerList.Count; i++)
                {
                    if (providerList[i].name.Equals(newProvier.name))
                    {
                        providerList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                providerList.Add(newProvier);
            }
            foreach (ManifestService service in data.serviceList)
            {
                service.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(service.node, true) as XmlElement;
                applicationElement.AppendChild(element);
                ManifestService newService = ManifestService.CreateInstance(element);
                for (int i = 0; i < serviceList.Count; i++)
                {
                    if (serviceList[i].name.Equals(newService.name))
                    {
                        serviceList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                serviceList.Add(newService);
            }
            foreach (ManifestMetaData metadata in data.metaDataList)
            {
                metadata.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(metadata.node, true) as XmlElement;
                applicationElement.AppendChild(element);
                ManifestMetaData newMetaData = ManifestMetaData.CreateInstance(element);
                for (int i = 0; i < metaDataList.Count; i++)
                {
                    if (metaDataList[i].name.Equals(newMetaData.name))
                    {
                        metaDataList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                metaDataList.Add(newMetaData);
            }
            foreach (ManifestUsesLibrary usesLibrary in data.usesLibraryList)
            {
                usesLibrary.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(usesLibrary.node, true) as XmlElement;
                applicationElement.AppendChild(element);
                ManifestUsesLibrary newUsesLibrary = ManifestUsesLibrary.CreateInstance(element);
                for (int i = 0; i < usesLibraryList.Count; i++)
                {
                    if (usesLibraryList[i].name.Equals(newUsesLibrary.name))
                    {
                        usesLibraryList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                usesLibraryList.Add(newUsesLibrary);
            }
            foreach (ManifestPermission permission in data.permissionList)
            {
                permission.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(permission.node, true) as XmlElement;
                manifestElement.AppendChild(element);
                ManifestPermission newPermission = ManifestPermission.CreateInstance(element);
                for (int i = 0; i < permissionList.Count; i++)
                {
                    if (permissionList[i].name.Equals(permission.name))
                    {
                        permissionList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                permissionList.Add(newPermission);
            }
            foreach (ManifestUsesPermission usesPermission in data.usesPermissionList)
            {
                usesPermission.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(usesPermission.node, true) as XmlElement;
                manifestElement.AppendChild(element);
                ManifestUsesPermission newUsesPermission = ManifestUsesPermission.CreateInstance(element);
                for (int i = 0; i < usesPermissionList.Count; i++)
                {
                    if (usesPermissionList[i].name.Equals(newUsesPermission.name))
                    {
                        usesPermissionList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                usesPermissionList.Add(newUsesPermission);
            }
            foreach (ManifestUsesFeature usesFeature in data.usesFeatureList)
            {
                usesFeature.ElementEditStatus = EditStatus.EDITED;
                XmlElement element = document.ImportNode(usesFeature.node, true) as XmlElement;
                manifestElement.AppendChild(element);
                ManifestUsesFeature newUsesFeature = ManifestUsesFeature.CreateInstance(element);
                for (int i = 0; i < usesFeatureList.Count; i++)
                {
                    if (usesFeatureList[i].name.Equals(newUsesFeature.name))
                    {
                        usesFeatureList[i].ElementEditStatus = EditStatus.REMOVED;
                        break;
                    }
                }
                usesFeatureList.Add(newUsesFeature);
            }
        }
コード例 #14
0
 public void OnGUI()
 {
     if (isTemplate)
     {
         EditorGUILayout.BeginHorizontal();
         {
             EditorGUILayout.LabelField("Name:", GUILayout.Width(75));
             name = EditorGUILayout.TextField(name);
         }
         EditorGUILayout.EndHorizontal();
     }
     else
     {
         application.OnGUI();
     }
     EditorGUILayout.LabelField("Application Level:");
     #region Activites
     displayActivities = EditorGUILayout.Foldout(displayActivities, "Activities: (" + activityList.Count + ")");
     if (displayActivities)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < activityList.Count; i++)
             {
                 Undo.RecordObject(activityList[i], "Activity");
                 if (activityList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(activityList[i]);
                     activityList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 activityList[i].OnGUI();
                 if (activityList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Activity"))
             {
                 activityList.Add(ManifestActivity.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region Receiver
     displayReceivers = EditorGUILayout.Foldout(displayReceivers, "Receivers: (" + receiverList.Count + ")");
     if (displayReceivers)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < receiverList.Count; i++)
             {
                 Undo.RecordObject(receiverList[i], "Receiver");
                 if (receiverList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(receiverList[i]);
                     receiverList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 receiverList[i].OnGUI();
                 if (receiverList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Receiver"))
             {
                 receiverList.Add(ManifestReceiver.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region Service
     displayServices = EditorGUILayout.Foldout(displayServices, "Services: (" + serviceList.Count + ")");
     if (displayServices)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < serviceList.Count; i++)
             {
                 Undo.RecordObject(serviceList[i], "Service");
                 if (serviceList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(serviceList[i]);
                     serviceList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 serviceList[i].OnGUI();
                 if (serviceList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Service"))
             {
                 serviceList.Add(ManifestService.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region Provider
     displayProviders = EditorGUILayout.Foldout(displayProviders, "Providers: (" + providerList.Count + ")");
     if (displayProviders)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < providerList.Count; i++)
             {
                 Undo.RecordObject(providerList[i], "Provider");
                 if (providerList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(providerList[i]);
                     providerList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 providerList[i].OnGUI();
                 if (providerList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Provider"))
             {
                 providerList.Add(ManifestProvider.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region MetaData
     displayMetaData = EditorGUILayout.Foldout(displayMetaData, "Meta-Data: (" + metaDataList.Count + ")");
     if (displayMetaData)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < metaDataList.Count; i++)
             {
                 Undo.RecordObject(metaDataList[i], "Meta-Data");
                 if (metaDataList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(metaDataList[i]);
                     metaDataList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 metaDataList[i].OnGUI();
                 if (metaDataList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Meta-Data"))
             {
                 metaDataList.Add(ManifestMetaData.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region UsesLibrary
     displayUsesLibrary = EditorGUILayout.Foldout(displayUsesLibrary, "Uses-Library: (" + usesLibraryList.Count + ")");
     if (displayUsesLibrary)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < usesLibraryList.Count; i++)
             {
                 Undo.RecordObject(usesLibraryList[i], "Uses-Library");
                 if (usesLibraryList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(usesLibraryList[i]);
                     usesLibraryList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 usesLibraryList[i].OnGUI();
                 if (usesLibraryList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Uses-Library"))
             {
                 usesLibraryList.Add(ManifestUsesLibrary.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     EditorGUILayout.LabelField("Manifest Level:");
     #region Permissions
     displayPermissions = EditorGUILayout.Foldout(displayPermissions, "Permissions: (" + permissionList.Count + ")");
     if (displayPermissions)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < permissionList.Count; i++)
             {
                 Undo.RecordObject(permissionList[i], "Permission");
                 if (permissionList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(permissionList[i]);
                     permissionList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 permissionList[i].OnGUI();
                 if (permissionList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Permission"))
             {
                 permissionList.Add(ManifestPermission.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region UsesPermissions
     displayUsesPermissions = EditorGUILayout.Foldout(displayUsesPermissions, "Uses-Permissions: (" + usesPermissionList.Count + ")");
     if (displayUsesPermissions)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < usesPermissionList.Count; i++)
             {
                 Undo.RecordObject(usesPermissionList[i], "Uses-Permission");
                 if (usesPermissionList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(usesPermissionList[i]);
                     usesPermissionList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 usesPermissionList[i].OnGUI();
                 if (usesPermissionList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Uses-Permission"))
             {
                 usesPermissionList.Add(ManifestUsesPermission.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
     #region UsesFeature
     displayUsesFeatures = EditorGUILayout.Foldout(displayUsesFeatures, "Uses-Features: (" + usesFeatureList.Count + ")");
     if (displayUsesFeatures)
     {
         BBGuiHelper.BeginIndent();
         {
             for (int i = 0; i < usesFeatureList.Count; i++)
             {
                 Undo.RecordObject(usesFeatureList[i], "Uses-Feature");
                 if (usesFeatureList[i].ElementEditStatus == EditStatus.REMOVED)
                 {
                     editedList.Add(usesFeatureList[i]);
                     usesFeatureList.RemoveAt(i);
                     dirty = true;
                     i--;
                     continue;
                 }
                 usesFeatureList[i].OnGUI();
                 if (usesFeatureList[i].ElementEditStatus != EditStatus.NONE)
                 {
                     dirty = true;
                 }
             }
             if (GUILayout.Button("New Uses-Feature"))
             {
                 usesFeatureList.Add(ManifestUsesFeature.CreateInstance());
             }
         }
         BBGuiHelper.EndIndent();
     }
     #endregion
 }