2022-10-15 17:38:01 +02:00
|
|
|
package eu.kanade.presentation.more.settings.screen
|
|
|
|
|
|
|
|
import androidx.compose.foundation.layout.RowScope
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import androidx.compose.runtime.ReadOnlyComposable
|
|
|
|
import cafe.adriel.voyager.core.screen.Screen
|
2023-11-18 19:54:56 +01:00
|
|
|
import dev.icerock.moko.resources.StringResource
|
2022-10-15 17:38:01 +02:00
|
|
|
import eu.kanade.presentation.more.settings.Preference
|
|
|
|
import eu.kanade.presentation.more.settings.PreferenceScaffold
|
|
|
|
import eu.kanade.presentation.util.LocalBackPress
|
|
|
|
|
|
|
|
interface SearchableSettings : Screen {
|
2022-10-15 17:58:24 +02:00
|
|
|
|
2022-10-15 17:38:01 +02:00
|
|
|
@Composable
|
|
|
|
@ReadOnlyComposable
|
2023-11-18 19:54:56 +01:00
|
|
|
fun getTitleRes(): StringResource
|
2022-10-15 17:38:01 +02:00
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun getPreferences(): List<Preference>
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun RowScope.AppBarAction() {
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
override fun Content() {
|
2022-10-16 18:15:01 +02:00
|
|
|
val handleBack = LocalBackPress.current
|
2022-10-15 17:38:01 +02:00
|
|
|
PreferenceScaffold(
|
2022-10-15 17:58:24 +02:00
|
|
|
titleRes = getTitleRes(),
|
2022-10-16 18:15:01 +02:00
|
|
|
onBackPressed = if (handleBack != null) handleBack::invoke else null,
|
2022-10-15 17:38:01 +02:00
|
|
|
actions = { AppBarAction() },
|
|
|
|
itemsProvider = { getPreferences() },
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
// HACK: for the background blipping thingy.
|
|
|
|
// The title of the target PreferenceItem
|
|
|
|
// Set before showing the destination screen and reset after
|
|
|
|
// See BasePreferenceWidget.highlightBackground
|
|
|
|
var highlightKey: String? = null
|
|
|
|
}
|
|
|
|
}
|