|
@@ -24,10 +24,9 @@ def execute(game, sdk, config):
|
|
|
|
|
|
changePlaceholders(game, sdk, subChannel, config)
|
|
|
|
|
|
- if config['addLauncher']:
|
|
|
- ret = addLauncher(game, sdk, subChannel, config)
|
|
|
- if ret:
|
|
|
- return ret
|
|
|
+ ret = deleteSplash(game, sdk, subChannel, config)
|
|
|
+ if ret:
|
|
|
+ return ret
|
|
|
|
|
|
return copyWechatCode(game, sdk, subChannel, config)
|
|
|
|
|
@@ -124,44 +123,20 @@ def copyWechatCode(game, sdk, subChannel, config):
|
|
|
|
|
|
return 0
|
|
|
|
|
|
-def addLauncher(game, sdk, subChannel, config):
|
|
|
+def deleteSplash(game, sdk, subChannel, config):
|
|
|
'''
|
|
|
- 添加启动图
|
|
|
+ 删除闪屏
|
|
|
'''
|
|
|
- channelPath = file_utils.getSubChannelPath(game, sdk, subChannel)
|
|
|
- splashPath = os.path.join(channelPath, 'splash')
|
|
|
- if len(os.listdir(splashPath)) == 0:
|
|
|
- print('dir splash is empty')
|
|
|
+ if game != 'wzjh':
|
|
|
return 0
|
|
|
-
|
|
|
- print('add launcher...')
|
|
|
+ channelPath = file_utils.getSubChannelPath(game, sdk, subChannel)
|
|
|
+ print('delete Splash...')
|
|
|
decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
|
|
|
manifest = os.path.join(decompliePath, 'AndroidManifest.xml')
|
|
|
activity = xml_utils.getLauncherActivityName(manifest)
|
|
|
- if activity == 'com.inner.sdk.ui.YsdkLauncherActivity':
|
|
|
- print('add launcher already exist...')
|
|
|
- return 1
|
|
|
- # 添加关联资源
|
|
|
- internalPath = file_utils.getFullInternalPath()
|
|
|
- ret = package_utils.copyAppResWithType(decompliePath, internalPath, 'launcher_res')
|
|
|
- if ret:
|
|
|
- return ret
|
|
|
-
|
|
|
- # 修改主文件信息
|
|
|
- print('change launcher config...')
|
|
|
activity = xml_utils.removeLauncherActivity(manifest)
|
|
|
- xml_utils.addLauncherActivity(manifest, config['screenOrientation'], 'com.inner.sdk.ui.YsdkLauncherActivity')
|
|
|
-
|
|
|
- # 修改跳转的
|
|
|
- launcherActivity = os.path.join(decompliePath, 'smali', 'com', 'inner', 'sdk', 'ui', 'YsdkLauncherActivity.smali')
|
|
|
- file_utils.replaceContent(launcherActivity, '{class}', activity)
|
|
|
-
|
|
|
- print('change launcher %s to %s' % (activity, 'com.inner.sdk.ui.YsdkLauncherActivity'))
|
|
|
-
|
|
|
- if 'launcherTime' in config:
|
|
|
- timeHex = package_utils.formatHex(config['launcherTime'])
|
|
|
- file_utils.replaceContent(launcherActivity, '0x0BB8', timeHex)
|
|
|
-
|
|
|
+ xml_utils.deleteActivityByName(manifest,'com.hugenstar.nanobox.NaNoUnityContext')
|
|
|
+ addLauncherActivity(manifest, config['screenOrientation'], 'com.hugenstar.nanobox.NaNoUnityContext')
|
|
|
return 0
|
|
|
|
|
|
def changeLauncherLaunchMode(manifest):
|
|
@@ -214,4 +189,46 @@ def changePlaceholders(game, sdk, subChannel, config):
|
|
|
decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache'])
|
|
|
manifest = os.path.join(decompliePath, 'AndroidManifest.xml')
|
|
|
|
|
|
- file_utils.replaceContent(manifest, '${screenOrientation}', config['screenOrientation'])
|
|
|
+ file_utils.replaceContent(manifest, '${screenOrientation}', config['screenOrientation'])
|
|
|
+
|
|
|
+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)
|
|
|
+ intent2 = ET.Element('intent-filter')
|
|
|
+ category = ET.Element('category', {'android:name' : 'android.intent.category.LEANBACK_LAUNCHER'})
|
|
|
+ intent2.append(category)
|
|
|
+ activity.append(intent2)
|
|
|
+
|
|
|
+ application = root.find('application')
|
|
|
+ application.insert(0, activity)
|
|
|
+
|
|
|
+ tree.write(manifest, encoding)
|
|
|
+
|
|
|
+
|