mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Fix accessibility ids
This commit is contained in:
parent
c32a5b6bba
commit
0867fb7da0
@ -39,6 +39,7 @@ import org.thoughtcrime.securesms.ui.components.OnPrimaryButtons
|
||||
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
||||
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
|
||||
|
||||
@AndroidEntryPoint
|
||||
@ -78,6 +79,7 @@ class InviteFriendFragment : Fragment() {
|
||||
TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.contentDescription("Your account ID")
|
||||
.align(Alignment.Center)
|
||||
.padding(22.dp)
|
||||
)
|
||||
@ -94,7 +96,8 @@ class InviteFriendFragment : Fragment() {
|
||||
SmallButtons {
|
||||
Row(horizontalArrangement = spacedBy(20.dp)) {
|
||||
OutlineButton(
|
||||
modifier = Modifier.weight(1f),
|
||||
modifier = Modifier.weight(1f)
|
||||
.contentDescription("Share button"),
|
||||
onClick = { requireContext().sendInvitation() }
|
||||
) {
|
||||
Text(stringResource(R.string.share))
|
||||
@ -102,7 +105,8 @@ class InviteFriendFragment : Fragment() {
|
||||
|
||||
TemporaryStateButton { source, temporary ->
|
||||
OutlineButton(
|
||||
modifier = Modifier.weight(1f),
|
||||
modifier = Modifier.weight(1f)
|
||||
.contentDescription("Copy button"),
|
||||
interactionSource = source,
|
||||
onClick = { requireContext().copyPublicKey() },
|
||||
) {
|
||||
|
@ -61,7 +61,7 @@ class NewConversationHomeFragment : Fragment() {
|
||||
Divider(modifier = Modifier.padding(start = 80.dp))
|
||||
ItemButton(textId = R.string.dialog_join_community_title, icon = R.drawable.ic_globe) { delegate.onJoinCommunitySelected() }
|
||||
Divider(modifier = Modifier.padding(start = 80.dp))
|
||||
ItemButton(textId = R.string.activity_settings_invite_button_title, icon = R.drawable.ic_invite_friend) { delegate.onInviteFriend() }
|
||||
ItemButton(textId = R.string.activity_settings_invite_button_title, icon = R.drawable.ic_invite_friend, contentDescription = R.string.AccessibilityId_invite_friend_button) { delegate.onInviteFriend() }
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 32.dp)
|
||||
|
@ -43,6 +43,7 @@ import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
|
||||
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
|
||||
import org.thoughtcrime.securesms.showOpenUrlDialog
|
||||
import org.thoughtcrime.securesms.ui.AppTheme
|
||||
import org.thoughtcrime.securesms.ui.GetString
|
||||
import org.thoughtcrime.securesms.ui.LoadingArcOr
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
||||
@ -150,13 +151,19 @@ fun EnterAccountId(
|
||||
) {
|
||||
SessionOutlinedTextField(
|
||||
text = state.newMessageIdOrOns,
|
||||
modifier = Modifier.padding(horizontal = 64.dp),
|
||||
modifier = Modifier.padding(horizontal = 64.dp)
|
||||
.contentDescription("Session id input box"),
|
||||
placeholder = stringResource(R.string.accountIdOrOnsEnter),
|
||||
onChange = callbacks::onChange,
|
||||
onContinue = callbacks::onContinue,
|
||||
error = state.error?.string(),
|
||||
)
|
||||
if (state.error == null) BorderlessButtonSecondary(text = stringResource(R.string.messageNewDescription)) { onHelp() }
|
||||
if (state.error == null) {
|
||||
BorderlessButtonSecondary(
|
||||
text = stringResource(R.string.messageNewDescription),
|
||||
contentDescription = GetString(R.string.AccessibilityId_help_desk_link),
|
||||
) { onHelp() }
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
@ -165,11 +172,11 @@ fun EnterAccountId(
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(horizontal = 64.dp, vertical = 20.dp)
|
||||
.width(200.dp)
|
||||
.contentDescription(R.string.continue_2),
|
||||
.contentDescription(R.string.next),
|
||||
onClick = { callbacks.onContinue() }
|
||||
) {
|
||||
LoadingArcOr(state.loading) {
|
||||
Text(stringResource(R.string.continue_2))
|
||||
Text(stringResource(R.string.next))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ class LinkDeviceEvent(val mnemonic: ByteArray)
|
||||
class LinkDeviceViewModel @Inject constructor(
|
||||
private val application: Application
|
||||
): AndroidViewModel(application) {
|
||||
private val QR_ERROR_TIME = 3.seconds
|
||||
private val state = MutableStateFlow(LinkDeviceState())
|
||||
val stateFlow = state.asStateFlow()
|
||||
|
||||
@ -43,10 +42,7 @@ class LinkDeviceViewModel @Inject constructor(
|
||||
|
||||
private val qrErrors = Channel<Throwable>()
|
||||
|
||||
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
|
||||
val qrErrorsFlow = qrErrors.receiveAsFlow()
|
||||
// .debounce(QR_ERROR_TIME)
|
||||
.takeWhile { event.isEmpty }
|
||||
.mapNotNull { application.getString(R.string.qrNotRecoveryPassword) }
|
||||
|
||||
private val codec by lazy { MnemonicCodec { MnemonicUtilities.loadFileContents(getApplication(), it) } }
|
||||
|
@ -141,7 +141,6 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
|
||||
Text(
|
||||
seed,
|
||||
modifier = Modifier
|
||||
.contentDescription(R.string.AccessibilityId_hide_recovery_password_button)
|
||||
.padding(vertical = 24.dp)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
|
@ -121,10 +121,12 @@ fun FilledButton(
|
||||
@Composable
|
||||
fun BorderlessButtonSecondary(
|
||||
text: String,
|
||||
contentDescription: GetString = GetString(text),
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
BorderlessButton(
|
||||
text,
|
||||
contentDescription = contentDescription,
|
||||
contentColor = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
|
||||
onClick = onClick
|
||||
)
|
||||
|
@ -45,7 +45,7 @@ fun QrImage(
|
||||
val scope = rememberCoroutineScope()
|
||||
LaunchedEffect(string) {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
val c = 150
|
||||
val c = 100
|
||||
val w = c * 2
|
||||
bitmap = QRCodeUtilities.encode(string, w).also {
|
||||
val hw = 30
|
||||
|
@ -43,7 +43,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:contentDescription="@string/AccessibilityId_username"
|
||||
android:contentDescription="@string/AccessibilityId_account_id"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:visibility="invisible"
|
||||
|
@ -6,6 +6,7 @@
|
||||
<item
|
||||
android:id="@+id/action_qr_code"
|
||||
android:title=""
|
||||
android:contentDescription="View QR code"
|
||||
android:icon="@drawable/ic_qr_code_24"
|
||||
app:showAsAction="always" />
|
||||
|
||||
|
@ -1133,4 +1133,6 @@
|
||||
<string name="this_is_your_account_id_other_users_can_scan_it_to_start_a_conversation_with_you">This is your Account ID. Other users can scan it to start a conversation with you.</string>
|
||||
<string name="accountIdShare">Hey, I\'ve been using Session to chat with complete privacy and security. Come join me! My Account ID is \n\n%1$s\n\nDownload it at https://getsession.org/</string>
|
||||
<string name="this_qr_code_does_not_contain_an_account_id">This QR code does not contain an Account ID.</string>
|
||||
<string name="AccessibilityId_invite_friend_button">Invite friend button</string>
|
||||
<string name="AccessibilityId_help_desk_link">Help desk link</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user