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