mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-27 02:07:42 +00:00
Update recovery password banner
This commit is contained in:
parent
4dd451e77f
commit
8b1751d40d
@ -10,25 +10,41 @@ import android.content.Intent
|
|||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.SpannableString
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.requiredWidth
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.layout.windowInsetsEndWidth
|
||||||
|
import androidx.compose.foundation.layout.wrapContentHeight
|
||||||
|
import androidx.compose.foundation.layout.wrapContentSize
|
||||||
|
import androidx.compose.foundation.layout.wrapContentWidth
|
||||||
import androidx.compose.material.Divider
|
import androidx.compose.material.Divider
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.material.primarySurface
|
||||||
import androidx.compose.runtime.Composable
|
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.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
@ -36,7 +52,6 @@ import androidx.lifecycle.repeatOnLifecycle
|
|||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.accompanist.themeadapter.appcompat.AppCompatTheme
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
@ -85,14 +100,18 @@ import org.thoughtcrime.securesms.messagerequests.MessageRequestsActivity
|
|||||||
import org.thoughtcrime.securesms.mms.GlideApp
|
import org.thoughtcrime.securesms.mms.GlideApp
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests
|
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||||
import org.thoughtcrime.securesms.notifications.PushRegistry
|
import org.thoughtcrime.securesms.notifications.PushRegistry
|
||||||
import org.thoughtcrime.securesms.onboarding.SeedActivity
|
import org.thoughtcrime.securesms.onboarding.startSeedActivity
|
||||||
import org.thoughtcrime.securesms.onboarding.SeedReminderViewDelegate
|
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions
|
import org.thoughtcrime.securesms.permissions.Permissions
|
||||||
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
||||||
import org.thoughtcrime.securesms.showMuteDialog
|
import org.thoughtcrime.securesms.showMuteDialog
|
||||||
import org.thoughtcrime.securesms.showSessionDialog
|
import org.thoughtcrime.securesms.showSessionDialog
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
|
import org.thoughtcrime.securesms.ui.OutlineButton
|
||||||
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
|
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
||||||
|
import org.thoughtcrime.securesms.ui.classicDarkColors
|
||||||
import org.thoughtcrime.securesms.ui.h8
|
import org.thoughtcrime.securesms.ui.h8
|
||||||
|
import org.thoughtcrime.securesms.ui.small
|
||||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||||
import org.thoughtcrime.securesms.util.DateUtils
|
import org.thoughtcrime.securesms.util.DateUtils
|
||||||
import org.thoughtcrime.securesms.util.IP2Country
|
import org.thoughtcrime.securesms.util.IP2Country
|
||||||
@ -107,7 +126,6 @@ import javax.inject.Inject
|
|||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class HomeActivity : PassphraseRequiredActionBarActivity(),
|
class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||||
ConversationClickListener,
|
ConversationClickListener,
|
||||||
SeedReminderViewDelegate,
|
|
||||||
GlobalSearchInputLayout.GlobalSearchInputLayoutListener {
|
GlobalSearchInputLayout.GlobalSearchInputLayoutListener {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -196,15 +214,8 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
binding.sessionToolbar.disableClipping()
|
binding.sessionToolbar.disableClipping()
|
||||||
// Set up seed reminder view
|
// Set up seed reminder view
|
||||||
lifecycleScope.launchWhenStarted {
|
lifecycleScope.launchWhenStarted {
|
||||||
val hasViewedSeed = textSecurePreferences.getHasViewedSeed()
|
binding.seedReminderView.setContent {
|
||||||
if (!hasViewedSeed) {
|
if (!textSecurePreferences.getHasViewedSeed()) SeedReminder()
|
||||||
binding.seedReminderView.isVisible = true
|
|
||||||
binding.seedReminderView.title = SpannableString("You're almost finished! 80%") // Intentionally not yet translated
|
|
||||||
binding.seedReminderView.subtitle = resources.getString(R.string.view_seed_reminder_subtitle_1)
|
|
||||||
binding.seedReminderView.setProgress(80, false)
|
|
||||||
binding.seedReminderView.delegate = this@HomeActivity
|
|
||||||
} else {
|
|
||||||
binding.seedReminderView.isVisible = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupMessageRequestsBanner()
|
setupMessageRequestsBanner()
|
||||||
@ -334,6 +345,53 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewMessageDetails(
|
||||||
|
@PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int
|
||||||
|
) {
|
||||||
|
PreviewTheme(themeResId) {
|
||||||
|
SeedReminder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SeedReminder() {
|
||||||
|
AppTheme {
|
||||||
|
Column {
|
||||||
|
Box(
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(4.dp)
|
||||||
|
.background(MaterialTheme.colors.secondary))
|
||||||
|
Row(
|
||||||
|
Modifier
|
||||||
|
.background(MaterialTheme.colors.surface)
|
||||||
|
.padding(horizontal = 24.dp, vertical = 16.dp)
|
||||||
|
) {
|
||||||
|
Column(Modifier.weight(1f)) {
|
||||||
|
Row {
|
||||||
|
Text("Save your recovery password", style = MaterialTheme.typography.h8)
|
||||||
|
Spacer(Modifier.requiredWidth(8.dp))
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.session_shield),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
|
.wrapContentSize(unbounded = true)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Text("Save your recovery password to make sure you don't lose access to your account.", style = MaterialTheme.typography.small)
|
||||||
|
}
|
||||||
|
Spacer(Modifier.width(12.dp))
|
||||||
|
OutlineButton(
|
||||||
|
stringResource(R.string.continue_2),
|
||||||
|
Modifier.align(Alignment.CenterVertically)
|
||||||
|
) { startSeedActivity() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun EmptyView() {
|
private fun EmptyView() {
|
||||||
AppTheme {
|
AppTheme {
|
||||||
@ -510,11 +568,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleSeedReminderViewContinueButtonTapped() {
|
|
||||||
val intent = Intent(this, SeedActivity::class.java)
|
|
||||||
show(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConversationClick(thread: ThreadRecord) {
|
override fun onConversationClick(thread: ThreadRecord) {
|
||||||
val intent = Intent(this, ConversationActivityV2::class.java)
|
val intent = Intent(this, ConversationActivityV2::class.java)
|
||||||
intent.putExtra(ConversationActivityV2.THREAD_ID, thread.threadId)
|
intent.putExtra(ConversationActivityV2.THREAD_ID, thread.threadId)
|
||||||
@ -538,7 +591,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
bottomSheet.dismiss()
|
bottomSheet.dismiss()
|
||||||
if (!thread.recipient.isGroupRecipient && !thread.recipient.isLocalNumber) {
|
if (!thread.recipient.isGroupRecipient && !thread.recipient.isLocalNumber) {
|
||||||
val clip = ClipData.newPlainText("Session ID", thread.recipient.address.toString())
|
val clip = ClipData.newPlainText("Session ID", thread.recipient.address.toString())
|
||||||
val manager = getSystemService(PassphraseRequiredActionBarActivity.CLIPBOARD_SERVICE) as ClipboardManager
|
val manager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
manager.setPrimaryClip(clip)
|
manager.setPrimaryClip(clip)
|
||||||
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
@ -547,7 +600,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
val openGroup = DatabaseComponent.get(this@HomeActivity).lokiThreadDatabase().getOpenGroupChat(threadId) ?: return@onCopyConversationId Unit
|
val openGroup = DatabaseComponent.get(this@HomeActivity).lokiThreadDatabase().getOpenGroupChat(threadId) ?: return@onCopyConversationId Unit
|
||||||
|
|
||||||
val clip = ClipData.newPlainText("Community URL", openGroup.joinURL)
|
val clip = ClipData.newPlainText("Community URL", openGroup.joinURL)
|
||||||
val manager = getSystemService(PassphraseRequiredActionBarActivity.CLIPBOARD_SERVICE) as ClipboardManager
|
val manager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
manager.setPrimaryClip(clip)
|
manager.setPrimaryClip(clip)
|
||||||
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.onboarding
|
|||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
@ -19,6 +20,7 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
|
|||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||||
import org.thoughtcrime.securesms.crypto.MnemonicUtilities
|
import org.thoughtcrime.securesms.crypto.MnemonicUtilities
|
||||||
import org.thoughtcrime.securesms.util.getAccentColor
|
import org.thoughtcrime.securesms.util.getAccentColor
|
||||||
|
import org.thoughtcrime.securesms.util.show
|
||||||
|
|
||||||
class SeedActivity : BaseActionBarActivity() {
|
class SeedActivity : BaseActionBarActivity() {
|
||||||
|
|
||||||
@ -44,10 +46,6 @@ class SeedActivity : BaseActionBarActivity() {
|
|||||||
val seedReminderViewTitle = SpannableString("You're almost finished! 90%") // Intentionally not yet translated
|
val seedReminderViewTitle = SpannableString("You're almost finished! 90%") // Intentionally not yet translated
|
||||||
seedReminderViewTitle.setSpan(ForegroundColorSpan(getAccentColor()), 24, 27, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
seedReminderViewTitle.setSpan(ForegroundColorSpan(getAccentColor()), 24, 27, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
with(binding) {
|
with(binding) {
|
||||||
seedReminderView.title = seedReminderViewTitle
|
|
||||||
seedReminderView.subtitle = resources.getString(R.string.view_seed_reminder_subtitle_2)
|
|
||||||
seedReminderView.setProgress(90, false)
|
|
||||||
seedReminderView.hideContinueButton()
|
|
||||||
var redactedSeed = seed
|
var redactedSeed = seed
|
||||||
var index = 0
|
var index = 0
|
||||||
for (character in seed) {
|
for (character in seed) {
|
||||||
@ -70,9 +68,6 @@ class SeedActivity : BaseActionBarActivity() {
|
|||||||
val seedReminderViewTitle = SpannableString("Account secured! 100%") // Intentionally not yet translated
|
val seedReminderViewTitle = SpannableString("Account secured! 100%") // Intentionally not yet translated
|
||||||
seedReminderViewTitle.setSpan(ForegroundColorSpan(getAccentColor()), 17, 21, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
seedReminderViewTitle.setSpan(ForegroundColorSpan(getAccentColor()), 17, 21, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
with(binding) {
|
with(binding) {
|
||||||
seedReminderView.title = seedReminderViewTitle
|
|
||||||
seedReminderView.subtitle = resources.getString(R.string.view_seed_reminder_subtitle_3)
|
|
||||||
seedReminderView.setProgress(100, true)
|
|
||||||
val seedTextViewLayoutParams = seedTextView.layoutParams as LinearLayout.LayoutParams
|
val seedTextViewLayoutParams = seedTextView.layoutParams as LinearLayout.LayoutParams
|
||||||
seedTextViewLayoutParams.height = seedTextView.height
|
seedTextViewLayoutParams.height = seedTextView.height
|
||||||
seedTextView.layoutParams = seedTextViewLayoutParams
|
seedTextView.layoutParams = seedTextViewLayoutParams
|
||||||
@ -93,3 +88,7 @@ class SeedActivity : BaseActionBarActivity() {
|
|||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Context.startSeedActivity() {
|
||||||
|
Intent(this, SeedActivity::class.java).also(::startActivity)
|
||||||
|
}
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
package org.thoughtcrime.securesms.onboarding
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Build
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import network.loki.messenger.databinding.ViewSeedReminderBinding
|
|
||||||
|
|
||||||
class SeedReminderView : FrameLayout {
|
|
||||||
private lateinit var binding: ViewSeedReminderBinding
|
|
||||||
|
|
||||||
var title: CharSequence
|
|
||||||
get() = binding.titleTextView.text
|
|
||||||
set(value) { binding.titleTextView.text = value }
|
|
||||||
var subtitle: CharSequence
|
|
||||||
get() = binding.subtitleTextView.text
|
|
||||||
set(value) { binding.subtitleTextView.text = value }
|
|
||||||
var delegate: SeedReminderViewDelegate? = null
|
|
||||||
|
|
||||||
constructor(context: Context) : super(context) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setUpViewHierarchy() {
|
|
||||||
binding = ViewSeedReminderBinding.inflate(LayoutInflater.from(context), this, true)
|
|
||||||
binding.button.setOnClickListener { delegate?.handleSeedReminderViewContinueButtonTapped() }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setProgress(progress: Int, isAnimated: Boolean) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
binding.progressBar.setProgress(progress, isAnimated)
|
|
||||||
} else {
|
|
||||||
binding.progressBar.progress = progress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hideContinueButton() {
|
|
||||||
binding.button.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SeedReminderViewDelegate {
|
|
||||||
|
|
||||||
fun handleSeedReminderViewContinueButtonTapped()
|
|
||||||
}
|
|
@ -1,10 +1,21 @@
|
|||||||
package org.thoughtcrime.securesms.ui
|
package org.thoughtcrime.securesms.ui
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.material.ButtonDefaults
|
import androidx.compose.material.ButtonDefaults
|
||||||
|
import androidx.compose.material.Card
|
||||||
import androidx.compose.material.Colors
|
import androidx.compose.material.Colors
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.material.primarySurface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
val colorDestructive = Color(0xffFF453A)
|
val colorDestructive = Color(0xffFF453A)
|
||||||
|
|
||||||
@ -62,3 +73,45 @@ fun transparentButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Co
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun destructiveButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent, contentColor = colorDestructive)
|
fun destructiveButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Color.Transparent, contentColor = colorDestructive)
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun Context.PreviewMessageDetails(
|
||||||
|
@PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int
|
||||||
|
) {
|
||||||
|
PreviewTheme(themeResId) {
|
||||||
|
Colors()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun Colors() {
|
||||||
|
AppTheme {
|
||||||
|
Column {
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.primary)) {
|
||||||
|
Text("primary")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.primaryVariant)) {
|
||||||
|
Text("primaryVariant")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.secondary)) {
|
||||||
|
Text("secondary")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.secondaryVariant)) {
|
||||||
|
Text("secondaryVariant")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.surface)) {
|
||||||
|
Text("surface")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.primarySurface)) {
|
||||||
|
Text("primarySurface")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.background)) {
|
||||||
|
Text("background")
|
||||||
|
}
|
||||||
|
Box(Modifier.background(MaterialTheme.colors.error)) {
|
||||||
|
Text("error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -58,7 +58,7 @@ fun OutlineButton(text: String, modifier: Modifier = Modifier, onClick: () -> Un
|
|||||||
shape = RoundedCornerShape(50), // = 50% percent
|
shape = RoundedCornerShape(50), // = 50% percent
|
||||||
colors = ButtonDefaults.outlinedButtonColors(
|
colors = ButtonDefaults.outlinedButtonColors(
|
||||||
contentColor = LocalExtraColors.current.prominentButtonColor,
|
contentColor = LocalExtraColors.current.prominentButtonColor,
|
||||||
backgroundColor = MaterialTheme.colors.background
|
backgroundColor = Color.Unspecified
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Text(text = text)
|
Text(text = text)
|
||||||
|
@ -40,15 +40,19 @@ data class ExtraColors(
|
|||||||
fun AppTheme(
|
fun AppTheme(
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
val extraColors = LocalContext.current.run {
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
val extraColors = context.run {
|
||||||
ExtraColors(
|
ExtraColors(
|
||||||
settingsBackground = getColorFromTheme(R.attr.colorSettingsBackground),
|
settingsBackground = getColorFromTheme(R.attr.colorSettingsBackground),
|
||||||
prominentButtonColor = getColorFromTheme(R.attr.prominentButtonColor),
|
prominentButtonColor = getColorFromTheme(R.attr.prominentButtonColor),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val surface = context.getColorFromTheme(R.attr.colorSettingsBackground)
|
||||||
|
|
||||||
CompositionLocalProvider(LocalExtraColors provides extraColors) {
|
CompositionLocalProvider(LocalExtraColors provides extraColors) {
|
||||||
AppCompatTheme {
|
AppCompatTheme(surface = surface) {
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,6 +64,7 @@ fun AppCompatTheme(
|
|||||||
readColors: Boolean = true,
|
readColors: Boolean = true,
|
||||||
typography: Typography = sessionTypography,
|
typography: Typography = sessionTypography,
|
||||||
shapes: Shapes = MaterialTheme.shapes,
|
shapes: Shapes = MaterialTheme.shapes,
|
||||||
|
surface: Color? = null,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
val themeParams = remember(context.theme) {
|
val themeParams = remember(context.theme) {
|
||||||
@ -69,8 +74,12 @@ fun AppCompatTheme(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val colors = themeParams.colors ?: MaterialTheme.colors
|
||||||
|
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colors = themeParams.colors ?: MaterialTheme.colors,
|
colors = colors.copy(
|
||||||
|
surface = surface ?: colors.surface
|
||||||
|
),
|
||||||
typography = typography,
|
typography = typography,
|
||||||
shapes = shapes,
|
shapes = shapes,
|
||||||
) {
|
) {
|
||||||
|
10
app/src/main/res/drawable/session_shield.xml
Normal file
10
app/src/main/res/drawable/session_shield.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="15dp"
|
||||||
|
android:height="17dp"
|
||||||
|
android:viewportWidth="15"
|
||||||
|
android:viewportHeight="17">
|
||||||
|
<path
|
||||||
|
android:pathData="M6.938,0.486C7.132,0.399 7.334,0.354 7.54,0.354L7.543,0.36C7.742,0.36 7.939,0.402 8.135,0.488C8.375,0.597 8.621,0.7 8.867,0.804L9.15,0.924L10.484,1.499C10.918,1.685 11.352,1.871 11.786,2.058C12.413,2.327 13.042,2.597 13.67,2.866C14.263,3.12 14.587,3.636 14.538,4.236C14.534,4.268 14.535,4.313 14.537,4.362V4.362V4.362C14.537,4.39 14.538,4.418 14.538,4.448C14.541,4.518 14.541,4.59 14.541,4.674C14.532,5.436 14.532,6.211 14.541,6.973V6.987L14.538,7.001V7.266L14.538,7.27V7.27C14.535,7.54 14.532,7.812 14.524,8.075C14.509,8.776 14.37,9.44 14.249,9.939L14.24,9.973L14.229,10.006C14.125,10.347 14.006,10.71 13.853,11.083C13.647,11.575 13.378,12.08 13.028,12.629L13.014,12.652L12.997,12.674C12.583,13.26 12.198,13.718 11.788,14.117C11.114,14.77 10.354,15.305 9.524,15.715C9.511,15.722 9.497,15.73 9.483,15.738C9.476,15.742 9.469,15.746 9.461,15.75C9.455,15.753 9.449,15.757 9.443,15.76L9.399,15.783L9.356,15.802C8.951,15.975 8.468,16.167 7.939,16.304L7.927,16.31H7.916C7.788,16.34 7.658,16.354 7.534,16.354C7.41,16.354 7.282,16.34 7.146,16.307C6.652,16.181 6.149,16 5.651,15.769L5.643,15.76H5.634C4.214,15.074 3.034,14.058 2.126,12.744L2.086,12.699L2.042,12.629C1.727,12.13 1.49,11.695 1.296,11.262C1.137,10.904 1.02,10.554 0.907,10.214L0.9,10.193L0.857,10.065L0.836,10.001L0.822,9.937L0.796,9.812L0.77,9.688L0.763,9.658C0.705,9.383 0.644,9.1 0.608,8.801C0.543,8.311 0.544,7.845 0.544,7.399L0.544,7.297V7.166V6.982V4.652V4.423C0.544,4.385 0.545,4.349 0.545,4.314C0.546,4.246 0.546,4.183 0.544,4.124C0.521,3.583 0.816,3.125 1.351,2.888C1.921,2.644 2.49,2.4 3.059,2.156C3.628,1.911 4.197,1.667 4.766,1.423L5.799,0.98L5.842,0.96L5.914,0.927L5.938,0.915C5.982,0.896 6.027,0.877 6.071,0.858L6.072,0.858C6.153,0.823 6.235,0.788 6.316,0.754C6.377,0.728 6.437,0.702 6.498,0.676L6.498,0.676L6.498,0.676C6.645,0.613 6.793,0.551 6.938,0.486ZM8.416,7.697L9.764,8.409C10.07,8.57 10.324,8.806 10.501,9.093C10.678,9.379 10.772,9.705 10.772,10.038C10.771,10.494 10.581,10.931 10.242,11.254C9.903,11.576 9.444,11.758 8.965,11.758H5.773C5.582,11.76 5.393,11.726 5.216,11.658C5.039,11.59 4.879,11.489 4.743,11.362C4.607,11.234 4.499,11.082 4.426,10.914C4.352,10.747 4.315,10.567 4.315,10.385C4.315,10.203 4.352,10.023 4.426,9.856C4.499,9.688 4.607,9.536 4.743,9.408C4.879,9.28 5.039,9.18 5.216,9.112C5.393,9.043 5.582,9.01 5.773,9.012H6.689L5.34,8.3C5.034,8.139 4.78,7.903 4.602,7.616C4.425,7.33 4.332,7.003 4.331,6.671C4.332,6.215 4.522,5.778 4.861,5.455C5.2,5.133 5.659,4.951 6.138,4.951H9.33C9.712,4.951 10.079,5.095 10.349,5.353C10.62,5.61 10.772,5.96 10.772,6.324C10.772,6.688 10.62,7.038 10.349,7.295C10.079,7.553 9.712,7.697 9.33,7.697H8.416ZM4.996,7.415C5.132,7.629 5.325,7.806 5.555,7.927L7.329,8.863V7.462C7.329,7.412 7.35,7.363 7.387,7.328C7.424,7.292 7.475,7.272 7.528,7.272H9.33C9.465,7.272 9.598,7.245 9.722,7.195C9.846,7.144 9.958,7.07 10.051,6.977C10.144,6.884 10.216,6.774 10.263,6.653C10.31,6.533 10.33,6.404 10.324,6.276C10.297,5.766 9.836,5.376 9.301,5.376H6.172C5.405,5.376 4.761,5.974 4.779,6.705C4.785,6.955 4.86,7.2 4.996,7.415ZM5.802,11.333H8.931C9.699,11.333 10.343,10.734 10.325,10.005C10.318,9.754 10.244,9.509 10.107,9.295C9.971,9.08 9.778,8.903 9.548,8.781L7.775,7.846V9.247C7.775,9.272 7.77,9.297 7.76,9.32C7.75,9.343 7.735,9.364 7.717,9.381C7.698,9.399 7.676,9.413 7.652,9.423C7.628,9.432 7.602,9.437 7.575,9.437H5.773C5.638,9.437 5.505,9.464 5.381,9.514C5.257,9.565 5.145,9.639 5.052,9.732C4.96,9.825 4.887,9.935 4.841,10.056C4.794,10.176 4.773,10.304 4.779,10.433C4.806,10.943 5.267,11.333 5.802,11.333Z"
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
</vector>
|
@ -6,7 +6,7 @@
|
|||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.onboarding.SeedReminderView
|
<androidx.compose.ui.platform.ComposeView
|
||||||
android:id="@+id/seedReminderView"
|
android:id="@+id/seedReminderView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?colorPrimary"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
|
||||||
android:id="@+id/progressBar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/accent_line_thickness"
|
|
||||||
android:paddingLeft="-2dp"
|
|
||||||
android:paddingRight="-2dp"
|
|
||||||
android:progressTint="?colorAccent"
|
|
||||||
android:progress="80" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:padding="@dimen/medium_spacing"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?android:textColor"
|
|
||||||
android:textSize="@dimen/small_font_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/view_seed_reminder_title" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/subtitleTextView"
|
|
||||||
android:layout_width="260dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textColor="?android:textColor"
|
|
||||||
android:textSize="@dimen/very_small_font_size"
|
|
||||||
android:lines="2"
|
|
||||||
android:alpha="0.6"
|
|
||||||
android:text="@string/view_seed_reminder_subtitle_1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginLeft="4dp" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/Widget.Session.Button.Common.ProminentOutline"
|
|
||||||
android:id="@+id/button"
|
|
||||||
android:contentDescription="@string/AccessibilityId_continue"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="28dp"
|
|
||||||
android:layout_marginLeft="4dp"
|
|
||||||
android:textStyle="normal"
|
|
||||||
android:text="@string/continue_2" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="?android:dividerHorizontal" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -94,7 +94,7 @@
|
|||||||
android:background="?android:dividerHorizontal"
|
android:background="?android:dividerHorizontal"
|
||||||
android:elevation="1dp" />
|
android:elevation="1dp" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.onboarding.SeedReminderView
|
<androidx.compose.ui.platform.ComposeView
|
||||||
tools:visibility="gone"
|
tools:visibility="gone"
|
||||||
android:id="@+id/seedReminderView"
|
android:id="@+id/seedReminderView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.onboarding.SeedReminderView
|
<androidx.compose.ui.platform.ComposeView
|
||||||
android:id="@+id/seedReminderView"
|
android:id="@+id/seedReminderView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?colorPrimary"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
|
||||||
android:id="@+id/progressBar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/accent_line_thickness"
|
|
||||||
android:paddingLeft="-2dp"
|
|
||||||
android:paddingRight="-2dp"
|
|
||||||
android:progressTint="?colorAccent"
|
|
||||||
android:progress="80" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:contentDescription="@string/AccessibilityId_recovery_phrase_reminder"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:padding="@dimen/medium_spacing"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/small_font_size"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/view_seed_reminder_title" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/subtitleTextView"
|
|
||||||
android:layout_width="224dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:textColor="?android:textColorPrimary"
|
|
||||||
android:textSize="@dimen/very_small_font_size"
|
|
||||||
android:lines="2"
|
|
||||||
android:alpha="0.6"
|
|
||||||
android:text="@string/view_seed_reminder_subtitle_1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginLeft="4dp" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/Widget.Session.Button.Common.ProminentOutline"
|
|
||||||
android:contentDescription="@string/AccessibilityId_continue"
|
|
||||||
android:id="@+id/button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="28dp"
|
|
||||||
android:layout_marginLeft="4dp"
|
|
||||||
android:textStyle="normal"
|
|
||||||
android:text="@string/continue_2" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1px"
|
|
||||||
android:background="?android:dividerHorizontal" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
Loading…
x
Reference in New Issue
Block a user