mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Rename Palette to Colors
This commit is contained in:
parent
969018e640
commit
81d5901e72
@ -18,8 +18,7 @@ import org.thoughtcrime.securesms.conversation.disappearingmessages.ui.Disappear
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.ui.UiState
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase
|
||||
import org.thoughtcrime.securesms.ui.SessionMaterialTheme
|
||||
import org.thoughtcrime.securesms.ui.setContentWithTheme
|
||||
import org.thoughtcrime.securesms.ui.setThemedContent
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
@ -46,7 +45,7 @@ class DisappearingMessagesActivity: PassphraseRequiredActionBarActivity() {
|
||||
|
||||
setUpToolbar()
|
||||
|
||||
binding.container.setContentWithTheme { DisappearingMessagesScreen() }
|
||||
binding.container.setThemedContent { DisappearingMessagesScreen() }
|
||||
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
|
@ -18,7 +18,7 @@ import androidx.compose.ui.unit.dp
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||
import org.thoughtcrime.securesms.ui.Callbacks
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.NoOpCallbacks
|
||||
import org.thoughtcrime.securesms.ui.OptionsCard
|
||||
import org.thoughtcrime.securesms.ui.RadioOption
|
||||
@ -55,7 +55,7 @@ fun DisappearingMessages(
|
||||
text = stringResource(R.string.activity_disappearing_messages_group_footer),
|
||||
style = extraSmall,
|
||||
fontWeight = FontWeight(400),
|
||||
color = LocalPalette.current.textSecondary,
|
||||
color = LocalColors.current.textSecondary,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth())
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.ExpiryType
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.State
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
|
||||
@Preview(widthDp = 450, heightDp = 700)
|
||||
@ -51,9 +51,9 @@ class StatePreviewParameterProvider : PreviewParameterProvider<State> {
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewThemes(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
DisappearingMessages(
|
||||
State(expiryMode = ExpiryMode.AfterSend(43200)).toUiState(),
|
||||
modifier = Modifier.size(400.dp, 600.dp)
|
||||
|
@ -43,8 +43,8 @@ import org.thoughtcrime.securesms.dependencies.DatabaseComponent
|
||||
import org.thoughtcrime.securesms.showOpenUrlDialog
|
||||
import org.thoughtcrime.securesms.ui.LoadingArcOr
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||
@ -54,7 +54,7 @@ import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.onCreateComposeView
|
||||
import org.thoughtcrime.securesms.ui.createThemedComposeView
|
||||
|
||||
class NewMessageFragment : Fragment() {
|
||||
|
||||
@ -75,7 +75,7 @@ class NewMessageFragment : Fragment() {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View = onCreateComposeView {
|
||||
): View = requireContext().createThemedComposeView {
|
||||
val uiState by viewModel.state.collectAsState(State())
|
||||
NewMessage(
|
||||
uiState,
|
||||
@ -101,9 +101,9 @@ class NewMessageFragment : Fragment() {
|
||||
@Preview
|
||||
@Composable
|
||||
private fun PreviewNewMessage(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
NewMessage(State())
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ private fun NewMessage(
|
||||
) {
|
||||
val pagerState = rememberPagerState { TITLES.size }
|
||||
|
||||
Column(modifier = Modifier.background(LocalPalette.current.backgroundSecondary)) {
|
||||
Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) {
|
||||
AppBar(stringResource(R.string.messageNew), onClose = onClose, onBack = onBack)
|
||||
SessionTabRow(pagerState, TITLES)
|
||||
HorizontalPager(pagerState) {
|
||||
@ -161,7 +161,7 @@ fun EnterAccountId(
|
||||
BorderlessButtonWithIcon(
|
||||
text = stringResource(R.string.messageNewDescription),
|
||||
iconRes = R.drawable.ic_circle_question_mark,
|
||||
contentColor = LocalPalette.current.textSecondary,
|
||||
contentColor = LocalColors.current.textSecondary,
|
||||
modifier = Modifier
|
||||
.contentDescription(R.string.AccessibilityId_help_desk_link)
|
||||
.fillMaxWidth()
|
||||
|
@ -29,14 +29,14 @@ import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.preferences.copyPublicKey
|
||||
import org.thoughtcrime.securesms.preferences.sendInvitationToUseSession
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineCopyButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.onCreateComposeView
|
||||
import org.thoughtcrime.securesms.ui.createThemedComposeView
|
||||
import org.thoughtcrime.securesms.ui.small
|
||||
|
||||
@AndroidEntryPoint
|
||||
@ -46,7 +46,7 @@ class InviteFriendFragment : Fragment() {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View = onCreateComposeView {
|
||||
): View = createThemedComposeView {
|
||||
InviteFriend(
|
||||
TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
|
||||
onBack = { delegate.onDialogBackPressed() },
|
||||
@ -73,7 +73,7 @@ private fun InviteFriend(
|
||||
copyPublicKey: () -> Unit = {},
|
||||
sendInvitation: () -> Unit = {},
|
||||
) {
|
||||
Column(modifier = Modifier.background(LocalPalette.current.backgroundSecondary)) {
|
||||
Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) {
|
||||
AppBar(stringResource(R.string.invite_a_friend), onBack = onBack, onClose = onClose)
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = 24.dp),
|
||||
@ -83,7 +83,7 @@ private fun InviteFriend(
|
||||
modifier = Modifier
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = LocalPalette.current.textSecondary,
|
||||
color = LocalColors.current.textSecondary,
|
||||
shape = RoundedCornerShape(size = 13.dp)
|
||||
)
|
||||
.fillMaxWidth()
|
||||
@ -104,7 +104,7 @@ private fun InviteFriend(
|
||||
stringResource(R.string.invite_your_friend_to_chat_with_you_on_session_by_sharing_your_account_id_with_them),
|
||||
textAlign = TextAlign.Center,
|
||||
style = small,
|
||||
color = LocalPalette.current.textSecondary,
|
||||
color = LocalColors.current.textSecondary,
|
||||
modifier = Modifier.padding(horizontal = 8.dp)
|
||||
)
|
||||
Row(horizontalArrangement = spacedBy(20.dp)) {
|
||||
@ -118,7 +118,7 @@ private fun InviteFriend(
|
||||
|
||||
SlimOutlineCopyButton(
|
||||
modifier = Modifier.weight(1f),
|
||||
color = LocalPalette.current.text,
|
||||
color = LocalColors.current.text,
|
||||
onClick = copyPublicKey
|
||||
)
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.ItemButton
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||
import org.thoughtcrime.securesms.ui.components.QrImage
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.onCreateComposeView
|
||||
import org.thoughtcrime.securesms.ui.createThemedComposeView
|
||||
import org.thoughtcrime.securesms.ui.small
|
||||
import org.thoughtcrime.securesms.ui.xl
|
||||
import javax.inject.Inject
|
||||
@ -41,11 +41,11 @@ class NewConversationHomeFragment : Fragment() {
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View = onCreateComposeView { NewConversationScreen() }
|
||||
): View = createThemedComposeView { NewConversationScreen() }
|
||||
|
||||
@Composable
|
||||
fun NewConversationScreen() {
|
||||
Column(modifier = Modifier.background(LocalPalette.current.backgroundSecondary)) {
|
||||
Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) {
|
||||
AppBar(stringResource(R.string.dialog_new_conversation_title), onClose = { delegate.onDialogClosePressed() })
|
||||
ItemButton(textId = R.string.messageNew, icon = R.drawable.ic_message) { delegate.onNewMessageSelected() }
|
||||
Divider(startIndent = LocalDimensions.current.dividerIndent)
|
||||
@ -66,7 +66,7 @@ class NewConversationHomeFragment : Fragment() {
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny))
|
||||
Text(
|
||||
text = stringResource(R.string.qrYoursDescription),
|
||||
color = LocalPalette.current.textSecondary,
|
||||
color = LocalColors.current.textSecondary,
|
||||
style = small
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
|
||||
|
@ -28,7 +28,6 @@ import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -65,9 +64,9 @@ import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.GetString
|
||||
import org.thoughtcrime.securesms.ui.HorizontalPagerIndicator
|
||||
import org.thoughtcrime.securesms.ui.ItemButton
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.TitledText
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
@ -312,9 +311,9 @@ fun ExpandButton(modifier: Modifier = Modifier, onClick: () -> Unit) {
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewMessageDetails(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
MessageDetails(
|
||||
state = MessageDetailsState(
|
||||
nonImageAttachmentFileDetails = listOf(
|
||||
@ -361,7 +360,7 @@ fun FileDetails(fileDetails: List<TitledText>) {
|
||||
fun TitledErrorText(titledText: TitledText?) {
|
||||
TitledText(
|
||||
titledText,
|
||||
style = base.copy(color = LocalPalette.current.danger)
|
||||
style = base.copy(color = LocalColors.current.danger)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ import org.thoughtcrime.securesms.showMuteDialog
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.SessionShieldIcon
|
||||
@ -104,7 +104,7 @@ import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.h4
|
||||
import org.thoughtcrime.securesms.ui.h8
|
||||
import org.thoughtcrime.securesms.ui.setContentWithTheme
|
||||
import org.thoughtcrime.securesms.ui.setThemedContent
|
||||
import org.thoughtcrime.securesms.ui.small
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
import org.thoughtcrime.securesms.util.IP2Country
|
||||
@ -206,7 +206,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
binding.sessionToolbar.disableClipping()
|
||||
// Set up seed reminder view
|
||||
lifecycleScope.launchWhenStarted {
|
||||
binding.seedReminderView.setContentWithTheme {
|
||||
binding.seedReminderView.setThemedContent {
|
||||
if (!textSecurePreferences.getHasViewedSeed()) SeedReminder()
|
||||
}
|
||||
}
|
||||
@ -223,7 +223,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
}
|
||||
|
||||
// Set up empty state view
|
||||
binding.emptyStateContainer.setContentWithTheme {
|
||||
binding.emptyStateContainer.setThemedContent {
|
||||
EmptyView(ApplicationContext.getInstance(this).newAccount)
|
||||
}
|
||||
|
||||
@ -364,9 +364,9 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewMessageDetails(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
SeedReminder()
|
||||
}
|
||||
}
|
||||
@ -379,11 +379,11 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.height(4.dp)
|
||||
.background(LocalPalette.current.primary)
|
||||
.background(LocalColors.current.primary)
|
||||
)
|
||||
Row(
|
||||
Modifier
|
||||
.background(LocalPalette.current.backgroundSecondary)
|
||||
.background(LocalColors.current.backgroundSecondary)
|
||||
.padding(
|
||||
horizontal = LocalDimensions.current.marginSmall,
|
||||
vertical = LocalDimensions.current.marginExtraSmall
|
||||
@ -438,7 +438,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||
Text(
|
||||
stringResource(R.string.welcome_to_session),
|
||||
style = base,
|
||||
color = LocalPalette.current.primary,
|
||||
color = LocalColors.current.primary,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivi
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService
|
||||
import org.thoughtcrime.securesms.showOpenUrlDialog
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.components.BorderlessHtmlButton
|
||||
@ -95,9 +95,9 @@ class LandingActivity : BaseActionBarActivity() {
|
||||
@Preview
|
||||
@Composable
|
||||
private fun LandingScreen(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
LandingScreen()
|
||||
}
|
||||
}
|
||||
@ -223,8 +223,8 @@ private fun MessageText(text: String, isOutgoing: Boolean, modifier: Modifier) {
|
||||
Box(modifier = modifier then Modifier.fillMaxWidth()) {
|
||||
MessageText(
|
||||
text,
|
||||
color = if (isOutgoing) LocalPalette.current.backgroundBubbleSent else LocalPalette.current.backgroundBubbleReceived,
|
||||
textColor = if (isOutgoing) LocalPalette.current.textBubbleSent else LocalPalette.current.textBubbleReceived,
|
||||
color = if (isOutgoing) LocalColors.current.backgroundBubbleSent else LocalColors.current.backgroundBubbleReceived,
|
||||
textColor = if (isOutgoing) LocalColors.current.textBubbleSent else LocalColors.current.textBubbleReceived,
|
||||
modifier = Modifier.align(if (isOutgoing) Alignment.TopEnd else Alignment.TopStart)
|
||||
)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
@ -27,7 +26,7 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.home.HomeActivity
|
||||
import org.thoughtcrime.securesms.notifications.PushRegistry
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
@ -74,9 +73,9 @@ class MessageNotificationsActivity : BaseActionBarActivity() {
|
||||
@Preview
|
||||
@Composable
|
||||
fun MessageNotificationsScreenPreview(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
MessageNotificationsScreen()
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.ui.CellWithPaddingAndMargin
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.SessionShieldIcon
|
||||
@ -91,9 +91,9 @@ class RecoveryPasswordActivity : BaseActionBarActivity() {
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewRecoveryPasswordScreen(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
RecoveryPasswordScreen(seed = "Voyage urban toyed maverick peculiar tuxedo penguin tree grass building listen speak withdraw terminal plane")
|
||||
}
|
||||
}
|
||||
@ -189,13 +189,13 @@ private fun RecoveryPassword(seed: String) {
|
||||
.padding(vertical = LocalDimensions.current.marginSmall)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
color = LocalPalette.current.borders,
|
||||
color = LocalColors.current.borders,
|
||||
shape = RoundedCornerShape(11.dp)
|
||||
)
|
||||
.padding(LocalDimensions.current.marginSmall),
|
||||
textAlign = TextAlign.Center,
|
||||
style = extraSmallMonospace,
|
||||
color = LocalPalette.current.run { if (isLight) text else primary },
|
||||
color = LocalColors.current.run { if (isLight) text else primary },
|
||||
)
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ private fun HideRecoveryPasswordCell(onHide: () -> Unit = {}) {
|
||||
.wrapContentWidth()
|
||||
.align(Alignment.CenterVertically)
|
||||
.contentDescription(R.string.AccessibilityId_hide_recovery_password_button),
|
||||
color = LocalPalette.current.danger,
|
||||
color = LocalColors.current.danger,
|
||||
onClick = onHide
|
||||
)
|
||||
}
|
||||
|
@ -8,13 +8,11 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.receiveAsFlow
|
||||
@ -27,7 +25,7 @@ import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
||||
import org.thoughtcrime.securesms.database.threadDatabase
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
|
||||
import org.thoughtcrime.securesms.ui.components.QrImage
|
||||
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
||||
@ -94,7 +92,7 @@ private fun Tabs(sessionId: String, errors: Flow<String>, onScan: (String) -> Un
|
||||
fun QrPage(string: String) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(LocalPalette.current.backgroundSecondary)
|
||||
.background(LocalColors.current.backgroundSecondary)
|
||||
.padding(horizontal = LocalDimensions.current.marginMedium)
|
||||
.fillMaxSize()
|
||||
) {
|
||||
|
@ -81,7 +81,7 @@ import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.OutlineCopyButton
|
||||
import org.thoughtcrime.securesms.ui.destructiveButtonColors
|
||||
import org.thoughtcrime.securesms.ui.setContentWithTheme
|
||||
import org.thoughtcrime.securesms.ui.setThemedContent
|
||||
import org.thoughtcrime.securesms.util.BitmapDecodingException
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
@ -132,7 +132,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
versionTextView.text = String.format(getString(R.string.version_s), "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE} - $gitCommitFirstSixChars)")
|
||||
}
|
||||
|
||||
binding.composeView.setContentWithTheme {
|
||||
binding.composeView.setThemedContent {
|
||||
Buttons()
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ fun BoxScope.HorizontalPagerIndicator(pagerState: PagerState) {
|
||||
pagerState = pagerState,
|
||||
pageCount = pagerState.pageCount,
|
||||
activeColor = Color.White,
|
||||
inactiveColor = LocalPalette.current.textSecondary)
|
||||
inactiveColor = LocalColors.current.textSecondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ val disabledLight = Color(0xFF6D6D6D)
|
||||
|
||||
val blackAlpha40 = Color.Black.copy(alpha = 0.4f)
|
||||
|
||||
val LocalPalette = staticCompositionLocalOf<Palette> { ClassicDark() }
|
||||
val LocalColors = staticCompositionLocalOf<Colors> { ClassicDark() }
|
||||
|
||||
interface Palette {
|
||||
interface Colors {
|
||||
val isLight: Boolean
|
||||
val primary: Color
|
||||
val danger: Color
|
||||
@ -94,14 +94,14 @@ fun sessionColors(
|
||||
isLight: Boolean,
|
||||
isClassic: Boolean,
|
||||
primary: Color
|
||||
): Palette = when {
|
||||
): Colors = when {
|
||||
isClassic && isLight -> ::ClassicLight
|
||||
isLight -> ::OceanLight
|
||||
isClassic -> ::ClassicDark
|
||||
else -> ::OceanDark
|
||||
}(primary)
|
||||
|
||||
data class ClassicDark(override val primary: Color = primaryGreen): Palette {
|
||||
data class ClassicDark(override val primary: Color = primaryGreen): Colors {
|
||||
override val isLight = false
|
||||
override val danger = dangerDark
|
||||
override val disabled = disabledDark
|
||||
@ -119,7 +119,7 @@ data class ClassicDark(override val primary: Color = primaryGreen): Palette {
|
||||
override val qrCodeBackground = text
|
||||
}
|
||||
|
||||
data class ClassicLight(override val primary: Color = primaryGreen): Palette {
|
||||
data class ClassicLight(override val primary: Color = primaryGreen): Colors {
|
||||
override val isLight = true
|
||||
override val danger = dangerLight
|
||||
override val disabled = disabledLight
|
||||
@ -137,7 +137,7 @@ data class ClassicLight(override val primary: Color = primaryGreen): Palette {
|
||||
override val qrCodeBackground = backgroundSecondary
|
||||
}
|
||||
|
||||
data class OceanDark(override val primary: Color = primaryBlue): Palette {
|
||||
data class OceanDark(override val primary: Color = primaryBlue): Colors {
|
||||
override val isLight = false
|
||||
override val danger = dangerDark
|
||||
override val disabled = disabledDark
|
||||
@ -155,7 +155,7 @@ data class OceanDark(override val primary: Color = primaryBlue): Palette {
|
||||
override val qrCodeBackground = text
|
||||
}
|
||||
|
||||
data class OceanLight(override val primary: Color = primaryBlue): Palette {
|
||||
data class OceanLight(override val primary: Color = primaryBlue): Colors {
|
||||
override val isLight = true
|
||||
override val danger = dangerLight
|
||||
override val disabled = disabledLight
|
||||
@ -177,7 +177,7 @@ data class OceanLight(override val primary: Color = primaryBlue): Palette {
|
||||
fun transparentButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent)
|
||||
|
||||
@Composable
|
||||
fun destructiveButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent, contentColor = LocalPalette.current.danger)
|
||||
fun destructiveButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent, contentColor = LocalColors.current.danger)
|
||||
|
||||
@Composable
|
||||
fun Colors(name: String, colors: List<Color>) {
|
||||
@ -193,9 +193,9 @@ fun Colors(name: String, colors: List<Color>) {
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewThemeColors(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) { ThemeColors() }
|
||||
PreviewTheme(colors) { ThemeColors() }
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ -229,7 +229,7 @@ private fun ThemeColors() {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Palette.outlinedTextFieldColors(
|
||||
fun Colors.outlinedTextFieldColors(
|
||||
isError: Boolean
|
||||
) = TextFieldDefaults.outlinedTextFieldColors(
|
||||
textColor = if (isError) danger else text,
|
||||
@ -239,10 +239,10 @@ fun Palette.outlinedTextFieldColors(
|
||||
placeholderColor = if (isError) danger else textSecondary
|
||||
)
|
||||
|
||||
val Palette.divider get() = text.copy(alpha = TabRowDefaults.DividerOpacity)
|
||||
val Colors.divider get() = text.copy(alpha = TabRowDefaults.DividerOpacity)
|
||||
|
||||
@Composable
|
||||
fun Palette.radioButtonColors() = RadioButtonDefaults.colors(
|
||||
fun Colors.radioButtonColors() = RadioButtonDefaults.colors(
|
||||
selectedColor = primary,
|
||||
unselectedColor = text,
|
||||
disabledColor = disabled
|
@ -30,7 +30,6 @@ import androidx.compose.material.Card
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.LocalContentColor
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.RadioButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
@ -212,7 +211,7 @@ fun CellWithPaddingAndMargin(
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
Card(
|
||||
backgroundColor = LocalPalette.current.backgroundSecondary,
|
||||
backgroundColor = LocalColors.current.backgroundSecondary,
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
elevation = 0.dp,
|
||||
modifier = Modifier
|
||||
@ -226,7 +225,7 @@ fun CellWithPaddingAndMargin(
|
||||
|
||||
@Composable
|
||||
fun <T> TitledRadioButton(option: RadioOption<T>, onClick: () -> Unit) {
|
||||
val color = if (option.enabled) LocalPalette.current.text else LocalPalette.current.disabled
|
||||
val color = if (option.enabled) LocalColors.current.text else LocalColors.current.disabled
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||
modifier = Modifier
|
||||
@ -260,7 +259,7 @@ fun <T> TitledRadioButton(option: RadioOption<T>, onClick: () -> Unit) {
|
||||
.height(26.dp)
|
||||
.align(Alignment.CenterVertically),
|
||||
enabled = option.enabled,
|
||||
colors = LocalPalette.current.radioButtonColors()
|
||||
colors = LocalColors.current.radioButtonColors()
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -326,7 +325,7 @@ fun Modifier.fadingEdges(
|
||||
fun Divider(modifier: Modifier = Modifier, startIndent: Dp = 0.dp) {
|
||||
androidx.compose.material.Divider(
|
||||
modifier = modifier.padding(horizontal = LocalDimensions.current.marginExtraSmall),
|
||||
color = LocalPalette.current.divider,
|
||||
color = LocalColors.current.divider,
|
||||
startIndent = startIndent
|
||||
)
|
||||
}
|
||||
@ -368,8 +367,8 @@ fun ProgressArc(progress: Float, modifier: Modifier = Modifier) {
|
||||
fun Arc(
|
||||
modifier: Modifier = Modifier,
|
||||
percentage: Float = 0.25f,
|
||||
fillColor: Color = LocalPalette.current.primary,
|
||||
backgroundColor: Color = LocalPalette.current.borders,
|
||||
fillColor: Color = LocalColors.current.primary,
|
||||
backgroundColor: Color = LocalColors.current.borders,
|
||||
strokeWidth: Dp = 18.dp,
|
||||
sweepAngle: Float = 310f,
|
||||
startAngle: Float = (360f - sweepAngle) / 2 + 90f
|
||||
|
@ -7,11 +7,7 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
|
||||
import androidx.compose.foundation.text.selection.TextSelectionColors
|
||||
import androidx.compose.material.Colors
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.LocalContentColor
|
||||
import androidx.compose.material.LocalMinimumInteractiveComponentEnforcement
|
||||
import androidx.compose.material.LocalTextStyle
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Shapes
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -34,26 +30,26 @@ fun SessionMaterialTheme(
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a given [Palette], and our typography and shapes as a Material 2 Compose Theme.
|
||||
* Apply a given [Colors], and our typography and shapes as a Material 2 Compose Theme.
|
||||
**/
|
||||
@Composable
|
||||
fun SessionMaterialTheme(
|
||||
palette: Palette,
|
||||
colors: Colors,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
MaterialTheme(
|
||||
colors = palette.toMaterialColors(),
|
||||
colors = colors.toMaterialColors(),
|
||||
typography = sessionTypography,
|
||||
shapes = sessionShapes,
|
||||
) {
|
||||
val textSelectionColors = TextSelectionColors(
|
||||
handleColor = LocalPalette.current.primary,
|
||||
backgroundColor = LocalPalette.current.primary.copy(alpha = 0.5f)
|
||||
handleColor = LocalColors.current.primary,
|
||||
backgroundColor = LocalColors.current.primary.copy(alpha = 0.5f)
|
||||
)
|
||||
|
||||
CompositionLocalProvider(
|
||||
LocalPalette provides palette,
|
||||
LocalContentColor provides palette.text,
|
||||
LocalColors provides colors,
|
||||
LocalContentColor provides colors.text,
|
||||
LocalTextSelectionColors provides textSelectionColors,
|
||||
) {
|
||||
content()
|
||||
@ -61,7 +57,7 @@ fun SessionMaterialTheme(
|
||||
}
|
||||
}
|
||||
|
||||
private fun Palette.toMaterialColors() = Colors(
|
||||
private fun Colors.toMaterialColors() = androidx.compose.material.Colors(
|
||||
primary = background,
|
||||
primaryVariant = backgroundSecondary,
|
||||
secondary = background,
|
||||
@ -89,16 +85,16 @@ val sessionShapes = Shapes(
|
||||
*/
|
||||
@Composable
|
||||
fun PreviewTheme(
|
||||
palette: Palette = LocalPalette.current,
|
||||
colors: Colors = LocalColors.current,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
SessionMaterialTheme(palette) {
|
||||
Box(modifier = Modifier.background(color = LocalPalette.current.background)) {
|
||||
SessionMaterialTheme(colors) {
|
||||
Box(modifier = Modifier.background(color = LocalColors.current.background)) {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SessionColorsParameterProvider : PreviewParameterProvider<Palette> {
|
||||
class SessionColorsParameterProvider : PreviewParameterProvider<Colors> {
|
||||
override val values = sequenceOf(ClassicDark(), ClassicLight(), OceanDark(), OceanLight())
|
||||
}
|
||||
|
@ -1,25 +1,23 @@
|
||||
package org.thoughtcrime.securesms.ui
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.fragment.app.Fragment
|
||||
|
||||
fun Activity.setComposeContent(content: @Composable () -> Unit) {
|
||||
ComposeView(this)
|
||||
.apply { setContent { SessionMaterialTheme { content() } } }
|
||||
.apply { setThemedContent(content) }
|
||||
.let(::setContentView)
|
||||
}
|
||||
|
||||
fun Fragment.onCreateComposeView(content: @Composable () -> Unit): ComposeView = ComposeView(requireContext()).apply {
|
||||
setContent {
|
||||
SessionMaterialTheme {
|
||||
content()
|
||||
}
|
||||
}
|
||||
fun Fragment.createThemedComposeView(content: @Composable () -> Unit): ComposeView = requireContext().createThemedComposeView(content)
|
||||
fun Context.createThemedComposeView(content: @Composable () -> Unit): ComposeView = ComposeView(this).apply {
|
||||
setThemedContent(content)
|
||||
}
|
||||
|
||||
fun ComposeView.setContentWithTheme(content: @Composable () -> Unit) = setContent {
|
||||
fun ComposeView.setThemedContent(content: @Composable () -> Unit) = setContent {
|
||||
SessionMaterialTheme {
|
||||
content()
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.h4
|
||||
@ -24,9 +24,9 @@ import org.thoughtcrime.securesms.ui.h4
|
||||
@Preview
|
||||
@Composable
|
||||
fun AppBarPreview(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
AppBar(title = "Title", {}, {})
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,10 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.LocalTextStyle
|
||||
import androidx.compose.material.RadioButton
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.staticCompositionLocalOf
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
@ -26,7 +24,7 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import org.thoughtcrime.securesms.ui.GetString
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.baseBold
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.extraSmall
|
||||
@ -38,7 +36,7 @@ import org.thoughtcrime.securesms.ui.small
|
||||
@Composable
|
||||
fun BorderlessButton(
|
||||
modifier: Modifier = Modifier,
|
||||
contentColor: Color = LocalPalette.current.text,
|
||||
contentColor: Color = LocalColors.current.text,
|
||||
backgroundColor: Color = Color.Transparent,
|
||||
onClick: () -> Unit,
|
||||
content: @Composable () -> Unit
|
||||
@ -58,7 +56,7 @@ fun BorderlessButton(
|
||||
text: String,
|
||||
modifier: Modifier = Modifier,
|
||||
contentDescription: GetString = GetString(text),
|
||||
contentColor: Color = LocalPalette.current.text,
|
||||
contentColor: Color = LocalColors.current.text,
|
||||
backgroundColor: Color = Color.Transparent,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@ -83,7 +81,7 @@ fun BorderlessButtonWithIcon(
|
||||
@DrawableRes iconRes: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
style: TextStyle = baseBold,
|
||||
contentColor: Color = LocalPalette.current.text,
|
||||
contentColor: Color = LocalColors.current.text,
|
||||
backgroundColor: Color = Color.Transparent,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@ -101,7 +99,7 @@ fun BorderlessButtonWithIcon(
|
||||
fun BorderlessHtmlButton(
|
||||
textId: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
contentColor: Color = LocalPalette.current.text,
|
||||
contentColor: Color = LocalColors.current.text,
|
||||
backgroundColor: Color = Color.Transparent,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@ -136,10 +134,10 @@ fun NotificationRadioButton(
|
||||
.weight(1f)
|
||||
.contentDescription(contentDescription),
|
||||
type = ButtonType.Outline,
|
||||
color = LocalPalette.current.text,
|
||||
color = LocalColors.current.text,
|
||||
border = BorderStroke(
|
||||
width = ButtonDefaults.OutlinedBorderSize,
|
||||
color = if (selected) LocalPalette.current.primary else LocalPalette.current.borders
|
||||
color = if (selected) LocalColors.current.primary else LocalColors.current.borders
|
||||
),
|
||||
shape = RoundedCornerShape(8.dp)
|
||||
) {
|
||||
@ -151,7 +149,7 @@ fun NotificationRadioButton(
|
||||
tag?.let {
|
||||
Text(
|
||||
stringResource(it),
|
||||
color = LocalPalette.current.primary,
|
||||
color = LocalColors.current.primary,
|
||||
style = h9
|
||||
)
|
||||
}
|
||||
@ -161,7 +159,7 @@ fun NotificationRadioButton(
|
||||
selected = selected,
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
onClick = onClick,
|
||||
colors = LocalPalette.current.radioButtonColors()
|
||||
colors = LocalColors.current.radioButtonColors()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ import kotlinx.coroutines.flow.filter
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
@ -76,7 +76,7 @@ fun MaybeScanQrCode(
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
.background(LocalPalette.current.background)
|
||||
.background(LocalColors.current.background)
|
||||
) {
|
||||
LocalSoftwareKeyboardController.current?.hide()
|
||||
|
||||
|
@ -30,7 +30,7 @@ import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.util.QRCodeUtilities
|
||||
|
||||
@Composable
|
||||
@ -53,10 +53,10 @@ fun QrImage(
|
||||
}
|
||||
|
||||
Card(
|
||||
backgroundColor = LocalPalette.current.qrCodeBackground,
|
||||
backgroundColor = LocalColors.current.qrCodeBackground,
|
||||
elevation = 0.dp,
|
||||
modifier = modifier
|
||||
) { Content(bitmap, icon, backgroundColor = LocalPalette.current.qrCodeBackground) }
|
||||
) { Content(bitmap, icon, backgroundColor = LocalColors.current.qrCodeBackground) }
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ -64,7 +64,7 @@ private fun Content(
|
||||
bitmap: Bitmap?,
|
||||
icon: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
qrColor: Color = LocalPalette.current.qrCodeContent,
|
||||
qrColor: Color = LocalColors.current.qrCodeContent,
|
||||
backgroundColor: Color,
|
||||
) {
|
||||
Box(
|
||||
|
@ -28,7 +28,7 @@ import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.LaunchedEffectAsync
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
@ -39,11 +39,11 @@ interface ButtonType {
|
||||
val elevation: ButtonElevation? @Composable get
|
||||
|
||||
object Outline: ButtonType {
|
||||
@Composable override fun border(color: Color, enabled: Boolean) = BorderStroke(1.dp, if (enabled) color else LocalPalette.current.disabled)
|
||||
@Composable override fun border(color: Color, enabled: Boolean) = BorderStroke(1.dp, if (enabled) color else LocalColors.current.disabled)
|
||||
@Composable override fun buttonColors(color: Color) = ButtonDefaults.buttonColors(
|
||||
contentColor = color,
|
||||
backgroundColor = Color.Unspecified,
|
||||
disabledContentColor = LocalPalette.current.disabled,
|
||||
disabledContentColor = LocalColors.current.disabled,
|
||||
disabledBackgroundColor = Color.Unspecified
|
||||
)
|
||||
override val elevation: ButtonElevation? @Composable get() = null
|
||||
@ -51,9 +51,9 @@ interface ButtonType {
|
||||
object Fill: ButtonType {
|
||||
@Composable override fun border(color: Color, enabled: Boolean) = null
|
||||
@Composable override fun buttonColors(color: Color) = ButtonDefaults.buttonColors(
|
||||
contentColor = LocalPalette.current.background,
|
||||
contentColor = LocalColors.current.background,
|
||||
backgroundColor = color,
|
||||
disabledContentColor = LocalPalette.current.disabled,
|
||||
disabledContentColor = LocalColors.current.disabled,
|
||||
disabledBackgroundColor = Color.Unspecified
|
||||
)
|
||||
override val elevation: ButtonElevation? @Composable get() = ButtonDefaults.elevation()
|
||||
@ -117,33 +117,33 @@ fun Button(
|
||||
}
|
||||
|
||||
@Composable fun FillButton(text: String, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
Button(text, onClick, LocalPalette.current.buttonOutline, ButtonType.Fill, modifier, enabled)
|
||||
Button(text, onClick, LocalColors.current.buttonOutline, ButtonType.Fill, modifier, enabled)
|
||||
}
|
||||
|
||||
@Composable fun PrimaryFillButton(text: String, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
Button(text, onClick, LocalPalette.current.primary, ButtonType.Fill, modifier, enabled)
|
||||
Button(text, onClick, LocalColors.current.primary, ButtonType.Fill, modifier, enabled)
|
||||
}
|
||||
|
||||
@Composable fun OutlineButton(text: String, modifier: Modifier = Modifier, color: Color = LocalPalette.current.buttonOutline, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
@Composable fun OutlineButton(text: String, modifier: Modifier = Modifier, color: Color = LocalColors.current.buttonOutline, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
Button(text, onClick, color, ButtonType.Outline, modifier, enabled)
|
||||
}
|
||||
|
||||
@Composable fun PrimaryOutlineButton(text: String, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
Button(text, onClick, LocalPalette.current.primary, ButtonType.Outline, modifier, enabled)
|
||||
Button(text, onClick, LocalColors.current.primary, ButtonType.Outline, modifier, enabled)
|
||||
}
|
||||
|
||||
@Composable fun SlimOutlineButton(text: String, modifier: Modifier = Modifier, color: Color = LocalPalette.current.buttonOutline, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
@Composable fun SlimOutlineButton(text: String, modifier: Modifier = Modifier, color: Color = LocalColors.current.buttonOutline, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
Button(text, onClick, color, ButtonType.Outline, modifier, enabled, SlimButtonSize)
|
||||
}
|
||||
|
||||
@Composable fun SlimOutlineButton(onClick: () -> Unit, modifier: Modifier = Modifier, color: Color = LocalPalette.current.buttonOutline, enabled: Boolean = true, content: @Composable () -> Unit) {
|
||||
@Composable fun SlimOutlineButton(onClick: () -> Unit, modifier: Modifier = Modifier, color: Color = LocalColors.current.buttonOutline, enabled: Boolean = true, content: @Composable () -> Unit) {
|
||||
Button(onClick, color, ButtonType.Outline, modifier, enabled, SlimButtonSize) { content() }
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SlimOutlineCopyButton(
|
||||
modifier: Modifier = Modifier,
|
||||
color: Color = LocalPalette.current.buttonOutline,
|
||||
color: Color = LocalColors.current.buttonOutline,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
OutlineCopyButton(modifier, SlimButtonSize, color, onClick)
|
||||
@ -153,7 +153,7 @@ fun SlimOutlineCopyButton(
|
||||
fun OutlineCopyButton(
|
||||
modifier: Modifier = Modifier,
|
||||
size: ButtonSize = LargeButtonSize,
|
||||
color: Color = LocalPalette.current.buttonOutline,
|
||||
color: Color = LocalColors.current.buttonOutline,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.pager.PagerState
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Tab
|
||||
import androidx.compose.material.TabRow
|
||||
import androidx.compose.material.TabRowDefaults
|
||||
@ -19,9 +18,9 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.Palette
|
||||
import org.thoughtcrime.securesms.ui.Colors
|
||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.divider
|
||||
import org.thoughtcrime.securesms.ui.h8
|
||||
@ -34,8 +33,8 @@ fun SessionTabRow(pagerState: PagerState, titles: List<Int>) {
|
||||
TabRow(
|
||||
backgroundColor = Color.Unspecified,
|
||||
selectedTabIndex = pagerState.currentPage,
|
||||
contentColor = LocalPalette.current.text,
|
||||
divider = { TabRowDefaults.Divider(color = LocalPalette.current.divider) },
|
||||
contentColor = LocalColors.current.text,
|
||||
divider = { TabRowDefaults.Divider(color = LocalColors.current.divider) },
|
||||
modifier = Modifier
|
||||
.height(48.dp)
|
||||
.background(color = Color.Unspecified)
|
||||
@ -45,8 +44,8 @@ fun SessionTabRow(pagerState: PagerState, titles: List<Int>) {
|
||||
Tab(
|
||||
i == pagerState.currentPage,
|
||||
onClick = { animationScope.launch { pagerState.animateScrollToPage(i) } },
|
||||
selectedContentColor = LocalPalette.current.text,
|
||||
unselectedContentColor = LocalPalette.current.text,
|
||||
selectedContentColor = LocalColors.current.text,
|
||||
unselectedContentColor = LocalColors.current.text,
|
||||
) {
|
||||
Text(
|
||||
stringResource(id = it),
|
||||
@ -61,9 +60,9 @@ fun SessionTabRow(pagerState: PagerState, titles: List<Int>) {
|
||||
@androidx.compose.ui.tooling.preview.Preview
|
||||
@Composable
|
||||
fun PreviewSessionTabRow(
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) palette: Palette
|
||||
@PreviewParameter(SessionColorsParameterProvider::class) colors: Colors
|
||||
) {
|
||||
PreviewTheme(palette) {
|
||||
PreviewTheme(colors) {
|
||||
val pagerState = rememberPagerState { TITLES.size }
|
||||
SessionTabRow(pagerState = pagerState, titles = TITLES)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import androidx.compose.foundation.text.InlineTextContent
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.appendInlineContent
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -24,7 +23,7 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import org.thoughtcrime.securesms.ui.LocalPalette
|
||||
import org.thoughtcrime.securesms.ui.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.base
|
||||
import org.thoughtcrime.securesms.ui.baseBold
|
||||
@ -51,7 +50,7 @@ fun SessionOutlinedTextField(
|
||||
style = base
|
||||
)
|
||||
},
|
||||
colors = LocalPalette.current.outlinedTextFieldColors(error != null),
|
||||
colors = LocalColors.current.outlinedTextFieldColors(error != null),
|
||||
singleLine = true,
|
||||
keyboardActions = KeyboardActions(
|
||||
onDone = { onContinue() },
|
||||
@ -68,7 +67,7 @@ fun SessionOutlinedTextField(
|
||||
modifier = Modifier.padding(top = LocalDimensions.current.marginExtraExtraSmall),
|
||||
textAlign = TextAlign.Center,
|
||||
style = baseBold,
|
||||
color = LocalPalette.current.danger
|
||||
color = LocalColors.current.danger
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user