Migrate SettingsMainController to Compose

This commit is contained in:
arkon
2022-04-26 22:41:42 -04:00
parent 2752540330
commit a4a4503311
6 changed files with 122 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
package eu.kanade.presentation.more
package eu.kanade.presentation.more.about
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
@@ -17,6 +17,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.components.LinkIcon
import eu.kanade.presentation.components.PreferenceRow
import eu.kanade.presentation.more.LogoHeader
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.updater.RELEASE_URL

View File

@@ -1,4 +1,4 @@
package eu.kanade.presentation.more
package eu.kanade.presentation.more.about
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme

View File

@@ -0,0 +1,37 @@
package eu.kanade.presentation.more.settings
import androidx.annotation.StringRes
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.components.PreferenceRow
@Composable
fun SettingsMainScreen(
nestedScrollInterop: NestedScrollConnection,
sections: List<SettingsSection>,
) {
LazyColumn(
modifier = Modifier.nestedScroll(nestedScrollInterop),
) {
sections.map {
item {
PreferenceRow(
title = stringResource(it.titleRes),
painter = it.painter,
onClick = it.onClick,
)
}
}
}
}
data class SettingsSection(
@StringRes val titleRes: Int,
val painter: Painter,
val onClick: () -> Unit,
)