mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-29 11:46:50 +00:00
Remove usage of grid layouts
This commit is contained in:
@@ -47,16 +47,13 @@ object Config : PreferenceModel, DBConfig {
|
||||
const val UPDATE_CHANNEL = "update_channel"
|
||||
const val CUSTOM_CHANNEL = "custom_channel"
|
||||
const val LOCALE = "locale"
|
||||
const val DARK_THEME = "dark_theme"
|
||||
const val DARK_THEME_EXTENDED = "dark_theme_extended"
|
||||
const val DARK_THEME = "dark_theme_extended"
|
||||
const val REPO_ORDER = "repo_order"
|
||||
const val SHOW_SYSTEM_APP = "show_system"
|
||||
const val DOWNLOAD_PATH = "download_path"
|
||||
const val REDESIGN = "redesign"
|
||||
const val SAFETY = "safety_notice"
|
||||
const val THEME_ORDINAL = "theme_ordinal"
|
||||
const val BOOT_ID = "boot_id"
|
||||
const val LIST_SPAN_COUNT = "column_count"
|
||||
|
||||
// system state
|
||||
const val MAGISKHIDE = "magiskhide"
|
||||
@@ -120,17 +117,12 @@ object Config : PreferenceModel, DBConfig {
|
||||
var updateChannel by preferenceStrInt(Key.UPDATE_CHANNEL, defaultChannel)
|
||||
|
||||
var safetyNotice by preference(Key.SAFETY, true)
|
||||
var darkThemeExtended by preference(
|
||||
Key.DARK_THEME_EXTENDED,
|
||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
)
|
||||
var darkTheme by preference(Key.DARK_THEME, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
var themeOrdinal by preference(Key.THEME_ORDINAL, Theme.Piplup.ordinal)
|
||||
var suReAuth by preference(Key.SU_REAUTH, false)
|
||||
var checkUpdate by preference(Key.CHECK_UPDATES, true)
|
||||
var magiskHide by preference(Key.MAGISKHIDE, true)
|
||||
var showSystemApp by preference(Key.SHOW_SYSTEM_APP, false)
|
||||
@JvmStatic
|
||||
var listSpanCount by preference(Key.LIST_SPAN_COUNT, 1)
|
||||
|
||||
var customChannelUrl by preference(Key.CUSTOM_CHANNEL, "")
|
||||
var locale by preference(Key.LOCALE, "")
|
||||
|
||||
@@ -42,7 +42,7 @@ class DarkThemeDialog : DialogEvent(), ActivityExecutor {
|
||||
}
|
||||
|
||||
private fun selectTheme(mode: Int) {
|
||||
Config.darkThemeExtended = mode
|
||||
Config.darkTheme = mode
|
||||
activity?.get()?.recreate()
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ abstract class BaseUIActivity<ViewModel : BaseViewModel, Binding : ViewDataBindi
|
||||
open val snackbarView get() = binding.root
|
||||
|
||||
init {
|
||||
val theme = Config.darkThemeExtended
|
||||
val theme = Config.darkTheme
|
||||
AppCompatDelegate.setDefaultNightMode(theme)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ import com.topjohnwu.magisk.model.entity.recycler.SettingsItem
|
||||
import com.topjohnwu.magisk.utils.asTransitive
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import java.io.File
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
// --- Customization
|
||||
|
||||
@@ -123,17 +121,6 @@ object DownloadPath : SettingsItem.Input() {
|
||||
.inflate(LayoutInflater.from(context)).also { it.data = this }.root
|
||||
}
|
||||
|
||||
object GridSize : SettingsItem.Selector() {
|
||||
override var value by bindableValue(Config.listSpanCount - 1) {
|
||||
Config.listSpanCount = max(1, min(2, it + 1))
|
||||
}
|
||||
|
||||
override val title = R.string.settings_grid_column_count_title.asTransitive()
|
||||
override val description = R.string.settings_grid_column_count_summary.asTransitive()
|
||||
override val entryRes = R.array.span_count
|
||||
override val entryValRes = R.array.value_array
|
||||
}
|
||||
|
||||
object UpdateChannel : SettingsItem.Selector() {
|
||||
override var value by bindableValue(Config.updateChannel) { Config.updateChannel = it }
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class SettingsViewModel(
|
||||
// Customization
|
||||
val list = mutableListOf(
|
||||
Customization,
|
||||
Theme, Language, GridSize
|
||||
Theme, Language
|
||||
)
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
// Pre 5.0 does not support getting colors from attributes,
|
||||
|
||||
Reference in New Issue
Block a user