2020-01-12 17:43:09 +01:00
|
|
|
package com.topjohnwu.magisk.ui.settings
|
2019-11-27 19:47:20 +01:00
|
|
|
|
|
|
|
import android.content.Context
|
2021-04-18 13:14:43 +02:00
|
|
|
import android.content.res.Resources
|
2019-12-02 18:35:48 +01:00
|
|
|
import android.os.Build
|
2019-11-29 20:07:33 +01:00
|
|
|
import android.view.LayoutInflater
|
2021-04-18 13:14:43 +02:00
|
|
|
import android.view.View
|
2019-11-29 20:07:33 +01:00
|
|
|
import androidx.databinding.Bindable
|
2020-01-13 15:01:46 +01:00
|
|
|
import com.topjohnwu.magisk.BR
|
|
|
|
import com.topjohnwu.magisk.BuildConfig
|
|
|
|
import com.topjohnwu.magisk.R
|
|
|
|
import com.topjohnwu.magisk.core.Config
|
|
|
|
import com.topjohnwu.magisk.core.Const
|
|
|
|
import com.topjohnwu.magisk.core.Info
|
2020-07-24 07:43:25 +02:00
|
|
|
import com.topjohnwu.magisk.core.UpdateCheckService
|
2020-10-17 12:40:43 +02:00
|
|
|
import com.topjohnwu.magisk.core.tasks.HideAPK
|
2020-07-12 15:15:32 +02:00
|
|
|
import com.topjohnwu.magisk.core.utils.BiometricHelper
|
2020-08-22 13:20:18 +02:00
|
|
|
import com.topjohnwu.magisk.core.utils.MediaStoreUtils
|
2020-07-12 15:15:32 +02:00
|
|
|
import com.topjohnwu.magisk.core.utils.availableLocales
|
|
|
|
import com.topjohnwu.magisk.core.utils.currentLocale
|
2019-12-02 18:35:48 +01:00
|
|
|
import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
|
2019-11-29 20:07:33 +01:00
|
|
|
import com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
|
|
|
|
import com.topjohnwu.magisk.databinding.DialogSettingsUpdateChannelBinding
|
2020-07-11 14:36:31 +02:00
|
|
|
import com.topjohnwu.magisk.ktx.get
|
2020-08-18 15:31:15 +02:00
|
|
|
import com.topjohnwu.magisk.utils.Utils
|
2021-04-09 10:32:37 +02:00
|
|
|
import com.topjohnwu.magisk.utils.asText
|
2020-07-15 10:21:57 +02:00
|
|
|
import com.topjohnwu.magisk.utils.set
|
2019-12-02 18:35:48 +01:00
|
|
|
import com.topjohnwu.superuser.Shell
|
2020-07-10 13:19:18 +02:00
|
|
|
import kotlinx.coroutines.CoroutineScope
|
|
|
|
import kotlinx.coroutines.launch
|
2019-11-27 19:47:20 +01:00
|
|
|
|
|
|
|
// --- Customization
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Customization : BaseSettingsItem.Section() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_customization.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Language : BaseSettingsItem.Selector() {
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = -1
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-07-15 10:21:57 +02:00
|
|
|
Config.locale = entryValues[it]
|
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.language.asText()
|
2021-04-18 13:14:43 +02:00
|
|
|
|
|
|
|
private var entries = emptyArray<String>()
|
|
|
|
private var entryValues = emptyArray<String>()
|
|
|
|
|
|
|
|
override fun entries(res: Resources) = entries
|
|
|
|
override fun descriptions(res: Resources) = entries
|
|
|
|
|
|
|
|
override fun onPressed(view: View, callback: Callback) {
|
|
|
|
if (entries.isEmpty()) return
|
|
|
|
super.onPressed(view, callback)
|
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2020-07-10 13:19:18 +02:00
|
|
|
suspend fun loadLanguages(scope: CoroutineScope) {
|
|
|
|
scope.launch {
|
|
|
|
availableLocales().let { (names, values) ->
|
|
|
|
entries = names
|
|
|
|
entryValues = values
|
|
|
|
val selectedLocale = currentLocale.getDisplayName(currentLocale)
|
|
|
|
value = names.indexOfFirst { it == selectedLocale }.let { if (it == -1) 0 else it }
|
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Theme : BaseSettingsItem.Blank() {
|
2019-11-27 19:47:20 +01:00
|
|
|
override val icon = R.drawable.ic_paint
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.section_theme.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2021-02-11 11:34:00 +01:00
|
|
|
// --- App
|
2019-11-27 19:47:20 +01:00
|
|
|
|
2021-02-11 11:34:00 +01:00
|
|
|
object AppSettings : BaseSettingsItem.Section() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.home_app_title.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object ClearRepoCache : BaseSettingsItem.Blank() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_clear_cache_title.asText()
|
|
|
|
override val description = R.string.settings_clear_cache_summary.asText()
|
2019-12-02 18:35:48 +01:00
|
|
|
|
|
|
|
override fun refresh() {
|
|
|
|
isEnabled = Info.env.isActive
|
|
|
|
}
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Hide : BaseSettingsItem.Input() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_hide_app_title.asText()
|
|
|
|
override val description = R.string.settings_hide_app_summary.asText()
|
2020-08-11 09:54:19 +02:00
|
|
|
|
2020-08-23 13:24:06 +02:00
|
|
|
override var value = ""
|
2020-08-12 18:42:54 +02:00
|
|
|
set(value) = setV(value, field, { field = it })
|
|
|
|
|
|
|
|
override val inputResult
|
|
|
|
get() = if (isError) null else result
|
2020-01-17 18:34:46 +01:00
|
|
|
|
|
|
|
@get:Bindable
|
2021-03-21 23:25:56 +01:00
|
|
|
var result = "Settings"
|
2020-08-12 18:42:54 +02:00
|
|
|
set(value) = set(value, field, { field = it }, BR.result, BR.error)
|
2019-12-02 18:35:48 +01:00
|
|
|
|
2020-08-31 12:39:20 +02:00
|
|
|
val maxLength
|
2020-10-17 12:40:43 +02:00
|
|
|
get() = HideAPK.MAX_LABEL_LENGTH
|
2020-08-31 12:39:20 +02:00
|
|
|
|
2020-08-12 18:42:54 +02:00
|
|
|
@get:Bindable
|
|
|
|
val isError
|
2020-08-31 12:39:20 +02:00
|
|
|
get() = result.length > maxLength || result.isBlank()
|
2019-12-02 18:35:48 +01:00
|
|
|
|
|
|
|
override fun getView(context: Context) = DialogSettingsAppNameBinding
|
|
|
|
.inflate(LayoutInflater.from(context)).also { it.data = this }.root
|
2020-08-12 18:42:54 +02:00
|
|
|
|
2020-10-19 21:01:02 +02:00
|
|
|
override fun refresh() {
|
|
|
|
isEnabled = Info.remote.stub.versionCode > 0
|
|
|
|
}
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Restore : BaseSettingsItem.Blank() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_restore_app_title.asText()
|
|
|
|
override val description = R.string.settings_restore_app_summary.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-21 12:36:12 +02:00
|
|
|
object AddShortcut : BaseSettingsItem.Blank() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.add_shortcut_title.asText()
|
|
|
|
override val description = R.string.setting_add_shortcut_summary.asText()
|
2020-08-21 12:36:12 +02:00
|
|
|
}
|
2019-11-27 19:47:20 +01:00
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object DownloadPath : BaseSettingsItem.Input() {
|
2020-08-22 13:20:18 +02:00
|
|
|
override var value = Config.downloadDir
|
|
|
|
set(value) = setV(value, field, { field = it }) { Config.downloadDir = it }
|
2020-08-11 09:54:19 +02:00
|
|
|
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_download_path_title.asText()
|
|
|
|
override val description get() = path.asText()
|
2020-08-11 09:54:19 +02:00
|
|
|
|
2020-08-21 16:36:59 +02:00
|
|
|
override val inputResult: String get() = result
|
2020-01-17 18:34:46 +01:00
|
|
|
|
|
|
|
@get:Bindable
|
2020-07-15 10:21:57 +02:00
|
|
|
var result = value
|
|
|
|
set(value) = set(value, field, { field = it }, BR.result, BR.path)
|
2020-01-17 18:34:46 +01:00
|
|
|
|
|
|
|
@get:Bindable
|
2020-08-12 18:42:54 +02:00
|
|
|
val path
|
2020-08-22 13:20:18 +02:00
|
|
|
get() = MediaStoreUtils.fullPath(result)
|
2019-11-29 20:07:33 +01:00
|
|
|
|
|
|
|
override fun getView(context: Context) = DialogSettingsDownloadPathBinding
|
|
|
|
.inflate(LayoutInflater.from(context)).also { it.data = this }.root
|
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object UpdateChannel : BaseSettingsItem.Selector() {
|
2021-04-18 13:14:43 +02:00
|
|
|
override var value = Config.updateChannel.let { if (it < 0) 0 else it }
|
2021-01-25 13:13:08 +01:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
|
|
|
Config.updateChannel = it
|
|
|
|
Info.remote = Info.EMPTY_REMOTE
|
|
|
|
}
|
2019-11-29 20:07:33 +01:00
|
|
|
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_update_channel_title.asText()
|
2021-04-18 13:14:43 +02:00
|
|
|
|
|
|
|
override val entryRes = R.array.update_channel
|
|
|
|
override fun entries(res: Resources): Array<String> {
|
|
|
|
return super.entries(res).let {
|
|
|
|
if (!BuildConfig.DEBUG)
|
|
|
|
it.copyOfRange(0, Config.Value.CANARY_CHANNEL)
|
|
|
|
else it
|
|
|
|
}
|
2020-11-30 18:31:13 +01:00
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object UpdateChannelUrl : BaseSettingsItem.Input() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_update_custom.asText()
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.customChannelUrl
|
2021-01-25 13:13:08 +01:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
|
|
|
Config.customChannelUrl = it
|
|
|
|
Info.remote = Info.EMPTY_REMOTE
|
|
|
|
}
|
2021-04-09 10:32:37 +02:00
|
|
|
override val description get() = value.asText()
|
2020-08-11 09:54:19 +02:00
|
|
|
|
|
|
|
override val inputResult get() = result
|
2019-11-29 20:07:33 +01:00
|
|
|
|
2020-01-17 18:34:46 +01:00
|
|
|
@get:Bindable
|
2020-07-15 10:21:57 +02:00
|
|
|
var result = value
|
|
|
|
set(value) = set(value, field, { field = it }, BR.result)
|
2019-11-29 20:07:33 +01:00
|
|
|
|
2019-12-02 18:35:48 +01:00
|
|
|
override fun refresh() {
|
2019-11-29 21:04:47 +01:00
|
|
|
isEnabled = UpdateChannel.value == Config.Value.CUSTOM_CHANNEL
|
|
|
|
}
|
|
|
|
|
2019-11-29 20:07:33 +01:00
|
|
|
override fun getView(context: Context) = DialogSettingsUpdateChannelBinding
|
|
|
|
.inflate(LayoutInflater.from(context)).also { it.data = this }.root
|
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object UpdateChecker : BaseSettingsItem.Toggle() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_check_update_title.asText()
|
|
|
|
override val description = R.string.settings_check_update_summary.asText()
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.checkUpdate
|
|
|
|
set(value) = setV(value, field, { field = it }) {
|
|
|
|
Config.checkUpdate = it
|
2020-07-24 07:43:25 +02:00
|
|
|
UpdateCheckService.schedule(get())
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-09-13 13:34:00 +02:00
|
|
|
object DoHToggle : BaseSettingsItem.Toggle() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_doh_title.asText()
|
|
|
|
override val description = R.string.settings_doh_description.asText()
|
2020-09-13 13:34:00 +02:00
|
|
|
override var value = Config.doh
|
|
|
|
set(value) = setV(value, field, { field = it }) {
|
|
|
|
Config.doh = it
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 19:47:20 +01:00
|
|
|
// check whether is module already installed beforehand?
|
2020-08-19 11:05:23 +02:00
|
|
|
object SystemlessHosts : BaseSettingsItem.Blank() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_hosts_title.asText()
|
|
|
|
override val description = R.string.settings_hosts_summary.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-10-22 11:40:47 +02:00
|
|
|
object Tapjack : BaseSettingsItem.Toggle() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_su_tapjack_title.asText()
|
|
|
|
override var description = R.string.settings_su_tapjack_summary.asText()
|
2020-10-22 11:40:47 +02:00
|
|
|
override var value = Config.suTapjack
|
|
|
|
set(value) = setV(value, field, { field = it }) { Config.suTapjack = it }
|
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Biometrics : BaseSettingsItem.Toggle() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_su_biometric_title.asText()
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.suBiometric
|
|
|
|
set(value) = setV(value, field, { field = it }) { Config.suBiometric = it }
|
2021-04-09 10:32:37 +02:00
|
|
|
override var description = R.string.settings_su_biometric_summary.asText()
|
2019-12-02 18:35:48 +01:00
|
|
|
|
|
|
|
override fun refresh() {
|
2020-01-17 20:06:33 +01:00
|
|
|
isEnabled = BiometricHelper.isSupported
|
2019-12-02 18:35:48 +01:00
|
|
|
if (!isEnabled) {
|
|
|
|
value = false
|
2021-04-09 10:32:37 +02:00
|
|
|
description = R.string.no_biometric.asText()
|
2019-12-02 18:35:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Reauthenticate : BaseSettingsItem.Toggle() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.settings_su_reauth_title.asText()
|
|
|
|
override val description = R.string.settings_su_reauth_summary.asText()
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.suReAuth
|
|
|
|
set(value) = setV(value, field, { field = it }) { Config.suReAuth = it }
|
2019-12-02 18:35:48 +01:00
|
|
|
|
|
|
|
override fun refresh() {
|
|
|
|
isEnabled = Build.VERSION.SDK_INT < Build.VERSION_CODES.O && Utils.showSuperUser()
|
|
|
|
}
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- Magisk
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Magisk : BaseSettingsItem.Section() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.magisk.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object MagiskHide : BaseSettingsItem.Toggle() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.magiskhide.asText()
|
|
|
|
override val description = R.string.settings_magiskhide_summary.asText()
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.magiskHide
|
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-09-23 22:50:10 +02:00
|
|
|
val cmd = if (it) "enable" else "disable"
|
2021-02-24 21:24:44 +01:00
|
|
|
Shell.su("magiskhide $cmd").submit { cb ->
|
2020-09-23 22:50:10 +02:00
|
|
|
if (cb.isSuccess) Config.magiskHide = it
|
|
|
|
else field = !it
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2019-12-02 18:35:48 +01:00
|
|
|
}
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- Superuser
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object Superuser : BaseSettingsItem.Section() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.superuser.asText()
|
2019-11-27 19:47:20 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object AccessMode : BaseSettingsItem.Selector() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.superuser_access.asText()
|
2020-02-18 23:02:08 +01:00
|
|
|
override val entryRes = R.array.su_access
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.rootMode
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-11-30 18:26:58 +01:00
|
|
|
Config.rootMode = it
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object MultiuserMode : BaseSettingsItem.Selector() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.multiuser_mode.asText()
|
2020-02-18 23:02:08 +01:00
|
|
|
override val entryRes = R.array.multiuser_mode
|
2021-04-18 13:14:43 +02:00
|
|
|
override val descriptionRes = R.array.multiuser_summary
|
2020-01-17 18:34:46 +01:00
|
|
|
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.suMultiuserMode
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-11-30 18:26:58 +01:00
|
|
|
Config.suMultiuserMode = it
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2020-01-17 18:34:46 +01:00
|
|
|
|
2019-12-02 18:35:48 +01:00
|
|
|
override fun refresh() {
|
2020-01-17 20:06:33 +01:00
|
|
|
isEnabled = Const.USER_ID == 0
|
2019-12-02 18:35:48 +01:00
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object MountNamespaceMode : BaseSettingsItem.Selector() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.mount_namespace_mode.asText()
|
2020-02-18 23:02:08 +01:00
|
|
|
override val entryRes = R.array.namespace
|
2021-04-18 13:14:43 +02:00
|
|
|
override val descriptionRes = R.array.namespace_summary
|
2020-01-17 18:34:46 +01:00
|
|
|
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.suMntNamespaceMode
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-11-30 18:26:58 +01:00
|
|
|
Config.suMntNamespaceMode = it
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object AutomaticResponse : BaseSettingsItem.Selector() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.auto_response.asText()
|
2020-02-18 23:02:08 +01:00
|
|
|
override val entryRes = R.array.auto_response
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2020-10-17 12:40:43 +02:00
|
|
|
override var value = Config.suAutoResponse
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-11-30 18:26:58 +01:00
|
|
|
Config.suAutoResponse = it
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object RequestTimeout : BaseSettingsItem.Selector() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.request_timeout.asText()
|
2020-02-18 23:02:08 +01:00
|
|
|
override val entryRes = R.array.request_timeout
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2021-04-18 13:14:43 +02:00
|
|
|
private val entryValues = listOf(10, 15, 20, 30, 45, 60)
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = selected
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2021-04-18 13:14:43 +02:00
|
|
|
Config.suDefaultTimeout = entryValues[it]
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2019-12-02 18:35:48 +01:00
|
|
|
|
2020-01-17 18:34:46 +01:00
|
|
|
private val selected: Int
|
2021-04-18 13:14:43 +02:00
|
|
|
get() = entryValues.indexOfFirst { it == Config.suDefaultTimeout }
|
2019-11-28 21:53:31 +01:00
|
|
|
}
|
|
|
|
|
2020-08-19 11:05:23 +02:00
|
|
|
object SUNotification : BaseSettingsItem.Selector() {
|
2021-04-09 10:32:37 +02:00
|
|
|
override val title = R.string.superuser_notification.asText()
|
2020-02-18 23:02:08 +01:00
|
|
|
override val entryRes = R.array.su_notification
|
2019-11-28 21:53:31 +01:00
|
|
|
|
2020-07-15 10:21:57 +02:00
|
|
|
override var value = Config.suNotification
|
2020-08-11 12:30:00 +02:00
|
|
|
set(value) = setV(value, field, { field = it }) {
|
2020-11-30 18:26:58 +01:00
|
|
|
Config.suNotification = it
|
2020-07-15 10:21:57 +02:00
|
|
|
}
|
2020-01-12 08:00:49 +01:00
|
|
|
}
|