Added grid column count settings

*Cough, cough* Use pinch to zoom gesture instead, not a fan of this.
This commit is contained in:
Viktor De Pasquale
2020-01-06 19:59:41 +01:00
parent 6a2acbe929
commit fcedd06e72
4 changed files with 30 additions and 1 deletions

View File

@@ -16,6 +16,8 @@ import com.topjohnwu.magisk.model.entity.recycler.SettingsItem
import com.topjohnwu.magisk.utils.*
import com.topjohnwu.superuser.Shell
import java.io.File
import kotlin.math.max
import kotlin.math.min
// --- Customization
@@ -122,6 +124,22 @@ object DownloadPath : SettingsItem.Input() {
.inflate(LayoutInflater.from(context)).also { it.data = this }.root
}
object GridSize : SettingsItem.Selector() {
override var value by dataObservable(Config.listSpanCount - 1) {
Config.listSpanCount = max(1, min(3, it + 1))
}
override val title = R.string.settings_grid_span_count_title.asTransitive()
override val description = R.string.settings_grid_span_count_summary.asTransitive()
init {
setValues(
resources.getStringArray(R.array.span_count),
resources.getStringArray(R.array.value_array)
)
}
}
object UpdateChannel : SettingsItem.Selector() {
override var value by dataObservable(Config.updateChannel) { Config.updateChannel = it }
override val title = R.string.settings_update_channel_title.asTransitive()

View File

@@ -35,7 +35,7 @@ class SettingsViewModel(
val itemBinding = itemBindingOf<SettingsItem> { it.bindExtra(BR.callback, this) }
val items = diffListOf(
Customization,
Theme, Language, Redesign, DownloadPath,
Theme, Language, Redesign, DownloadPath, GridSize,
Manager,
UpdateChannel, UpdateChannelUrl, ClearRepoCache, HideOrRestore(), UpdateChecker,