зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1042257 - Part 2: Listen when the user enables/disables accessibility. r=mfinkle
This commit is contained in:
Родитель
0b8faee779
Коммит
304b1ca8d3
|
@ -251,6 +251,19 @@ public class GeckoAccessibility {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setAccessibilityStateChangeListener(final Context context) {
|
||||
// The state change listener is only supported on API14+
|
||||
if (Versions.feature14Plus) {
|
||||
AccessibilityManager accessibilityManager =
|
||||
(AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
|
||||
public void onAccessibilityStateChanged(boolean enabled) {
|
||||
updateAccessibilitySettings(context);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void onLayerViewFocusChanged(LayerView layerview, boolean gainFocus) {
|
||||
if (sEnabled)
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Accessibility:Focus",
|
||||
|
|
|
@ -1911,8 +1911,12 @@ public abstract class GeckoApp
|
|||
refreshChrome();
|
||||
}
|
||||
|
||||
// User may have enabled/disabled accessibility.
|
||||
GeckoAccessibility.updateAccessibilitySettings(this);
|
||||
if (!Versions.feature14Plus) {
|
||||
// Update accessibility settings in case it has been changed by the
|
||||
// user. On API14+, this is handled in LayerView by registering an
|
||||
// accessibility state change listener.
|
||||
GeckoAccessibility.updateAccessibilitySettings(this);
|
||||
}
|
||||
|
||||
if (mAppStateListeners != null) {
|
||||
for (GeckoAppShell.AppStateListener listener: mAppStateListeners) {
|
||||
|
|
|
@ -138,6 +138,7 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
|
|||
setFocusableInTouchMode(true);
|
||||
|
||||
GeckoAccessibility.setDelegate(this);
|
||||
GeckoAccessibility.setAccessibilityStateChangeListener(getContext());
|
||||
}
|
||||
|
||||
private static Point getEventRadius(MotionEvent event) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче