diff --git a/res/layout/activity_mousepad.xml b/res/layout/activity_mousepad.xml index 09ac6bca..1899d100 100644 --- a/res/layout/activity_mousepad.xml +++ b/res/layout/activity_mousepad.xml @@ -31,13 +31,16 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted android:layout_centerInParent="true" android:gravity="center" android:padding="12dip" + android:importantForAccessibility="no" android:text="@string/mousepad_info" /> + android:layout_above="@id/mouse_buttons" + android:contentDescription="@string/mousepad_info_no_gestures" + /> @@ -57,6 +61,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted @@ -64,6 +69,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted + - diff --git a/res/layout/fragment_about.xml b/res/layout/fragment_about.xml index a54e4ba1..152b038e 100644 --- a/res/layout/fragment_about.xml +++ b/res/layout/fragment_about.xml @@ -48,7 +48,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted android:layout_gravity="top" android:paddingTop="@dimen/nav_header_vertical_spacing" android:paddingBottom="4dp" - android:contentDescription="@string/kde_connect" + android:importantForAccessibility="no" tools:src="@drawable/icon" /> diff --git a/res/layout/mpris_now_playing.xml b/res/layout/mpris_now_playing.xml index 13d80220..89a7abf7 100644 --- a/res/layout/mpris_now_playing.xml +++ b/res/layout/mpris_now_playing.xml @@ -19,7 +19,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted android:layout_height="@dimen/mpris_now_playing_album_height" android:layout_margin="25dp" android:layout_weight="@integer/mpris_now_playing_album_weight" - android:contentDescription="@string/mpris_coverart_description" + android:importantForAccessibility="no" android:scaleType="fitCenter" /> diff --git a/res/layout/widget_remotecommandplugin.xml b/res/layout/widget_remotecommandplugin.xml index e6355bad..4c27034e 100644 --- a/res/layout/widget_remotecommandplugin.xml +++ b/res/layout/widget_remotecommandplugin.xml @@ -30,7 +30,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted android:layout_height="wrap_content" android:tint="@color/text_color" android:src="@drawable/ic_kde_24dp" - android:contentDescription="@string/device_icon_description" + android:importantForAccessibility="no" tools:ignore="UseAppTint"/> There is more than one remote keyboard connection, select the device to configure Remote input Move a finger on the screen to move the mouse cursor. Tap for a click, and use two/three fingers for right and middle buttons. Use 2 fingers to scroll. Use a long press to drag\'n drop. Gyro mouse functionality can be enabled from plugin preferences + Move a finger on the screen to move the mouse cursor, tap for a click. Keyboard input not supported by the paired device Set one finger tap action Set two finger tap action @@ -181,6 +182,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted SHA256 fingerprint of your device certificate is: SHA256 fingerprint of remote device certificate is: Pair requested + Pair succeeded Pairing request from %1s 🔑%1s... Receiving file from %1s> @@ -219,6 +221,7 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted Tap to open \'%1s\' Cannot create file %s Tap to answer + Send Left Click Send Right Click Send Middle Click Show Keyboard @@ -345,7 +348,6 @@ SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted Blocked numbers Don\'t show calls and SMS from these numbers. Please specify one number per line Cover art of current media - Device icon Settings icon Fullscreen diff --git a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/ComposeSendActivity.kt b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/ComposeSendActivity.kt index 8b6dd2f3..38f43ff4 100644 --- a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/ComposeSendActivity.kt +++ b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/ComposeSendActivity.kt @@ -95,6 +95,7 @@ class ComposeSendActivity : AppCompatActivity() { KdeTopAppBar( title = stringResource(R.string.compose_send_title), navIconOnClick = { onBackPressedDispatcher.onBackPressed() }, + navIconDescription = getString(androidx.appcompat.R.string.abc_action_bar_up_description), actions = { KdeTextButton( modifier = Modifier.padding(horizontal = 8.dp), diff --git a/src/org/kde/kdeconnect/Plugins/PresenterPlugin/PresenterActivity.kt b/src/org/kde/kdeconnect/Plugins/PresenterPlugin/PresenterActivity.kt index 6402cc5a..f984a277 100644 --- a/src/org/kde/kdeconnect/Plugins/PresenterPlugin/PresenterActivity.kt +++ b/src/org/kde/kdeconnect/Plugins/PresenterPlugin/PresenterActivity.kt @@ -133,10 +133,12 @@ class PresenterActivity : AppCompatActivity(), SensorEventListener { KdeButton( onClick = { plugin.sendPrevious() }, modifier = Modifier.fillMaxSize().weight(1f), + contentDescription = getString(R.string.mpris_previous), icon = Icons.Default.ArrowBack, ) KdeButton( onClick = { plugin.sendNext() }, + contentDescription = getString(R.string.mpris_next), modifier = Modifier.fillMaxSize().weight(1f), icon = Icons.Default.ArrowForward, ) @@ -176,20 +178,25 @@ class PresenterActivity : AppCompatActivity(), SensorEventListener { var dropdownShownState by remember { mutableStateOf(false) } - KdeTopAppBar(navIconOnClick = { onBackPressedDispatcher.onBackPressed() }, actions = { - IconButton(onClick = { dropdownShownState = true }) { - Icon(Icons.Default.MoreVert, stringResource(R.string.extra_options)) + KdeTopAppBar( + title = stringResource(R.string.pref_plugin_presenter), + navIconOnClick = { onBackPressedDispatcher.onBackPressed() }, + navIconDescription = getString(androidx.appcompat.R.string.abc_action_bar_up_description), + actions = { + IconButton(onClick = { dropdownShownState = true }) { + Icon(Icons.Default.MoreVert, stringResource(R.string.extra_options)) + } + DropdownMenu(expanded = dropdownShownState, onDismissRequest = { dropdownShownState = false }) { + DropdownMenuItem( + onClick = { plugin.sendFullscreen() }, + text = { Text(stringResource(R.string.presenter_fullscreen)) }, + ) + DropdownMenuItem( + onClick = { plugin.sendEsc() }, + text = { Text(stringResource(R.string.presenter_exit)) }, + ) + } } - DropdownMenu(expanded = dropdownShownState, onDismissRequest = { dropdownShownState = false }) { - DropdownMenuItem( - onClick = { plugin.sendFullscreen() }, - text = { Text(stringResource(R.string.presenter_fullscreen)) }, - ) - DropdownMenuItem( - onClick = { plugin.sendEsc() }, - text = { Text(stringResource(R.string.presenter_exit)) }, - ) - } - }) + ) } } \ No newline at end of file diff --git a/src/org/kde/kdeconnect/UserInterface/DeviceFragment.kt b/src/org/kde/kdeconnect/UserInterface/DeviceFragment.kt index 932cb13c..fe073782 100644 --- a/src/org/kde/kdeconnect/UserInterface/DeviceFragment.kt +++ b/src/org/kde/kdeconnect/UserInterface/DeviceFragment.kt @@ -23,6 +23,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.res.painterResource +import androidx.compose.ui.semantics.Role +import androidx.compose.ui.semantics.heading +import androidx.compose.ui.semantics.role +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.* @@ -113,7 +117,7 @@ class DeviceFragment : Fragment() { requirePairingBinding().pairButton.setOnClickListener { with(requirePairingBinding()) { pairButton.visibility = View.GONE - pairMessage.text = null + pairMessage.text = getString(R.string.pair_requested) pairVerification.visibility = View.VISIBLE pairVerification.text = SslHelper.getVerificationKey(SslHelper.certificate, device?.certificate) pairProgress.visibility = View.VISIBLE @@ -306,6 +310,7 @@ class DeviceFragment : Fragment() { } override fun pairingSuccessful() { + requirePairingBinding().pairMessage.announceForAccessibility(getString(R.string.pair_succeeded)) mActivity?.runOnUiThread { refreshUI() } } @@ -383,7 +388,7 @@ class DeviceFragment : Fragment() { fun PluginButton(plugin : Plugin, modifier: Modifier) { Card( shape = MaterialTheme.shapes.medium, - modifier = modifier, + modifier = modifier.semantics { role = Role.Button }, onClick = { plugin.startMainActivity(mActivity) } ) { Column( @@ -435,7 +440,7 @@ class DeviceFragment : Fragment() { fun PluginsWithoutPermissions(title : String, plugins: Collection, action : (plugin: Plugin) -> Unit) { Text( text = title, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp) + modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp).semantics { heading() } ) plugins.forEach { plugin -> Text( @@ -444,6 +449,7 @@ class DeviceFragment : Fragment() { .fillMaxWidth() .clickable { action(plugin) } .padding(start = 28.dp, end = 16.dp, top = 12.dp, bottom = 12.dp) + .semantics { role = Role.Button } ) } } diff --git a/src/org/kde/kdeconnect/UserInterface/compose/Buttons.kt b/src/org/kde/kdeconnect/UserInterface/compose/Buttons.kt index efa1c713..f82a5ca6 100644 --- a/src/org/kde/kdeconnect/UserInterface/compose/Buttons.kt +++ b/src/org/kde/kdeconnect/UserInterface/compose/Buttons.kt @@ -51,6 +51,7 @@ fun KdeButton( modifier: Modifier = Modifier, colors: ButtonColors = ButtonDefaults.buttonColors(), text: String? = null, + contentDescription: String? = null, icon: ImageVector? = null, ) { //TODO uncomment when button is widely used @@ -69,7 +70,7 @@ fun KdeButton( colors = colors, // interactionSource = interactionSource, content = { - icon?.let { Icon(imageVector = it, contentDescription = text) } + icon?.let { Icon(imageVector = it, contentDescription = contentDescription ?: text) } text?.let { Text(it, maxLines = 1, overflow = Ellipsis) } } ) @@ -83,6 +84,7 @@ fun IconButtonPreview() { Modifier.width(120.dp), ButtonDefaults.buttonColors(Color.Gray, Color.DarkGray), "Button Text", + null, Icons.Default.Build, ) } \ No newline at end of file diff --git a/src/org/kde/kdeconnect/UserInterface/compose/TopAppBars.kt b/src/org/kde/kdeconnect/UserInterface/compose/TopAppBars.kt index 97a76194..6b68cbfa 100644 --- a/src/org/kde/kdeconnect/UserInterface/compose/TopAppBars.kt +++ b/src/org/kde/kdeconnect/UserInterface/compose/TopAppBars.kt @@ -11,8 +11,11 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.* import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.heading +import androidx.compose.ui.semantics.semantics import org.kde.kdeconnect_tp.R @OptIn(ExperimentalMaterial3Api::class) @@ -20,14 +23,20 @@ import org.kde.kdeconnect_tp.R fun KdeTopAppBar( title: String = stringResource(R.string.kde_connect), navIcon: ImageVector = Icons.Default.ArrowBack, + navIconDescription: String = "", navIconOnClick: () -> Unit, // = { onBackPressedDispatcher.onBackPressed() } actions: @Composable (RowScope.() -> Unit) = {}, ) { TopAppBar( navigationIcon = { - IconButton(onClick = navIconOnClick, content = { Icon(navIcon, null) }) + IconButton(onClick = navIconOnClick, content = { Icon(navIcon, navIconDescription) }) }, - title = { Text(title) }, + title = { Text(title, + // Commented for now because the MDC and androidx toolbars don't set this either + // https://github.com/material-components/material-components-android/issues/4073 + // https://github.com/androidx/androidx/blob/androidx-main/appcompat/appcompat/src/main/res/layout/abc_action_bar_title_item.xml + // modifier = Modifier.semantics { heading() } + ) }, actions = actions ) } \ No newline at end of file