mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-04 15:35:19 +00:00
Remove manual theming and fix background colors
This commit is contained in:
parent
9721dbbd9e
commit
96157d65a6
@ -19,6 +19,7 @@ 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.SessionMaterialTheme
|
||||||
|
import org.thoughtcrime.securesms.ui.setContentWithTheme
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@ -45,7 +46,7 @@ class DisappearingMessagesActivity: PassphraseRequiredActionBarActivity() {
|
|||||||
|
|
||||||
setUpToolbar()
|
setUpToolbar()
|
||||||
|
|
||||||
binding.container.setContent { DisappearingMessagesScreen() }
|
binding.container.setContentWithTheme { DisappearingMessagesScreen() }
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||||
@ -87,8 +88,6 @@ class DisappearingMessagesActivity: PassphraseRequiredActionBarActivity() {
|
|||||||
@Composable
|
@Composable
|
||||||
fun DisappearingMessagesScreen() {
|
fun DisappearingMessagesScreen() {
|
||||||
val uiState by viewModel.uiState.collectAsState(UiState())
|
val uiState by viewModel.uiState.collectAsState(UiState())
|
||||||
SessionMaterialTheme {
|
|
||||||
DisappearingMessages(uiState, callbacks = viewModel)
|
DisappearingMessages(uiState, callbacks = viewModel)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,11 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
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.primarySurface
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.ComposeView
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
@ -50,7 +47,6 @@ import org.thoughtcrime.securesms.ui.LocalDimensions
|
|||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.SessionColors
|
import org.thoughtcrime.securesms.ui.SessionColors
|
||||||
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
import org.thoughtcrime.securesms.ui.SessionColorsParameterProvider
|
||||||
import org.thoughtcrime.securesms.ui.SessionMaterialTheme
|
|
||||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||||
import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon
|
import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon
|
||||||
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
|
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
|
||||||
@ -59,6 +55,7 @@ import org.thoughtcrime.securesms.ui.components.SessionButtonText
|
|||||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
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.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
|
import org.thoughtcrime.securesms.ui.onCreateView
|
||||||
|
|
||||||
class NewMessageFragment : Fragment() {
|
class NewMessageFragment : Fragment() {
|
||||||
|
|
||||||
@ -79,9 +76,7 @@ class NewMessageFragment : Fragment() {
|
|||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View = ComposeView(requireContext()).apply {
|
): View = onCreateView {
|
||||||
setContent {
|
|
||||||
SessionMaterialTheme {
|
|
||||||
val uiState by viewModel.state.collectAsState(State())
|
val uiState by viewModel.state.collectAsState(State())
|
||||||
NewMessage(
|
NewMessage(
|
||||||
uiState,
|
uiState,
|
||||||
@ -92,8 +87,6 @@ class NewMessageFragment : Fragment() {
|
|||||||
onHelp = { requireContext().showOpenUrlDialog("https://sessionapp.zendesk.com/hc/en-us/articles/4439132747033-How-do-Session-ID-usernames-work") }
|
onHelp = { requireContext().showOpenUrlDialog("https://sessionapp.zendesk.com/hc/en-us/articles/4439132747033-How-do-Session-ID-usernames-work") }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createPrivateChat(hexEncodedPublicKey: String) {
|
private fun createPrivateChat(hexEncodedPublicKey: String) {
|
||||||
val recipient = Recipient.from(requireContext(), Address.fromSerialized(hexEncodedPublicKey), false)
|
val recipient = Recipient.from(requireContext(), Address.fromSerialized(hexEncodedPublicKey), false)
|
||||||
@ -130,7 +123,7 @@ private fun NewMessage(
|
|||||||
) {
|
) {
|
||||||
val pagerState = rememberPagerState { TITLES.size }
|
val pagerState = rememberPagerState { TITLES.size }
|
||||||
|
|
||||||
Column(modifier = Modifier.background(MaterialTheme.colors.primarySurface)) {
|
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) {
|
||||||
|
@ -77,6 +77,7 @@ import org.thoughtcrime.securesms.ui.baseMonospace
|
|||||||
import org.thoughtcrime.securesms.ui.blackAlpha40
|
import org.thoughtcrime.securesms.ui.blackAlpha40
|
||||||
import org.thoughtcrime.securesms.ui.components.SessionButtonText
|
import org.thoughtcrime.securesms.ui.components.SessionButtonText
|
||||||
import org.thoughtcrime.securesms.ui.destructiveButtonColors
|
import org.thoughtcrime.securesms.ui.destructiveButtonColors
|
||||||
|
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@ -103,9 +104,7 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
|
|
||||||
viewModel.timestamp = intent.getLongExtra(MESSAGE_TIMESTAMP, -1L)
|
viewModel.timestamp = intent.getLongExtra(MESSAGE_TIMESTAMP, -1L)
|
||||||
|
|
||||||
ComposeView(this)
|
setComposeContent { MessageDetailsScreen() }
|
||||||
.apply { setContent { MessageDetailsScreen() } }
|
|
||||||
.let(::setContentView)
|
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
viewModel.eventFlow.collect {
|
viewModel.eventFlow.collect {
|
||||||
@ -122,7 +121,6 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun MessageDetailsScreen() {
|
private fun MessageDetailsScreen() {
|
||||||
val state by viewModel.stateFlow.collectAsState()
|
val state by viewModel.stateFlow.collectAsState()
|
||||||
SessionMaterialTheme {
|
|
||||||
MessageDetails(
|
MessageDetails(
|
||||||
state = state,
|
state = state,
|
||||||
onReply = if (state.canReply) { { setResultAndFinish(ON_REPLY) } } else null,
|
onReply = if (state.canReply) { { setResultAndFinish(ON_REPLY) } } else null,
|
||||||
@ -132,7 +130,6 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
onAttachmentNeedsDownload = viewModel::onAttachmentNeedsDownload,
|
onAttachmentNeedsDownload = viewModel::onAttachmentNeedsDownload,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun setResultAndFinish(code: Int) {
|
private fun setResultAndFinish(code: Int) {
|
||||||
Bundle().apply { putLong(MESSAGE_TIMESTAMP, viewModel.timestamp) }
|
Bundle().apply { putLong(MESSAGE_TIMESTAMP, viewModel.timestamp) }
|
||||||
|
@ -26,6 +26,7 @@ import androidx.compose.runtime.Composable
|
|||||||
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
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
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
|
||||||
@ -105,6 +106,7 @@ import org.thoughtcrime.securesms.ui.base
|
|||||||
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.h8
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
|
import org.thoughtcrime.securesms.ui.setContentWithTheme
|
||||||
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 +208,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.setContent {
|
binding.seedReminderView.setContentWithTheme {
|
||||||
if (!textSecurePreferences.getHasViewedSeed()) SeedReminder()
|
if (!textSecurePreferences.getHasViewedSeed()) SeedReminder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +225,9 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up empty state view
|
// Set up empty state view
|
||||||
binding.emptyStateContainer.setContent { EmptyView(ApplicationContext.getInstance(this).newAccount) }
|
binding.emptyStateContainer.setContentWithTheme {
|
||||||
|
EmptyView(ApplicationContext.getInstance(this).newAccount)
|
||||||
|
}
|
||||||
|
|
||||||
IP2Country.configureIfNeeded(this@HomeActivity)
|
IP2Country.configureIfNeeded(this@HomeActivity)
|
||||||
|
|
||||||
@ -371,18 +375,17 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SeedReminder() {
|
private fun SeedReminder() {
|
||||||
SessionMaterialTheme {
|
|
||||||
Column {
|
Column {
|
||||||
// Color Strip
|
// Color Strip
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(4.dp)
|
.height(4.dp)
|
||||||
.background(MaterialTheme.colors.secondary)
|
.background(LocalColors.current.primary)
|
||||||
)
|
)
|
||||||
Row(
|
Row(
|
||||||
Modifier
|
Modifier
|
||||||
.background(MaterialTheme.colors.surface)
|
.background(LocalColors.current.backgroundSecondary)
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = LocalDimensions.current.marginSmall,
|
horizontal = LocalDimensions.current.marginSmall,
|
||||||
vertical = LocalDimensions.current.marginExtraSmall
|
vertical = LocalDimensions.current.marginExtraSmall
|
||||||
@ -413,11 +416,9 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun EmptyView(newAccount: Boolean) {
|
private fun EmptyView(newAccount: Boolean) {
|
||||||
SessionMaterialTheme {
|
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -459,7 +460,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
Spacer(modifier = Modifier.weight(2f))
|
Spacer(modifier = Modifier.weight(2f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInputFocusChanged(hasFocus: Boolean) {
|
override fun onInputFocusChanged(hasFocus: Boolean) {
|
||||||
setSearchShown(hasFocus || binding.globalSearchInputLayout.query.value.isNotEmpty())
|
setSearchShown(hasFocus || binding.globalSearchInputLayout.query.value.isNotEmpty())
|
||||||
|
@ -43,6 +43,7 @@ import org.thoughtcrime.securesms.ui.components.OutlineButton
|
|||||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
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.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
|
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||||
import org.thoughtcrime.securesms.util.start
|
import org.thoughtcrime.securesms.util.start
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -75,15 +76,11 @@ class LinkDeviceActivity : BaseActionBarActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComposeView(this).apply {
|
setComposeContent {
|
||||||
setContent {
|
|
||||||
val state by viewModel.stateFlow.collectAsState()
|
val state by viewModel.stateFlow.collectAsState()
|
||||||
SessionMaterialTheme {
|
|
||||||
LoadAccountScreen(state, viewModel::onChange, viewModel::onContinue, viewModel::onScanQrCode)
|
LoadAccountScreen(state, viewModel::onChange, viewModel::onContinue, viewModel::onScanQrCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.let(::setContentView)
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -34,6 +34,7 @@ import org.thoughtcrime.securesms.ui.SessionMaterialTheme
|
|||||||
import org.thoughtcrime.securesms.ui.base
|
import org.thoughtcrime.securesms.ui.base
|
||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.h7
|
import org.thoughtcrime.securesms.ui.h7
|
||||||
|
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||||
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
|
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -71,9 +72,7 @@ class LoadingActivity: BaseActionBarActivity() {
|
|||||||
|
|
||||||
ApplicationContext.getInstance(this).newAccount = false
|
ApplicationContext.getInstance(this).newAccount = false
|
||||||
|
|
||||||
ComposeView(this)
|
setComposeContent { LoadingScreen() }
|
||||||
.apply { setContent { LoadingScreen() } }
|
|
||||||
.let(::setContentView)
|
|
||||||
|
|
||||||
setUpActionBarSessionLogo(true)
|
setUpActionBarSessionLogo(true)
|
||||||
|
|
||||||
@ -103,7 +102,6 @@ class LoadingActivity: BaseActionBarActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionMaterialTheme {
|
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
ProgressArc(
|
ProgressArc(
|
||||||
@ -121,7 +119,6 @@ class LoadingActivity: BaseActionBarActivity() {
|
|||||||
Spacer(modifier = Modifier.weight(2f))
|
Spacer(modifier = Modifier.weight(2f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.startLoadingActivity(mnemonic: ByteArray) {
|
fun Context.startLoadingActivity(mnemonic: ByteArray) {
|
||||||
|
@ -47,6 +47,7 @@ import org.thoughtcrime.securesms.ui.components.OutlineButton
|
|||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.h8
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
import org.thoughtcrime.securesms.ui.h9
|
import org.thoughtcrime.securesms.ui.h9
|
||||||
|
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||||
import org.thoughtcrime.securesms.ui.small
|
import org.thoughtcrime.securesms.ui.small
|
||||||
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
|
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -63,19 +64,14 @@ class MessageNotificationsActivity : BaseActionBarActivity() {
|
|||||||
setUpActionBarSessionLogo(true)
|
setUpActionBarSessionLogo(true)
|
||||||
TextSecurePreferences.setHasSeenWelcomeScreen(this, true)
|
TextSecurePreferences.setHasSeenWelcomeScreen(this, true)
|
||||||
|
|
||||||
ComposeView(this)
|
setComposeContent { MessageNotificationsScreen() }
|
||||||
.apply { setContent { MessageNotificationsScreen() } }
|
|
||||||
.let(::setContentView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MessageNotificationsScreen() {
|
private fun MessageNotificationsScreen() {
|
||||||
val state by viewModel.stateFlow.collectAsState()
|
val state by viewModel.stateFlow.collectAsState()
|
||||||
|
|
||||||
SessionMaterialTheme {
|
|
||||||
MessageNotificationsScreen(state, viewModel::setEnabled, ::register)
|
MessageNotificationsScreen(state, viewModel::setEnabled, ::register)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun register() {
|
private fun register() {
|
||||||
TextSecurePreferences.setPushEnabled(this, viewModel.stateFlow.value.pushEnabled)
|
TextSecurePreferences.setPushEnabled(this, viewModel.stateFlow.value.pushEnabled)
|
||||||
|
@ -49,6 +49,7 @@ import org.thoughtcrime.securesms.ui.components.SmallButtons
|
|||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.extraSmallMonospace
|
import org.thoughtcrime.securesms.ui.extraSmallMonospace
|
||||||
import org.thoughtcrime.securesms.ui.h8
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
|
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||||
|
|
||||||
class RecoveryPasswordActivity : BaseActionBarActivity() {
|
class RecoveryPasswordActivity : BaseActionBarActivity() {
|
||||||
|
|
||||||
@ -58,14 +59,12 @@ class RecoveryPasswordActivity : BaseActionBarActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
supportActionBar!!.title = resources.getString(R.string.sessionRecoveryPassword)
|
supportActionBar!!.title = resources.getString(R.string.sessionRecoveryPassword)
|
||||||
|
|
||||||
ComposeView(this).apply {
|
setComposeContent {
|
||||||
setContent {
|
|
||||||
RecoveryPasswordScreen(
|
RecoveryPasswordScreen(
|
||||||
viewModel.seed,
|
viewModel.seed,
|
||||||
{ viewModel.copySeed(context) }
|
{ viewModel.copySeed(this) }
|
||||||
) { onHide() }
|
) { onHide() }
|
||||||
}
|
}
|
||||||
}.let(::setContentView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onHide() {
|
private fun onHide() {
|
||||||
@ -109,7 +108,6 @@ fun RecoveryPasswordScreen(
|
|||||||
copySeed:() -> Unit = {},
|
copySeed:() -> Unit = {},
|
||||||
onHide:() -> Unit = {}
|
onHide:() -> Unit = {}
|
||||||
) {
|
) {
|
||||||
SessionMaterialTheme {
|
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.marginExtraSmall),
|
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.marginExtraSmall),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -122,7 +120,6 @@ fun RecoveryPasswordScreen(
|
|||||||
HideRecoveryPasswordCell(onHide)
|
HideRecoveryPasswordCell(onHide)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -82,6 +82,7 @@ import org.thoughtcrime.securesms.ui.SessionMaterialTheme
|
|||||||
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.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,12 +133,10 @@ 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.setContent {
|
binding.composeView.setContentWithTheme {
|
||||||
SessionMaterialTheme {
|
|
||||||
Buttons()
|
Buttons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun getDisplayName(): String =
|
private fun getDisplayName(): String =
|
||||||
TextSecurePreferences.getProfileName(this) ?: truncateIdForDisplay(hexEncodedPublicKey)
|
TextSecurePreferences.getProfileName(this) ?: truncateIdForDisplay(hexEncodedPublicKey)
|
||||||
|
@ -95,7 +95,7 @@ val primaryYellow = Color(0xFFFAD657)
|
|||||||
val dangerDark = Color(0xFFFF3A3A)
|
val dangerDark = Color(0xFFFF3A3A)
|
||||||
val dangerLight = Color(0xFFE12D19)
|
val dangerLight = Color(0xFFE12D19)
|
||||||
val disabledDark = Color(0xFFA1A2A1)
|
val disabledDark = Color(0xFFA1A2A1)
|
||||||
val disabledLioht = Color(0xFF6D6D6D)
|
val disabledLight = Color(0xFF6D6D6D)
|
||||||
|
|
||||||
fun sessionColors(
|
fun sessionColors(
|
||||||
isLight: Boolean,
|
isLight: Boolean,
|
||||||
@ -128,7 +128,7 @@ val classicLight = SessionColors(
|
|||||||
isLight = true,
|
isLight = true,
|
||||||
primary = primaryGreen,
|
primary = primaryGreen,
|
||||||
danger = dangerLight,
|
danger = dangerLight,
|
||||||
disabled = disabledLioht,
|
disabled = disabledLight,
|
||||||
background = Color.White,
|
background = Color.White,
|
||||||
backgroundSecondary = classicLight5,
|
backgroundSecondary = classicLight5,
|
||||||
text = Color.Black,
|
text = Color.Black,
|
||||||
@ -158,7 +158,7 @@ val oceanLight = SessionColors(
|
|||||||
isLight = true,
|
isLight = true,
|
||||||
primary = primaryBlue,
|
primary = primaryBlue,
|
||||||
danger = dangerLight,
|
danger = dangerLight,
|
||||||
disabled = disabledLioht,
|
disabled = disabledLight,
|
||||||
background = oceanLight7,
|
background = oceanLight7,
|
||||||
backgroundSecondary = oceanLight6,
|
backgroundSecondary = oceanLight6,
|
||||||
text = oceanLight1,
|
text = oceanLight1,
|
||||||
|
@ -18,3 +18,9 @@ fun Fragment.onCreateView(content: @Composable () -> Unit): ComposeView = Compos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ComposeView.setContentWithTheme(content: @Composable () -> Unit) = setContent {
|
||||||
|
SessionMaterialTheme {
|
||||||
|
content()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user