diff --git a/app/build.gradle b/app/build.gradle index 6a99e36..8984b34 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "me.ash.reader" minSdk 26 targetSdk 32 - versionCode 4 - versionName "0.7.0" + versionCode 5 + versionName "0.7.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -53,10 +53,12 @@ android { } dependencies { + implementation 'com.caverock:androidsvg-aar:1.4' implementation 'com.github.ireward:compose-html:1.0.2' implementation 'be.ceau:opml-parser:2.2.0' implementation "androidx.profileinstaller:profileinstaller:1.2.0-alpha02" - implementation("io.coil-kt:coil-compose:2.0.0-rc02") + implementation("io.coil-kt:coil-svg:2.0.0-rc03") + implementation("io.coil-kt:coil-compose:2.0.0-rc03") implementation("androidx.compose.animation:animation-graphics:$compose_version") implementation("com.google.accompanist:accompanist-flowlayout:0.24.3-alpha") implementation("com.google.accompanist:accompanist-navigation-animation:0.24.3-alpha") diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 86e882c..d02ee9e 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 4, - "versionName": "0.7.0", + "versionCode": 5, + "versionName": "0.7.2", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/java/me/ash/reader/MainActivity.kt b/app/src/main/java/me/ash/reader/MainActivity.kt index cab6743..d51c87c 100644 --- a/app/src/main/java/me/ash/reader/MainActivity.kt +++ b/app/src/main/java/me/ash/reader/MainActivity.kt @@ -1,16 +1,27 @@ package me.ash.reader +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.graphics.drawable.Drawable import android.os.Bundle import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.core.view.WindowCompat import androidx.profileinstaller.ProfileInstallerInitializer +import coil.ComponentRegistry +import coil.ImageLoader +import coil.decode.DataSource +import coil.decode.SvgDecoder +import coil.disk.DiskCache +import coil.memory.MemoryCache +import coil.request.* import dagger.hilt.android.AndroidEntryPoint +import kotlinx.coroutines.CompletableDeferred import me.ash.reader.ui.page.common.HomeEntry @AndroidEntryPoint -class MainActivity : ComponentActivity() { +class MainActivity : ComponentActivity(), ImageLoader { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -20,4 +31,49 @@ class MainActivity : ComponentActivity() { HomeEntry() } } + + override val components: ComponentRegistry + get() = ComponentRegistry.Builder().add(SvgDecoder.Factory()).build() + override val defaults: DefaultRequestOptions + get() = DefaultRequestOptions() + override val diskCache: DiskCache + get() = DiskCache.Builder() + .directory(this.cacheDir.resolve("images")) + .maxSizePercent(0.02) + .build() + override val memoryCache: MemoryCache + get() = MemoryCache.Builder(this) + .maxSizePercent(0.25) + .build() + + override fun enqueue(request: ImageRequest): Disposable { + // Always call onStart before onSuccess. + request.target?.onStart(request.placeholder) + val result = ColorDrawable(Color.BLACK) + request.target?.onSuccess(result) + return object : Disposable { + override val job = CompletableDeferred(newResult(request, result)) + override val isDisposed get() = true + override fun dispose() {} + } + } + + override suspend fun execute(request: ImageRequest): ImageResult { + return newResult(request, ColorDrawable(Color.BLACK)) + } + + override fun newBuilder(): ImageLoader.Builder { + throw UnsupportedOperationException() + } + + override fun shutdown() { + } + + private fun newResult(request: ImageRequest, drawable: Drawable): SuccessResult { + return SuccessResult( + drawable = drawable, + request = request, + dataSource = DataSource.MEMORY_CACHE + ) + } } \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/component/Banner.kt b/app/src/main/java/me/ash/reader/ui/component/Banner.kt index 20e9572..bce64ec 100644 --- a/app/src/main/java/me/ash/reader/ui/component/Banner.kt +++ b/app/src/main/java/me/ash/reader/ui/component/Banner.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import me.ash.reader.ui.theme.palette.onDark +import me.ash.reader.ui.theme.palette.alwaysLight @Composable fun Banner( @@ -46,7 +46,7 @@ fun Banner( .fillMaxSize() .padding(horizontal = 16.dp) .clip(RoundedCornerShape(32.dp)) - .background(MaterialTheme.colorScheme.primaryContainer onDark MaterialTheme.colorScheme.onPrimaryContainer) + .background(MaterialTheme.colorScheme.primaryContainer alwaysLight true) .clickable { onClick() } .padding(16.dp, 20.dp), verticalAlignment = Alignment.CenterVertically @@ -57,7 +57,7 @@ fun Banner( imageVector = it, contentDescription = null, modifier = Modifier.padding(end = 16.dp), - tint = MaterialTheme.colorScheme.onSurface onDark MaterialTheme.colorScheme.surface, + tint = MaterialTheme.colorScheme.onSurface alwaysLight true, ) } } @@ -71,15 +71,14 @@ fun Banner( text = title, maxLines = if (desc == null) 2 else 1, style = MaterialTheme.typography.titleLarge.copy(fontSize = 20.sp), - color = MaterialTheme.colorScheme.onSurface onDark MaterialTheme.colorScheme.surface, + color = MaterialTheme.colorScheme.onSurface alwaysLight true, overflow = TextOverflow.Ellipsis, ) desc?.let { Text( text = it, style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f) - onDark MaterialTheme.colorScheme.surface.copy(alpha = 0.7f), + color = (MaterialTheme.colorScheme.onSurface alwaysLight true).copy(alpha = 0.7f), maxLines = 1, overflow = TextOverflow.Ellipsis, ) @@ -88,10 +87,7 @@ fun Banner( action?.let { Box(Modifier.padding(start = 16.dp)) { CompositionLocalProvider( - LocalContentColor provides ( - MaterialTheme.colorScheme.onSurface - onDark MaterialTheme.colorScheme.surface - ) + LocalContentColor provides (MaterialTheme.colorScheme.onSurface alwaysLight true) ) { it() } } } diff --git a/app/src/main/java/me/ash/reader/ui/component/BlockButton.kt b/app/src/main/java/me/ash/reader/ui/component/BlockButton.kt index 458710f..433b7e7 100644 --- a/app/src/main/java/me/ash/reader/ui/component/BlockButton.kt +++ b/app/src/main/java/me/ash/reader/ui/component/BlockButton.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp +import me.ash.reader.ui.theme.palette.alwaysLight import me.ash.reader.ui.theme.palette.onDark @Composable @@ -22,9 +23,9 @@ fun BlockButton( text: String = "", selected: Boolean = false, containerColor: Color = MaterialTheme.colorScheme.surface.copy(0.7f) onDark MaterialTheme.colorScheme.inverseOnSurface, - selectedContainerColor: Color = MaterialTheme.colorScheme.primaryContainer onDark MaterialTheme.colorScheme.onPrimaryContainer, + selectedContainerColor: Color = MaterialTheme.colorScheme.primaryContainer alwaysLight true, contentColor: Color = MaterialTheme.colorScheme.inverseSurface, - selectedContentColor: Color = MaterialTheme.colorScheme.onSurface onDark MaterialTheme.colorScheme.surface, + selectedContentColor: Color = MaterialTheme.colorScheme.onSurface alwaysLight true, onClick: () -> Unit = {}, ) { Column( diff --git a/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt b/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt new file mode 100644 index 0000000..27048b1 --- /dev/null +++ b/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt @@ -0,0 +1,59 @@ +package me.ash.reader.ui.component + +import android.graphics.drawable.PictureDrawable +import androidx.compose.animation.Crossfade +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.IntSize +import coil.compose.AsyncImage +import coil.imageLoader +import coil.request.ImageRequest +import com.caverock.androidsvg.SVG +import me.ash.reader.ui.svg.parseDynamicColor +import me.ash.reader.ui.theme.LocalUseDarkTheme +import me.ash.reader.ui.theme.palette.LocalTonalPalettes + +@Composable +fun DynamicSVGImage( + modifier: Modifier = Modifier, + svgImageString: String, + contentDescription: String, +) { + val context = LocalContext.current + val useDarkTheme = LocalUseDarkTheme.current + val tonalPalettes = LocalTonalPalettes.current + var size by remember { mutableStateOf(IntSize.Zero) } + val pic by remember(tonalPalettes, size) { + mutableStateOf( + PictureDrawable( + SVG.getFromString(svgImageString.parseDynamicColor(tonalPalettes, useDarkTheme)) + .renderToPicture(size.width, size.height) + ) + ) + } + + Row( + modifier = modifier + .aspectRatio(1.38f) + .onGloballyPositioned { + if (it.size != IntSize.Zero) { + size = it.size + } + }, + ) { + Crossfade(targetState = pic) { + AsyncImage( + contentDescription = contentDescription, + model = ImageRequest.Builder(context) + .data(it) + .crossfade(true) + .build(), + imageLoader = context.imageLoader, + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/component/SelectionChip.kt b/app/src/main/java/me/ash/reader/ui/component/SelectionChip.kt index 5243a74..5da94a1 100644 --- a/app/src/main/java/me/ash/reader/ui/component/SelectionChip.kt +++ b/app/src/main/java/me/ash/reader/ui/component/SelectionChip.kt @@ -2,11 +2,10 @@ package me.ash.reader.ui.component import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.* +import androidx.compose.foundation.layout.defaultMinSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.text.BasicTextField -import androidx.compose.foundation.text.KeyboardActions -import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.ChipDefaults import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.FilterChip @@ -17,16 +16,13 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import me.ash.reader.R +import me.ash.reader.ui.theme.palette.alwaysLight @OptIn(ExperimentalMaterialApi::class) @Composable @@ -47,14 +43,8 @@ fun SelectionChip( modifier = modifier.defaultMinSize(minHeight = 36.dp), colors = ChipDefaults.filterChipColors( backgroundColor = MaterialTheme.colorScheme.surfaceVariant, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, - leadingIconColor = MaterialTheme.colorScheme.surfaceVariant, disabledBackgroundColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.7f), - disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f), - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f), - selectedBackgroundColor = MaterialTheme.colorScheme.primaryContainer, - selectedContentColor = MaterialTheme.colorScheme.onPrimaryContainer, - selectedLeadingIconColor = MaterialTheme.colorScheme.onPrimaryContainer + selectedBackgroundColor = MaterialTheme.colorScheme.primaryContainer alwaysLight true, ), border = border, interactionSource = interactionSource, @@ -62,11 +52,12 @@ fun SelectionChip( selected = selected, selectedIcon = selectedIcon ?: { Icon( - imageVector = Icons.Rounded.Check, - contentDescription = stringResource(R.string.selected), modifier = Modifier .padding(start = 8.dp) .size(20.dp), + imageVector = Icons.Rounded.Check, + contentDescription = stringResource(R.string.selected), + tint = MaterialTheme.colorScheme.onSurface alwaysLight true ) }, shape = shape, @@ -84,101 +75,7 @@ fun SelectionChip( ), text = content, style = MaterialTheme.typography.titleSmall, - ) - }, - ) -} - -@OptIn(ExperimentalMaterialApi::class) -@Composable -fun SelectionEditorChip( - modifier: Modifier = Modifier, - content: String, - onValueChange: (String) -> Unit = {}, - selected: Boolean, - enabled: Boolean = true, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - shape: Shape = CircleShape, - selectedIcon: @Composable (() -> Unit)? = null, - onKeyboardAction: () -> Unit = {}, - onClick: () -> Unit, -) { - val focusManager = LocalFocusManager.current - val placeholder = stringResource(R.string.add_to_group) - - FilterChip( - modifier = modifier.defaultMinSize(minHeight = 36.dp), - colors = ChipDefaults.filterChipColors( - backgroundColor = MaterialTheme.colorScheme.surfaceVariant, - contentColor = MaterialTheme.colorScheme.onSurfaceVariant, - leadingIconColor = MaterialTheme.colorScheme.surfaceVariant, - disabledBackgroundColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.7f), - disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f), - disabledLeadingIconColor = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f), - selectedBackgroundColor = MaterialTheme.colorScheme.primaryContainer, - selectedContentColor = MaterialTheme.colorScheme.onPrimaryContainer, - selectedLeadingIconColor = MaterialTheme.colorScheme.onPrimaryContainer - ), - interactionSource = interactionSource, - enabled = enabled, - selected = selected, - selectedIcon = selectedIcon ?: { - Icon( - imageVector = Icons.Rounded.Check, - contentDescription = stringResource(R.string.selected), - modifier = Modifier - .padding(start = 8.dp) - .size(20.dp), - ) - }, - shape = shape, - onClick = onClick, - content = { - BasicTextField( - modifier = Modifier - .padding( - start = if (selected) 0.dp else 8.dp, - top = 8.dp, - end = if (content.isEmpty()) 0.dp else 8.dp, - bottom = 8.dp - ) - .onFocusChanged { - if (it.isFocused) { - onClick() - } else { - focusManager.clearFocus() - } - }, - value = content, - onValueChange = { onValueChange(it) }, - cursorBrush = SolidColor(MaterialTheme.colorScheme.onSurfaceVariant), - textStyle = MaterialTheme.typography.titleSmall.copy( - color = MaterialTheme.colorScheme.onSurfaceVariant, - ), - decorationBox = { innerTextField -> - Row( - horizontalArrangement = Arrangement.Start, - verticalAlignment = Alignment.CenterVertically, - ) { - if (content.isEmpty()) { - Text( - text = placeholder, - color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f), - style = MaterialTheme.typography.titleSmall, - ) - } - } - innerTextField() - }, - keyboardActions = KeyboardActions( - onDone = { - focusManager.clearFocus() - onKeyboardAction() - } - ), - keyboardOptions = KeyboardOptions( - imeAction = ImeAction.Done - ), + color = MaterialTheme.colorScheme.onSurface alwaysLight selected, ) }, ) diff --git a/app/src/main/java/me/ash/reader/ui/component/Switch.kt b/app/src/main/java/me/ash/reader/ui/component/Switch.kt index a1e7247..ab00983 100644 --- a/app/src/main/java/me/ash/reader/ui/component/Switch.kt +++ b/app/src/main/java/me/ash/reader/ui/component/Switch.kt @@ -26,8 +26,8 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import me.ash.reader.ui.theme.palette.LocalTonalPalettes import me.ash.reader.ui.theme.palette.onDark -import me.ash.reader.ui.theme.palette.tonalPalettes // TODO: ripple & swipe @Composable @@ -37,10 +37,12 @@ fun Switch( enable: Boolean = true, onClick: (() -> Unit)? = null ) { - val tonalPalettes = MaterialTheme.colorScheme.tonalPalettes() + val tonalPalettes = LocalTonalPalettes.current Surface( - modifier = modifier.size(56.dp, 28.dp).alpha(if (enable) 1f else 0.5f), + modifier = modifier + .size(56.dp, 28.dp) + .alpha(if (enable) 1f else 0.5f), shape = CircleShape, color = animateColorAsState( if (activated) (tonalPalettes primary 40) onDark (tonalPalettes neutralVariant 50) @@ -74,7 +76,7 @@ fun SwitchHeadline( title: String, modifier: Modifier = Modifier ) { - val tonalPalettes = MaterialTheme.colorScheme.tonalPalettes() + val tonalPalettes = LocalTonalPalettes.current Surface( modifier = modifier, diff --git a/app/src/main/java/me/ash/reader/ui/ext/DataStoreExt.kt b/app/src/main/java/me/ash/reader/ui/ext/DataStoreExt.kt index d77ad9a..f7d0d98 100644 --- a/app/src/main/java/me/ash/reader/ui/ext/DataStoreExt.kt +++ b/app/src/main/java/me/ash/reader/ui/ext/DataStoreExt.kt @@ -19,7 +19,7 @@ val Context.currentAccountId: Int val Context.currentAccountType: Int get() = this.dataStore.get(DataStoreKeys.CurrentAccountType)!! val Context.themeIndex: Int - get() = this.dataStore.get(DataStoreKeys.ThemeIndex) ?: 0 + get() = this.dataStore.get(DataStoreKeys.ThemeIndex) ?: 5 val Context.customPrimaryColor: String get() = this.dataStore.get(DataStoreKeys.CustomPrimaryColor) ?: "" diff --git a/app/src/main/java/me/ash/reader/ui/page/common/HomeEntry.kt b/app/src/main/java/me/ash/reader/ui/page/common/HomeEntry.kt index a7bc389..2a88673 100644 --- a/app/src/main/java/me/ash/reader/ui/page/common/HomeEntry.kt +++ b/app/src/main/java/me/ash/reader/ui/page/common/HomeEntry.kt @@ -2,7 +2,6 @@ package me.ash.reader.ui.page.common import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.background -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -24,19 +23,21 @@ import me.ash.reader.ui.page.settings.ColorAndStyle import me.ash.reader.ui.page.settings.SettingsPage import me.ash.reader.ui.page.startup.StartupPage import me.ash.reader.ui.theme.AppTheme +import me.ash.reader.ui.theme.LocalUseDarkTheme @OptIn(ExperimentalAnimationApi::class, androidx.compose.material.ExperimentalMaterialApi::class) @Composable fun HomeEntry() { - val context = LocalContext.current - val navController = rememberAnimatedNavController() - AppTheme { + val context = LocalContext.current + val useDarkTheme = LocalUseDarkTheme.current + val navController = rememberAnimatedNavController() + ProvideWindowInsets { rememberSystemUiController().run { - setStatusBarColor(Color.Transparent, !isSystemInDarkTheme()) - setSystemBarsColor(Color.Transparent, !isSystemInDarkTheme()) - setNavigationBarColor(MaterialTheme.colorScheme.surface, !isSystemInDarkTheme()) + setStatusBarColor(Color.Transparent, !useDarkTheme) + setSystemBarsColor(Color.Transparent, !useDarkTheme) + setNavigationBarColor(MaterialTheme.colorScheme.surface, !useDarkTheme) } Column { Row( diff --git a/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt b/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt index c6a4aca..a2f217d 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/FilterBar.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.zIndex import com.google.accompanist.pager.ExperimentalPagerApi import me.ash.reader.data.entity.Filter import me.ash.reader.ui.ext.getName +import me.ash.reader.ui.theme.palette.alwaysLight @OptIn(ExperimentalPagerApi::class) @Composable @@ -55,11 +56,11 @@ fun FilterBar( filterOnClick(item) }, colors = NavigationBarItemDefaults.colors( -// selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer, + selectedIconColor = MaterialTheme.colorScheme.onSecondaryContainer alwaysLight true, // unselectedIconColor = MaterialTheme.colorScheme.outline, -// selectedTextColor = MaterialTheme.colorScheme.onSurface, + selectedTextColor = MaterialTheme.colorScheme.onSurface alwaysLight true, // unselectedTextColor = MaterialTheme.colorScheme.onSurfaceVariant, - indicatorColor = MaterialTheme.colorScheme.primaryContainer, + indicatorColor = MaterialTheme.colorScheme.primaryContainer alwaysLight true, ) ) } diff --git a/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/ResultView.kt b/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/ResultView.kt index d892900..bef743b 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/ResultView.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/ResultView.kt @@ -35,6 +35,7 @@ import me.ash.reader.data.entity.Group import me.ash.reader.ui.component.SelectionChip import me.ash.reader.ui.component.Subtitle import me.ash.reader.ui.ext.roundClick +import me.ash.reader.ui.theme.palette.alwaysLight @Composable fun ResultView( @@ -131,11 +132,12 @@ private fun Preset( selected = selectedAllowNotificationPreset, selectedIcon = { Icon( - imageVector = Icons.Outlined.Notifications, - contentDescription = stringResource(R.string.allow_notification), modifier = Modifier .padding(start = 8.dp) .size(20.dp), + imageVector = Icons.Outlined.Notifications, + contentDescription = stringResource(R.string.allow_notification), + tint = MaterialTheme.colorScheme.onSurface alwaysLight true, ) }, ) { @@ -147,11 +149,12 @@ private fun Preset( selected = selectedParseFullContentPreset, selectedIcon = { Icon( - imageVector = Icons.Outlined.Article, - contentDescription = stringResource(R.string.parse_full_content), modifier = Modifier .padding(start = 8.dp) .size(20.dp), + imageVector = Icons.Outlined.Article, + contentDescription = stringResource(R.string.parse_full_content), + tint = MaterialTheme.colorScheme.onSurface alwaysLight true, ) }, ) { diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/MarkAsReadBar.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/MarkAsReadBar.kt index 1730b1d..9458e08 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/MarkAsReadBar.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/MarkAsReadBar.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import me.ash.reader.R import me.ash.reader.ui.component.AnimatedPopup +import me.ash.reader.ui.theme.palette.alwaysLight @Composable fun MarkAsReadBar( @@ -101,7 +102,7 @@ fun MarkAsReadBarItem( tonalElevation = 2.dp, shape = RoundedCornerShape(16.dp), color = if (isPrimary) { - MaterialTheme.colorScheme.primaryContainer + MaterialTheme.colorScheme.primaryContainer alwaysLight true } else { MaterialTheme.colorScheme.surface } @@ -115,7 +116,7 @@ fun MarkAsReadBarItem( text = text, style = MaterialTheme.typography.titleSmall, color = if (isPrimary) { - MaterialTheme.colorScheme.onSurface + MaterialTheme.colorScheme.onSurface alwaysLight true } else { MaterialTheme.colorScheme.secondary }, diff --git a/app/src/main/java/me/ash/reader/ui/page/home/read/ReadBar.kt b/app/src/main/java/me/ash/reader/ui/page/home/read/ReadBar.kt index 57de11d..184428f 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/read/ReadBar.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/read/ReadBar.kt @@ -96,7 +96,7 @@ fun ReadBar( starredOnClick(!isStarred) } CanBeDisabledIconButton( - disabled = disabled, + disabled = true, modifier = Modifier.size(40.dp), imageVector = Icons.Rounded.ExpandMore, contentDescription = "Next Article", @@ -106,7 +106,7 @@ fun ReadBar( } CanBeDisabledIconButton( modifier = Modifier.size(40.dp), - disabled = disabled, + disabled = true, imageVector = Icons.Outlined.TextFormat, contentDescription = "Add Tag", tint = MaterialTheme.colorScheme.outline, diff --git a/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt index ea003f5..4e48d3d 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt @@ -15,6 +15,7 @@ import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex @@ -155,13 +156,14 @@ private fun TopBar( actions = { if (isShowActions) { FeedbackIconButton( - modifier = Modifier.size(22.dp), + modifier = Modifier.size(22.dp).alpha(0.5f), imageVector = Icons.Outlined.Headphones, contentDescription = stringResource(R.string.mark_all_as_read), tint = MaterialTheme.colorScheme.onSurface, ) { } FeedbackIconButton( + modifier = Modifier.alpha(0.5f), imageVector = Icons.Outlined.MoreVert, contentDescription = stringResource(R.string.search), tint = MaterialTheme.colorScheme.onSurface, diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/ColorAndStyle.kt b/app/src/main/java/me/ash/reader/ui/page/settings/ColorAndStyle.kt index 3da67a9..2b20a1f 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/ColorAndStyle.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/ColorAndStyle.kt @@ -3,9 +3,12 @@ package me.ash.reader.ui.page.settings import android.annotation.SuppressLint import android.os.Build import androidx.compose.animation.* -import androidx.compose.foundation.* +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons @@ -18,7 +21,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController @@ -29,6 +31,9 @@ import kotlinx.coroutines.launch import me.ash.reader.R import me.ash.reader.ui.component.* import me.ash.reader.ui.ext.* +import me.ash.reader.ui.svg.PALETTE +import me.ash.reader.ui.svg.SVGString +import me.ash.reader.ui.theme.LocalUseDarkTheme import me.ash.reader.ui.theme.palette.* import me.ash.reader.ui.theme.palette.TonalPalettes.Companion.toTonalPalettes import me.ash.reader.ui.theme.palette.dynamic.extractTonalPalettesFromUserWallpaper @@ -40,6 +45,7 @@ fun ColorAndStyle( navController: NavHostController, ) { val context = LocalContext.current + val useDarkTheme = LocalUseDarkTheme.current val wallpaperTonalPalettes = extractTonalPalettesFromUserWallpaper() var radioButtonSelected by remember { mutableStateOf(if (context.themeIndex > 4) 0 else 1) } @@ -86,10 +92,10 @@ fun ColorAndStyle( horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically ) { - Image( + DynamicSVGImage( modifier = Modifier.padding(60.dp), - painter = painterResource(id = R.drawable.palettie), - contentDescription = stringResource(R.string.welcome), + svgImageString = SVGString.PALETTE, + contentDescription = stringResource(R.string.color_and_style), ) } Spacer(modifier = Modifier.height(24.dp)) @@ -129,7 +135,7 @@ fun ColorAndStyle( item { Subtitle( modifier = Modifier.padding(horizontal = 24.dp), - text = stringResource(R.string.style) + text = stringResource(R.string.appearance), ) SettingItem( title = stringResource(R.string.dark_theme), @@ -138,10 +144,11 @@ fun ColorAndStyle( separatedActions = true, onClick = {}, ) { - Switch(activated = isSystemInDarkTheme(), enable = false) + Switch(activated = useDarkTheme, enable = false) } SettingItem( - title = stringResource(R.string.tonal_elevation), + title = stringResource(R.string.basic_fonts), + desc = "Google Sans", enable = false, onClick = {}, ) {} @@ -150,23 +157,20 @@ fun ColorAndStyle( item { Subtitle( modifier = Modifier.padding(horizontal = 24.dp), - text = stringResource(R.string.fonts) + text = stringResource(R.string.style) ) SettingItem( - title = stringResource(R.string.basic_fonts), - desc = "Google Sans", + title = stringResource(R.string.feeds_page), enable = false, onClick = {}, ) {} SettingItem( - title = stringResource(R.string.reading_fonts), - desc = "Google Sans", + title = stringResource(R.string.flow_page), enable = false, onClick = {}, ) {} SettingItem( - title = stringResource(R.string.reading_fonts_size), - desc = "16sp", + title = stringResource(R.string.reading_page), enable = false, onClick = {}, ) {} @@ -252,10 +256,10 @@ fun Palettes( TextFieldDialog( visible = addDialogVisible, - title = "强调色", + title = stringResource(R.string.primary_color), icon = Icons.Outlined.Palette, value = customColorValue, - placeholder = "#123456", + placeholder = stringResource(R.string.primary_color_hint), onValueChange = { customColorValue = it }, @@ -314,7 +318,7 @@ fun SelectableMiniPalette( modifier = Modifier .size(48.dp) .offset(24.dp, 24.dp), - color = palette secondary 50, + color = palette secondary 60, ) {} AnimatedVisibility( visible = selected, diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt index 23fb912..61c0dfd 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt @@ -55,8 +55,8 @@ fun SettingsPage( } item { Banner( - title = stringResource(R.string.get_new_updates), - desc = stringResource(R.string.get_new_updates_desc), + title = stringResource(R.string.in_coding), + desc = stringResource(R.string.coming_soon), icon = Icons.Outlined.Lightbulb, action = { Icon( diff --git a/app/src/main/java/me/ash/reader/ui/page/startup/StartupPage.kt b/app/src/main/java/me/ash/reader/ui/page/startup/StartupPage.kt index ef7e126..fde1a9b 100644 --- a/app/src/main/java/me/ash/reader/ui/page/startup/StartupPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/startup/StartupPage.kt @@ -2,7 +2,6 @@ package me.ash.reader.ui.page.startup import android.content.Intent import android.net.Uri -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn @@ -14,7 +13,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController @@ -23,10 +21,13 @@ import com.ireward.htmlcompose.HtmlText import kotlinx.coroutines.launch import me.ash.reader.R import me.ash.reader.ui.component.DisplayText +import me.ash.reader.ui.component.DynamicSVGImage import me.ash.reader.ui.ext.DataStoreKeys import me.ash.reader.ui.ext.dataStore import me.ash.reader.ui.ext.put import me.ash.reader.ui.page.common.RouteName +import me.ash.reader.ui.svg.SVGString +import me.ash.reader.ui.svg.WELCOME @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -37,7 +38,9 @@ fun StartupPage( val scope = rememberCoroutineScope() Scaffold( - modifier = Modifier.statusBarsPadding().background(MaterialTheme.colorScheme.surface), + modifier = Modifier + .statusBarsPadding() + .background(MaterialTheme.colorScheme.surface), topBar = {}, content = { LazyColumn { @@ -47,10 +50,10 @@ fun StartupPage( } item { Spacer(modifier = Modifier.height(16.dp)) - Image( - modifier = Modifier.padding(horizontal = 16.dp), - painter = painterResource(id = R.drawable.welcome), - contentDescription = stringResource(R.string.welcome), + DynamicSVGImage( + modifier = Modifier.padding(horizontal = 60.dp), + svgImageString = SVGString.WELCOME, + contentDescription = stringResource(R.string.color_and_style), ) } item { diff --git a/app/src/main/java/me/ash/reader/ui/svg/SVGString.kt b/app/src/main/java/me/ash/reader/ui/svg/SVGString.kt new file mode 100644 index 0000000..bbadd60 --- /dev/null +++ b/app/src/main/java/me/ash/reader/ui/svg/SVGString.kt @@ -0,0 +1,50 @@ +package me.ash.reader.ui.svg + +import android.util.Log +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb +import me.ash.reader.ui.theme.palette.TonalPalettes + +object SVGString + +fun String.parseDynamicColor(tonalPalettes: TonalPalettes, isDarkTheme: Boolean): String = + replace("fill=\"(.+?)\"".toRegex()) { + val value = it.groupValues[1] + if (value.startsWith("#")) return@replace it.value + try { + val (scheme, tone) = value.split("(?<=\\d)(?=\\D)|(?=\\d)(?<=\\D)".toRegex()) + val argb = when (scheme) { + "p" -> tonalPalettes.primary[tone.toInt().autoToDarkTone(isDarkTheme)] + "s" -> tonalPalettes.secondary[tone.toInt().autoToDarkTone(isDarkTheme)] + "t" -> tonalPalettes.tertiary[tone.toInt().autoToDarkTone(isDarkTheme)] + "n" -> tonalPalettes.neutral[tone.toInt().autoToDarkTone(isDarkTheme)] + "nv" -> tonalPalettes.neutralVariant[tone.toInt().autoToDarkTone(isDarkTheme)] + "e" -> tonalPalettes.error[tone.toInt().autoToDarkTone(isDarkTheme)] + else -> Color.Transparent + }?.toArgb() ?: 0xFFFFFF + "fill=\"${String.format("#%06X", 0xFFFFFF and argb)}\"" + } catch (e: Exception) { + Log.e("RLog", "parseDynamicColor: ${e.message}") + it.value + } + } + +internal fun Int.autoToDarkTone(isDarkTheme: Boolean): Int = + if (!isDarkTheme) this + else when (this) { + 10 -> 99 + 20 -> 95 + 25 -> 90 + 30 -> 90 + 40 -> 80 + 50 -> 60 + 60 -> 50 + 70 -> 40 + 80 -> 40 + 90 -> 30 + 95 -> 20 + 98 -> 10 + 99 -> 10 + 100 -> 20 + else -> this + } \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/svg/palette.kt b/app/src/main/java/me/ash/reader/ui/svg/palette.kt new file mode 100644 index 0000000..d6d8f7b --- /dev/null +++ b/app/src/main/java/me/ash/reader/ui/svg/palette.kt @@ -0,0 +1,63 @@ +package me.ash.reader.ui.svg + +val SVGString.PALETTE: String + get() = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/svg/welcome.kt b/app/src/main/java/me/ash/reader/ui/svg/welcome.kt new file mode 100644 index 0000000..3fd6964 --- /dev/null +++ b/app/src/main/java/me/ash/reader/ui/svg/welcome.kt @@ -0,0 +1,51 @@ +package me.ash.reader.ui.svg + +val SVGString.WELCOME: String + get() = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/theme/Theme.kt b/app/src/main/java/me/ash/reader/ui/theme/Theme.kt index 03d57b4..da76775 100644 --- a/app/src/main/java/me/ash/reader/ui/theme/Theme.kt +++ b/app/src/main/java/me/ash/reader/ui/theme/Theme.kt @@ -6,6 +6,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.compositionLocalOf import androidx.compose.ui.platform.LocalContext import kotlinx.coroutines.flow.map import me.ash.reader.ui.ext.DataStoreKeys @@ -17,6 +18,8 @@ import me.ash.reader.ui.theme.palette.dynamic.extractTonalPalettesFromUserWallpa import me.ash.reader.ui.theme.palette.dynamicDarkColorScheme import me.ash.reader.ui.theme.palette.dynamicLightColorScheme +val LocalUseDarkTheme = compositionLocalOf { false } + @SuppressLint("FlowOperatorInvokedInComposition") @Composable fun AppTheme( @@ -25,27 +28,31 @@ fun AppTheme( content: @Composable () -> Unit ) { val context = LocalContext.current - val themeIndex = context.dataStore.data.map { it[DataStoreKeys.ThemeIndex.key] ?: 0 } - .collectAsState(initial = 0).value + val themeIndex = context.dataStore.data + .map { it[DataStoreKeys.ThemeIndex.key] ?: 5 } + .collectAsState(initial = 5).value + + val tonalPalettes = wallpaperPalettes[ + if (themeIndex >= wallpaperPalettes.size) { + when { + wallpaperPalettes.size == 5 -> 0 + wallpaperPalettes.size > 5 -> 5 + else -> 0 + } + } else { + themeIndex + } + ] ProvideZcamViewingConditions { CompositionLocalProvider( - LocalTonalPalettes provides wallpaperPalettes[ - if (themeIndex >= wallpaperPalettes.size) { - when { - wallpaperPalettes.size == 5 -> 0 - wallpaperPalettes.size > 5 -> 5 - else -> 0 - } - } else { - themeIndex - } - ] + LocalTonalPalettes provides tonalPalettes.also { it.Preheating() }, + LocalUseDarkTheme provides useDarkTheme ) { MaterialTheme( colorScheme = - if (useDarkTheme) dynamicDarkColorScheme() - else dynamicLightColorScheme(), + if (useDarkTheme) dynamicDarkColorScheme() + else dynamicLightColorScheme(), typography = AppTypography, content = content ) diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt index 80170e5..818d16c 100644 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt +++ b/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt @@ -1,11 +1,12 @@ package me.ash.reader.ui.theme.palette -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.ColorScheme +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color +import me.ash.reader.ui.theme.LocalUseDarkTheme @Composable fun dynamicLightColorScheme(): ColorScheme { @@ -65,18 +66,55 @@ fun dynamicDarkColorScheme(): ColorScheme { ) } -@Composable -fun ColorScheme.tonalPalettes() = LocalTonalPalettes.current - @Suppress("NOTHING_TO_INLINE") @Composable inline infix fun Color.onLight(lightColor: Color): Color = - if (!isSystemInDarkTheme()) lightColor else this + if (!LocalUseDarkTheme.current) lightColor else this @Suppress("NOTHING_TO_INLINE") @Composable inline infix fun Color.onDark(darkColor: Color): Color = - if (isSystemInDarkTheme()) darkColor else this + if (LocalUseDarkTheme.current) darkColor else this + +@Composable +infix fun Color.alwaysLight(isAlways: Boolean): Color { + val colorScheme = MaterialTheme.colorScheme + return if (isAlways && LocalUseDarkTheme.current) { + when (this) { + colorScheme.primary -> colorScheme.onPrimary + colorScheme.secondary -> colorScheme.onSecondary + colorScheme.tertiary -> colorScheme.onTertiary + colorScheme.background -> colorScheme.onBackground + colorScheme.error -> colorScheme.onError + colorScheme.surface -> colorScheme.onSurface + colorScheme.surfaceVariant -> colorScheme.onSurfaceVariant + colorScheme.error -> colorScheme.onError + colorScheme.primaryContainer -> colorScheme.onPrimaryContainer + colorScheme.secondaryContainer -> colorScheme.onSecondaryContainer + colorScheme.tertiaryContainer -> colorScheme.onTertiaryContainer + colorScheme.errorContainer -> colorScheme.onErrorContainer + colorScheme.inverseSurface -> colorScheme.inverseOnSurface + + colorScheme.onPrimary -> colorScheme.primary + colorScheme.onSecondary -> colorScheme.secondary + colorScheme.onTertiary -> colorScheme.tertiary + colorScheme.onBackground -> colorScheme.background + colorScheme.onError -> colorScheme.error + colorScheme.onSurface -> colorScheme.surface + colorScheme.onSurfaceVariant -> colorScheme.surfaceVariant + colorScheme.onError -> colorScheme.error + colorScheme.onPrimaryContainer -> colorScheme.primaryContainer + colorScheme.onSecondaryContainer -> colorScheme.secondaryContainer + colorScheme.onTertiaryContainer -> colorScheme.tertiaryContainer + colorScheme.onErrorContainer -> colorScheme.errorContainer + colorScheme.inverseOnSurface -> colorScheme.inverseSurface + + else -> Color.Unspecified + } + } else { + this + } +} fun String.checkColorHex(): String? { var s = this.trim() diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/TonalPalettes.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/TonalPalettes.kt index ae0d066..f7cefb8 100644 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/TonalPalettes.kt +++ b/app/src/main/java/me/ash/reader/ui/theme/palette/TonalPalettes.kt @@ -95,6 +95,17 @@ data class TonalPalettes( ).clampToRgb().toColor() } + @Composable + fun Preheating() { + val tonalValues = listOf(0, 10, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 95, 98, 99, 100) + tonalValues.forEach { primary(it) } + tonalValues.forEach { secondary(it) } + tonalValues.forEach { tertiary(it) } + tonalValues.forEach { neutral(it) } + tonalValues.forEach { neutralVariant(it) } + tonalValues.forEach { error(it) } + } + companion object { @Composable fun Color.toTonalPalettes(): TonalPalettes { diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/data/Theme.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/data/Theme.kt deleted file mode 100644 index a96f407..0000000 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/data/Theme.kt +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (C) 2021 Kyant0 - * - * @link https://github.com/Kyant0/MusicYou - * @author Kyant0 - */ - -package me.ash.reader.ui.theme.palette.data - -import me.ash.reader.ui.theme.palette.TonalPalettes - -data class Theme( - val hue: Double, - val primaryChroma: Double, -) { - fun toTonalPalettes(): TonalPalettes = TonalPalettes( - hue = hue, - primaryChroma = primaryChroma, - ) - - companion object { - fun TonalPalettes.toTheme(): Theme = Theme( - hue = hue, - primaryChroma = primaryChroma, - ) - } -} diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/BlueColor.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/preset/BlueColor.kt deleted file mode 100644 index ae3787d..0000000 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/BlueColor.kt +++ /dev/null @@ -1,118 +0,0 @@ -package me.ash.reader.ui.theme.palette.preset - -import androidx.compose.ui.graphics.Color - -object BlueColor : IColor { - override val md_theme_light_primary: Color - get() = Color(0xFF00658e) - override val md_theme_light_onPrimary: Color - get() = Color(0xFFffffff) - override val md_theme_light_primaryContainer: Color - get() = Color(0xFFc3e7ff) - override val md_theme_light_onPrimaryContainer: Color - get() = Color(0xFF001e2e) - override val md_theme_light_secondary: Color - get() = Color(0xFF4f616e) - override val md_theme_light_onSecondary: Color - get() = Color(0xFFffffff) - override val md_theme_light_secondaryContainer: Color - get() = Color(0xFFd2e5f4) - override val md_theme_light_onSecondaryContainer: Color - get() = Color(0xFF0b1d28) - override val md_theme_light_tertiary: Color - get() = Color(0xFF625a7c) - override val md_theme_light_onTertiary: Color - get() = Color(0xFFffffff) - override val md_theme_light_tertiaryContainer: Color - get() = Color(0xFFe8ddff) - override val md_theme_light_onTertiaryContainer: Color - get() = Color(0xFF1e1735) - override val md_theme_light_error: Color - get() = Color(0xFFba1b1b) - override val md_theme_light_errorContainer: Color - get() = Color(0xFFffdad4) - override val md_theme_light_onError: Color - get() = Color(0xFFffffff) - override val md_theme_light_onErrorContainer: Color - get() = Color(0xFF410001) - override val md_theme_light_background: Color - get() = Color(0xFFfbfcff) - override val md_theme_light_onBackground: Color - get() = Color(0xFF191c1e) - override val md_theme_light_surface: Color - get() = Color(0xFFfbfcff) - override val md_theme_light_onSurface: Color - get() = Color(0xFF191c1e) - override val md_theme_light_surfaceVariant: Color - get() = Color(0xFFdde3ea) - override val md_theme_light_onSurfaceVariant: Color - get() = Color(0xFF41484d) - override val md_theme_light_outline: Color - get() = Color(0xFF71787e) - override val md_theme_light_inverseOnSurface: Color - get() = Color(0xFFf0f1f4) - override val md_theme_light_inverseSurface: Color - get() = Color(0xFF2e3133) - override val md_theme_light_inversePrimary: Color - get() = Color(0xFF7fcfff) - override val md_theme_light_shadow: Color - get() = Color(0xFF000000) - override val md_theme_dark_primary: Color - get() = Color(0xFF7fcfff) - override val md_theme_dark_onPrimary: Color - get() = Color(0xFF00344b) - override val md_theme_dark_primaryContainer: Color - get() = Color(0xFF004c6c) - override val md_theme_dark_onPrimaryContainer: Color - get() = Color(0xFFc3e7ff) - override val md_theme_dark_secondary: Color - get() = Color(0xFFb6c9d8) - override val md_theme_dark_onSecondary: Color - get() = Color(0xFF21333e) - override val md_theme_dark_secondaryContainer: Color - get() = Color(0xFF374955) - override val md_theme_dark_onSecondaryContainer: Color - get() = Color(0xFFd2e5f4) - override val md_theme_dark_tertiary: Color - get() = Color(0xFFccc1e9) - override val md_theme_dark_onTertiary: Color - get() = Color(0xFF332c4b) - override val md_theme_dark_tertiaryContainer: Color - get() = Color(0xFF4a4263) - override val md_theme_dark_onTertiaryContainer: Color - get() = Color(0xFFe8ddff) - override val md_theme_dark_error: Color - get() = Color(0xFFffb4a9) - override val md_theme_dark_errorContainer: Color - get() = Color(0xFF930006) - override val md_theme_dark_onError: Color - get() = Color(0xFF680003) - override val md_theme_dark_onErrorContainer: Color - get() = Color(0xFFffdad4) - override val md_theme_dark_background: Color - get() = Color(0xFF191c1e) - override val md_theme_dark_onBackground: Color - get() = Color(0xFFe1e2e5) - override val md_theme_dark_surface: Color - get() = Color(0xFF191c1e) - override val md_theme_dark_onSurface: Color - get() = Color(0xFFe1e2e5) - override val md_theme_dark_surfaceVariant: Color - get() = Color(0xFF41484d) - override val md_theme_dark_onSurfaceVariant: Color - get() = Color(0xFFc1c7ce) - override val md_theme_dark_outline: Color - get() = Color(0xFF8b9298) - override val md_theme_dark_inverseOnSurface: Color - get() = Color(0xFF191c1e) - override val md_theme_dark_inverseSurface: Color - get() = Color(0xFFe1e2e5) - override val md_theme_dark_inversePrimary: Color - get() = Color(0xFF00658e) - override val md_theme_dark_shadow: Color - get() = Color(0xFF000000) - override val seed: Color - get() = Color(0xFF006187) - override val error: Color - get() = Color(0xFFba1b1b) -} \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/GreenColor.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/preset/GreenColor.kt deleted file mode 100644 index 2511930..0000000 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/GreenColor.kt +++ /dev/null @@ -1,118 +0,0 @@ -package me.ash.reader.ui.theme.palette.preset - -import androidx.compose.ui.graphics.Color - -object GreenColor : IColor { - override val md_theme_light_primary: Color - get() = Color(0xFF3c6a1b) - override val md_theme_light_onPrimary: Color - get() = Color(0xFFffffff) - override val md_theme_light_primaryContainer: Color - get() = Color(0xFFbbf292) - override val md_theme_light_onPrimaryContainer: Color - get() = Color(0xFF0b2000) - override val md_theme_light_secondary: Color - get() = Color(0xFF56624b) - override val md_theme_light_onSecondary: Color - get() = Color(0xFFffffff) - override val md_theme_light_secondaryContainer: Color - get() = Color(0xFFd9e7c9) - override val md_theme_light_onSecondaryContainer: Color - get() = Color(0xFF141e0c) - override val md_theme_light_tertiary: Color - get() = Color(0xFF386665) - override val md_theme_light_onTertiary: Color - get() = Color(0xFFffffff) - override val md_theme_light_tertiaryContainer: Color - get() = Color(0xFFbbebea) - override val md_theme_light_onTertiaryContainer: Color - get() = Color(0xFF002020) - override val md_theme_light_error: Color - get() = Color(0xFFba1b1b) - override val md_theme_light_errorContainer: Color - get() = Color(0xFFffdad4) - override val md_theme_light_onError: Color - get() = Color(0xFFffffff) - override val md_theme_light_onErrorContainer: Color - get() = Color(0xFF410001) - override val md_theme_light_background: Color - get() = Color(0xFFfdfdf5) - override val md_theme_light_onBackground: Color - get() = Color(0xFF1a1c17) - override val md_theme_light_surface: Color - get() = Color(0xFFfdfdf5) - override val md_theme_light_onSurface: Color - get() = Color(0xFF1a1c17) - override val md_theme_light_surfaceVariant: Color - get() = Color(0xFFe0e4d6) - override val md_theme_light_onSurfaceVariant: Color - get() = Color(0xFF43483e) - override val md_theme_light_outline: Color - get() = Color(0xFF74796d) - override val md_theme_light_inverseOnSurface: Color - get() = Color(0xFFf1f1ea) - override val md_theme_light_inverseSurface: Color - get() = Color(0xFF2f312c) - override val md_theme_light_inversePrimary: Color - get() = Color(0xFFa0d579) - override val md_theme_light_shadow: Color - get() = Color(0xFF000000) - override val md_theme_dark_primary: Color - get() = Color(0xFFa0d579) - override val md_theme_dark_onPrimary: Color - get() = Color(0xFF143800) - override val md_theme_dark_primaryContainer: Color - get() = Color(0xFF245101) - override val md_theme_dark_onPrimaryContainer: Color - get() = Color(0xFFbbf292) - override val md_theme_dark_secondary: Color - get() = Color(0xFFbecbaf) - override val md_theme_dark_onSecondary: Color - get() = Color(0xFF283420) - override val md_theme_dark_secondaryContainer: Color - get() = Color(0xFF3e4a34) - override val md_theme_dark_onSecondaryContainer: Color - get() = Color(0xFFd9e7c9) - override val md_theme_dark_tertiary: Color - get() = Color(0xFFa0cfce) - override val md_theme_dark_onTertiary: Color - get() = Color(0xFF003737) - override val md_theme_dark_tertiaryContainer: Color - get() = Color(0xFF1e4e4d) - override val md_theme_dark_onTertiaryContainer: Color - get() = Color(0xFFbbebea) - override val md_theme_dark_error: Color - get() = Color(0xFFffb4a9) - override val md_theme_dark_errorContainer: Color - get() = Color(0xFF930006) - override val md_theme_dark_onError: Color - get() = Color(0xFF680003) - override val md_theme_dark_onErrorContainer: Color - get() = Color(0xFFffdad4) - override val md_theme_dark_background: Color - get() = Color(0xFF1a1c17) - override val md_theme_dark_onBackground: Color - get() = Color(0xFFe3e3dc) - override val md_theme_dark_surface: Color - get() = Color(0xFF1a1c17) - override val md_theme_dark_onSurface: Color - get() = Color(0xFFe3e3dc) - override val md_theme_dark_surfaceVariant: Color - get() = Color(0xFF43483e) - override val md_theme_dark_onSurfaceVariant: Color - get() = Color(0xFFc4c8bb) - override val md_theme_dark_outline: Color - get() = Color(0xFF8e9386) - override val md_theme_dark_inverseOnSurface: Color - get() = Color(0xFF1a1c17) - override val md_theme_dark_inverseSurface: Color - get() = Color(0xFFe3e3dc) - override val md_theme_dark_inversePrimary: Color - get() = Color(0xFF3c6a1b) - override val md_theme_dark_shadow: Color - get() = Color(0xFF000000) - override val seed: Color - get() = Color(0xFF3c6a1b) - override val error: Color - get() = Color(0xFFba1b1b) -} \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/IColor.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/preset/IColor.kt deleted file mode 100644 index bc992da..0000000 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/IColor.kt +++ /dev/null @@ -1,127 +0,0 @@ -package me.ash.reader.ui.theme.palette.preset - -import androidx.compose.material3.ColorScheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.lightColorScheme -import androidx.compose.ui.graphics.Color - -interface IColor { - val md_theme_light_primary: Color - val md_theme_light_onPrimary: Color - val md_theme_light_primaryContainer: Color - val md_theme_light_onPrimaryContainer: Color - val md_theme_light_secondary: Color - val md_theme_light_onSecondary: Color - val md_theme_light_secondaryContainer: Color - val md_theme_light_onSecondaryContainer: Color - val md_theme_light_tertiary: Color - val md_theme_light_onTertiary: Color - val md_theme_light_tertiaryContainer: Color - val md_theme_light_onTertiaryContainer: Color - val md_theme_light_error: Color - val md_theme_light_errorContainer: Color - val md_theme_light_onError: Color - val md_theme_light_onErrorContainer: Color - val md_theme_light_background: Color - val md_theme_light_onBackground: Color - val md_theme_light_surface: Color - val md_theme_light_onSurface: Color - val md_theme_light_surfaceVariant: Color - val md_theme_light_onSurfaceVariant: Color - val md_theme_light_outline: Color - val md_theme_light_inverseOnSurface: Color - val md_theme_light_inverseSurface: Color - val md_theme_light_inversePrimary: Color - val md_theme_light_shadow: Color - - val md_theme_dark_primary: Color - val md_theme_dark_onPrimary: Color - val md_theme_dark_primaryContainer: Color - val md_theme_dark_onPrimaryContainer: Color - val md_theme_dark_secondary: Color - val md_theme_dark_onSecondary: Color - val md_theme_dark_secondaryContainer: Color - val md_theme_dark_onSecondaryContainer: Color - val md_theme_dark_tertiary: Color - val md_theme_dark_onTertiary: Color - val md_theme_dark_tertiaryContainer: Color - val md_theme_dark_onTertiaryContainer: Color - val md_theme_dark_error: Color - val md_theme_dark_errorContainer: Color - val md_theme_dark_onError: Color - val md_theme_dark_onErrorContainer: Color - val md_theme_dark_background: Color - val md_theme_dark_onBackground: Color - val md_theme_dark_surface: Color - val md_theme_dark_onSurface: Color - val md_theme_dark_surfaceVariant: Color - val md_theme_dark_onSurfaceVariant: Color - val md_theme_dark_outline: Color - val md_theme_dark_inverseOnSurface: Color - val md_theme_dark_inverseSurface: Color - val md_theme_dark_inversePrimary: Color - val md_theme_dark_shadow: Color - - val seed: Color - val error: Color - - val lightColorScheme: ColorScheme - get() = lightColorScheme( - primary = md_theme_light_primary, - onPrimary = md_theme_light_onPrimary, - primaryContainer = md_theme_light_primaryContainer, - onPrimaryContainer = md_theme_light_onPrimaryContainer, - secondary = md_theme_light_secondary, - onSecondary = md_theme_light_onSecondary, - secondaryContainer = md_theme_light_secondaryContainer, - onSecondaryContainer = md_theme_light_onSecondaryContainer, - tertiary = md_theme_light_tertiary, - onTertiary = md_theme_light_onTertiary, - tertiaryContainer = md_theme_light_tertiaryContainer, - onTertiaryContainer = md_theme_light_onTertiaryContainer, - error = md_theme_light_error, - errorContainer = md_theme_light_errorContainer, - onError = md_theme_light_onError, - onErrorContainer = md_theme_light_onErrorContainer, - background = md_theme_light_background, - onBackground = md_theme_light_onBackground, - surface = md_theme_light_surface, - onSurface = md_theme_light_onSurface, - surfaceVariant = md_theme_light_surfaceVariant, - onSurfaceVariant = md_theme_light_onSurfaceVariant, - outline = md_theme_light_outline, - inverseOnSurface = md_theme_light_inverseOnSurface, - inverseSurface = md_theme_light_inverseSurface, - inversePrimary = md_theme_light_inversePrimary, - ) - - val darkColorScheme: ColorScheme - get() = darkColorScheme( - primary = md_theme_dark_primary, - onPrimary = md_theme_dark_onPrimary, - primaryContainer = md_theme_dark_primaryContainer, - onPrimaryContainer = md_theme_dark_onPrimaryContainer, - secondary = md_theme_dark_secondary, - onSecondary = md_theme_dark_onSecondary, - secondaryContainer = md_theme_dark_secondaryContainer, - onSecondaryContainer = md_theme_dark_onSecondaryContainer, - tertiary = md_theme_dark_tertiary, - onTertiary = md_theme_dark_onTertiary, - tertiaryContainer = md_theme_dark_tertiaryContainer, - onTertiaryContainer = md_theme_dark_onTertiaryContainer, - error = md_theme_dark_error, - errorContainer = md_theme_dark_errorContainer, - onError = md_theme_dark_onError, - onErrorContainer = md_theme_dark_onErrorContainer, - background = md_theme_dark_background, - onBackground = md_theme_dark_onBackground, - surface = md_theme_dark_surface, - onSurface = md_theme_dark_onSurface, - surfaceVariant = md_theme_dark_surfaceVariant, - onSurfaceVariant = md_theme_dark_onSurfaceVariant, - outline = md_theme_dark_outline, - inverseOnSurface = md_theme_dark_inverseOnSurface, - inverseSurface = md_theme_dark_inverseSurface, - inversePrimary = md_theme_dark_inversePrimary, - ) -} \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/PurpleColor.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/preset/PurpleColor.kt deleted file mode 100644 index c4e1ffc..0000000 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/preset/PurpleColor.kt +++ /dev/null @@ -1,118 +0,0 @@ -package me.ash.reader.ui.theme.palette.preset - -import androidx.compose.ui.graphics.Color - -object PurpleColor : IColor { - override val md_theme_light_primary: Color - get() = Color(0xFF5f51ac) - override val md_theme_light_onPrimary: Color - get() = Color(0xFFffffff) - override val md_theme_light_primaryContainer: Color - get() = Color(0xFFe6deff) - override val md_theme_light_onPrimaryContainer: Color - get() = Color(0xFF190065) - override val md_theme_light_secondary: Color - get() = Color(0xFF605c72) - override val md_theme_light_onSecondary: Color - get() = Color(0xFFffffff) - override val md_theme_light_secondaryContainer: Color - get() = Color(0xFFe5dff9) - override val md_theme_light_onSecondaryContainer: Color - get() = Color(0xFF1c192c) - override val md_theme_light_tertiary: Color - get() = Color(0xFF7c5264) - override val md_theme_light_onTertiary: Color - get() = Color(0xFFffffff) - override val md_theme_light_tertiaryContainer: Color - get() = Color(0xFFffd8e8) - override val md_theme_light_onTertiaryContainer: Color - get() = Color(0xFF301020) - override val md_theme_light_error: Color - get() = Color(0xFFba1b1b) - override val md_theme_light_errorContainer: Color - get() = Color(0xFFffdad4) - override val md_theme_light_onError: Color - get() = Color(0xFFffffff) - override val md_theme_light_onErrorContainer: Color - get() = Color(0xFF410001) - override val md_theme_light_background: Color - get() = Color(0xFFfffbff) - override val md_theme_light_onBackground: Color - get() = Color(0xFF1c1b1e) - override val md_theme_light_surface: Color - get() = Color(0xFFfffbff) - override val md_theme_light_onSurface: Color - get() = Color(0xFF1c1b1e) - override val md_theme_light_surfaceVariant: Color - get() = Color(0xFFe5e0ec) - override val md_theme_light_onSurfaceVariant: Color - get() = Color(0xFF48454f) - override val md_theme_light_outline: Color - get() = Color(0xFF79767f) - override val md_theme_light_inverseOnSurface: Color - get() = Color(0xFFf4eff4) - override val md_theme_light_inverseSurface: Color - get() = Color(0xFF313033) - override val md_theme_light_inversePrimary: Color - get() = Color(0xFFcabeff) - override val md_theme_light_shadow: Color - get() = Color(0xFF000000) - override val md_theme_dark_primary: Color - get() = Color(0xFFcabeff) - override val md_theme_dark_onPrimary: Color - get() = Color(0xFF301f7a) - override val md_theme_dark_primaryContainer: Color - get() = Color(0xFF473892) - override val md_theme_dark_onPrimaryContainer: Color - get() = Color(0xFFe6deff) - override val md_theme_dark_secondary: Color - get() = Color(0xFFc9c3dc) - override val md_theme_dark_onSecondary: Color - get() = Color(0xFF312e41) - override val md_theme_dark_secondaryContainer: Color - get() = Color(0xFF484459) - override val md_theme_dark_onSecondaryContainer: Color - get() = Color(0xFFe5dff9) - override val md_theme_dark_tertiary: Color - get() = Color(0xFFedb8cd) - override val md_theme_dark_onTertiary: Color - get() = Color(0xFF492536) - override val md_theme_dark_tertiaryContainer: Color - get() = Color(0xFF613b4c) - override val md_theme_dark_onTertiaryContainer: Color - get() = Color(0xFFffd8e8) - override val md_theme_dark_error: Color - get() = Color(0xFFffb4a9) - override val md_theme_dark_errorContainer: Color - get() = Color(0xFF930006) - override val md_theme_dark_onError: Color - get() = Color(0xFF680003) - override val md_theme_dark_onErrorContainer: Color - get() = Color(0xFFffdad4) - override val md_theme_dark_background: Color - get() = Color(0xFF1c1b1e) - override val md_theme_dark_onBackground: Color - get() = Color(0xFFe5e1e5) - override val md_theme_dark_surface: Color - get() = Color(0xFF1c1b1e) - override val md_theme_dark_onSurface: Color - get() = Color(0xFFe5e1e5) - override val md_theme_dark_surfaceVariant: Color - get() = Color(0xFF48454f) - override val md_theme_dark_onSurfaceVariant: Color - get() = Color(0xFFc9c4d0) - override val md_theme_dark_outline: Color - get() = Color(0xFF938f99) - override val md_theme_dark_inverseOnSurface: Color - get() = Color(0xFF1c1b1e) - override val md_theme_dark_inverseSurface: Color - get() = Color(0xFFe5e1e5) - override val md_theme_dark_inversePrimary: Color - get() = Color(0xFF5f51ac) - override val md_theme_dark_shadow: Color - get() = Color(0xFF000000) - override val seed: Color - get() = Color(0xFF53459f) - override val error: Color - get() = Color(0xFFba1b1b) -} \ No newline at end of file diff --git a/app/src/main/res/drawable/palettie.xml b/app/src/main/res/drawable/palettie.xml deleted file mode 100644 index a13a0a3..0000000 --- a/app/src/main/res/drawable/palettie.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/welcome.xml b/app/src/main/res/drawable/welcome.xml deleted file mode 100644 index 7d38fe4..0000000 --- a/app/src/main/res/drawable/welcome.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 8652c39..99933ec 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -74,6 +74,8 @@ 关闭 获取新的更新 版本 0.6.1 现已发布 + 施工中 + 正在路上 账户 本地、FreshRSS 颜色和样式 @@ -93,12 +95,16 @@ 暂无色板 仅限 Android 8.1+ 基本颜色 + 强调色 + 例如 #666666 或 666666 + 外观 样式 深色模式 跟随系统设置 色调海拔 字体 基本字体 - 阅读字体 - 阅读字体大小 + 订阅源页面 + 信息流页面 + 阅读页面 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 93f3345..ba9b704 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -72,8 +72,10 @@ 3d 7d Close - Get New updates + Get new updates Version 0.6.1 has been released + In coding + Coming soon Accounts Local, FreshRSS Color & style @@ -93,12 +95,16 @@ No Palettes Only Android 8.1+ Basic Colors + Primary Color + Like #666666 or 666666 + Appearance Style Dark Theme Use Device Theme Tonal Elevation Fonts Basic Fonts - Reading Fonts - Reading Fonts Size + Feeds Page + Flow Page + Reading Page \ No newline at end of file