mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-27 09:44:55 +03:00
Migrate licenses screen to full Compose
This commit is contained in:
parent
80c7a45328
commit
1b2c12385f
6 changed files with 49 additions and 36 deletions
|
@ -13,10 +13,10 @@ import eu.kanade.presentation.category.components.CategoryCreateDialog
|
||||||
import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
||||||
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
|
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
|
||||||
import eu.kanade.presentation.category.components.CategoryRenameDialog
|
import eu.kanade.presentation.category.components.CategoryRenameDialog
|
||||||
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.EmptyScreen
|
import eu.kanade.presentation.components.EmptyScreen
|
||||||
import eu.kanade.presentation.components.LoadingScreen
|
import eu.kanade.presentation.components.LoadingScreen
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.components.TopAppBar
|
|
||||||
import eu.kanade.presentation.util.horizontalPadding
|
import eu.kanade.presentation.util.horizontalPadding
|
||||||
import eu.kanade.presentation.util.plus
|
import eu.kanade.presentation.util.plus
|
||||||
import eu.kanade.presentation.util.topPaddingValues
|
import eu.kanade.presentation.util.topPaddingValues
|
||||||
|
@ -35,7 +35,7 @@ fun CategoryScreen(
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = Modifier.statusBarsPadding(),
|
modifier = Modifier.statusBarsPadding(),
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
AppBar(
|
||||||
title = stringResource(R.string.action_edit_categories),
|
title = stringResource(R.string.action_edit_categories),
|
||||||
navigateUp = navigateUp,
|
navigateUp = navigateUp,
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,24 +23,27 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TopAppBar(
|
fun AppBar(
|
||||||
title: String?,
|
title: String?,
|
||||||
subtitle: String? = null,
|
subtitle: String? = null,
|
||||||
navigateUp: () -> Unit,
|
navigateUp: (() -> Unit)? = null,
|
||||||
navigationIcon: ImageVector = Icons.Default.ArrowBack,
|
navigationIcon: ImageVector = Icons.Default.ArrowBack,
|
||||||
actions: @Composable RowScope.() -> Unit = {},
|
actions: @Composable RowScope.() -> Unit = {},
|
||||||
) {
|
) {
|
||||||
SmallTopAppBar(
|
SmallTopAppBar(
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = navigateUp) {
|
navigateUp?.let {
|
||||||
Icon(
|
IconButton(onClick = it) {
|
||||||
imageVector = navigationIcon,
|
Icon(
|
||||||
contentDescription = stringResource(R.string.abc_action_bar_up_description),
|
imageVector = navigationIcon,
|
||||||
)
|
contentDescription = stringResource(R.string.abc_action_bar_up_description),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
AppBarTitle(title, subtitle)
|
AppBarTitle(title, subtitle)
|
||||||
|
// TODO: incognito/downloaded only banners
|
||||||
},
|
},
|
||||||
actions = actions,
|
actions = actions,
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,11 +16,11 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.LinkIcon
|
import eu.kanade.presentation.components.LinkIcon
|
||||||
import eu.kanade.presentation.components.PreferenceRow
|
import eu.kanade.presentation.components.PreferenceRow
|
||||||
import eu.kanade.presentation.components.Scaffold
|
import eu.kanade.presentation.components.Scaffold
|
||||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||||
import eu.kanade.presentation.components.TopAppBar
|
|
||||||
import eu.kanade.presentation.more.LogoHeader
|
import eu.kanade.presentation.more.LogoHeader
|
||||||
import eu.kanade.presentation.util.plus
|
import eu.kanade.presentation.util.plus
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
|
@ -42,7 +42,7 @@ fun AboutScreen(
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = Modifier.statusBarsPadding(),
|
modifier = Modifier.statusBarsPadding(),
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
AppBar(
|
||||||
title = stringResource(R.string.pref_category_about),
|
title = stringResource(R.string.pref_category_about),
|
||||||
navigateUp = navigateUp,
|
navigateUp = navigateUp,
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,28 +4,41 @@ import androidx.compose.foundation.layout.WindowInsets
|
||||||
import androidx.compose.foundation.layout.asPaddingValues
|
import androidx.compose.foundation.layout.asPaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
import androidx.compose.foundation.layout.navigationBars
|
||||||
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|
||||||
import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
|
import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
|
||||||
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
|
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
|
||||||
|
import eu.kanade.presentation.components.AppBar
|
||||||
|
import eu.kanade.presentation.components.Scaffold
|
||||||
|
import eu.kanade.presentation.util.plus
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LicensesScreen(
|
fun LicensesScreen(
|
||||||
nestedScrollInterop: NestedScrollConnection,
|
navigateUp: () -> Unit,
|
||||||
) {
|
) {
|
||||||
LibrariesContainer(
|
Scaffold(
|
||||||
modifier = Modifier
|
modifier = Modifier.statusBarsPadding(),
|
||||||
.fillMaxSize()
|
topBar = {
|
||||||
.nestedScroll(nestedScrollInterop),
|
AppBar(
|
||||||
contentPadding = WindowInsets.navigationBars.asPaddingValues(),
|
title = stringResource(R.string.licenses),
|
||||||
colors = LibraryDefaults.libraryColors(
|
navigateUp = navigateUp,
|
||||||
backgroundColor = MaterialTheme.colorScheme.background,
|
)
|
||||||
contentColor = MaterialTheme.colorScheme.onBackground,
|
},
|
||||||
badgeBackgroundColor = MaterialTheme.colorScheme.primary,
|
) { paddingValues ->
|
||||||
badgeContentColor = MaterialTheme.colorScheme.onPrimary,
|
LibrariesContainer(
|
||||||
),
|
modifier = Modifier
|
||||||
)
|
.fillMaxSize(),
|
||||||
|
contentPadding = paddingValues + WindowInsets.navigationBars.asPaddingValues(),
|
||||||
|
colors = LibraryDefaults.libraryColors(
|
||||||
|
backgroundColor = MaterialTheme.colorScheme.background,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onBackground,
|
||||||
|
badgeBackgroundColor = MaterialTheme.colorScheme.primary,
|
||||||
|
badgeContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import com.google.accompanist.web.rememberWebViewNavigator
|
||||||
import com.google.accompanist.web.rememberWebViewState
|
import com.google.accompanist.web.rememberWebViewState
|
||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.AppBarActions
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.components.TopAppBar
|
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
||||||
|
@ -45,7 +44,7 @@ fun WebViewScreen(
|
||||||
val navigator = rememberWebViewNavigator()
|
val navigator = rememberWebViewNavigator()
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
TopAppBar(
|
AppBar(
|
||||||
title = state.pageTitle ?: initialTitle,
|
title = state.pageTitle ?: initialTitle,
|
||||||
subtitle = state.content.getCurrentUrl(),
|
subtitle = state.content.getCurrentUrl(),
|
||||||
navigateUp = onUp,
|
navigateUp = onUp,
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
package eu.kanade.tachiyomi.ui.more
|
package eu.kanade.tachiyomi.ui.more
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
|
||||||
import eu.kanade.presentation.more.about.LicensesScreen
|
import eu.kanade.presentation.more.about.LicensesScreen
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.ui.base.controller.BasicFullComposeController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.BasicComposeController
|
|
||||||
|
|
||||||
class LicensesController : BasicComposeController() {
|
class LicensesController : BasicFullComposeController() {
|
||||||
|
|
||||||
override fun getTitle() = resources?.getString(R.string.licenses)
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) {
|
override fun ComposeContent() {
|
||||||
LicensesScreen(nestedScrollInterop = nestedScrollInterop)
|
LicensesScreen(
|
||||||
|
navigateUp = router::popCurrentController,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue