manager: Add multiple activity declarations for the backup icon close #469
This commit is contained in:
@@ -18,13 +18,17 @@
|
|||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.KernelSU"
|
android:theme="@style/Theme.KernelSU"
|
||||||
android:requestLegacyExternalStorage="true"
|
|
||||||
tools:targetApi="34">
|
tools:targetApi="34">
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.MainActivity"
|
android:name=".ui.MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
android:enabled="true"
|
||||||
|
android:launchMode="standard"
|
||||||
|
android:documentLaunchMode="intoExisting"
|
||||||
|
android:autoRemoveFromRecents="true"
|
||||||
android:theme="@style/Theme.KernelSU">
|
android:theme="@style/Theme.KernelSU">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -51,18 +55,38 @@
|
|||||||
<data android:mimeType="application/vnd.android.package-archive" />
|
<data android:mimeType="application/vnd.android.package-archive" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<!-- 切换图标 -->
|
||||||
<activity-alias
|
<activity-alias
|
||||||
android:name=".ui.MainActivityAlias"
|
android:name=".ui.MainActivityAlias"
|
||||||
|
android:targetActivity=".ui.MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:icon="@mipmap/ic_launcher_alt"
|
android:icon="@mipmap/ic_launcher_alt"
|
||||||
android:roundIcon="@mipmap/ic_launcher_alt_round"
|
android:roundIcon="@mipmap/ic_launcher_alt_round">
|
||||||
android:targetActivity=".ui.MainActivity">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="content" />
|
||||||
|
<data android:mimeType="application/zip" />
|
||||||
|
<data android:mimeType="application/vnd.android.package-archive" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="application/zip" />
|
||||||
|
<data android:mimeType="application/vnd.android.package-archive" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="application/zip" />
|
||||||
|
<data android:mimeType="application/vnd.android.package-archive" />
|
||||||
|
</intent-filter>
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -1,44 +1,27 @@
|
|||||||
package zako.zako.zako.zakoui.screen.moreSettings.util
|
package zako.zako.zako.zakoui.screen.moreSettings.util
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import com.sukisu.ultra.ui.MainActivity
|
import com.sukisu.ultra.ui.MainActivity
|
||||||
|
|
||||||
/**
|
|
||||||
* 重启应用程序
|
|
||||||
**/
|
|
||||||
|
|
||||||
fun Context.restartApp(
|
|
||||||
activityClass: Class<out Activity>,
|
|
||||||
finishCurrent: Boolean = true,
|
|
||||||
clearTask: Boolean = true,
|
|
||||||
newTask: Boolean = true
|
|
||||||
) {
|
|
||||||
val intent = Intent(this, activityClass)
|
|
||||||
if (clearTask) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
|
||||||
if (newTask) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
startActivity(intent)
|
|
||||||
|
|
||||||
if (finishCurrent && this is Activity) {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新启动器图标
|
* 刷新启动器图标
|
||||||
*/
|
*/
|
||||||
fun toggleLauncherIcon(context: Context, useAlt: Boolean) {
|
fun toggleLauncherIcon(context: Context, useAlt: Boolean) {
|
||||||
val pm = context.packageManager
|
val pm = context.packageManager
|
||||||
val main = ComponentName(context, MainActivity::class.java.name)
|
val main = ComponentName(context, MainActivity::class.java.name)
|
||||||
val alt = ComponentName(context, "${MainActivity::class.java.name}Alias")
|
val alias = ComponentName(context, "${MainActivity::class.java.name}Alias")
|
||||||
if (useAlt) {
|
|
||||||
pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
|
pm.setComponentEnabledSetting(
|
||||||
pm.setComponentEnabledSetting(alt, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP)
|
if (useAlt) alias else main,
|
||||||
} else {
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||||
pm.setComponentEnabledSetting(alt, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
|
PackageManager.DONT_KILL_APP
|
||||||
pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP)
|
)
|
||||||
}
|
|
||||||
|
pm.setComponentEnabledSetting(
|
||||||
|
if (useAlt) main else alias,
|
||||||
|
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||||
|
PackageManager.DONT_KILL_APP
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user