Remove top app bar scroll behavior
This lets us make it more consistent with the Compose screens for now. Maybe it'll return in the future.
This also includes making the AboutController a full Compose controller with a new abstracted TopAppBar composable.
(cherry picked from commit 80c7a45328)
# Conflicts:
# app/src/main/java/eu/kanade/presentation/category/components/CategoryTopAppBar.kt
# app/src/main/java/eu/kanade/presentation/more/about/AboutScreen.kt
This commit is contained in:
@@ -13,10 +13,10 @@ import eu.kanade.presentation.category.components.CategoryCreateDialog
|
||||
import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
||||
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
|
||||
import eu.kanade.presentation.category.components.CategoryRenameDialog
|
||||
import eu.kanade.presentation.category.components.CategoryTopAppBar
|
||||
import eu.kanade.presentation.components.EmptyScreen
|
||||
import eu.kanade.presentation.components.LoadingScreen
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.presentation.components.TopAppBar
|
||||
import eu.kanade.presentation.util.horizontalPadding
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.presentation.util.topPaddingValues
|
||||
@@ -35,9 +35,9 @@ fun CategoryScreen(
|
||||
Scaffold(
|
||||
modifier = Modifier.statusBarsPadding(),
|
||||
topBar = {
|
||||
CategoryTopAppBar(
|
||||
TopAppBar(
|
||||
title = stringResource(R.string.action_edit_categories),
|
||||
navigateUp = navigateUp,
|
||||
title = stringResource(id = R.string.action_edit_categories),
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
|
||||
@@ -11,11 +11,11 @@ import androidx.compose.ui.res.stringResource
|
||||
import eu.kanade.presentation.category.components.CategoryCreateDialog
|
||||
import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
||||
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
|
||||
import eu.kanade.presentation.category.components.CategoryTopAppBar
|
||||
import eu.kanade.presentation.category.components.genre.SortTagContent
|
||||
import eu.kanade.presentation.components.EmptyScreen
|
||||
import eu.kanade.presentation.components.LoadingScreen
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.presentation.components.TopAppBar
|
||||
import eu.kanade.presentation.util.horizontalPadding
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.presentation.util.topPaddingValues
|
||||
@@ -35,9 +35,9 @@ fun SortTagScreen(
|
||||
modifier = Modifier
|
||||
.statusBarsPadding(),
|
||||
topBar = {
|
||||
CategoryTopAppBar(
|
||||
TopAppBar(
|
||||
navigateUp = navigateUp,
|
||||
title = stringResource(id = R.string.action_edit_tags),
|
||||
title = stringResource(R.string.action_edit_tags),
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
|
||||
@@ -12,11 +12,11 @@ import eu.kanade.presentation.category.components.CategoryCreateDialog
|
||||
import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
||||
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
|
||||
import eu.kanade.presentation.category.components.CategoryRenameDialog
|
||||
import eu.kanade.presentation.category.components.CategoryTopAppBar
|
||||
import eu.kanade.presentation.category.components.sources.SourceCategoryContent
|
||||
import eu.kanade.presentation.components.EmptyScreen
|
||||
import eu.kanade.presentation.components.LoadingScreen
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.presentation.components.TopAppBar
|
||||
import eu.kanade.presentation.util.horizontalPadding
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.presentation.util.topPaddingValues
|
||||
@@ -36,9 +36,9 @@ fun SourceCategoryScreen(
|
||||
modifier = Modifier
|
||||
.statusBarsPadding(),
|
||||
topBar = {
|
||||
CategoryTopAppBar(
|
||||
TopAppBar(
|
||||
navigateUp = navigateUp,
|
||||
title = stringResource(id = R.string.action_edit_categories),
|
||||
title = stringResource(R.string.action_edit_categories),
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
|
||||
@@ -11,11 +11,11 @@ import androidx.compose.ui.res.stringResource
|
||||
import eu.kanade.presentation.category.components.CategoryCreateDialog
|
||||
import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
||||
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
|
||||
import eu.kanade.presentation.category.components.CategoryTopAppBar
|
||||
import eu.kanade.presentation.category.components.repo.SourceRepoContent
|
||||
import eu.kanade.presentation.components.EmptyScreen
|
||||
import eu.kanade.presentation.components.LoadingScreen
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.presentation.components.TopAppBar
|
||||
import eu.kanade.presentation.util.horizontalPadding
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.presentation.util.topPaddingValues
|
||||
@@ -35,7 +35,7 @@ fun SourceRepoScreen(
|
||||
modifier = Modifier
|
||||
.statusBarsPadding(),
|
||||
topBar = {
|
||||
CategoryTopAppBar(
|
||||
TopAppBar(
|
||||
navigateUp = navigateUp,
|
||||
title = stringResource(R.string.action_edit_repos),
|
||||
)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package eu.kanade.presentation.category.components
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.SmallTopAppBar
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
@Composable
|
||||
fun CategoryTopAppBar(
|
||||
navigateUp: () -> Unit,
|
||||
title: String,
|
||||
) {
|
||||
SmallTopAppBar(
|
||||
navigationIcon = {
|
||||
IconButton(onClick = navigateUp) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.ArrowBack,
|
||||
contentDescription = stringResource(R.string.abc_action_bar_up_description),
|
||||
)
|
||||
}
|
||||
},
|
||||
title = {
|
||||
Text(text = title)
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package eu.kanade.presentation.components
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.SmallTopAppBar
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -19,6 +22,30 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
@Composable
|
||||
fun TopAppBar(
|
||||
title: String?,
|
||||
subtitle: String? = null,
|
||||
navigateUp: () -> Unit,
|
||||
navigationIcon: ImageVector = Icons.Default.ArrowBack,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
) {
|
||||
SmallTopAppBar(
|
||||
navigationIcon = {
|
||||
IconButton(onClick = navigateUp) {
|
||||
Icon(
|
||||
imageVector = navigationIcon,
|
||||
contentDescription = stringResource(R.string.abc_action_bar_up_description),
|
||||
)
|
||||
}
|
||||
},
|
||||
title = {
|
||||
AppBarTitle(title, subtitle)
|
||||
},
|
||||
actions = actions,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AppBarTitle(
|
||||
title: String?,
|
||||
|
||||
@@ -6,20 +6,21 @@ import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.asPaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.statusBarsPadding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Public
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
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.components.Scaffold
|
||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||
import eu.kanade.presentation.components.TopAppBar
|
||||
import eu.kanade.presentation.more.LogoHeader
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
@@ -29,7 +30,7 @@ import exh.syDebugVersion
|
||||
|
||||
@Composable
|
||||
fun AboutScreen(
|
||||
nestedScrollInterop: NestedScrollConnection,
|
||||
navigateUp: () -> Unit,
|
||||
checkVersion: () -> Unit,
|
||||
getFormattedBuildTime: () -> String,
|
||||
onClickLicenses: () -> Unit,
|
||||
@@ -38,110 +39,119 @@ fun AboutScreen(
|
||||
val context = LocalContext.current
|
||||
val uriHandler = LocalUriHandler.current
|
||||
|
||||
ScrollbarLazyColumn(
|
||||
modifier = Modifier.nestedScroll(nestedScrollInterop),
|
||||
contentPadding = WindowInsets.navigationBars.asPaddingValues(),
|
||||
) {
|
||||
item {
|
||||
LogoHeader()
|
||||
}
|
||||
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.version),
|
||||
subtitle = when {
|
||||
BuildConfig.DEBUG -> {
|
||||
"Debug ${BuildConfig.COMMIT_SHA} (${getFormattedBuildTime()})"
|
||||
}
|
||||
// SY -->
|
||||
syDebugVersion != "0" -> {
|
||||
"Preview r$syDebugVersion (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"
|
||||
}
|
||||
// SY <--
|
||||
else -> {
|
||||
"Stable ${BuildConfig.VERSION_NAME} (${getFormattedBuildTime()})"
|
||||
}
|
||||
},
|
||||
onClick = {
|
||||
val deviceInfo = CrashLogUtil(context).getDebugInfo()
|
||||
context.copyToClipboard("Debug information", deviceInfo)
|
||||
},
|
||||
Scaffold(
|
||||
modifier = Modifier.statusBarsPadding(),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = stringResource(R.string.pref_category_about),
|
||||
navigateUp = navigateUp,
|
||||
)
|
||||
}
|
||||
},
|
||||
) { paddingValues ->
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = WindowInsets.navigationBars.asPaddingValues(),
|
||||
) {
|
||||
item {
|
||||
LogoHeader()
|
||||
}
|
||||
|
||||
if (BuildConfig.INCLUDE_UPDATER) {
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.check_for_updates),
|
||||
onClick = checkVersion,
|
||||
title = stringResource(R.string.version),
|
||||
subtitle = when {
|
||||
BuildConfig.DEBUG -> {
|
||||
"Debug ${BuildConfig.COMMIT_SHA} (${getFormattedBuildTime()})"
|
||||
}
|
||||
// SY -->
|
||||
syDebugVersion != "0" -> {
|
||||
"Preview r$syDebugVersion (${BuildConfig.COMMIT_SHA}, ${getFormattedBuildTime()})"
|
||||
}
|
||||
// SY <--
|
||||
else -> {
|
||||
"Stable ${BuildConfig.VERSION_NAME} (${getFormattedBuildTime()})"
|
||||
}
|
||||
},
|
||||
onClick = {
|
||||
val deviceInfo = CrashLogUtil(context).getDebugInfo()
|
||||
context.copyToClipboard("Debug information", deviceInfo)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
if (!BuildConfig.DEBUG) {
|
||||
|
||||
if (BuildConfig.INCLUDE_UPDATER) {
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.check_for_updates),
|
||||
onClick = checkVersion,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (!BuildConfig.DEBUG) {
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.whats_new),
|
||||
onClick = onClickWhatsNew,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.whats_new),
|
||||
onClick = onClickWhatsNew,
|
||||
title = stringResource(R.string.help_translate),
|
||||
onClick = { uriHandler.openUri("https://tachiyomi.org/help/contribution/#translation") },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.help_translate),
|
||||
onClick = { uriHandler.openUri("https://tachiyomi.org/help/contribution/#translation") },
|
||||
)
|
||||
}
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.licenses),
|
||||
onClick = onClickLicenses,
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.licenses),
|
||||
onClick = onClickLicenses,
|
||||
)
|
||||
}
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.privacy_policy),
|
||||
onClick = { uriHandler.openUri("https://tachiyomi.org/privacy") },
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
PreferenceRow(
|
||||
title = stringResource(R.string.privacy_policy),
|
||||
onClick = { uriHandler.openUri("https://tachiyomi.org/privacy") },
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
) {
|
||||
LinkIcon(
|
||||
label = stringResource(R.string.website),
|
||||
painter = rememberVectorPainter(Icons.Outlined.Public),
|
||||
url = "https://tachiyomi.org",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Discord",
|
||||
painter = painterResource(R.drawable.ic_discord_24dp),
|
||||
url = "https://discord.gg/tachiyomi",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Twitter",
|
||||
painter = painterResource(R.drawable.ic_twitter_24dp),
|
||||
url = "https://twitter.com/tachiyomiorg",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Facebook",
|
||||
painter = painterResource(R.drawable.ic_facebook_24dp),
|
||||
url = "https://facebook.com/tachiyomiorg",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Reddit",
|
||||
painter = painterResource(R.drawable.ic_reddit_24dp),
|
||||
url = "https://www.reddit.com/r/Tachiyomi",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "GitHub",
|
||||
painter = painterResource(R.drawable.ic_github_24dp),
|
||||
url = "https://github.com/jobobby04/tachiyomisy",
|
||||
)
|
||||
item {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
) {
|
||||
LinkIcon(
|
||||
label = stringResource(R.string.website),
|
||||
painter = rememberVectorPainter(Icons.Outlined.Public),
|
||||
url = "https://tachiyomi.org",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Discord",
|
||||
painter = painterResource(R.drawable.ic_discord_24dp),
|
||||
url = "https://discord.gg/tachiyomi",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Twitter",
|
||||
painter = painterResource(R.drawable.ic_twitter_24dp),
|
||||
url = "https://twitter.com/tachiyomiorg",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Facebook",
|
||||
painter = painterResource(R.drawable.ic_facebook_24dp),
|
||||
url = "https://facebook.com/tachiyomiorg",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "Reddit",
|
||||
painter = painterResource(R.drawable.ic_reddit_24dp),
|
||||
url = "https://www.reddit.com/r/Tachiyomi",
|
||||
)
|
||||
LinkIcon(
|
||||
label = "GitHub",
|
||||
painter = painterResource(R.drawable.ic_github_24dp),
|
||||
url = "https://github.com/jobobby04/tachiyomisy",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,7 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.ArrowForward
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.SmallTopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -28,7 +25,7 @@ import com.google.accompanist.web.rememberWebViewNavigator
|
||||
import com.google.accompanist.web.rememberWebViewState
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.AppBarActions
|
||||
import eu.kanade.presentation.components.AppBarTitle
|
||||
import eu.kanade.presentation.components.TopAppBar
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
||||
@@ -48,21 +45,11 @@ fun WebViewScreen(
|
||||
val navigator = rememberWebViewNavigator()
|
||||
|
||||
Column {
|
||||
SmallTopAppBar(
|
||||
title = {
|
||||
AppBarTitle(
|
||||
title = state.pageTitle ?: initialTitle,
|
||||
subtitle = state.content.getCurrentUrl(),
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onUp) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Close,
|
||||
contentDescription = stringResource(R.string.action_close),
|
||||
)
|
||||
}
|
||||
},
|
||||
TopAppBar(
|
||||
title = state.pageTitle ?: initialTitle,
|
||||
subtitle = state.content.getCurrentUrl(),
|
||||
navigateUp = onUp,
|
||||
navigationIcon = Icons.Default.Close,
|
||||
actions = {
|
||||
AppBarActions(
|
||||
listOf(
|
||||
|
||||
Reference in New Issue
Block a user