Browse Source

修改星沐游manifest文件

zengqb 5 years ago
parent
commit
fb1a69f86e
2 changed files with 47 additions and 10 deletions
  1. 8 8
      sdk/jm_xingmuyou/manifest.xml
  2. 39 2
      sdk/jm_xingmuyou/script/sdk_script.py

+ 8 - 8
sdk/jm_xingmuyou/manifest.xml

@@ -82,14 +82,14 @@
 
         <!-- 聚合sdk -->
         <!-- 闪屏Activity -->
-        <activity android:name="fusion.mj.communal.element.SplashScreenActivity"
-            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-            android:screenOrientation="landscape">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
+        <!--<activity android:name="fusion.mj.communal.element.SplashScreenActivity"-->
+            <!--android:theme="@android:style/Theme.NoTitleBar.Fullscreen"-->
+            <!--android:screenOrientation="landscape">-->
+            <!--<intent-filter>-->
+                <!--<action android:name="android.intent.action.MAIN" />-->
+                <!--<category android:name="android.intent.category.LAUNCHER" />-->
+            <!--</intent-filter>-->
+        <!--</activity>-->
 
         <activity android:name="fusion.mj.communal.element.RequestPermissionsHelpActivity"
             android:configChanges="keyboardHidden|orientation|screenSize"

+ 39 - 2
sdk/jm_xingmuyou/script/sdk_script.py

@@ -38,8 +38,7 @@ def execute(game, sdk, config):
     meta['fusion_entryactivity'] = removeLauncherActivity
     jsonConfig['metaData'] = meta
     addMetaData(game, sdk, subChannel, jsonConfig, config['cache'])
-
-
+    addLauncherActivity(manifest, config['screenOrientation'], 'fusion.mj.communal.element.SplashScreenActivity')
 
     return 0
 
@@ -104,4 +103,42 @@ def copySmaliCode(game, sdk, subChannel, config):
 
 
 
+def addLauncherActivity(manifest, screenOrientation, activity):
+    '''
+    添加启动的activity
+    '''
+    for key in namespaces:
+        ET.register_namespace(key, namespaces[key])
+
+    tree = ET.parse(manifest)
+    root = tree.getroot()
+
+    # activity
+    '''<activity android:name=".LauncherActivity"
+            android:theme="@style/LauncherStyle">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>'''
+
+    activity = ET.Element('activity', {'android:name' : activity,
+    'android:theme' : '@android:style/Theme.Holo.Light.NoActionBar.Fullscreen',
+    'android:launchMode' : 'singleTop',
+    'android:configChanges' : 'orientation|screenSize|keyboardHidden',
+    'android:screenOrientation' : screenOrientation})
+    intent = ET.Element('intent-filter')
+    action = ET.Element('action', {'android:name' : 'android.intent.action.MAIN'})
+    category = ET.Element('category', {'android:name' : 'android.intent.category.LAUNCHER'})
+    intent.append(action)
+    intent.append(category)
+    activity.append(intent)
+
+
+    application = root.find('application')
+    application.insert(0, activity)
+
+    tree.write(manifest, encoding)
+
+