tachiyomi/app/src/main/java/eu/kanade/presentation/more/settings/screen/SearchableSettings.kt
arkon 46e734fc8e
Migrate to multiplatform string resources (#10147)
* Migrate to multiplatform string resources

* Move plurals translations into separate files

* Fix lint check on generated files
2023-11-18 13:54:56 -05:00

44 lines
1.3 KiB
Kotlin

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
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.PreferenceScaffold
import eu.kanade.presentation.util.LocalBackPress
interface SearchableSettings : Screen {
@Composable
@ReadOnlyComposable
fun getTitleRes(): StringResource
@Composable
fun getPreferences(): List<Preference>
@Composable
fun RowScope.AppBarAction() {
}
@Composable
override fun Content() {
val handleBack = LocalBackPress.current
PreferenceScaffold(
titleRes = getTitleRes(),
onBackPressed = if (handleBack != null) handleBack::invoke else null,
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
}
}