diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt
index 6a4a8d620a..766d402251 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt
@@ -163,7 +163,7 @@ fun EnterAccountId(
if (state.error == null) {
BorderlessButtonSecondary(
text = stringResource(R.string.messageNewDescription),
- contentDescription = GetString(R.string.AccessibilityId_help_desk_link),
+ modifier = Modifier.contentDescription(R.string.AccessibilityId_help_desk_link)
) { onHelp() }
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt
index eb063f4ae4..a120adf4b7 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/InviteFriendFragment.kt
@@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement.Absolute.spacedBy
@@ -25,6 +24,7 @@ import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.fragment.app.Fragment
import dagger.hilt.android.AndroidEntryPoint
@@ -39,7 +39,6 @@ import org.thoughtcrime.securesms.ui.components.OnPrimaryButtons
import org.thoughtcrime.securesms.ui.components.OutlineButton
import org.thoughtcrime.securesms.ui.components.OutlineTemporaryStateButton
import org.thoughtcrime.securesms.ui.components.SmallButtons
-import org.thoughtcrime.securesms.ui.components.TemporaryStateButton
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.small
@@ -53,66 +52,82 @@ class InviteFriendFragment : Fragment() {
): View = ComposeView(requireContext()).apply {
setContent {
AppTheme {
- InviteFriend()
+ InviteFriend(
+ onBack = { delegate.onDialogBackPressed() },
+ onClose = { delegate.onDialogClosePressed() },
+ copyPublicKey = requireContext()::copyPublicKey,
+ sendInvitation = requireContext()::sendInvitation,
+ )
}
}
}
+}
- @Composable
- private fun InviteFriend() {
- Column(modifier = Modifier.background(MaterialTheme.colors.primarySurface)) {
- AppBar(stringResource(R.string.invite_a_friend), onBack = { delegate.onDialogBackPressed() }, onClose = { delegate.onDialogClosePressed() })
- Column(
- modifier = Modifier.padding(horizontal = 24.dp),
- verticalArrangement = spacedBy(10.dp)
- ) {
- Box(
- modifier = Modifier
- .border(
- width = 1.dp,
- color = classicDarkColors[5],
- shape = RoundedCornerShape(size = 13.dp)
- )
- .fillMaxWidth()
- .wrapContentHeight()
- ) {
- Text(
- TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
- textAlign = TextAlign.Center,
- modifier = Modifier
- .contentDescription("Your account ID")
- .align(Alignment.Center)
- .padding(22.dp)
+@Preview
+@Composable
+private fun PreviewInviteFriend() {
+ InviteFriend()
+}
+
+@Composable
+private fun InviteFriend(
+ onBack: () -> Unit = {},
+ onClose: () -> Unit = {},
+ copyPublicKey: () -> Unit = {},
+ sendInvitation: () -> Unit = {},
+) {
+ Column(modifier = Modifier.background(MaterialTheme.colors.primarySurface)) {
+ AppBar(stringResource(R.string.invite_a_friend), onBack = onBack, onClose = onClose)
+ Column(
+ modifier = Modifier.padding(horizontal = 24.dp),
+ verticalArrangement = spacedBy(10.dp)
+ ) {
+ Box(
+ modifier = Modifier
+ .border(
+ width = 1.dp,
+ color = classicDarkColors[5],
+ shape = RoundedCornerShape(size = 13.dp)
)
- }
-
+ .fillMaxWidth()
+ .wrapContentHeight()
+ ) {
Text(
- stringResource(R.string.invite_your_friend_to_chat_with_you_on_session_by_sharing_your_account_id_with_them),
+ TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
textAlign = TextAlign.Center,
- style = MaterialTheme.typography.small,
- color = classicDarkColors[5],
- modifier = Modifier.padding(horizontal = 8.dp)
+ modifier = Modifier
+ .contentDescription("Your account ID")
+ .align(Alignment.Center)
+ .padding(22.dp)
)
- OnPrimaryButtons {
- SmallButtons {
- Row(horizontalArrangement = spacedBy(20.dp)) {
- OutlineButton(
- modifier = Modifier
- .weight(1f)
- .contentDescription("Share button"),
- onClick = { requireContext().sendInvitation() }
- ) {
- Text(stringResource(R.string.share))
- }
+ }
- OutlineTemporaryStateButton(
- Modifier
- .weight(1f)
- .contentDescription("Copy button"),
- onClick = { requireContext().copyPublicKey() }
- ) { isTemporary ->
- Text(stringResource(if (isTemporary) R.string.copied else R.string.copy))
- }
+ Text(
+ stringResource(R.string.invite_your_friend_to_chat_with_you_on_session_by_sharing_your_account_id_with_them),
+ textAlign = TextAlign.Center,
+ style = MaterialTheme.typography.small,
+ color = classicDarkColors[5],
+ modifier = Modifier.padding(horizontal = 8.dp)
+ )
+ OnPrimaryButtons {
+ SmallButtons {
+ Row(horizontalArrangement = spacedBy(20.dp)) {
+ OutlineButton(
+ modifier = Modifier
+ .weight(1f)
+ .contentDescription("Share button"),
+ onClick = sendInvitation
+ ) {
+ Text(stringResource(R.string.share))
+ }
+
+ OutlineTemporaryStateButton(
+ Modifier
+ .weight(1f)
+ .contentDescription(R.string.AccessibilityId_copy_button),
+ onClick = copyPublicKey
+ ) { isTemporary ->
+ Text(stringResource(if (isTemporary) R.string.copied else R.string.copy))
}
}
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt
index 9f6fec4b07..25e0d2b15b 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt
@@ -70,7 +70,7 @@ class NewConversationHomeFragment : Fragment() {
Spacer(modifier = Modifier.height(4.dp))
Text(text = stringResource(R.string.qrYoursDescription), color = classicDarkColors[5], style = MaterialTheme.typography.small)
Spacer(modifier = Modifier.height(20.dp))
- QrImage(string = TextSecurePreferences.getLocalNumber(requireContext())!!, contentDescription = "Your session id")
+ QrImage(string = TextSecurePreferences.getLocalNumber(requireContext())!!, contentDescription = stringResource(R.string.AccessibilityId_qr_code))
}
}
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/recoverypassword/RecoveryPasswordActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/recoverypassword/RecoveryPasswordActivity.kt
index 95efe84747..923096e405 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/recoverypassword/RecoveryPasswordActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/recoverypassword/RecoveryPasswordActivity.kt
@@ -143,7 +143,7 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
Text(
seed,
modifier = Modifier
- .contentDescription(R.string.AccessibilityId_hide_recovery_password_button)
+ .contentDescription(R.string.AccessibilityId_recovery_password_container)
.padding(vertical = 24.dp)
.border(
width = 1.dp,
@@ -164,7 +164,7 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
QrImage(
seed,
modifier = Modifier.padding(vertical = 24.dp),
- contentDescription = "QR code of your recovery password",
+ contentDescription = stringResource(R.string.AccessibilityId_qr_code),
icon = R.drawable.session_shield
)
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt
index f74673b209..a6592b7fa1 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt
@@ -91,7 +91,7 @@ fun QrPage(string: String) {
) {
QrImage(
string = string,
- contentDescription = "Your session id",
+ contentDescription = stringResource(R.string.AccessibilityId_qr_code),
modifier = Modifier.padding(top = 32.dp, bottom = 12.dp),
icon = R.drawable.session
)
diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt
index 496a67733a..5b3ec6cf0f 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt
@@ -83,6 +83,7 @@ import org.thoughtcrime.securesms.ui.ItemButtonWithDrawable
import org.thoughtcrime.securesms.ui.components.OutlineButton
import org.thoughtcrime.securesms.ui.components.OutlineTemporaryStateButton
import org.thoughtcrime.securesms.ui.components.TemporaryStateButton
+import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.destructiveButtonColors
import org.thoughtcrime.securesms.util.BitmapDecodingException
import org.thoughtcrime.securesms.util.BitmapUtil
@@ -402,7 +403,8 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
}
OutlineTemporaryStateButton(
- modifier = Modifier.weight(1f),
+ modifier = Modifier.weight(1f)
+ .contentDescription(R.string.AccessibilityId_copy_button),
onClick = { copyPublicKey() },
) { isTemporary ->
Text(stringResource(if (isTemporary) R.string.copied else R.string.copy))
diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt
index 29ad429d6b..1b125444c2 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt
@@ -148,12 +148,12 @@ fun FilledButton(
@Composable
fun BorderlessButtonSecondary(
text: String,
- contentDescription: GetString = GetString(text),
+ modifier: Modifier = Modifier,
onClick: () -> Unit
) {
BorderlessButton(
text,
- contentDescription = contentDescription,
+ modifier = modifier,
contentColor = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
onClick = onClick
)
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index a481526655..ddf231a752 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -43,7 +43,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
- android:contentDescription="@string/AccessibilityId_account_id"
+ android:contentDescription="@string/AccessibilityId_enter_display_name"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:visibility="invisible"
diff --git a/app/src/main/res/menu/settings_general.xml b/app/src/main/res/menu/settings_general.xml
index e65c599524..48100eddaa 100644
--- a/app/src/main/res/menu/settings_general.xml
+++ b/app/src/main/res/menu/settings_general.xml
@@ -6,7 +6,7 @@
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ad3fc62319..f3508c9277 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1118,6 +1118,7 @@
Recovery phrase input
Error message
Hide recovery password button
+ Recovery password container
Confirm button
Open URL
This Account ID is invalid. Please check and try again.
@@ -1139,4 +1140,6 @@
Invite friend button
Help desk link
Copy button
+ View QR code
+ QR code