mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): api17 crash on a11y service (#9792)
This commit is contained in:
committed by
Nathan Walker
parent
3140b9c8fe
commit
2efcdf5787
@@ -71,19 +71,20 @@ function ensureStateListener(): SharedA11YObservable {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
touchExplorationStateChangeListener = new android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener({
|
|
||||||
onTouchExplorationStateChanged(enabled) {
|
|
||||||
updateAccessibilityState();
|
|
||||||
|
|
||||||
if (Trace.isEnabled()) {
|
|
||||||
Trace.write(`TouchExplorationStateChangeListener state changed to: ${!!enabled}`, Trace.categories.Accessibility);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
accessibilityManager.addAccessibilityStateChangeListener(accessibilityStateChangeListener);
|
accessibilityManager.addAccessibilityStateChangeListener(accessibilityStateChangeListener);
|
||||||
accessibilityManager.addTouchExplorationStateChangeListener(touchExplorationStateChangeListener);
|
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||||
|
touchExplorationStateChangeListener = new android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener({
|
||||||
|
onTouchExplorationStateChanged(enabled) {
|
||||||
|
updateAccessibilityState();
|
||||||
|
|
||||||
|
if (Trace.isEnabled()) {
|
||||||
|
Trace.write(`TouchExplorationStateChangeListener state changed to: ${!!enabled}`, Trace.categories.Accessibility);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
accessibilityManager.addTouchExplorationStateChangeListener(touchExplorationStateChangeListener);
|
||||||
|
}
|
||||||
|
|
||||||
updateAccessibilityState();
|
updateAccessibilityState();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user