mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Fixing wrong accessibility focus when opening a floating view
> Using common logic for announcing a floating view for widgets and folders Bug: 79091095 Bug: 79748886 Change-Id: Ibb3fe48e68e724f50d69f51a03d3b35ad0baf625
This commit is contained in:
@@ -16,10 +16,18 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
|
||||
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
|
||||
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Pair;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -123,6 +131,25 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void announceAccessibilityChanges() {
|
||||
Pair<View, String> targetInfo = getAccessibilityTarget();
|
||||
if (targetInfo == null || !isAccessibilityEnabled(getContext())) {
|
||||
return;
|
||||
}
|
||||
sendCustomAccessibilityEvent(
|
||||
targetInfo.first, TYPE_WINDOW_STATE_CHANGED, targetInfo.second);
|
||||
|
||||
if (mIsOpen) {
|
||||
sendAccessibilityEvent(TYPE_VIEW_FOCUSED);
|
||||
}
|
||||
BaseDraggingActivity.fromContext(getContext()).getDragLayer()
|
||||
.sendAccessibilityEvent(TYPE_WINDOW_CONTENT_CHANGED);
|
||||
}
|
||||
|
||||
protected Pair<View, String> getAccessibilityTarget() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static <T extends AbstractFloatingView> T getOpenView(
|
||||
BaseDraggingActivity activity, @FloatingViewType int type) {
|
||||
BaseDragLayer dragLayer = activity.getDragLayer();
|
||||
|
||||
Reference in New Issue
Block a user