Show unsupported message when running low versions

This commit is contained in:
topjohnwu 2020-02-28 21:09:52 -08:00
parent 38af82e152
commit 200bf993d8
2 changed files with 11 additions and 2 deletions

View File

@ -166,8 +166,6 @@ val shouldKeepResources = listOf(
R.string.no_info_provided, R.string.no_info_provided,
R.string.release_notes, R.string.release_notes,
R.string.settings_download_path_error, R.string.settings_download_path_error,
R.string.unsupport_magisk_msg,
R.string.unsupport_magisk_title,
R.string.install_inactive_slot_msg, R.string.install_inactive_slot_msg,
R.string.invalid_update_channel, R.string.invalid_update_channel,
R.string.update_available R.string.update_available

View File

@ -14,6 +14,7 @@ import com.google.android.material.card.MaterialCardView
import com.ncapdevi.fragnav.FragNavController import com.ncapdevi.fragnav.FragNavController
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.Const
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding import com.topjohnwu.magisk.databinding.ActivityMainMd2Binding
import com.topjohnwu.magisk.extensions.startAnimations import com.topjohnwu.magisk.extensions.startAnimations
import com.topjohnwu.magisk.model.navigation.Navigation 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.HideBottomViewOnScrollBehavior
import com.topjohnwu.magisk.utils.HideTopViewOnScrollBehavior import com.topjohnwu.magisk.utils.HideTopViewOnScrollBehavior
import com.topjohnwu.magisk.utils.HideableBehavior import com.topjohnwu.magisk.utils.HideableBehavior
import com.topjohnwu.magisk.view.MagiskDialog
import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.Shell
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
import kotlin.reflect.KClass import kotlin.reflect.KClass
@ -55,6 +57,15 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) 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) window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
setSupportActionBar(binding.mainToolbar) setSupportActionBar(binding.mainToolbar)