summaryrefslogtreecommitdiffhomepage
path: root/android/app/src
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson@mullvad.net>2024-10-03 13:40:35 +0200
committerDavid Göransson <david.goransson@mullvad.net>2024-10-03 13:40:35 +0200
commit2301dbd5b22ca87ae25109d874df6e2151348f42 (patch)
tree5b2db93be1a608d9160542faafbe5de892e3b837 /android/app/src
parent54f9af860fa9fa30db654be58666416ff9f9150a (diff)
parent9b728aab1a97d0cb2a2af0058d566f9a1590a24e (diff)
downloadmullvadvpn-2301dbd5b22ca87ae25109d874df6e2151348f42.tar.xz
mullvadvpn-2301dbd5b22ca87ae25109d874df6e2151348f42.zip
Merge branch 'a11y-fix-unlabeled-buttons-android'
Diffstat (limited to 'android/app/src')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt3
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt4
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt4
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt7
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ExpandChevron.kt10
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt17
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt20
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt5
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt4
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt10
14 files changed, 72 insertions, 20 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt
index 910276bb5b..b03a4f9be8 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt
@@ -23,6 +23,7 @@ import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
@@ -157,7 +158,7 @@ fun SwitchLocationButton(
) {
Icon(
painter = painterResource(R.drawable.icon_reconnect),
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.reconnect),
)
}
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt
index 02568ec5a3..5560a69754 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt
@@ -8,8 +8,10 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
+import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.lib.theme.AppTheme
import net.mullvad.mullvadvpn.lib.theme.Dimens
@@ -43,7 +45,7 @@ fun ThreeDotCell(
IconButton(onClick = onClickDots) {
Icon(
imageVector = Icons.Default.MoreVert,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.custom_lists),
tint = textColor,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt
index 46a2053ffc..81a5bd0ea5 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt
@@ -102,7 +102,7 @@ private fun ExpandableComposeCellBody(
) {
Icon(
imageVector = Icons.Default.Info,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.more_information),
tint = MaterialTheme.colorScheme.onPrimary,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt
index f5376335b3..f4715ff949 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt
@@ -15,7 +15,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
+import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.lib.theme.AppTheme
import net.mullvad.mullvadvpn.lib.theme.Dimens
import net.mullvad.mullvadvpn.lib.theme.color.AlphaInactive
@@ -80,7 +82,7 @@ private fun InformationComposeCellBody(modifier: Modifier, onInfoClicked: (() ->
) {
Icon(
imageVector = Icons.Default.Info,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.more_information),
tint = MaterialTheme.colorScheme.onPrimary,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt
index c5d9ef1f3f..3f05995738 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt
@@ -17,6 +17,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
@@ -168,7 +169,11 @@ fun SwitchCellView(
.padding(horizontal = Dimens.miniPadding),
onClick = onInfoClicked,
) {
- Icon(imageVector = Icons.Default.Info, contentDescription = null, tint = iconColor)
+ Icon(
+ imageVector = Icons.Default.Info,
+ contentDescription = stringResource(id = R.string.more_information),
+ tint = iconColor,
+ )
}
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ExpandChevron.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ExpandChevron.kt
index a38b283256..d1ec86fde7 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ExpandChevron.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ExpandChevron.kt
@@ -14,7 +14,9 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
+import net.mullvad.mullvadvpn.R
@Composable
@Preview
@@ -29,6 +31,12 @@ private fun PreviewChevron() {
fun ExpandChevron(modifier: Modifier = Modifier, color: Color, isExpanded: Boolean) {
val degree = remember(isExpanded) { if (isExpanded) UP_ROTATION else DOWN_ROTATION }
+ val stateLabel =
+ if (isExpanded) {
+ stringResource(id = R.string.collapse)
+ } else {
+ stringResource(id = R.string.expand)
+ }
val animatedRotation =
animateFloatAsState(
targetValue = degree,
@@ -38,7 +46,7 @@ fun ExpandChevron(modifier: Modifier = Modifier, color: Color, isExpanded: Boole
Icon(
imageVector = Icons.Default.KeyboardArrowDown,
- contentDescription = null,
+ contentDescription = stateLabel,
tint = color,
modifier = modifier.rotate(animatedRotation.value),
)
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt
index 43ba773cdc..929e758a6b 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt
@@ -9,24 +9,35 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import net.mullvad.mullvadvpn.R
@Composable
fun NavigateBackIconButton(modifier: Modifier = Modifier, onNavigateBack: () -> Unit) {
IconButton(onClick = onNavigateBack, modifier = modifier) {
- Icon(imageVector = Icons.AutoMirrored.Default.ArrowBack, contentDescription = null)
+ Icon(
+ imageVector = Icons.AutoMirrored.Default.ArrowBack,
+ contentDescription = stringResource(id = R.string.back),
+ )
}
}
@Composable
fun NavigateBackDownIconButton(onNavigateBack: () -> Unit) {
IconButton(onClick = onNavigateBack) {
- Icon(imageVector = Icons.Default.ArrowDownward, contentDescription = null)
+ Icon(
+ imageVector = Icons.Default.ArrowDownward,
+ contentDescription = stringResource(id = R.string.back),
+ )
}
}
@Composable
fun NavigateCloseIconButton(onNavigateClose: () -> Unit) {
IconButton(onClick = onNavigateClose) {
- Icon(imageVector = Icons.Default.Close, contentDescription = null)
+ Icon(
+ imageVector = Icons.Default.Close,
+ contentDescription = stringResource(id = R.string.close),
+ )
}
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt
index 676b08ed34..ebed6ea462 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt
@@ -187,7 +187,7 @@ private fun Notification(notificationBannerData: NotificationData) {
Icon(
modifier = Modifier.padding(Dimens.notificationIconPadding),
imageVector = it.icon,
- contentDescription = null,
+ contentDescription = it.contentDescription,
tint = MaterialTheme.colorScheme.onSurface,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt
index 1b811ed313..de36f76ac7 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt
@@ -35,7 +35,11 @@ data class NotificationData(
) : this(title, message?.let { AnnotatedString(it) }, statusLevel, action)
}
-data class NotificationAction(val icon: ImageVector, val onClick: (() -> Unit))
+data class NotificationAction(
+ val icon: ImageVector,
+ val onClick: (() -> Unit),
+ val contentDescription: String,
+)
@Composable
fun InAppNotification.toNotificationData(
@@ -64,7 +68,12 @@ fun InAppNotification.toNotificationData(
)
),
statusLevel = StatusLevel.Info,
- action = NotificationAction(Icons.Default.Clear, onDismissNewDevice),
+ action =
+ NotificationAction(
+ Icons.Default.Clear,
+ onDismissNewDevice,
+ stringResource(id = R.string.dismiss),
+ ),
)
is InAppNotification.AccountExpiry ->
NotificationData(
@@ -74,7 +83,11 @@ fun InAppNotification.toNotificationData(
action =
if (isPlayBuild) null
else
- NotificationAction(Icons.AutoMirrored.Default.OpenInNew, onClickShowAccount),
+ NotificationAction(
+ Icons.AutoMirrored.Default.OpenInNew,
+ onClickShowAccount,
+ stringResource(id = R.string.open_url),
+ ),
)
InAppNotification.TunnelStateBlocked ->
NotificationData(
@@ -93,6 +106,7 @@ fun InAppNotification.toNotificationData(
NotificationAction(
Icons.AutoMirrored.Default.OpenInNew,
onClickUpdateVersion,
+ stringResource(id = R.string.open_url),
),
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt
index 262f990d99..2599b0f982 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt
@@ -226,7 +226,7 @@ private fun DeviceNameRow(deviceName: String, onInfoClick: () -> Unit) {
IconButton(onClick = onInfoClick) {
Icon(
imageVector = Icons.Default.Info,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.more_information),
tint = MaterialTheme.colorScheme.onSurface,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt
index 87fe75b9f1..9b3142b161 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt
@@ -232,7 +232,7 @@ private fun TopBar(onBackClick: () -> Unit) {
IconButton(onClick = onBackClick) {
Icon(
imageVector = Icons.AutoMirrored.Default.ArrowBack,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.back),
tint = MaterialTheme.colorScheme.onSurface,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt
index 9a5e34c285..3abcc5842d 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt
@@ -55,7 +55,10 @@ fun ImportOverridesByTextScreen(onNavigateBack: () -> Unit, onImportClicked: (St
title = stringResource(R.string.import_overrides_text_title),
navigationIcon = {
IconButton(onClick = onNavigateBack) {
- Icon(imageVector = Icons.Default.Close, contentDescription = null)
+ Icon(
+ imageVector = Icons.Default.Close,
+ contentDescription = stringResource(id = R.string.close),
+ )
}
},
actions = {
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
index e5e64c931d..371347bcdd 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt
@@ -491,7 +491,7 @@ private fun SelectLocationTopBar(onBackClick: () -> Unit, onFilterClick: () -> U
Icon(
imageVector = Icons.Default.Close,
tint = MaterialTheme.colorScheme.onSurface,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.back),
)
}
Text(
@@ -504,7 +504,7 @@ private fun SelectLocationTopBar(onBackClick: () -> Unit, onFilterClick: () -> U
IconButton(onClick = onFilterClick) {
Icon(
imageVector = Icons.Default.FilterList,
- contentDescription = null,
+ contentDescription = stringResource(id = R.string.filter),
tint = MaterialTheme.colorScheme.onSurface,
)
}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt
index a73ce7abb7..7b227f9a9f 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt
@@ -114,13 +114,19 @@ private fun TopBar(
onClick = { clipboardHandle(state.text(), clipboardToastMessage) },
modifier = Modifier.focusProperties { down = FocusRequester.Cancel },
) {
- Icon(imageVector = Icons.Default.ContentCopy, contentDescription = null)
+ Icon(
+ imageVector = Icons.Default.ContentCopy,
+ contentDescription = stringResource(id = R.string.copy),
+ )
}
IconButton(
onClick = { scope.launch { shareText(context, state.text()) } },
modifier = Modifier.focusProperties { down = FocusRequester.Cancel },
) {
- Icon(imageVector = Icons.Default.Share, contentDescription = null)
+ Icon(
+ imageVector = Icons.Default.Share,
+ contentDescription = stringResource(id = R.string.share),
+ )
}
},
)