1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-13 20:54:12 +01:00

Add more notice/messages

This commit is contained in:
topjohnwu 2020-02-29 02:04:31 -08:00
parent 200bf993d8
commit 6fbc38d764
3 changed files with 27 additions and 4 deletions

View File

@ -161,12 +161,10 @@ object ClassMap {
* being removed when running "remove unused resources" */
val shouldKeepResources = listOf(
/* TODO: The following strings should be used somewhere */
R.string.patch_file_msg,
R.string.no_apps_found,
R.string.no_info_provided,
R.string.release_notes,
R.string.settings_download_path_error,
R.string.install_inactive_slot_msg,
R.string.invalid_update_channel,
R.string.update_available
)

View File

@ -0,0 +1,16 @@
package com.topjohnwu.magisk.model.events.dialog
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.view.MagiskDialog
class SecondSlotWarningDialog : DialogEvent() {
override fun build(dialog: MagiskDialog) {
dialog.applyTitle(android.R.string.dialog_alert_title)
.applyMessage(R.string.install_inactive_slot_msg)
.applyButton(MagiskDialog.ButtonType.POSITIVE) {
titleRes = android.R.string.ok
}
.cancellable(true)
}
}

View File

@ -1,14 +1,17 @@
package com.topjohnwu.magisk.ui.install
import android.net.Uri
import android.widget.Toast
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.download.DownloadService
import com.topjohnwu.magisk.core.download.RemoteFileService
import com.topjohnwu.magisk.core.utils.Utils
import com.topjohnwu.magisk.extensions.addOnPropertyChangedCallback
import com.topjohnwu.magisk.model.entity.internal.Configuration
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
import com.topjohnwu.magisk.model.events.RequestFileEvent
import com.topjohnwu.magisk.model.events.dialog.SecondSlotWarningDialog
import com.topjohnwu.magisk.ui.base.BaseViewModel
import com.topjohnwu.magisk.utils.KObservableField
import com.topjohnwu.superuser.Shell
@ -41,8 +44,14 @@ class InstallViewModel : BaseViewModel(State.LOADED) {
}
}
method.addOnPropertyChangedCallback {
if (method.value == R.id.method_patch) {
RequestFileEvent().publish()
when (method.value) {
R.id.method_patch -> {
Utils.toast(R.string.patch_file_msg, Toast.LENGTH_LONG)
RequestFileEvent().publish()
}
R.id.method_inactive_slot -> {
SecondSlotWarningDialog().publish()
}
}
}
}