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.OutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.components.SmallButtons
|
import org.thoughtcrime.securesms.ui.components.SmallButtons
|
||||||
import org.thoughtcrime.securesms.ui.components.TemporaryStateButton
|
import org.thoughtcrime.securesms.ui.components.TemporaryStateButton
|
||||||
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
import org.thoughtcrime.securesms.ui.small
|
import org.thoughtcrime.securesms.ui.small
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@ -78,6 +79,7 @@ class InviteFriendFragment : Fragment() {
|
|||||||
TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
|
TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.contentDescription("Your account ID")
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.padding(22.dp)
|
.padding(22.dp)
|
||||||
)
|
)
|
||||||
@ -94,7 +96,8 @@ class InviteFriendFragment : Fragment() {
|
|||||||
SmallButtons {
|
SmallButtons {
|
||||||
Row(horizontalArrangement = spacedBy(20.dp)) {
|
Row(horizontalArrangement = spacedBy(20.dp)) {
|
||||||
OutlineButton(
|
OutlineButton(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f)
|
||||||
|
.contentDescription("Share button"),
|
||||||
onClick = { requireContext().sendInvitation() }
|
onClick = { requireContext().sendInvitation() }
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.share))
|
Text(stringResource(R.string.share))
|
||||||
@ -102,7 +105,8 @@ class InviteFriendFragment : Fragment() {
|
|||||||
|
|
||||||
TemporaryStateButton { source, temporary ->
|
TemporaryStateButton { source, temporary ->
|
||||||
OutlineButton(
|
OutlineButton(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f)
|
||||||
|
.contentDescription("Copy button"),
|
||||||
interactionSource = source,
|
interactionSource = source,
|
||||||
onClick = { requireContext().copyPublicKey() },
|
onClick = { requireContext().copyPublicKey() },
|
||||||
) {
|
) {
|
||||||
|
@ -61,7 +61,7 @@ class NewConversationHomeFragment : Fragment() {
|
|||||||
Divider(modifier = Modifier.padding(start = 80.dp))
|
Divider(modifier = Modifier.padding(start = 80.dp))
|
||||||
ItemButton(textId = R.string.dialog_join_community_title, icon = R.drawable.ic_globe) { delegate.onJoinCommunitySelected() }
|
ItemButton(textId = R.string.dialog_join_community_title, icon = R.drawable.ic_globe) { delegate.onJoinCommunitySelected() }
|
||||||
Divider(modifier = Modifier.padding(start = 80.dp))
|
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(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 32.dp)
|
.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.dependencies.DatabaseComponent
|
||||||
import org.thoughtcrime.securesms.showOpenUrlDialog
|
import org.thoughtcrime.securesms.showOpenUrlDialog
|
||||||
import org.thoughtcrime.securesms.ui.AppTheme
|
import org.thoughtcrime.securesms.ui.AppTheme
|
||||||
|
import org.thoughtcrime.securesms.ui.GetString
|
||||||
import org.thoughtcrime.securesms.ui.LoadingArcOr
|
import org.thoughtcrime.securesms.ui.LoadingArcOr
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
||||||
@ -150,13 +151,19 @@ fun EnterAccountId(
|
|||||||
) {
|
) {
|
||||||
SessionOutlinedTextField(
|
SessionOutlinedTextField(
|
||||||
text = state.newMessageIdOrOns,
|
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),
|
placeholder = stringResource(R.string.accountIdOrOnsEnter),
|
||||||
onChange = callbacks::onChange,
|
onChange = callbacks::onChange,
|
||||||
onContinue = callbacks::onContinue,
|
onContinue = callbacks::onContinue,
|
||||||
error = state.error?.string(),
|
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))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
@ -165,11 +172,11 @@ fun EnterAccountId(
|
|||||||
.align(Alignment.CenterHorizontally)
|
.align(Alignment.CenterHorizontally)
|
||||||
.padding(horizontal = 64.dp, vertical = 20.dp)
|
.padding(horizontal = 64.dp, vertical = 20.dp)
|
||||||
.width(200.dp)
|
.width(200.dp)
|
||||||
.contentDescription(R.string.continue_2),
|
.contentDescription(R.string.next),
|
||||||
onClick = { callbacks.onContinue() }
|
onClick = { callbacks.onContinue() }
|
||||||
) {
|
) {
|
||||||
LoadingArcOr(state.loading) {
|
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(
|
class LinkDeviceViewModel @Inject constructor(
|
||||||
private val application: Application
|
private val application: Application
|
||||||
): AndroidViewModel(application) {
|
): AndroidViewModel(application) {
|
||||||
private val QR_ERROR_TIME = 3.seconds
|
|
||||||
private val state = MutableStateFlow(LinkDeviceState())
|
private val state = MutableStateFlow(LinkDeviceState())
|
||||||
val stateFlow = state.asStateFlow()
|
val stateFlow = state.asStateFlow()
|
||||||
|
|
||||||
@ -43,10 +42,7 @@ class LinkDeviceViewModel @Inject constructor(
|
|||||||
|
|
||||||
private val qrErrors = Channel<Throwable>()
|
private val qrErrors = Channel<Throwable>()
|
||||||
|
|
||||||
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
|
|
||||||
val qrErrorsFlow = qrErrors.receiveAsFlow()
|
val qrErrorsFlow = qrErrors.receiveAsFlow()
|
||||||
// .debounce(QR_ERROR_TIME)
|
|
||||||
.takeWhile { event.isEmpty }
|
|
||||||
.mapNotNull { application.getString(R.string.qrNotRecoveryPassword) }
|
.mapNotNull { application.getString(R.string.qrNotRecoveryPassword) }
|
||||||
|
|
||||||
private val codec by lazy { MnemonicCodec { MnemonicUtilities.loadFileContents(getApplication(), it) } }
|
private val codec by lazy { MnemonicCodec { MnemonicUtilities.loadFileContents(getApplication(), it) } }
|
||||||
|
@ -141,7 +141,6 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
|
|||||||
Text(
|
Text(
|
||||||
seed,
|
seed,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.contentDescription(R.string.AccessibilityId_hide_recovery_password_button)
|
|
||||||
.padding(vertical = 24.dp)
|
.padding(vertical = 24.dp)
|
||||||
.border(
|
.border(
|
||||||
width = 1.dp,
|
width = 1.dp,
|
||||||
|
@ -121,10 +121,12 @@ fun FilledButton(
|
|||||||
@Composable
|
@Composable
|
||||||
fun BorderlessButtonSecondary(
|
fun BorderlessButtonSecondary(
|
||||||
text: String,
|
text: String,
|
||||||
|
contentDescription: GetString = GetString(text),
|
||||||
onClick: () -> Unit
|
onClick: () -> Unit
|
||||||
) {
|
) {
|
||||||
BorderlessButton(
|
BorderlessButton(
|
||||||
text,
|
text,
|
||||||
|
contentDescription = contentDescription,
|
||||||
contentColor = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
|
contentColor = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
|
||||||
onClick = onClick
|
onClick = onClick
|
||||||
)
|
)
|
||||||
|
@ -45,7 +45,7 @@ fun QrImage(
|
|||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
LaunchedEffect(string) {
|
LaunchedEffect(string) {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
val c = 150
|
val c = 100
|
||||||
val w = c * 2
|
val w = c * 2
|
||||||
bitmap = QRCodeUtilities.encode(string, w).also {
|
bitmap = QRCodeUtilities.encode(string, w).also {
|
||||||
val hw = 30
|
val hw = 30
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:contentDescription="@string/AccessibilityId_username"
|
android:contentDescription="@string/AccessibilityId_account_id"
|
||||||
android:paddingTop="12dp"
|
android:paddingTop="12dp"
|
||||||
android:paddingBottom="12dp"
|
android:paddingBottom="12dp"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/action_qr_code"
|
android:id="@+id/action_qr_code"
|
||||||
android:title=""
|
android:title=""
|
||||||
|
android:contentDescription="View QR code"
|
||||||
android:icon="@drawable/ic_qr_code_24"
|
android:icon="@drawable/ic_qr_code_24"
|
||||||
app:showAsAction="always" />
|
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="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="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="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>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user