From 200bf993d837cddf4c5481a0472723e9c0f38d8b Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 28 Feb 2020 21:09:52 -0800 Subject: [PATCH] Show unsupported message when running low versions --- app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt | 2 -- .../main/java/com/topjohnwu/magisk/ui/MainActivity.kt | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt b/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt index 6316b1883..8e5472b56 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt @@ -166,8 +166,6 @@ val shouldKeepResources = listOf( R.string.no_info_provided, R.string.release_notes, R.string.settings_download_path_error, - R.string.unsupport_magisk_msg, - R.string.unsupport_magisk_title, R.string.install_inactive_slot_msg, R.string.invalid_update_channel, R.string.update_available diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt index 5fbf1cd3d..f5bc0d066 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt @@ -14,6 +14,7 @@ import com.google.android.material.card.MaterialCardView import com.ncapdevi.fragnav.FragNavController import com.topjohnwu.magisk.R import com.topjohnwu.magisk.core.Const +import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding import com.topjohnwu.magisk.extensions.startAnimations import com.topjohnwu.magisk.model.navigation.Navigation @@ -25,6 +26,7 @@ import com.topjohnwu.magisk.ui.superuser.SuperuserFragment import com.topjohnwu.magisk.utils.HideBottomViewOnScrollBehavior import com.topjohnwu.magisk.utils.HideTopViewOnScrollBehavior import com.topjohnwu.magisk.utils.HideableBehavior +import com.topjohnwu.magisk.view.MagiskDialog import com.topjohnwu.superuser.Shell import org.koin.androidx.viewmodel.ext.android.viewModel import kotlin.reflect.KClass @@ -55,6 +57,15 @@ open class MainActivity : BaseUIActivity( override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + if (Info.env.isUnsupported) { + MagiskDialog(this) + .applyTitle(R.string.unsupport_magisk_title) + .applyMessage(R.string.unsupport_magisk_msg, Const.Version.MIN_VERSION) + .applyButton(MagiskDialog.ButtonType.POSITIVE) { titleRes = android.R.string.ok } + .cancellable(true) + .reveal() + } + window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) setSupportActionBar(binding.mainToolbar)