mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-02-02 04:09:13 +00:00
Merge pull request #11539 from Isira-Seneviratne/Compose-theme-improvements
Compose theme improvements
This commit is contained in:
commit
407d2d768d
@ -3,7 +3,6 @@ package org.schabi.newpipe.fragments.list.comments
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.Fragment
|
||||
@ -20,7 +19,7 @@ class CommentsFragment : Fragment() {
|
||||
savedInstanceState: Bundle?
|
||||
) = content {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
CommentSection()
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.fragments.list.videos
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.Fragment
|
||||
@ -21,7 +20,7 @@ class RelatedItemsFragment : Fragment() {
|
||||
savedInstanceState: Bundle?
|
||||
) = content {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
RelatedItems(requireArguments().serializable<StreamInfo>(KEY_INFO)!!)
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.SearchBar
|
||||
import androidx.compose.material3.SearchBarDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -91,14 +90,7 @@ fun Toolbar(
|
||||
active = true,
|
||||
onActiveChange = {
|
||||
isSearchActive = it
|
||||
},
|
||||
colors = SearchBarDefaults.colors(
|
||||
containerColor = MaterialTheme.colorScheme.background,
|
||||
inputFieldColors = SearchBarDefaults.inputFieldColors(
|
||||
focusedTextColor = MaterialTheme.colorScheme.onBackground,
|
||||
unfocusedTextColor = MaterialTheme.colorScheme.onBackground
|
||||
)
|
||||
)
|
||||
}
|
||||
) {
|
||||
onSearchQueryChange?.invoke(query)?.takeIf { it.isNotEmpty() }
|
||||
?.map { suggestionText -> SearchSuggestionItem(text = suggestionText) }
|
||||
|
@ -3,16 +3,11 @@ package org.schabi.newpipe.ui.components.common
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
||||
@Composable
|
||||
fun LoadingIndicator(modifier: Modifier = Modifier) {
|
||||
CircularProgressIndicator(
|
||||
modifier = modifier.fillMaxSize().wrapContentSize(Alignment.Center),
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
trackColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||
)
|
||||
CircularProgressIndicator(modifier = modifier.fillMaxSize().wrapContentSize(Alignment.Center))
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import my.nanihadesuka.compose.LazyColumnScrollbar
|
||||
import my.nanihadesuka.compose.ScrollbarSettings
|
||||
|
||||
@Composable
|
||||
@ -20,7 +21,7 @@ fun LazyColumnThemedScrollbar(
|
||||
indicatorContent: (@Composable (index: Int, isThumbSelected: Boolean) -> Unit)? = null,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
my.nanihadesuka.compose.LazyColumnScrollbar(
|
||||
LazyColumnScrollbar(
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
settings = settings,
|
||||
|
@ -64,7 +64,7 @@ private fun PlaylistListItemPreview() {
|
||||
playlist.uploaderName = "Uploader"
|
||||
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
PlaylistListItem(playlist)
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ private fun StreamListItemPreview(
|
||||
@PreviewParameter(StreamItemPreviewProvider::class) stream: StreamInfoItem
|
||||
) {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
StreamListItem(stream, showProgress = false, isSelected = false)
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package org.schabi.newpipe.ui.components.items.stream
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@ -34,8 +32,8 @@ fun StreamMenu(
|
||||
|
||||
DropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest) {
|
||||
if (playerHolder.isPlayQueueReady) {
|
||||
StreamMenuItem(
|
||||
text = R.string.enqueue_stream,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.enqueue_stream)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
SparseItemUtil.fetchItemInfoIfSparse(context, stream) {
|
||||
@ -45,8 +43,8 @@ fun StreamMenu(
|
||||
)
|
||||
|
||||
if (playerHolder.queuePosition < playerHolder.queueSize - 1) {
|
||||
StreamMenuItem(
|
||||
text = R.string.enqueue_next_stream,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.enqueue_next_stream)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
SparseItemUtil.fetchItemInfoIfSparse(context, stream) {
|
||||
@ -57,8 +55,8 @@ fun StreamMenu(
|
||||
}
|
||||
}
|
||||
|
||||
StreamMenuItem(
|
||||
text = R.string.start_here_on_background,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.start_here_on_background)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
SparseItemUtil.fetchItemInfoIfSparse(context, stream) {
|
||||
@ -66,8 +64,8 @@ fun StreamMenu(
|
||||
}
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.start_here_on_popup,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.start_here_on_popup)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
SparseItemUtil.fetchItemInfoIfSparse(context, stream) {
|
||||
@ -75,8 +73,8 @@ fun StreamMenu(
|
||||
}
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.download,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.download)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
SparseItemUtil.fetchStreamInfoAndSaveToDatabase(
|
||||
@ -89,8 +87,8 @@ fun StreamMenu(
|
||||
}
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.add_to_playlist,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.add_to_playlist)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
val list = listOf(StreamEntity(stream))
|
||||
@ -103,29 +101,29 @@ fun StreamMenu(
|
||||
}
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.share,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.share)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
ShareUtils.shareText(context, stream.name, stream.url, stream.thumbnails)
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.open_in_browser,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.open_in_browser)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
ShareUtils.openUrlInBrowser(context, stream.url)
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.mark_as_watched,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.mark_as_watched)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
streamViewModel.markAsWatched(stream)
|
||||
}
|
||||
)
|
||||
StreamMenuItem(
|
||||
text = R.string.show_channel_details,
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = stringResource(R.string.show_channel_details)) },
|
||||
onClick = {
|
||||
onDismissRequest()
|
||||
SparseItemUtil.fetchUploaderUrlIfSparse(
|
||||
@ -138,16 +136,3 @@ fun StreamMenu(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun StreamMenuItem(
|
||||
@StringRes text: Int,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = {
|
||||
Text(text = stringResource(text), color = MaterialTheme.colorScheme.onBackground)
|
||||
},
|
||||
onClick = onClick
|
||||
)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
@ -94,7 +93,7 @@ private fun RelatedItemsPreview() {
|
||||
)
|
||||
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
RelatedItems(info)
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ private fun CommentPreview(
|
||||
@PreviewParameter(CommentPreviewProvider::class) commentsInfoItem: CommentsInfoItem
|
||||
) {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
Comment(commentsInfoItem) {}
|
||||
}
|
||||
}
|
||||
@ -267,7 +267,7 @@ private fun CommentPreview(
|
||||
@Composable
|
||||
private fun CommentListPreview() {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
Column {
|
||||
for (comment in CommentPreviewProvider().values) {
|
||||
Comment(comment) {}
|
||||
|
@ -6,14 +6,11 @@ import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.contentColorFor
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Modifier
|
||||
@ -86,12 +83,6 @@ private fun CommentRepliesDialog(
|
||||
ModalBottomSheet(
|
||||
sheetState = sheetState,
|
||||
onDismissRequest = onDismissRequest,
|
||||
) {
|
||||
CompositionLocalProvider(
|
||||
// contentColorFor(MaterialTheme.colorScheme.containerColor), i.e. ModalBottomSheet's
|
||||
// default background color, does not resolve correctly, so need to manually set the
|
||||
// content color for MaterialTheme.colorScheme.background instead
|
||||
LocalContentColor provides contentColorFor(MaterialTheme.colorScheme.background)
|
||||
) {
|
||||
LazyColumnThemedScrollbar(state = listState) {
|
||||
LazyColumn(
|
||||
@ -138,8 +129,8 @@ private fun CommentRepliesDialog(
|
||||
EmptyStateSpec.DisabledComments.copy(
|
||||
descriptionText = {
|
||||
stringResource(R.string.error_unable_to_load_comments)
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
} else {
|
||||
EmptyStateComposable(EmptyStateSpec.NoComments)
|
||||
@ -156,7 +147,6 @@ private fun CommentRepliesDialog(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light mode", uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
|
@ -143,7 +143,7 @@ fun CommentRepliesHeaderPreview() {
|
||||
)
|
||||
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
CommentRepliesHeader(comment) {}
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ private fun CommentSection(
|
||||
@Composable
|
||||
private fun CommentSectionLoadingPreview() {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
CommentSection(uiState = Resource.Loading, commentsFlow = flowOf())
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ private fun CommentSectionSuccessPreview() {
|
||||
}
|
||||
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
CommentSection(
|
||||
uiState = Resource.Success(
|
||||
CommentInfo(
|
||||
@ -186,7 +186,7 @@ private fun CommentSectionSuccessPreview() {
|
||||
@Composable
|
||||
private fun CommentSectionErrorPreview() {
|
||||
AppTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
Surface {
|
||||
CommentSection(uiState = Resource.Error(RuntimeException()), commentsFlow = flowOf())
|
||||
}
|
||||
}
|
||||
|
@ -2,62 +2,74 @@ package org.schabi.newpipe.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val md_theme_light_primary = Color(0xFFBB171C)
|
||||
val md_theme_light_onPrimary = Color(0xFFFFFFFF)
|
||||
val md_theme_light_primaryContainer = Color(0xFFFFDAD6)
|
||||
val md_theme_light_onPrimaryContainer = Color(0xFF410002)
|
||||
val md_theme_light_secondary = Color(0xFF984061)
|
||||
val md_theme_light_onSecondary = Color(0xFFFFFFFF)
|
||||
val md_theme_light_secondaryContainer = Color(0xFFFFD9E2)
|
||||
val md_theme_light_onSecondaryContainer = Color(0xFF3E001D)
|
||||
val md_theme_light_tertiary = Color(0xFF006874)
|
||||
val md_theme_light_onTertiary = Color(0xFFFFFFFF)
|
||||
val md_theme_light_tertiaryContainer = Color(0xFF97F0FF)
|
||||
val md_theme_light_onTertiaryContainer = Color(0xFF001F24)
|
||||
val md_theme_light_error = Color(0xFFBA1A1A)
|
||||
val md_theme_light_errorContainer = Color(0xFFFFDAD6)
|
||||
val md_theme_light_onError = Color(0xFFFFFFFF)
|
||||
val md_theme_light_onErrorContainer = Color(0xFF410002)
|
||||
val md_theme_light_background = Color(0xFFEEEEEE)
|
||||
val md_theme_light_onBackground = Color(0xFF1B1B1B)
|
||||
val md_theme_light_surface = Color(0xFFE53835)
|
||||
val md_theme_light_onSurface = Color(0xFFFFFFFF)
|
||||
val md_theme_light_surfaceVariant = Color(0xFFF5DDDB)
|
||||
val md_theme_light_onSurfaceVariant = Color(0xFF534341)
|
||||
val md_theme_light_outline = Color(0xFF857371)
|
||||
val md_theme_light_inverseOnSurface = Color(0xFFD6F6FF)
|
||||
val md_theme_light_inverseSurface = Color(0xFF00363F)
|
||||
val md_theme_light_inversePrimary = Color(0xFFFFB4AC)
|
||||
val md_theme_light_surfaceTint = Color(0xFFBB171C)
|
||||
val md_theme_light_outlineVariant = Color(0xFFD8C2BF)
|
||||
val md_theme_light_scrim = Color(0xFF000000)
|
||||
val primaryLight = Color(0xFF904A45)
|
||||
val onPrimaryLight = Color(0xFFFFFFFF)
|
||||
val primaryContainerLight = Color(0xFFFFDAD6)
|
||||
val onPrimaryContainerLight = Color(0xFF3B0908)
|
||||
val secondaryLight = Color(0xFF775653)
|
||||
val onSecondaryLight = Color(0xFFFFFFFF)
|
||||
val secondaryContainerLight = Color(0xFFFFDAD6)
|
||||
val onSecondaryContainerLight = Color(0xFF2C1513)
|
||||
val tertiaryLight = Color(0xFF725B2E)
|
||||
val onTertiaryLight = Color(0xFFFFFFFF)
|
||||
val tertiaryContainerLight = Color(0xFFFEDEA6)
|
||||
val onTertiaryContainerLight = Color(0xFF261900)
|
||||
val errorLight = Color(0xFFBA1A1A)
|
||||
val onErrorLight = Color(0xFFFFFFFF)
|
||||
val errorContainerLight = Color(0xFFFFDAD6)
|
||||
val onErrorContainerLight = Color(0xFF410002)
|
||||
val backgroundLight = Color(0xFFFFF8F7)
|
||||
val onBackgroundLight = Color(0xFF231918)
|
||||
val surfaceLight = Color(0xFFFFF8F7)
|
||||
val onSurfaceLight = Color(0xFF231918)
|
||||
val surfaceVariantLight = Color(0xFFF5DDDB)
|
||||
val onSurfaceVariantLight = Color(0xFF534342)
|
||||
val outlineLight = Color(0xFF857371)
|
||||
val outlineVariantLight = Color(0xFFD8C2BF)
|
||||
val scrimLight = Color(0xFF000000)
|
||||
val inverseSurfaceLight = Color(0xFF392E2D)
|
||||
val inverseOnSurfaceLight = Color(0xFFFFEDEB)
|
||||
val inversePrimaryLight = Color(0xFFFFB3AC)
|
||||
val surfaceDimLight = Color(0xFFE8D6D4)
|
||||
val surfaceBrightLight = Color(0xFFFFF8F7)
|
||||
val surfaceContainerLowestLight = Color(0xFFFFFFFF)
|
||||
val surfaceContainerLowLight = Color(0xFFFFF0EF)
|
||||
val surfaceContainerLight = Color(0xFFFCEAE8)
|
||||
val surfaceContainerHighLight = Color(0xFFF6E4E2)
|
||||
val surfaceContainerHighestLight = Color(0xFFF1DEDC)
|
||||
|
||||
val md_theme_dark_primary = Color(0xFFFFB4AC)
|
||||
val md_theme_dark_onPrimary = Color(0xFF690006)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF93000D)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFFFFDAD6)
|
||||
val md_theme_dark_secondary = Color(0xFFFFB1C8)
|
||||
val md_theme_dark_onSecondary = Color(0xFF5E1133)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF7B2949)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFFFD9E2)
|
||||
val md_theme_dark_tertiary = Color(0xFF4FD8EB)
|
||||
val md_theme_dark_onTertiary = Color(0xFF00363D)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF004F58)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFF97F0FF)
|
||||
val md_theme_dark_error = Color(0xFFFFB4AB)
|
||||
val md_theme_dark_errorContainer = Color(0xFF93000A)
|
||||
val md_theme_dark_onError = Color(0xFF690005)
|
||||
val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6)
|
||||
val md_theme_dark_background = Color(0xFF212121)
|
||||
val md_theme_dark_onBackground = Color(0xFFFFFFFF)
|
||||
val md_theme_dark_surface = Color(0xFF992521)
|
||||
val md_theme_dark_onSurface = Color(0xFFFFFFFF)
|
||||
val md_theme_dark_surfaceVariant = Color(0xFF534341)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFD8C2BF)
|
||||
val md_theme_dark_outline = Color(0xFFA08C8A)
|
||||
val md_theme_dark_inverseOnSurface = Color(0xFF001F25)
|
||||
val md_theme_dark_inverseSurface = Color(0xFFA6EEFF)
|
||||
val md_theme_dark_inversePrimary = Color(0xFFBB171C)
|
||||
val md_theme_dark_surfaceTint = Color(0xFFFFB4AC)
|
||||
val md_theme_dark_outlineVariant = Color(0xFF534341)
|
||||
val md_theme_dark_scrim = Color(0xFF000000)
|
||||
val primaryDark = Color(0xFFFFB3AC)
|
||||
val onPrimaryDark = Color(0xFF571E1B)
|
||||
val primaryContainerDark = Color(0xFF73332F)
|
||||
val onPrimaryContainerDark = Color(0xFFFFDAD6)
|
||||
val secondaryDark = Color(0xFFE7BDB8)
|
||||
val onSecondaryDark = Color(0xFF442927)
|
||||
val secondaryContainerDark = Color(0xFF5D3F3C)
|
||||
val onSecondaryContainerDark = Color(0xFFFFDAD6)
|
||||
val tertiaryDark = Color(0xFFE1C38C)
|
||||
val onTertiaryDark = Color(0xFF402D04)
|
||||
val tertiaryContainerDark = Color(0xFF584419)
|
||||
val onTertiaryContainerDark = Color(0xFFFEDEA6)
|
||||
val errorDark = Color(0xFFFFB4AB)
|
||||
val onErrorDark = Color(0xFF690005)
|
||||
val errorContainerDark = Color(0xFF93000A)
|
||||
val onErrorContainerDark = Color(0xFFFFDAD6)
|
||||
val backgroundDark = Color(0xFF1A1110)
|
||||
val onBackgroundDark = Color(0xFFF1DEDC)
|
||||
val surfaceDark = Color(0xFF1A1110)
|
||||
val onSurfaceDark = Color(0xFFF1DEDC)
|
||||
val surfaceVariantDark = Color(0xFF534342)
|
||||
val onSurfaceVariantDark = Color(0xFFD8C2BF)
|
||||
val outlineDark = Color(0xFFA08C8A)
|
||||
val outlineVariantDark = Color(0xFF534342)
|
||||
val scrimDark = Color(0xFF000000)
|
||||
val inverseSurfaceDark = Color(0xFFF1DEDC)
|
||||
val inverseOnSurfaceDark = Color(0xFF392E2D)
|
||||
val inversePrimaryDark = Color(0xFF904A45)
|
||||
val surfaceDimDark = Color(0xFF1A1110)
|
||||
val surfaceBrightDark = Color(0xFF423735)
|
||||
val surfaceContainerLowestDark = Color(0xFF140C0B)
|
||||
val surfaceContainerLowDark = Color(0xFF231918)
|
||||
val surfaceContainerDark = Color(0xFF271D1C)
|
||||
val surfaceContainerHighDark = Color(0xFF322827)
|
||||
val surfaceContainerHighestDark = Color(0xFF3D3231)
|
||||
|
@ -5,75 +5,102 @@ 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 androidx.compose.ui.platform.LocalContext
|
||||
import androidx.preference.PreferenceManager
|
||||
|
||||
private val LightColors = 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,
|
||||
surfaceTint = md_theme_light_surfaceTint,
|
||||
outlineVariant = md_theme_light_outlineVariant,
|
||||
scrim = md_theme_light_scrim,
|
||||
private val lightScheme = lightColorScheme(
|
||||
primary = primaryLight,
|
||||
onPrimary = onPrimaryLight,
|
||||
primaryContainer = primaryContainerLight,
|
||||
onPrimaryContainer = onPrimaryContainerLight,
|
||||
secondary = secondaryLight,
|
||||
onSecondary = onSecondaryLight,
|
||||
secondaryContainer = secondaryContainerLight,
|
||||
onSecondaryContainer = onSecondaryContainerLight,
|
||||
tertiary = tertiaryLight,
|
||||
onTertiary = onTertiaryLight,
|
||||
tertiaryContainer = tertiaryContainerLight,
|
||||
onTertiaryContainer = onTertiaryContainerLight,
|
||||
error = errorLight,
|
||||
onError = onErrorLight,
|
||||
errorContainer = errorContainerLight,
|
||||
onErrorContainer = onErrorContainerLight,
|
||||
background = backgroundLight,
|
||||
onBackground = onBackgroundLight,
|
||||
surface = surfaceLight,
|
||||
onSurface = onSurfaceLight,
|
||||
surfaceVariant = surfaceVariantLight,
|
||||
onSurfaceVariant = onSurfaceVariantLight,
|
||||
outline = outlineLight,
|
||||
outlineVariant = outlineVariantLight,
|
||||
scrim = scrimLight,
|
||||
inverseSurface = inverseSurfaceLight,
|
||||
inverseOnSurface = inverseOnSurfaceLight,
|
||||
inversePrimary = inversePrimaryLight,
|
||||
surfaceDim = surfaceDimLight,
|
||||
surfaceBright = surfaceBrightLight,
|
||||
surfaceContainerLowest = surfaceContainerLowestLight,
|
||||
surfaceContainerLow = surfaceContainerLowLight,
|
||||
surfaceContainer = surfaceContainerLight,
|
||||
surfaceContainerHigh = surfaceContainerHighLight,
|
||||
surfaceContainerHighest = surfaceContainerHighestLight,
|
||||
)
|
||||
|
||||
private val DarkColors = 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,
|
||||
surfaceTint = md_theme_dark_surfaceTint,
|
||||
outlineVariant = md_theme_dark_outlineVariant,
|
||||
scrim = md_theme_dark_scrim,
|
||||
private val darkScheme = darkColorScheme(
|
||||
primary = primaryDark,
|
||||
onPrimary = onPrimaryDark,
|
||||
primaryContainer = primaryContainerDark,
|
||||
onPrimaryContainer = onPrimaryContainerDark,
|
||||
secondary = secondaryDark,
|
||||
onSecondary = onSecondaryDark,
|
||||
secondaryContainer = secondaryContainerDark,
|
||||
onSecondaryContainer = onSecondaryContainerDark,
|
||||
tertiary = tertiaryDark,
|
||||
onTertiary = onTertiaryDark,
|
||||
tertiaryContainer = tertiaryContainerDark,
|
||||
onTertiaryContainer = onTertiaryContainerDark,
|
||||
error = errorDark,
|
||||
onError = onErrorDark,
|
||||
errorContainer = errorContainerDark,
|
||||
onErrorContainer = onErrorContainerDark,
|
||||
background = backgroundDark,
|
||||
onBackground = onBackgroundDark,
|
||||
surface = surfaceDark,
|
||||
onSurface = onSurfaceDark,
|
||||
surfaceVariant = surfaceVariantDark,
|
||||
onSurfaceVariant = onSurfaceVariantDark,
|
||||
outline = outlineDark,
|
||||
outlineVariant = outlineVariantDark,
|
||||
scrim = scrimDark,
|
||||
inverseSurface = inverseSurfaceDark,
|
||||
inverseOnSurface = inverseOnSurfaceDark,
|
||||
inversePrimary = inversePrimaryDark,
|
||||
surfaceDim = surfaceDimDark,
|
||||
surfaceBright = surfaceBrightDark,
|
||||
surfaceContainerLowest = surfaceContainerLowestDark,
|
||||
surfaceContainerLow = surfaceContainerLowDark,
|
||||
surfaceContainer = surfaceContainerDark,
|
||||
surfaceContainerHigh = surfaceContainerHighDark,
|
||||
surfaceContainerHighest = surfaceContainerHighestDark,
|
||||
)
|
||||
|
||||
private val blackScheme = darkScheme.copy(surface = Color.Black)
|
||||
|
||||
@Composable
|
||||
fun AppTheme(useDarkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(LocalContext.current)
|
||||
val theme = sharedPreferences.getString("theme", "auto_device_theme")
|
||||
val nightTheme = sharedPreferences.getString("night_theme", "dark_theme")
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = if (useDarkTheme) DarkColors else LightColors,
|
||||
colorScheme = if (!useDarkTheme) {
|
||||
lightScheme
|
||||
} else if (theme == "black_theme" || nightTheme == "black_theme") {
|
||||
blackScheme
|
||||
} else {
|
||||
darkScheme
|
||||
},
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
<color name="placeholder_foreground">#6C6C6C</color>
|
||||
|
||||
<!-- Light Theme -->
|
||||
<color name="light_background_color">#EEEEEE</color>
|
||||
<color name="light_dialog_background_color">#EEEEEE</color>
|
||||
<color name="light_background_color">#FFFFF8F7</color>
|
||||
<color name="light_dialog_background_color">#FFFFF8F7</color>
|
||||
<color name="light_settings_accent_color">#e53935</color>
|
||||
<color name="light_separator_color">#32000000</color>
|
||||
<color name="light_ripple_color">#48868686</color>
|
||||
@ -25,7 +25,7 @@
|
||||
<color name="light_border_color">#33000000</color>
|
||||
|
||||
<!-- Dark Theme -->
|
||||
<color name="dark_background_color">#222222</color>
|
||||
<color name="dark_background_color">#FF1A1110</color>
|
||||
<color name="dark_dialog_background_color">#424242</color>
|
||||
<color name="dark_settings_accent_color">#ff5252</color>
|
||||
<color name="dark_separator_color">#0affffff</color>
|
||||
|
Loading…
Reference in New Issue
Block a user