mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-12 07:42:03 +01:00
Remove Scrollable column
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ca.gosyer.ui.base.components
|
|
||||||
|
|
||||||
import androidx.compose.foundation.gestures.Orientation
|
|
||||||
import androidx.compose.foundation.gestures.scrollable
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ScrollableColumn(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
content: @Composable () -> Unit
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier.scrollable(
|
|
||||||
state = rememberScrollState(),
|
|
||||||
orientation = Orientation.Vertical
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
content()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -48,120 +48,9 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ca.gosyer.ui.base.WindowDialog
|
import ca.gosyer.ui.base.WindowDialog
|
||||||
import ca.gosyer.ui.base.components.ColorPickerDialog
|
import ca.gosyer.ui.base.components.ColorPickerDialog
|
||||||
import ca.gosyer.ui.base.components.ScrollableColumn
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PreferencesScrollableColumn(
|
fun PreferenceRow(
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
content: @Composable PreferenceScope.() -> Unit
|
|
||||||
) {
|
|
||||||
Box {
|
|
||||||
ScrollableColumn(modifier) {
|
|
||||||
val scope = PreferenceScope()
|
|
||||||
scope.content()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class PreferenceScope {
|
|
||||||
@Composable
|
|
||||||
fun <Key> ChoicePref(
|
|
||||||
preference: PreferenceMutableStateFlow<Key>,
|
|
||||||
choices: Map<Key, String>,
|
|
||||||
title: String,
|
|
||||||
subtitle: String? = null
|
|
||||||
) {
|
|
||||||
val prefValue by preference.collectAsState()
|
|
||||||
Pref(
|
|
||||||
title = title,
|
|
||||||
subtitle = if (subtitle == null) choices[prefValue] else null,
|
|
||||||
onClick = {
|
|
||||||
ChoiceDialog(
|
|
||||||
items = choices.toList(),
|
|
||||||
selected = prefValue,
|
|
||||||
title = title,
|
|
||||||
onSelected = { selected ->
|
|
||||||
preference.value = selected
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ColorPref(
|
|
||||||
preference: PreferenceMutableStateFlow<Color>,
|
|
||||||
title: String,
|
|
||||||
subtitle: String? = null,
|
|
||||||
unsetColor: Color = Color.Unspecified
|
|
||||||
) {
|
|
||||||
val initialColor = preference.value.takeOrElse { unsetColor }
|
|
||||||
Pref(
|
|
||||||
title = title,
|
|
||||||
subtitle = subtitle,
|
|
||||||
onClick = {
|
|
||||||
ColorPickerDialog(
|
|
||||||
title = title,
|
|
||||||
onSelected = {
|
|
||||||
preference.value = it
|
|
||||||
},
|
|
||||||
initialColor = initialColor
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onLongClick = { preference.value = Color.Unspecified },
|
|
||||||
action = {
|
|
||||||
val prefValue by preference.collectAsState()
|
|
||||||
if (prefValue != Color.Unspecified || unsetColor != Color.Unspecified) {
|
|
||||||
val borderColor = MaterialTheme.colors.onBackground.copy(alpha = 0.54f)
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(4.dp)
|
|
||||||
.size(32.dp)
|
|
||||||
.clip(CircleShape)
|
|
||||||
.background(color = initialColor)
|
|
||||||
.border(BorderStroke(1.dp, borderColor), CircleShape)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun <T> ChoiceDialog(
|
|
||||||
items: List<Pair<T, String>>,
|
|
||||||
selected: T?,
|
|
||||||
onDismissRequest: () -> Unit = {},
|
|
||||||
onSelected: (T) -> Unit,
|
|
||||||
title: String,
|
|
||||||
buttons: @Composable (AppWindow) -> Unit = { }
|
|
||||||
) {
|
|
||||||
WindowDialog(onDismissRequest = onDismissRequest, buttons = buttons, title = title, content = {
|
|
||||||
LazyColumn {
|
|
||||||
items(items) { (value, text) ->
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable(
|
|
||||||
onClick = {
|
|
||||||
onSelected(value)
|
|
||||||
it.close()
|
|
||||||
}),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
RadioButton(
|
|
||||||
selected = value == selected,
|
|
||||||
onClick = {
|
|
||||||
onSelected(value)
|
|
||||||
it.close()
|
|
||||||
},
|
|
||||||
)
|
|
||||||
Text(text = text, modifier = Modifier.padding(start = 24.dp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun Pref(
|
|
||||||
title: String,
|
title: String,
|
||||||
icon: ImageVector? = null,
|
icon: ImageVector? = null,
|
||||||
onClick: () -> Unit = {},
|
onClick: () -> Unit = {},
|
||||||
@@ -213,13 +102,13 @@ fun Pref(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SwitchPref(
|
fun SwitchPreference(
|
||||||
preference: PreferenceMutableStateFlow<Boolean>,
|
preference: PreferenceMutableStateFlow<Boolean>,
|
||||||
title: String,
|
title: String,
|
||||||
subtitle: String? = null,
|
subtitle: String? = null,
|
||||||
icon: ImageVector? = null,
|
icon: ImageVector? = null,
|
||||||
) {
|
) {
|
||||||
Pref(
|
PreferenceRow(
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
icon = icon,
|
icon = icon,
|
||||||
@@ -232,14 +121,14 @@ fun SwitchPref(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun EditTextPref(
|
fun EditTextPreference(
|
||||||
preference: PreferenceMutableStateFlow<String>,
|
preference: PreferenceMutableStateFlow<String>,
|
||||||
title: String,
|
title: String,
|
||||||
subtitle: String? = null,
|
subtitle: String? = null,
|
||||||
icon: ImageVector? = null
|
icon: ImageVector? = null
|
||||||
) {
|
) {
|
||||||
var editText by remember { mutableStateOf(TextFieldValue(preference.value)) }
|
var editText by remember { mutableStateOf(TextFieldValue(preference.value)) }
|
||||||
Pref(
|
PreferenceRow(
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
icon = icon,
|
icon = icon,
|
||||||
@@ -257,3 +146,98 @@ fun EditTextPref(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun <Key> ChoicePreference(
|
||||||
|
preference: PreferenceMutableStateFlow<Key>,
|
||||||
|
choices: Map<Key, String>,
|
||||||
|
title: String,
|
||||||
|
subtitle: String? = null
|
||||||
|
) {
|
||||||
|
val prefValue by preference.collectAsState()
|
||||||
|
PreferenceRow(
|
||||||
|
title = title,
|
||||||
|
subtitle = if (subtitle == null) choices[prefValue] else null,
|
||||||
|
onClick = {
|
||||||
|
ChoiceDialog(
|
||||||
|
items = choices.toList(),
|
||||||
|
selected = prefValue,
|
||||||
|
title = title,
|
||||||
|
onSelected = { selected ->
|
||||||
|
preference.value = selected
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun <T> ChoiceDialog(
|
||||||
|
items: List<Pair<T, String>>,
|
||||||
|
selected: T?,
|
||||||
|
onDismissRequest: () -> Unit = {},
|
||||||
|
onSelected: (T) -> Unit,
|
||||||
|
title: String,
|
||||||
|
buttons: @Composable (AppWindow) -> Unit = { }
|
||||||
|
) {
|
||||||
|
WindowDialog(onDismissRequest = onDismissRequest, buttons = buttons, title = title, content = {
|
||||||
|
LazyColumn {
|
||||||
|
items(items) { (value, text) ->
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.requiredHeight(48.dp).fillMaxWidth().clickable(
|
||||||
|
onClick = {
|
||||||
|
onSelected(value)
|
||||||
|
it.close()
|
||||||
|
}),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
RadioButton(
|
||||||
|
selected = value == selected,
|
||||||
|
onClick = {
|
||||||
|
onSelected(value)
|
||||||
|
it.close()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
Text(text = text, modifier = Modifier.padding(start = 24.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ColorPreference(
|
||||||
|
preference: PreferenceMutableStateFlow<Color>,
|
||||||
|
title: String,
|
||||||
|
subtitle: String? = null,
|
||||||
|
unsetColor: Color = Color.Unspecified
|
||||||
|
) {
|
||||||
|
val initialColor = preference.value.takeOrElse { unsetColor }
|
||||||
|
PreferenceRow(
|
||||||
|
title = title,
|
||||||
|
subtitle = subtitle,
|
||||||
|
onClick = {
|
||||||
|
ColorPickerDialog(
|
||||||
|
title = title,
|
||||||
|
onSelected = {
|
||||||
|
preference.value = it
|
||||||
|
},
|
||||||
|
initialColor = initialColor
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onLongClick = { preference.value = Color.Unspecified },
|
||||||
|
action = {
|
||||||
|
val prefValue by preference.collectAsState()
|
||||||
|
if (prefValue != Color.Unspecified || unsetColor != Color.Unspecified) {
|
||||||
|
val borderColor = MaterialTheme.colors.onBackground.copy(alpha = 0.54f)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(4.dp)
|
||||||
|
.size(32.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(color = initialColor)
|
||||||
|
.border(BorderStroke(1.dp, borderColor), CircleShape)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,18 +4,12 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -23,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsAdvancedScreen(navController: BackStack<Route>) {
|
fun SettingsAdvancedScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Advanced Settings", navController, true)
|
Toolbar("Advanced Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,6 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
@@ -20,6 +14,7 @@ import androidx.compose.foundation.layout.PaddingValues
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.CornerSize
|
import androidx.compose.foundation.shape.CornerSize
|
||||||
@@ -38,7 +33,8 @@ import androidx.compose.ui.unit.sp
|
|||||||
import ca.gosyer.data.ui.UiPreferences
|
import ca.gosyer.data.ui.UiPreferences
|
||||||
import ca.gosyer.data.ui.model.ThemeMode
|
import ca.gosyer.data.ui.model.ThemeMode
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
import ca.gosyer.ui.base.prefs.ChoicePreference
|
||||||
|
import ca.gosyer.ui.base.prefs.ColorPreference
|
||||||
import ca.gosyer.ui.base.theme.AppColorsPreferenceState
|
import ca.gosyer.ui.base.theme.AppColorsPreferenceState
|
||||||
import ca.gosyer.ui.base.theme.Theme
|
import ca.gosyer.ui.base.theme.Theme
|
||||||
import ca.gosyer.ui.base.theme.asStateFlow
|
import ca.gosyer.ui.base.theme.asStateFlow
|
||||||
@@ -79,8 +75,9 @@ fun SettingsAppearance(navController: BackStack<Route>) {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Appearance Settings", navController, true)
|
Toolbar("Appearance Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
ChoicePref(
|
item {
|
||||||
|
ChoicePreference(
|
||||||
preference = vm.themeMode,
|
preference = vm.themeMode,
|
||||||
choices = mapOf(
|
choices = mapOf(
|
||||||
//ThemeMode.System to R.string.follow_system_settings,
|
//ThemeMode.System to R.string.follow_system_settings,
|
||||||
@@ -89,6 +86,8 @@ fun SettingsAppearance(navController: BackStack<Route>) {
|
|||||||
),
|
),
|
||||||
title = "Theme"
|
title = "Theme"
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
item {
|
||||||
Text(
|
Text(
|
||||||
"Preset themes",
|
"Preset themes",
|
||||||
modifier = Modifier.padding(start = 16.dp, top = 16.dp, bottom = 4.dp)
|
modifier = Modifier.padding(start = 16.dp, top = 16.dp, bottom = 4.dp)
|
||||||
@@ -102,18 +101,23 @@ fun SettingsAppearance(navController: BackStack<Route>) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ColorPref(
|
}
|
||||||
|
item {
|
||||||
|
ColorPreference(
|
||||||
preference = activeColors.primaryStateFlow, title = "Color primary",
|
preference = activeColors.primaryStateFlow, title = "Color primary",
|
||||||
subtitle = "Displayed most frequently across your app",
|
subtitle = "Displayed most frequently across your app",
|
||||||
unsetColor = MaterialTheme.colors.primary
|
unsetColor = MaterialTheme.colors.primary
|
||||||
)
|
)
|
||||||
ColorPref(
|
}
|
||||||
|
item {
|
||||||
|
ColorPreference(
|
||||||
preference = activeColors.secondaryStateFlow, title = "Color secondary",
|
preference = activeColors.secondaryStateFlow, title = "Color secondary",
|
||||||
subtitle = "Accents select parts of the UI",
|
subtitle = "Accents select parts of the UI",
|
||||||
unsetColor = MaterialTheme.colors.secondary
|
unsetColor = MaterialTheme.colors.secondary
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsBackupScreen(navController: BackStack<Route>) {
|
fun SettingsBackupScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Backup Settings", navController, true)
|
Toolbar("Backup Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsBrowseScreen(navController: BackStack<Route>) {
|
fun SettingsBrowseScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Browse Settings", navController, true)
|
Toolbar("Browse Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsDownloadsScreen(navController: BackStack<Route>) {
|
fun SettingsDownloadsScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Download Settings", navController, true)
|
Toolbar("Download Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,22 +4,17 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.material.Divider
|
import androidx.compose.material.Divider
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.data.ui.UiPreferences
|
import ca.gosyer.data.ui.UiPreferences
|
||||||
import ca.gosyer.data.ui.model.StartScreen
|
import ca.gosyer.data.ui.model.StartScreen
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
import ca.gosyer.ui.base.prefs.ChoicePreference
|
||||||
import ca.gosyer.ui.base.prefs.SwitchPref
|
import ca.gosyer.ui.base.prefs.SwitchPreference
|
||||||
import ca.gosyer.ui.base.vm.ViewModel
|
import ca.gosyer.ui.base.vm.ViewModel
|
||||||
import ca.gosyer.ui.base.vm.viewModel
|
import ca.gosyer.ui.base.vm.viewModel
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
@@ -73,8 +68,9 @@ fun SettingsGeneralScreen(navController: BackStack<Route>) {
|
|||||||
val vm = viewModel<SettingsGeneralViewModel>()
|
val vm = viewModel<SettingsGeneralViewModel>()
|
||||||
Column {
|
Column {
|
||||||
Toolbar("General Settings", navController, true)
|
Toolbar("General Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
ChoicePref(
|
item {
|
||||||
|
ChoicePreference(
|
||||||
preference = vm.startScreen,
|
preference = vm.startScreen,
|
||||||
title = "Start Screen",
|
title = "Start Screen",
|
||||||
choices = mapOf(
|
choices = mapOf(
|
||||||
@@ -83,18 +79,27 @@ fun SettingsGeneralScreen(navController: BackStack<Route>) {
|
|||||||
StartScreen.Extensions to "Extensions",
|
StartScreen.Extensions to "Extensions",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
SwitchPref(preference = vm.confirmExit, title = "Confirm Exit")
|
}
|
||||||
|
item {
|
||||||
|
SwitchPreference(preference = vm.confirmExit, title = "Confirm Exit")
|
||||||
|
}
|
||||||
|
item {
|
||||||
Divider()
|
Divider()
|
||||||
ChoicePref(
|
}
|
||||||
|
item {
|
||||||
|
ChoicePreference(
|
||||||
preference = vm.language,
|
preference = vm.language,
|
||||||
title = "Language",
|
title = "Language",
|
||||||
choices = vm.getLanguageChoices(),
|
choices = vm.getLanguageChoices(),
|
||||||
)
|
)
|
||||||
ChoicePref(
|
}
|
||||||
|
item {
|
||||||
|
ChoicePreference(
|
||||||
preference = vm.dateFormat,
|
preference = vm.dateFormat,
|
||||||
title = "Date Format",
|
title = "Date Format",
|
||||||
choices = vm.getDateChoices()
|
choices = vm.getDateChoices()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,14 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.data.library.LibraryPreferences
|
import ca.gosyer.data.library.LibraryPreferences
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
import ca.gosyer.ui.base.prefs.SwitchPreference
|
||||||
import ca.gosyer.ui.base.prefs.SwitchPref
|
|
||||||
import ca.gosyer.ui.base.vm.ViewModel
|
import ca.gosyer.ui.base.vm.ViewModel
|
||||||
import ca.gosyer.ui.base.vm.viewModel
|
import ca.gosyer.ui.base.vm.viewModel
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
@@ -37,8 +31,10 @@ fun SettingsLibraryScreen(navController: BackStack<Route>) {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Library Settings", navController, true)
|
Toolbar("Library Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
SwitchPref(preference = vm.showAllCategory, title = "Show all category")
|
item {
|
||||||
|
SwitchPreference(preference = vm.showAllCategory, title = "Show all category")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsParentalControlsScreen(navController: BackStack<Route>) {
|
fun SettingsParentalControlsScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Parental Control Settings", navController, true)
|
Toolbar("Parental Control Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsReaderScreen(navController: BackStack<Route>) {
|
fun SettingsReaderScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Reader Settings", navController, true)
|
Toolbar("Reader Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,13 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.Pref
|
import ca.gosyer.ui.base.prefs.PreferenceRow
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
import compose.icons.FontAwesomeIcons
|
import compose.icons.FontAwesomeIcons
|
||||||
@@ -27,68 +21,91 @@ import compose.icons.fontawesomeicons.regular.Edit
|
|||||||
fun SettingsScreen(navController: BackStack<Route>) {
|
fun SettingsScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Settings", closable = false)
|
Toolbar("Settings", closable = false)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
Pref(
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "General",
|
title = "General",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsGeneral) }
|
onClick = { navController.push(Route.SettingsGeneral) }
|
||||||
)
|
)
|
||||||
Pref(
|
}
|
||||||
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Appearance",
|
title = "Appearance",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsAppearance) }
|
onClick = { navController.push(Route.SettingsAppearance) }
|
||||||
)
|
)
|
||||||
Pref(
|
}
|
||||||
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Server",
|
title = "Server",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsServer) }
|
onClick = { navController.push(Route.SettingsServer) }
|
||||||
)
|
)
|
||||||
Pref(
|
}
|
||||||
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Library",
|
title = "Library",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsLibrary) }
|
onClick = { navController.push(Route.SettingsLibrary) }
|
||||||
)
|
)
|
||||||
Pref(
|
}
|
||||||
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Reader",
|
title = "Reader",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsReader) }
|
onClick = { navController.push(Route.SettingsReader) }
|
||||||
)
|
)
|
||||||
/*Pref(
|
}
|
||||||
|
/*item {
|
||||||
|
Pref(
|
||||||
title = "Downloads",
|
title = "Downloads",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsDownloads) }
|
onClick = { navController.push(Route.SettingsDownloads) }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
item {
|
||||||
Pref(
|
Pref(
|
||||||
title = "Tracking",
|
title = "Tracking",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsTracking) }
|
onClick = { navController.push(Route.SettingsTracking) }
|
||||||
)
|
)
|
||||||
*/
|
}*/
|
||||||
Pref(
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Browse",
|
title = "Browse",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsBrowse) }
|
onClick = { navController.push(Route.SettingsBrowse) }
|
||||||
)
|
)
|
||||||
Pref(
|
}
|
||||||
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Backup",
|
title = "Backup",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsBackup) }
|
onClick = { navController.push(Route.SettingsBackup) }
|
||||||
)
|
)
|
||||||
/*Pref(
|
}
|
||||||
|
/*item {
|
||||||
|
Pref(
|
||||||
title = "Security",
|
title = "Security",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsSecurity) }
|
onClick = { navController.push(Route.SettingsSecurity) }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
item {
|
||||||
Pref(
|
Pref(
|
||||||
title = "Parental Controls",
|
title = "Parental Controls",
|
||||||
icon = FontAwesomeIcons.Regular.User,
|
icon = FontAwesomeIcons.Regular.User,
|
||||||
onClick = { navController.push(Route.SettingsParentalControls) }
|
onClick = { navController.push(Route.SettingsParentalControls) }
|
||||||
)*/
|
)
|
||||||
Pref(
|
}*/
|
||||||
|
item {
|
||||||
|
PreferenceRow(
|
||||||
title = "Advanced",
|
title = "Advanced",
|
||||||
icon = FontAwesomeIcons.Regular.Edit,
|
icon = FontAwesomeIcons.Regular.Edit,
|
||||||
onClick = { navController.push(Route.SettingsAdvanced) }
|
onClick = { navController.push(Route.SettingsAdvanced) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsSecurityScreen(navController: BackStack<Route>) {
|
fun SettingsSecurityScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Security Settings", navController, true)
|
Toolbar("Security Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import ca.gosyer.data.server.ServerPreferences
|
import ca.gosyer.data.server.ServerPreferences
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.EditTextPref
|
import ca.gosyer.ui.base.prefs.EditTextPreference
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
import ca.gosyer.ui.base.prefs.SwitchPreference
|
||||||
import ca.gosyer.ui.base.prefs.SwitchPref
|
|
||||||
import ca.gosyer.ui.base.prefs.asStateIn
|
import ca.gosyer.ui.base.prefs.asStateIn
|
||||||
import ca.gosyer.ui.base.vm.ViewModel
|
import ca.gosyer.ui.base.vm.ViewModel
|
||||||
import ca.gosyer.ui.base.vm.viewModel
|
import ca.gosyer.ui.base.vm.viewModel
|
||||||
@@ -33,9 +33,11 @@ fun SettingsServerScreen(navController: BackStack<Route>) {
|
|||||||
val vm = viewModel<SettingsServerViewModel>()
|
val vm = viewModel<SettingsServerViewModel>()
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Server Settings", navController, true)
|
Toolbar("Server Settings", navController, true)
|
||||||
SwitchPref(preference = vm.host, title = "Host server inside TachideskJUI")
|
SwitchPreference(preference = vm.host, title = "Host server inside TachideskJUI")
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
EditTextPref(vm.serverUrl, "Server Url", subtitle = vm.serverUrl.collectAsState().value)
|
item {
|
||||||
|
EditTextPreference(vm.serverUrl, "Server Url", subtitle = vm.serverUrl.collectAsState().value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
package ca.gosyer.ui.settings
|
package ca.gosyer.ui.settings
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import ca.gosyer.ui.base.components.Toolbar
|
import ca.gosyer.ui.base.components.Toolbar
|
||||||
import ca.gosyer.ui.base.prefs.PreferencesScrollableColumn
|
|
||||||
import ca.gosyer.ui.main.Route
|
import ca.gosyer.ui.main.Route
|
||||||
import com.github.zsoltk.compose.router.BackStack
|
import com.github.zsoltk.compose.router.BackStack
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import com.github.zsoltk.compose.router.BackStack
|
|||||||
fun SettingsTrackingScreen(navController: BackStack<Route>) {
|
fun SettingsTrackingScreen(navController: BackStack<Route>) {
|
||||||
Column {
|
Column {
|
||||||
Toolbar("Tracking Settings", navController, true)
|
Toolbar("Tracking Settings", navController, true)
|
||||||
PreferencesScrollableColumn {
|
LazyColumn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user