Accessibility fixes for clipboard overlay
Add/fix content descriptions for content preview, share button and remote copy. Add labels for the overlay window and the edit activity. Reset timeout on hover so that a11y exploration keeps the UI up. Bug: 232485623 Bug: 232494683 Bug: 232487324 Test: Manual evaluation with talkback enabled. Change-Id: I995083a8b00f68d85d0a1c3f699a7f27a3c40aad
This commit is contained in:
@@ -788,6 +788,7 @@
|
||||
android:theme="@style/EditTextActivity"
|
||||
android:exported="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:label="@string/clipboard_editor"
|
||||
/>
|
||||
|
||||
<activity android:name=".controls.management.ControlsProviderSelectorActivity"
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
android:theme="@style/FloatingOverlay"
|
||||
android:alpha="0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/clipboard_overlay_window_name">
|
||||
<ImageView
|
||||
android:id="@+id/actions_container_background"
|
||||
android:visibility="gone"
|
||||
@@ -121,6 +122,7 @@
|
||||
android:id="@+id/image_preview"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/clipboard_image_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
|
||||
@@ -2507,6 +2507,14 @@
|
||||
<string name="clipboard_image_copied">Image copied</string>
|
||||
<!-- Accessibility announcement informing user that something has been copied [CHAR LIMIT=NONE] -->
|
||||
<string name="clipboard_content_copied">Content copied</string>
|
||||
<!-- Name of the screen that lets the user edit the context of the clipboard (copy/paste) [CHAR LIMIT=NONE] -->
|
||||
<string name="clipboard_editor">Clipboard Editor</string>
|
||||
<!-- Name for the window showing the clipboard (copy/paste) preview and controls [CHAR LIMIT=NONE] -->
|
||||
<string name="clipboard_overlay_window_name">Clipboard</string>
|
||||
<!-- Accessibility label for an image preview [CHAR LIMIT=NONE] -->
|
||||
<string name="clipboard_image_preview">Image preview</string>
|
||||
<!-- Accessibility string describing what will happen when the user selects the clipboard preview. Completing the sentence "Double tap to ..." [CHAR LIMIT=NONE] -->
|
||||
<string name="clipboard_edit">edit</string>
|
||||
|
||||
<!-- Generic "add" string [CHAR LIMIT=NONE] -->
|
||||
<string name="add">Add</string>
|
||||
|
||||
@@ -97,6 +97,9 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.internal.policy.PhoneWindow;
|
||||
import com.android.systemui.R;
|
||||
@@ -218,6 +221,7 @@ public class ClipboardOverlayController {
|
||||
mRemoteCopyChip.setAlpha(1);
|
||||
mDismissButton = requireNonNull(mView.findViewById(R.id.dismiss_button));
|
||||
|
||||
mShareChip.setContentDescription(mContext.getString(com.android.internal.R.string.share));
|
||||
mView.setCallbacks(new DraggableConstraintLayout.SwipeDismissCallbacks() {
|
||||
@Override
|
||||
public void onInteraction() {
|
||||
@@ -367,6 +371,8 @@ public class ClipboardOverlayController {
|
||||
PackageManager packageManager = mContext.getPackageManager();
|
||||
if (packageManager.resolveActivity(
|
||||
remoteCopyIntent, PackageManager.ResolveInfoFlags.of(0)) != null) {
|
||||
mRemoteCopyChip.setContentDescription(
|
||||
mContext.getString(R.string.clipboard_send_nearby_description));
|
||||
mRemoteCopyChip.setVisibility(View.VISIBLE);
|
||||
mRemoteCopyChip.setOnClickListener((v) -> {
|
||||
mUiEventLogger.log(CLIPBOARD_OVERLAY_REMOTE_COPY_TAPPED);
|
||||
@@ -581,6 +587,7 @@ public class ClipboardOverlayController {
|
||||
TextView textView = hidden ? mHiddenPreview : mTextPreview;
|
||||
showTextPreview(text, textView);
|
||||
View.OnClickListener listener = v -> editText();
|
||||
setAccessibilityActionToEdit(textView);
|
||||
if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
CLIPBOARD_OVERLAY_SHOW_EDIT_BUTTON, false)) {
|
||||
mEditChip.setVisibility(View.VISIBLE);
|
||||
@@ -602,6 +609,7 @@ public class ClipboardOverlayController {
|
||||
showSinglePreview(mHiddenPreview);
|
||||
if (isEditableImage) {
|
||||
mHiddenPreview.setOnClickListener(listener);
|
||||
setAccessibilityActionToEdit(mHiddenPreview);
|
||||
}
|
||||
} else if (isEditableImage) { // if the MIMEtype is image, try to load
|
||||
try {
|
||||
@@ -612,6 +620,7 @@ public class ClipboardOverlayController {
|
||||
showSinglePreview(mImagePreview);
|
||||
mImagePreview.setImageBitmap(thumbnail);
|
||||
mImagePreview.setOnClickListener(listener);
|
||||
setAccessibilityActionToEdit(mImagePreview);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Thumbnail loading failed", e);
|
||||
showTextPreview(
|
||||
@@ -635,6 +644,12 @@ public class ClipboardOverlayController {
|
||||
return isEditableImage;
|
||||
}
|
||||
|
||||
private void setAccessibilityActionToEdit(View view) {
|
||||
ViewCompat.replaceAccessibilityAction(view,
|
||||
AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK,
|
||||
mContext.getString(R.string.clipboard_edit), null);
|
||||
}
|
||||
|
||||
private Intent getRemoteCopyIntent(ClipData clipData) {
|
||||
Intent nearbyIntent = new Intent(REMOTE_COPY_ACTION);
|
||||
|
||||
|
||||
@@ -117,6 +117,14 @@ public class DraggableConstraintLayout extends ConstraintLayout
|
||||
mCallbacks = callbacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptHoverEvent(MotionEvent event) {
|
||||
if (mCallbacks != null) {
|
||||
mCallbacks.onInteraction();
|
||||
}
|
||||
return super.onInterceptHoverEvent(event);
|
||||
}
|
||||
|
||||
@Override // View
|
||||
protected void onFinishInflate() {
|
||||
mActionsContainer = findViewById(R.id.actions_container);
|
||||
|
||||
Reference in New Issue
Block a user