- Migrates "Show Anyway" and "Show More" buttons to lighter version (Tonal)

- Improves tonal rendering on Light theme
- Lightens card surfaces
- Adjusts surfaceTint on Dark theme to match the elevation differences on the Light theme
This commit is contained in:
Vitor Pamplona
2025-03-26 11:22:27 -04:00
parent aa9f1b6c4f
commit aac366c690
24 changed files with 142 additions and 175 deletions
@@ -67,12 +67,12 @@ import com.vitorpamplona.amethyst.ui.note.ZapIcon
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.AmethystTheme
import com.vitorpamplona.amethyst.ui.theme.CashuCardBorders
import com.vitorpamplona.amethyst.ui.theme.Size18Modifier
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
import com.vitorpamplona.amethyst.ui.theme.SmallishBorder
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
@@ -129,14 +129,12 @@ fun CashuPreviewPreview() {
sharedPreferencesViewModel.init()
sharedPreferencesViewModel.updateTheme(ThemeType.DARK)
AmethystTheme(sharedPrefsViewModel = sharedPreferencesViewModel) {
Column {
CashuPreviewNew(
token = CashuToken("token", "mint", 32400, listOf()),
melt = { token, context, onDone -> },
toast = { title, message -> },
)
}
ThemeComparisonColumn {
CashuPreviewNew(
token = CashuToken("token", "mint", 32400, listOf()),
melt = { token, context, onDone -> },
toast = { title, message -> },
)
}
}
@@ -210,7 +208,6 @@ fun CashuPreviewNew(
Text(
"Redeem",
color = MaterialTheme.colorScheme.onBackground,
fontSize = 16.sp,
)
}
@@ -232,7 +229,7 @@ fun CashuPreviewNew(
shape = SmallishBorder,
contentPadding = PaddingValues(0.dp),
) {
OpenInNewIcon(Size18Modifier, tint = MaterialTheme.colorScheme.onBackground)
OpenInNewIcon(Size18Modifier)
}
Spacer(modifier = StdHorzSpacer)
@@ -245,7 +242,7 @@ fun CashuPreviewNew(
shape = SmallishBorder,
contentPadding = PaddingValues(0.dp),
) {
CopyIcon(Size18Modifier, tint = MaterialTheme.colorScheme.onBackground)
CopyIcon(Size18Modifier)
}
}
}
@@ -26,9 +26,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
@@ -50,7 +48,6 @@ import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
import com.vitorpamplona.amethyst.ui.theme.StdTopPadding
import com.vitorpamplona.amethyst.ui.theme.secondaryButtonBackground
import com.vitorpamplona.quartz.nip02FollowList.ImmutableListOfLists
object ShowFullTextCache {
@@ -128,16 +125,12 @@ fun ExpandableRichTextViewer(
@Composable
fun ShowMoreButton(onClick: () -> Unit) {
Button(
FilledTonalButton(
modifier = StdTopPadding,
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.secondaryButtonBackground,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.show_more), color = Color.White)
Text(text = stringRes(R.string.show_more))
}
}
@@ -32,8 +32,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.rounded.Warning
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
@@ -161,19 +160,14 @@ fun ContentWarningNote(onDismiss: () -> Unit) {
}
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
Button(
FilledTonalButton(
modifier = Modifier.padding(top = 10.dp),
onClick = onDismiss,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(
text = stringRes(R.string.show_anyway),
color = Color.White,
)
}
}
@@ -29,6 +29,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.width
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
@@ -38,6 +39,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
import com.vitorpamplona.amethyst.ui.theme.isLight
@Composable
fun TopBarExtensibleWithBackButton(
@@ -90,7 +92,8 @@ fun MyExtensibleTopAppBar(
)
if (expanded.value && extendableRow != null) {
Surface(modifier = Modifier.fillMaxWidth(), tonalElevation = 10.dp) {
val elevation = if (MaterialTheme.colorScheme.isLight) 1.dp else 10.dp
Surface(modifier = Modifier.fillMaxWidth(), tonalElevation = elevation) {
Column { extendableRow() }
}
}
@@ -26,9 +26,7 @@ import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
@@ -155,17 +153,13 @@ fun HiddenNote(
}
}
Button(
FilledTonalButton(
modifier = Modifier.padding(top = 10.dp),
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
contentColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.show_anyway), color = Color.White)
Text(text = stringRes(R.string.show_anyway))
}
}
}
@@ -201,17 +195,13 @@ fun HiddenNoteByMe(
textAlign = TextAlign.Center,
)
Button(
FilledTonalButton(
modifier = Modifier.padding(top = 10.dp),
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
contentColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.show_anyway), color = Color.White)
Text(text = stringRes(R.string.show_anyway))
}
}
}
@@ -312,27 +312,19 @@ fun CashuIcon(modifier: Modifier) {
}
@Composable
fun CopyIcon(
modifier: Modifier,
tint: Color = Color.Unspecified,
) {
fun CopyIcon(modifier: Modifier) {
Icon(
imageVector = Icons.Default.ContentCopy,
stringRes(id = R.string.copy_to_clipboard),
tint = tint,
modifier = modifier,
)
}
@Composable
fun OpenInNewIcon(
modifier: Modifier,
tint: Color = Color.Unspecified,
) {
fun OpenInNewIcon(modifier: Modifier) {
Icon(
imageVector = Icons.AutoMirrored.Filled.OpenInNew,
stringRes(id = R.string.copy_to_clipboard),
tint = tint,
modifier = modifier,
)
}
@@ -25,9 +25,8 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
@@ -35,7 +34,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
@@ -121,33 +119,25 @@ private fun RelayOptions(
@Composable
fun AddRelayButton(onClick: () -> Unit) {
Button(
OutlinedButton(
modifier = Modifier.padding(horizontal = 3.dp),
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(id = R.string.add), color = Color.White)
Text(text = stringRes(id = R.string.add))
}
}
@Composable
fun RemoveRelayButton(onClick: () -> Unit) {
Button(
OutlinedButton(
modifier = Modifier.padding(horizontal = 3.dp),
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.remove), color = Color.White)
Text(text = stringRes(R.string.remove))
}
}
@@ -52,7 +52,9 @@ fun UserCompose(
UserPicture(baseUser, Size55dp, accountViewModel = accountViewModel, nav = nav)
Column(modifier = remember { Modifier.padding(start = 10.dp).weight(1f) }) {
Row(verticalAlignment = Alignment.CenterVertically) { UsernameDisplay(baseUser, accountViewModel = accountViewModel) }
Row(verticalAlignment = Alignment.CenterVertically) {
UsernameDisplay(baseUser, accountViewModel = accountViewModel)
}
AboutDisplay(baseUser)
}
@@ -34,7 +34,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -165,8 +164,6 @@ fun UserActionOptions(
baseAuthor: User,
accountViewModel: AccountViewModel,
) {
val scope = rememberCoroutineScope()
WatchIsHiddenUser(baseAuthor, accountViewModel) { isHidden ->
if (isHidden) {
ShowUserButton { accountViewModel.show(baseAuthor) }
@@ -24,11 +24,10 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@@ -62,7 +61,7 @@ fun AddButton(
modifier: Modifier = Modifier.padding(start = 3.dp),
onClick: () -> Unit,
) {
Button(
OutlinedButton(
modifier = modifier,
onClick = {
if (isActive) {
@@ -73,7 +72,7 @@ fun AddButton(
enabled = isActive,
contentPadding = PaddingValues(vertical = 0.dp, horizontal = 16.dp),
) {
Text(text = stringRes(text), color = Color.White, textAlign = TextAlign.Center)
Text(text = stringRes(text), textAlign = TextAlign.Center)
}
}
@@ -82,7 +81,7 @@ fun RemoveButton(
isActive: Boolean = true,
onClick: () -> Unit,
) {
Button(
OutlinedButton(
modifier = Modifier.padding(start = 3.dp),
onClick = {
if (isActive) {
@@ -93,6 +92,6 @@ fun RemoveButton(
enabled = isActive,
contentPadding = PaddingValues(vertical = 0.dp, horizontal = 16.dp),
) {
Text(text = stringRes(R.string.remove), color = Color.White)
Text(text = stringRes(R.string.remove))
}
}
@@ -31,7 +31,7 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.EditNote
import androidx.compose.material3.Button
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
@@ -42,7 +42,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@@ -132,7 +131,7 @@ fun GroupMembersHeader(
val list = remember(room) { room.users.toPersistentList() }
Row(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.fillMaxWidth().padding(5.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
@@ -181,7 +180,7 @@ private fun EditRoomSubjectButton(
NewChatroomSubjectDialog({ wantsToPost = false }, accountViewModel, room)
}
Button(
FilledTonalButton(
modifier =
Modifier
.padding(horizontal = 3.dp)
@@ -190,7 +189,6 @@ private fun EditRoomSubjectButton(
contentPadding = ZeroPadding,
) {
Icon(
tint = Color.White,
imageVector = Icons.Default.EditNote,
contentDescription = stringRes(R.string.edits_the_channel_metadata),
)
@@ -30,7 +30,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.PublicChatChannel
@@ -55,7 +54,6 @@ fun EditButton(
contentPadding = ZeroPadding,
) {
Icon(
tint = Color.White,
imageVector = Icons.Default.EditNote,
contentDescription = stringRes(R.string.edits_the_channel_metadata),
)
@@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.nip28
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.PublicChatChannel
import com.vitorpamplona.amethyst.ui.navigation.INav
@@ -43,6 +42,6 @@ fun JoinChatButton(
onClick = { accountViewModel.follow(channel) },
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.join), color = Color.White)
Text(text = stringRes(R.string.join))
}
}
@@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.publicChannels.nip28
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.PublicChatChannel
import com.vitorpamplona.amethyst.ui.navigation.INav
@@ -43,6 +42,6 @@ fun LeaveChatButton(
onClick = { accountViewModel.unfollow(channel) },
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.leave), color = Color.White)
Text(text = stringRes(R.string.leave))
}
}
@@ -29,7 +29,6 @@ import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
@@ -80,7 +79,6 @@ fun LinkChatButton(
contentPadding = ZeroPadding,
) {
Icon(
tint = Color.White,
imageVector = Icons.Default.ContentCopy,
contentDescription = stringRes(R.string.quick_action_copy_note_id),
modifier = Size20Modifier,
@@ -30,7 +30,6 @@ import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
@@ -65,7 +64,6 @@ fun OpenChatButton(
contentPadding = ZeroPadding,
) {
Icon(
tint = Color.White,
imageVector = Icons.AutoMirrored.Filled.OpenInNew,
contentDescription = stringRes(R.string.quick_actions_open_in_another_app),
modifier = Size20Modifier,
@@ -31,7 +31,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
@@ -77,7 +76,6 @@ fun ShareChatButton(
contentPadding = ZeroPadding,
) {
Icon(
tint = Color.White,
imageVector = Icons.Default.Share,
contentDescription = stringRes(R.string.quick_action_share),
modifier = Size20Modifier,
@@ -21,13 +21,10 @@
package com.vitorpamplona.amethyst.ui.screen.loggedIn.profile
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
@@ -40,32 +37,24 @@ fun FollowButton(
text: Int = R.string.follow,
onClick: () -> Unit,
) {
Button(
FilledTonalButton(
modifier = Modifier.padding(start = 3.dp),
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(text), color = Color.White, textAlign = TextAlign.Center)
Text(text = stringRes(text), textAlign = TextAlign.Center)
}
}
@Composable
fun UnfollowButton(onClick: () -> Unit) {
Button(
FilledTonalButton(
modifier = Modifier.padding(horizontal = 3.dp),
onClick = onClick,
shape = ButtonBorder,
colors =
ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.unfollow), color = Color.White)
Text(text = stringRes(R.string.unfollow))
}
}
@@ -24,11 +24,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.EditNote
import androidx.compose.material3.Button
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
@@ -50,7 +49,7 @@ fun InnerEditButtonPreview() {
@Composable
fun InnerEditButton(onClick: () -> Unit) {
Button(
FilledTonalButton(
modifier =
Modifier
.padding(horizontal = 3.dp)
@@ -59,7 +58,6 @@ fun InnerEditButton(onClick: () -> Unit) {
contentPadding = ZeroPadding,
) {
Icon(
tint = Color.White,
imageVector = Icons.Default.EditNote,
contentDescription = stringRes(R.string.edits_the_user_s_metadata),
)
@@ -22,12 +22,11 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.header
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Button
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
@@ -48,7 +47,7 @@ fun MessageButton(
) {
val scope = rememberCoroutineScope()
Button(
FilledTonalButton(
modifier =
Modifier
.padding(horizontal = 3.dp)
@@ -62,7 +61,6 @@ fun MessageButton(
painter = painterResource(R.drawable.ic_dm),
stringRes(R.string.send_a_direct_message),
modifier = Size20Modifier,
tint = Color.White,
)
}
}
@@ -21,13 +21,12 @@
package com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.zaps
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.stringRes
@@ -36,7 +35,7 @@ import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
@Composable
fun ShowUserButton(onClick: () -> Unit) {
Button(
FilledTonalButton(
modifier = Modifier.padding(start = 3.dp),
onClick = onClick,
shape = ButtonBorder,
@@ -46,6 +45,6 @@ fun ShowUserButton(onClick: () -> Unit) {
),
contentPadding = ButtonPadding,
) {
Text(text = stringRes(R.string.unblock), color = Color.White)
Text(text = stringRes(R.string.unblock))
}
}
@@ -24,6 +24,14 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.ColorMatrix
val Primary50 = Color(red = 127, green = 103, blue = 190)
val Primary60 = Color(red = 154, green = 130, blue = 219)
val Primary70 = Color(red = 182, green = 157, blue = 248)
val Primary80 = Color(red = 208, green = 188, blue = 255)
val DEFAULT_PRIMARY = Color(red = 208, green = 188, blue = 255)
val LIGHT_PURPLE = Color(red = 187, green = 134, blue = 252)
val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
@@ -0,0 +1,74 @@
/**
* Copyright (c) 2024 Vitor Pamplona
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.vitorpamplona.amethyst.ui.theme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.lifecycle.viewmodel.compose.viewModel
import com.vitorpamplona.amethyst.model.ThemeType
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
@Composable
fun ThemeComparisonColumn(toPreview: @Composable () -> Unit) {
Column {
Box {
val darkTheme: SharedPreferencesViewModel = viewModel()
darkTheme.updateTheme(ThemeType.DARK)
AmethystTheme(darkTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
Box {
val lightTheme: SharedPreferencesViewModel = viewModel()
lightTheme.updateTheme(ThemeType.LIGHT)
AmethystTheme(lightTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
}
}
@Composable
fun ThemeComparisonRow(toPreview: @Composable () -> Unit) {
Row {
Box(modifier = Modifier.weight(1f)) {
val darkTheme: SharedPreferencesViewModel = viewModel()
darkTheme.updateTheme(ThemeType.DARK)
AmethystTheme(darkTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
Box(modifier = Modifier.weight(1f)) {
val lightTheme: SharedPreferencesViewModel = viewModel()
lightTheme.updateTheme(ThemeType.LIGHT)
AmethystTheme(lightTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
}
}
@@ -23,12 +23,10 @@ package com.vitorpamplona.amethyst.ui.theme
import android.app.Activity
import android.app.UiModeManager
import android.content.Context
import android.graphics.Color.red
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@@ -37,7 +35,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
@@ -57,7 +54,6 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.view.WindowCompat
import androidx.lifecycle.viewmodel.compose.viewModel
import com.halilibo.richtext.ui.RichTextStyle
import com.halilibo.richtext.ui.resolveDefaults
import com.patrykandpatrick.vico.compose.common.VicoTheme
@@ -70,8 +66,9 @@ private val DarkColorPalette =
primary = Purple200,
secondary = Teal200,
tertiary = Teal200,
background = Color(red = 0, green = 0, blue = 0),
surface = Color(red = 0, green = 0, blue = 0),
background = Color.Black, // full black theme
surface = Color.Black, // full black theme
surfaceDim = Color.Black, // full black theme
surfaceVariant = Color(red = 29, green = 26, blue = 34),
)
@@ -80,6 +77,7 @@ private val LightColorPalette =
primary = Purple500,
secondary = Teal200,
tertiary = Teal200,
surfaceContainerHighest = Color(red = 236, green = 230, blue = 240),
surfaceVariant = Color(red = 250, green = 245, blue = 252),
)
@@ -540,45 +538,3 @@ fun AmethystTheme(
}
}
}
@Composable
fun ThemeComparisonColumn(toPreview: @Composable () -> Unit) {
Column {
Box {
val darkTheme: SharedPreferencesViewModel = viewModel()
darkTheme.updateTheme(ThemeType.DARK)
AmethystTheme(darkTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
Box {
val lightTheme: SharedPreferencesViewModel = viewModel()
lightTheme.updateTheme(ThemeType.LIGHT)
AmethystTheme(lightTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
}
}
@Composable
fun ThemeComparisonRow(toPreview: @Composable () -> Unit) {
Row {
Box(modifier = Modifier.weight(1f)) {
val darkTheme: SharedPreferencesViewModel = viewModel()
darkTheme.updateTheme(ThemeType.DARK)
AmethystTheme(darkTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
Box(modifier = Modifier.weight(1f)) {
val lightTheme: SharedPreferencesViewModel = viewModel()
lightTheme.updateTheme(ThemeType.LIGHT)
AmethystTheme(lightTheme) {
Surface(color = MaterialTheme.colorScheme.background) { toPreview() }
}
}
}
}