diff --git a/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt index 00854a545..e7757dac9 100644 --- a/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt +++ b/app/core/src/main/java/com/topjohnwu/magisk/core/base/BaseActivity.kt @@ -3,9 +3,7 @@ package com.topjohnwu.magisk.core.base import android.Manifest.permission.POST_NOTIFICATIONS import android.Manifest.permission.REQUEST_INSTALL_PACKAGES import android.Manifest.permission.WRITE_EXTERNAL_STORAGE -import android.app.Activity import android.content.ActivityNotFoundException -import android.content.Intent import android.net.Uri import android.os.Build import android.os.Bundle @@ -125,8 +123,3 @@ class ActivityExtension(private val activity: ComponentActivity) { private const val CONTENT_CALLBACK_KEY = "content_callback" } } - -fun Activity.relaunch() { - startActivity(Intent(intent).setFlags(0)) - finish() -} diff --git a/app/core/src/main/java/com/topjohnwu/magisk/core/utils/LocaleSetting.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/LocaleSetting.kt index 9aaf11d54..8698a9545 100644 --- a/app/core/src/main/java/com/topjohnwu/magisk/core/utils/LocaleSetting.kt +++ b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/LocaleSetting.kt @@ -13,7 +13,6 @@ import androidx.annotation.RequiresApi import com.topjohnwu.magisk.core.AppContext import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.R -import com.topjohnwu.magisk.core.base.relaunch import org.xmlpull.v1.XmlPullParser import java.util.Locale @@ -47,7 +46,9 @@ interface LocaleSetting { appLocale = localeList?.get(0) LocaleList.setDefault(currentLocaleList) updateResource(AppContext.resources) - AppContext.foregroundActivity?.relaunch() + // Recreate instead of starting a new instance: MainActivity is singleTask, so + // starting it again would deliver the intent to this instance, which is then finished + AppContext.foregroundActivity?.recreate() } @Suppress("DEPRECATION")