Adjust behavior of MobileAccessibility.updateTextZoom and MobileAccessibility.getTextZoom

Adjust behavior of MobileAccessibility.updateTextZoom and
MobileAccessibility.getTextZoom so they both return the correct updated
zoom value to a callback method.

Adjust behavior of isTalkBackRunning and isVoiceOverRunning so that
they return true only for the appropriate platform.
This commit is contained in:
Michael Jordan
2014-03-25 20:33:16 -04:00
parent 9bff312e85
commit 54efe1452c
8 changed files with 680 additions and 543 deletions
@@ -1,20 +1,41 @@
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.phonegap.plugin.mobileaccessibility;
import android.view.ViewParent;
public abstract class AbstractMobileAccessibilityHelper {
protected MobileAccessibility mMobileAccessibility;
protected ViewParent mParent;
public abstract void initialize(MobileAccessibility mobileAccessibility);
public abstract boolean isClosedCaptioningEnabled();
public abstract boolean isScreenReaderRunning();
public abstract boolean isTouchExplorationEnabled();
public abstract void onAccessibilityStateChanged(boolean enabled);
public abstract void onCaptioningEnabledChanged(boolean enabled);
public abstract void onTouchExplorationStateChanged(boolean enabled);
public abstract void addStateChangeListeners();
public abstract void removeStateChangeListeners();
public abstract void announceForAccessibility(CharSequence text);
public abstract int getTextZoom();
public abstract void setTextZoom(int textZoom);
protected MobileAccessibility mMobileAccessibility;
protected ViewParent mParent;
public abstract void initialize(MobileAccessibility mobileAccessibility);
public abstract boolean isClosedCaptioningEnabled();
public abstract boolean isScreenReaderRunning();
public abstract boolean isTouchExplorationEnabled();
public abstract void onAccessibilityStateChanged(boolean enabled);
public abstract void onCaptioningEnabledChanged(boolean enabled);
public abstract void onTouchExplorationStateChanged(boolean enabled);
public abstract void addStateChangeListeners();
public abstract void removeStateChangeListeners();
public abstract void announceForAccessibility(CharSequence text);
public abstract double getTextZoom();
public abstract void setTextZoom(double textZoom);
}
@@ -1,5 +1,25 @@
package com.phonegap.plugin.mobileaccessibility;
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.phonegap.plugin.mobileaccessibility;
import android.annotation.TargetApi;
import android.content.Context;
@@ -11,117 +31,117 @@ import android.webkit.WebView;
@TargetApi(Build.VERSION_CODES.DONUT)
public class DonutMobileAccessibilityHelper extends
AbstractMobileAccessibilityHelper {
protected AccessibilityManager mAccessibilityManager;
protected WebView mWebView;
@Override
public void initialize(MobileAccessibility mobileAccessibility) {
mMobileAccessibility = mobileAccessibility;
mWebView = mobileAccessibility.webView;
mAccessibilityManager = (AccessibilityManager) mMobileAccessibility.cordova.getActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
}
AbstractMobileAccessibilityHelper {
protected AccessibilityManager mAccessibilityManager;
protected WebView mWebView;
@Override
public boolean isClosedCaptioningEnabled() {
return false;
}
@Override
public boolean isScreenReaderRunning() {
return mAccessibilityManager.isEnabled();
}
@Override
public boolean isTouchExplorationEnabled() {
return false;
}
@Override
public void onAccessibilityStateChanged(boolean enabled) {
mMobileAccessibility.onAccessibilityStateChanged(enabled);
}
@Override
public void onCaptioningEnabledChanged(boolean enabled) {
mMobileAccessibility.onCaptioningEnabledChanged(enabled);
}
@Override
public void onTouchExplorationStateChanged(boolean enabled) {
mMobileAccessibility.onTouchExplorationStateChanged(enabled);
}
@Override
public void addStateChangeListeners() {
}
@Override
public void removeStateChangeListeners() {
}
@Override
public void announceForAccessibility(CharSequence text) {
if (!mAccessibilityManager.isEnabled()) {
return;
}
final int eventType = AccessibilityEvent.TYPE_VIEW_FOCUSED;
final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.getText().add(text);
event.setEnabled(mWebView.isEnabled());
event.setClassName(mWebView.getClass().getName());
event.setPackageName(mWebView.getContext().getPackageName());
event.setContentDescription(null);
mAccessibilityManager.sendAccessibilityEvent(event);
@Override
public void initialize(MobileAccessibility mobileAccessibility) {
mMobileAccessibility = mobileAccessibility;
mWebView = mobileAccessibility.webView;
mAccessibilityManager = (AccessibilityManager) mMobileAccessibility.cordova.getActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
}
@Override
public boolean isClosedCaptioningEnabled() {
return false;
}
@Override
public boolean isScreenReaderRunning() {
return mAccessibilityManager.isEnabled();
}
@Override
public boolean isTouchExplorationEnabled() {
return false;
}
@Override
public void onAccessibilityStateChanged(boolean enabled) {
mMobileAccessibility.onAccessibilityStateChanged(enabled);
}
@Override
public void onCaptioningEnabledChanged(boolean enabled) {
mMobileAccessibility.onCaptioningEnabledChanged(enabled);
}
@Override
public void onTouchExplorationStateChanged(boolean enabled) {
mMobileAccessibility.onTouchExplorationStateChanged(enabled);
}
@Override
public void addStateChangeListeners() {
}
@Override
public void removeStateChangeListeners() {
}
@Override
public void announceForAccessibility(CharSequence text) {
if (!mAccessibilityManager.isEnabled()) {
return;
}
final int eventType = AccessibilityEvent.TYPE_VIEW_FOCUSED;
final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.getText().add(text);
event.setEnabled(mWebView.isEnabled());
event.setClassName(mWebView.getClass().getName());
event.setPackageName(mWebView.getContext().getPackageName());
event.setContentDescription(null);
mAccessibilityManager.sendAccessibilityEvent(event);
}
@SuppressWarnings("deprecation")
@Override
public double getTextZoom() {
double zoom = 100;
WebSettings.TextSize wTextSize = mWebView.getSettings().getTextSize();
switch (wTextSize) {
case LARGEST:
zoom = 200;
break;
case LARGER:
zoom = 150;
break;
case NORMAL:
zoom = 100;
break;
case SMALLER:
zoom = 75;
break;
case SMALLEST:
zoom = 50;
break;
default:
zoom = 100;
break;
}
return zoom;
}
@SuppressWarnings("deprecation")
@Override
public void setTextZoom(double textZoom) {
final double zoom = textZoom;
WebSettings.TextSize wTextSize = WebSettings.TextSize.NORMAL;
if (zoom > 115) {
wTextSize = WebSettings.TextSize.LARGEST;
} else if (zoom > 100) {
wTextSize = WebSettings.TextSize.LARGER;
} else if (zoom == 100) {
wTextSize = WebSettings.TextSize.NORMAL;
} else if (zoom > 50) {
wTextSize = WebSettings.TextSize.SMALLER;
} else {
wTextSize = WebSettings.TextSize.SMALLEST;
}
//Log.i("MobileAccessibility", "fontScale = " + zoom + ", WebSettings.TextSize = " + wTextSize.toString());
mWebView.getSettings().setTextSize(wTextSize);
}
@SuppressWarnings("deprecation")
@Override
public int getTextZoom() {
int zoom = 100;
WebSettings.TextSize wTextSize = mWebView.getSettings().getTextSize();
switch (wTextSize) {
case LARGEST:
zoom = 200;
break;
case LARGER:
zoom = 150;
break;
case NORMAL:
zoom = 100;
break;
case SMALLER:
zoom = 75;
break;
case SMALLEST:
zoom = 50;
break;
default:
zoom = 100;
break;
}
return zoom;
}
@SuppressWarnings("deprecation")
@Override
public void setTextZoom(int textZoom) {
final int zoom = textZoom;
WebSettings.TextSize wTextSize = WebSettings.TextSize.NORMAL;
if (zoom > 115) {
wTextSize = WebSettings.TextSize.LARGEST;
} else if (zoom > 100) {
wTextSize = WebSettings.TextSize.LARGER;
} else if (zoom == 100) {
wTextSize = WebSettings.TextSize.NORMAL;
} else if (zoom > 50) {
wTextSize = WebSettings.TextSize.SMALLER;
} else {
wTextSize = WebSettings.TextSize.SMALLEST;
}
//Log.i("MobileAccessibility", "fontScale = " + zoom + ", WebSettings.TextSize = " + wTextSize.toString());
mWebView.getSettings().setTextSize(wTextSize);
}
}
@@ -1,3 +1,24 @@
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.phonegap.plugin.mobileaccessibility;
import android.accessibilityservice.AccessibilityServiceInfo;
@@ -7,46 +28,46 @@ import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeL
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class IceCreamSandwichMobileAccessibilityHelper extends
DonutMobileAccessibilityHelper {
protected AccessibilityStateChangeListener mAccessibilityStateChangeListener;
@Override
public boolean isScreenReaderRunning() {
return mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN).size() > 0;
}
@Override
public void addStateChangeListeners() {
if (mAccessibilityStateChangeListener == null) {
mAccessibilityStateChangeListener = new InternalAccessibilityStateChangeListener();
}
mAccessibilityManager.addAccessibilityStateChangeListener(mAccessibilityStateChangeListener);
}
@Override
public void removeStateChangeListeners() {
mAccessibilityManager.removeAccessibilityStateChangeListener(mAccessibilityStateChangeListener);
mAccessibilityStateChangeListener = null;
}
@Override
public int getTextZoom() {
return mWebView.getSettings().getTextZoom();
}
@Override
public void setTextZoom(int textZoom) {
final int zoom = textZoom;
//Log.i("MobileAccessibility", "setTextZoom(" + zoom + ")");
mWebView.getSettings().setTextZoom(zoom);
}
protected class InternalAccessibilityStateChangeListener
implements AccessibilityStateChangeListener {
@Override
public void onAccessibilityStateChanged(boolean enabled) {
mMobileAccessibility.onAccessibilityStateChanged(enabled);
}
}
DonutMobileAccessibilityHelper {
protected AccessibilityStateChangeListener mAccessibilityStateChangeListener;
@Override
public boolean isScreenReaderRunning() {
return mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN).size() > 0;
}
@Override
public void addStateChangeListeners() {
if (mAccessibilityStateChangeListener == null) {
mAccessibilityStateChangeListener = new InternalAccessibilityStateChangeListener();
}
mAccessibilityManager.addAccessibilityStateChangeListener(mAccessibilityStateChangeListener);
}
@Override
public void removeStateChangeListeners() {
mAccessibilityManager.removeAccessibilityStateChangeListener(mAccessibilityStateChangeListener);
mAccessibilityStateChangeListener = null;
}
@Override
public double getTextZoom() {
return mWebView.getSettings().getTextZoom();
}
@Override
public void setTextZoom(double textZoom) {
final double zoom = textZoom;
//Log.i("MobileAccessibility", "setTextZoom(" + zoom + ")");
mWebView.getSettings().setTextZoom((int) zoom);
}
protected class InternalAccessibilityStateChangeListener
implements AccessibilityStateChangeListener {
@Override
public void onAccessibilityStateChanged(boolean enabled) {
mMobileAccessibility.onAccessibilityStateChanged(enabled);
}
}
}
@@ -1,3 +1,24 @@
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.phonegap.plugin.mobileaccessibility;
import com.phonegap.plugin.mobileaccessibility.MobileAccessibility;
@@ -8,16 +29,16 @@ import android.view.accessibility.AccessibilityEvent;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public class JellyBeanMobileAccessibilityHelper extends
IceCreamSandwichMobileAccessibilityHelper {
@Override
public void initialize(MobileAccessibility mobileAccessibility) {
super.initialize(mobileAccessibility);
mParent = mobileAccessibility.webView.getParentForAccessibility();
}
@Override
public void announceForAccessibility(CharSequence text) {
IceCreamSandwichMobileAccessibilityHelper {
@Override
public void initialize(MobileAccessibility mobileAccessibility) {
super.initialize(mobileAccessibility);
mParent = mobileAccessibility.webView.getParentForAccessibility();
}
@Override
public void announceForAccessibility(CharSequence text) {
if (mAccessibilityManager.isEnabled() && mParent != null) {
AccessibilityEvent event = AccessibilityEvent.obtain(
AccessibilityEvent.TYPE_ANNOUNCEMENT);
@@ -1,3 +1,24 @@
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.phonegap.plugin.mobileaccessibility;
import android.accessibilityservice.AccessibilityServiceInfo;
@@ -9,71 +30,71 @@ import android.view.accessibility.CaptioningManager.CaptioningChangeListener;
@TargetApi(19)
public class KitKatMobileAccessibilityHelper extends
JellyBeanMobileAccessibilityHelper {
protected CaptioningManager mCaptioningManager;
protected CaptioningChangeListener mCaptioningChangeListener;
protected TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
@Override
public void initialize(MobileAccessibility mobileAccessibility) {
super.initialize(mobileAccessibility);
mCaptioningManager = (CaptioningManager) mobileAccessibility.cordova.getActivity().getSystemService(Context.CAPTIONING_SERVICE);
}
@Override
public boolean isScreenReaderRunning() {
return mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_BRAILLE | AccessibilityServiceInfo.FEEDBACK_SPOKEN).size() > 0;
}
JellyBeanMobileAccessibilityHelper {
protected CaptioningManager mCaptioningManager;
protected CaptioningChangeListener mCaptioningChangeListener;
protected TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
@Override
public boolean isClosedCaptioningEnabled() {
return mCaptioningManager.isEnabled();
}
@Override
public void initialize(MobileAccessibility mobileAccessibility) {
super.initialize(mobileAccessibility);
mCaptioningManager = (CaptioningManager) mobileAccessibility.cordova.getActivity().getSystemService(Context.CAPTIONING_SERVICE);
}
@Override
public boolean isTouchExplorationEnabled() {
return mAccessibilityManager.isTouchExplorationEnabled();
}
@Override
public void addStateChangeListeners() {
super.addStateChangeListeners();
if (mCaptioningChangeListener == null) {
mCaptioningChangeListener = new CaptioningChangeListener() {
/** @hide */
@Override
public void onEnabledChanged(boolean enabled) {
onCaptioningEnabledChanged(enabled);
}
};
}
mCaptioningManager.addCaptioningChangeListener(mCaptioningChangeListener);
if (mTouchExplorationStateChangeListener == null) {
mTouchExplorationStateChangeListener = new InternalTouchExplorationStateChangeListener();
}
mAccessibilityManager.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
}
@Override
public void removeStateChangeListeners() {
super.removeStateChangeListeners();
if (mCaptioningChangeListener != null) {
mCaptioningManager.removeCaptioningChangeListener(mCaptioningChangeListener);
mCaptioningChangeListener = null;
}
if (mTouchExplorationStateChangeListener != null) {
mAccessibilityManager.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
mTouchExplorationStateChangeListener = null;
}
}
protected class InternalTouchExplorationStateChangeListener
implements TouchExplorationStateChangeListener {
@Override
public void onTouchExplorationStateChanged(boolean enabled) {
mMobileAccessibility.onTouchExplorationStateChanged(enabled);
}
}
@Override
public boolean isScreenReaderRunning() {
return mAccessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_BRAILLE | AccessibilityServiceInfo.FEEDBACK_SPOKEN).size() > 0;
}
@Override
public boolean isClosedCaptioningEnabled() {
return mCaptioningManager.isEnabled();
}
@Override
public boolean isTouchExplorationEnabled() {
return mAccessibilityManager.isTouchExplorationEnabled();
}
@Override
public void addStateChangeListeners() {
super.addStateChangeListeners();
if (mCaptioningChangeListener == null) {
mCaptioningChangeListener = new CaptioningChangeListener() {
/** @hide */
@Override
public void onEnabledChanged(boolean enabled) {
onCaptioningEnabledChanged(enabled);
}
};
}
mCaptioningManager.addCaptioningChangeListener(mCaptioningChangeListener);
if (mTouchExplorationStateChangeListener == null) {
mTouchExplorationStateChangeListener = new InternalTouchExplorationStateChangeListener();
}
mAccessibilityManager.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
}
@Override
public void removeStateChangeListeners() {
super.removeStateChangeListeners();
if (mCaptioningChangeListener != null) {
mCaptioningManager.removeCaptioningChangeListener(mCaptioningChangeListener);
mCaptioningChangeListener = null;
}
if (mTouchExplorationStateChangeListener != null) {
mAccessibilityManager.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
mTouchExplorationStateChangeListener = null;
}
}
protected class InternalTouchExplorationStateChangeListener
implements TouchExplorationStateChangeListener {
@Override
public void onTouchExplorationStateChanged(boolean enabled) {
mMobileAccessibility.onTouchExplorationStateChanged(enabled);
}
}
}
@@ -1,3 +1,24 @@
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.phonegap.plugin.mobileaccessibility;
import org.apache.cordova.CallbackContext;
@@ -15,277 +36,277 @@ import android.os.Build;
* This class provides information on the status of native accessibility services to JavaScript.
*/
public class MobileAccessibility extends CordovaPlugin {
protected AbstractMobileAccessibilityHelper mMobileAccessibilityHelper;
protected CallbackContext mCallbackContext = null;
protected boolean mIsScreenReaderRunning = false;
protected boolean mClosedCaptioningEnabled = false;
protected boolean mTouchExplorationEnabled = false;
protected boolean mCachedIsScreenReaderRunning = false;
protected float mFontScale = 1;
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
protected AbstractMobileAccessibilityHelper mMobileAccessibilityHelper;
protected CallbackContext mCallbackContext = null;
protected boolean mIsScreenReaderRunning = false;
protected boolean mClosedCaptioningEnabled = false;
protected boolean mTouchExplorationEnabled = false;
protected boolean mCachedIsScreenReaderRunning = false;
protected float mFontScale = 1;
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mMobileAccessibilityHelper = new KitKatMobileAccessibilityHelper();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mMobileAccessibilityHelper = new JellyBeanMobileAccessibilityHelper();
mMobileAccessibilityHelper = new JellyBeanMobileAccessibilityHelper();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mMobileAccessibilityHelper = new IceCreamSandwichMobileAccessibilityHelper();
mMobileAccessibilityHelper = new IceCreamSandwichMobileAccessibilityHelper();
} else {
mMobileAccessibilityHelper = new DonutMobileAccessibilityHelper();
mMobileAccessibilityHelper = new DonutMobileAccessibilityHelper();
}
mMobileAccessibilityHelper.initialize(this);
}
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
try {
if (action.equals("isScreenReaderRunning")) {
isScreenReaderRunning(callbackContext);
return true;
} else if (action.equals("isClosedCaptioningEnabled")) {
isClosedCaptioningEnabled(callbackContext);
return true;
} else if (action.equals("isTouchExplorationEnabled")) {
isTouchExplorationEnabled(callbackContext);
return true;
} else if (action.equals("postNotification")) {
if (args.length() > 1) {
String string = args.getString(1);
if (!string.isEmpty()) {
announceForAccessibility(string, callbackContext);
}
}
return true;
} else if(action.equals("getTextZoom")) {
getTextZoom(callbackContext);
return true;
} else if(action.equals("setTextZoom")) {
if (args.length() > 0) {
int textZoom = args.getInt(0);
if (textZoom > 0) {
setTextZoom(textZoom, callbackContext);
}
}
return true;
} else if(action.equals("updateTextZoom")) {
updateTextZoom();
return true;
} else if (action.equals("start")) {
start(callbackContext);
return true;
} else if (action.equals("stop")) {
stop();
return true;
}
} catch (JSONException e) {
}
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
try {
if (action.equals("isScreenReaderRunning")) {
isScreenReaderRunning(callbackContext);
return true;
} else if (action.equals("isClosedCaptioningEnabled")) {
isClosedCaptioningEnabled(callbackContext);
return true;
} else if (action.equals("isTouchExplorationEnabled")) {
isTouchExplorationEnabled(callbackContext);
return true;
} else if (action.equals("postNotification")) {
if (args.length() > 1) {
String string = args.getString(1);
if (!string.isEmpty()) {
announceForAccessibility(string, callbackContext);
}
}
return true;
} else if(action.equals("getTextZoom")) {
getTextZoom(callbackContext);
return true;
} else if(action.equals("setTextZoom")) {
if (args.length() > 0) {
double textZoom = args.getDouble(0);
if (textZoom > 0) {
setTextZoom(textZoom, callbackContext);
}
}
return true;
} else if(action.equals("updateTextZoom")) {
updateTextZoom(callbackContext);
return true;
} else if (action.equals("start")) {
start(callbackContext);
return true;
} else if (action.equals("stop")) {
stop();
return true;
}
} catch (JSONException e) {
e.printStackTrace();
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
}
return false;
}
/**
/**
* Called when the system is about to pause the current activity
*
* @param multitasking Flag indicating if multitasking is turned on for app
* @param multitasking Flag indicating if multitasking is turned on for app
*/
@Override
@Override
public void onPause(boolean multitasking) {
//Log.i("MobileAccessibility", "onPause");
mCachedIsScreenReaderRunning = mIsScreenReaderRunning;
//Log.i("MobileAccessibility", "onPause");
mCachedIsScreenReaderRunning = mIsScreenReaderRunning;
}
/**
* Called when the activity will start interacting with the user.
*
* @param multitasking Flag indicating if multitasking is turned on for app
* @param multitasking Flag indicating if multitasking is turned on for app
*/
@Override
@Override
public void onResume(boolean multitasking) {
//Log.i("MobileAccessibility", "onResume");
if (mIsScreenReaderRunning && !mCachedIsScreenReaderRunning) {
//Log.i("MobileAccessibility", "Reloading page on reload because the Accessibility State has changed.");
mCachedIsScreenReaderRunning = mIsScreenReaderRunning;
stop();
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
webView.reload();
}
});
}
//Log.i("MobileAccessibility", "onResume");
if (mIsScreenReaderRunning && !mCachedIsScreenReaderRunning) {
//Log.i("MobileAccessibility", "Reloading page on reload because the Accessibility State has changed.");
mCachedIsScreenReaderRunning = mIsScreenReaderRunning;
stop();
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
webView.reload();
}
});
}
}
/**
* The final call you receive before your activity is destroyed.
*/
public void onDestroy() {
stop();
stop();
}
protected boolean isScreenReaderRunning(final CallbackContext callbackContext) {
mIsScreenReaderRunning = mMobileAccessibilityHelper.isScreenReaderRunning();
cordova.getThreadPool().execute(new Runnable() {
public void run() {
callbackContext.success(mIsScreenReaderRunning ? 1 : 0);
}
});
return mIsScreenReaderRunning;
}
protected boolean isScreenReaderRunning() {
mIsScreenReaderRunning = mMobileAccessibilityHelper.isScreenReaderRunning();
return mIsScreenReaderRunning;
}
protected boolean isClosedCaptioningEnabled(final CallbackContext callbackContext) {
mClosedCaptioningEnabled = mMobileAccessibilityHelper.isClosedCaptioningEnabled();
cordova.getThreadPool().execute(new Runnable() {
public void run() {
callbackContext.success(mClosedCaptioningEnabled ? 1 : 0);
}
});
return mClosedCaptioningEnabled;
}
protected boolean isClosedCaptioningEnabled() {
mClosedCaptioningEnabled = mMobileAccessibilityHelper.isClosedCaptioningEnabled();
return mClosedCaptioningEnabled;
}
protected boolean isTouchExplorationEnabled(final CallbackContext callbackContext) {
mTouchExplorationEnabled= mMobileAccessibilityHelper.isTouchExplorationEnabled();
cordova.getThreadPool().execute(new Runnable() {
public void run() {
callbackContext.success(mTouchExplorationEnabled ? 1 : 0);
}
});
return mTouchExplorationEnabled;
}
protected boolean isTouchExplorationEnabled() {
mTouchExplorationEnabled = mMobileAccessibilityHelper.isTouchExplorationEnabled();
return mTouchExplorationEnabled;
}
protected void announceForAccessibility(CharSequence text, final CallbackContext callbackContext) {
mMobileAccessibilityHelper.announceForAccessibility(text);
if (callbackContext != null) {
JSONObject info = new JSONObject();
try {
info.put("stringValue", text);
info.put("wasSuccessful", mIsScreenReaderRunning);
} catch (JSONException e) {
e.printStackTrace();
}
callbackContext.success(info);
}
}
public void onAccessibilityStateChanged(boolean enabled) {
mIsScreenReaderRunning = enabled;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
sendMobileAccessibilityStatusChangedCallback();
}
});
}
public void onCaptioningEnabledChanged(boolean enabled) {
mClosedCaptioningEnabled = enabled;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
sendMobileAccessibilityStatusChangedCallback();
}
});
}
public void onTouchExplorationStateChanged(boolean enabled) {
mTouchExplorationEnabled = enabled;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
sendMobileAccessibilityStatusChangedCallback();
}
});
}
public void getTextZoom(final CallbackContext callbackContext) {
cordova.getActivity().runOnUiThread(new Runnable() {
protected boolean isScreenReaderRunning(final CallbackContext callbackContext) {
mIsScreenReaderRunning = mMobileAccessibilityHelper.isScreenReaderRunning();
cordova.getThreadPool().execute(new Runnable() {
public void run() {
final int textZoom = mMobileAccessibilityHelper.getTextZoom();
if (callbackContext != null) {
callbackContext.success(textZoom);
}
callbackContext.success(mIsScreenReaderRunning ? 1 : 0);
}
});
return mIsScreenReaderRunning;
}
protected boolean isScreenReaderRunning() {
mIsScreenReaderRunning = mMobileAccessibilityHelper.isScreenReaderRunning();
return mIsScreenReaderRunning;
}
protected boolean isClosedCaptioningEnabled(final CallbackContext callbackContext) {
mClosedCaptioningEnabled = mMobileAccessibilityHelper.isClosedCaptioningEnabled();
cordova.getThreadPool().execute(new Runnable() {
public void run() {
callbackContext.success(mClosedCaptioningEnabled ? 1 : 0);
}
});
}
public void setTextZoom(final int textZoom, final CallbackContext callbackContext) {
cordova.getActivity().runOnUiThread(new Runnable() {
return mClosedCaptioningEnabled;
}
protected boolean isClosedCaptioningEnabled() {
mClosedCaptioningEnabled = mMobileAccessibilityHelper.isClosedCaptioningEnabled();
return mClosedCaptioningEnabled;
}
protected boolean isTouchExplorationEnabled(final CallbackContext callbackContext) {
mTouchExplorationEnabled= mMobileAccessibilityHelper.isTouchExplorationEnabled();
cordova.getThreadPool().execute(new Runnable() {
public void run() {
mMobileAccessibilityHelper.setTextZoom(textZoom);
if (callbackContext != null) {
callbackContext.success(mMobileAccessibilityHelper.getTextZoom());
};
callbackContext.success(mTouchExplorationEnabled ? 1 : 0);
}
});
}
public void setTextZoom(final int textZoom) {
cordova.getActivity().runOnUiThread(new Runnable() {
return mTouchExplorationEnabled;
}
protected boolean isTouchExplorationEnabled() {
mTouchExplorationEnabled = mMobileAccessibilityHelper.isTouchExplorationEnabled();
return mTouchExplorationEnabled;
}
protected void announceForAccessibility(CharSequence text, final CallbackContext callbackContext) {
mMobileAccessibilityHelper.announceForAccessibility(text);
if (callbackContext != null) {
JSONObject info = new JSONObject();
try {
info.put("stringValue", text);
info.put("wasSuccessful", mIsScreenReaderRunning);
} catch (JSONException e) {
e.printStackTrace();
}
callbackContext.success(info);
}
}
public void onAccessibilityStateChanged(boolean enabled) {
mIsScreenReaderRunning = enabled;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
mMobileAccessibilityHelper.setTextZoom(textZoom);
sendMobileAccessibilityStatusChangedCallback();
}
});
}
public void onCaptioningEnabledChanged(boolean enabled) {
mClosedCaptioningEnabled = enabled;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
sendMobileAccessibilityStatusChangedCallback();
}
});
}
public void onTouchExplorationStateChanged(boolean enabled) {
mTouchExplorationEnabled = enabled;
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
sendMobileAccessibilityStatusChangedCallback();
}
});
}
public void getTextZoom(final CallbackContext callbackContext) {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
final double textZoom = mMobileAccessibilityHelper.getTextZoom();
if (callbackContext != null) {
callbackContext.success((int) textZoom);
}
}
});
}
public void updateTextZoom() {
float fontScale = cordova.getActivity().getResources().getConfiguration().fontScale;
if (fontScale != mFontScale) {
mFontScale = fontScale;
}
int textZoom = Math.round(mFontScale * 100);
setTextZoom(textZoom);
}
protected void sendMobileAccessibilityStatusChangedCallback() {
if (this.mCallbackContext != null) {
PluginResult result = new PluginResult(PluginResult.Status.OK, getMobileAccessibilityStatus());
result.setKeepCallback(true);
this.mCallbackContext.sendPluginResult(result);
}
}
/* Get the current mobile accessibility status. */
protected JSONObject getMobileAccessibilityStatus() {
JSONObject status = new JSONObject();
try {
status.put("isScreenReaderRunning", mIsScreenReaderRunning);
status.put("isClosedCaptioningEnabled", mClosedCaptioningEnabled);
status.put("isTouchExplorationEnabled", mTouchExplorationEnabled);
//Log.i("MobileAccessibility", "MobileAccessibility.isScreenReaderRunning == " + status.getString("isScreenReaderRunning") +
// "\nMobileAccessibility.isClosedCaptioningEnabled == " + status.getString("isClosedCaptioningEnabled") +
// "\nMobileAccessibility.isTouchExplorationEnabled == " + status.getString("isTouchExplorationEnabled") );
} catch (JSONException e) {
e.printStackTrace();
}
return status;
}
protected void start(CallbackContext callbackContext) {
//Log.i("MobileAccessibility", "MobileAccessibility.start");
mCallbackContext = callbackContext;
mMobileAccessibilityHelper.addStateChangeListeners();
sendMobileAccessibilityStatusChangedCallback();
}
protected void stop() {
//Log.i("MobileAccessibility", "MobileAccessibility.stop");
if (mCallbackContext != null) {
sendMobileAccessibilityStatusChangedCallback();
mMobileAccessibilityHelper.removeStateChangeListeners();
mCallbackContext = null;
}
}
}
}
public void setTextZoom(final double textZoom, final CallbackContext callbackContext) {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
mMobileAccessibilityHelper.setTextZoom(textZoom);
if (callbackContext != null) {
callbackContext.success((int) mMobileAccessibilityHelper.getTextZoom());
};
}
});
}
public void setTextZoom(final double textZoom) {
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
mMobileAccessibilityHelper.setTextZoom(textZoom);
}
});
}
public void updateTextZoom(final CallbackContext callbackContext) {
float fontScale = cordova.getActivity().getResources().getConfiguration().fontScale;
if (fontScale != mFontScale) {
mFontScale = fontScale;
}
final double textZoom = Math.round(mFontScale * 100);
setTextZoom(textZoom, callbackContext);
}
protected void sendMobileAccessibilityStatusChangedCallback() {
if (this.mCallbackContext != null) {
PluginResult result = new PluginResult(PluginResult.Status.OK, getMobileAccessibilityStatus());
result.setKeepCallback(true);
this.mCallbackContext.sendPluginResult(result);
}
}
/* Get the current mobile accessibility status. */
protected JSONObject getMobileAccessibilityStatus() {
JSONObject status = new JSONObject();
try {
status.put("isScreenReaderRunning", mIsScreenReaderRunning);
status.put("isClosedCaptioningEnabled", mClosedCaptioningEnabled);
status.put("isTouchExplorationEnabled", mTouchExplorationEnabled);
//Log.i("MobileAccessibility", "MobileAccessibility.isScreenReaderRunning == " + status.getString("isScreenReaderRunning") +
// "\nMobileAccessibility.isClosedCaptioningEnabled == " + status.getString("isClosedCaptioningEnabled") +
// "\nMobileAccessibility.isTouchExplorationEnabled == " + status.getString("isTouchExplorationEnabled") );
} catch (JSONException e) {
e.printStackTrace();
}
return status;
}
protected void start(CallbackContext callbackContext) {
//Log.i("MobileAccessibility", "MobileAccessibility.start");
mCallbackContext = callbackContext;
mMobileAccessibilityHelper.addStateChangeListeners();
sendMobileAccessibilityStatusChangedCallback();
}
protected void stop() {
//Log.i("MobileAccessibility", "MobileAccessibility.stop");
if (mCallbackContext != null) {
sendMobileAccessibilityStatusChangedCallback();
mMobileAccessibilityHelper.removeStateChangeListeners();
mCallbackContext = null;
}
}
}
+21 -19
View File
@@ -1,21 +1,23 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#import <Cordova/CDVPlugin.h>
@@ -38,7 +40,7 @@ static const int BASE_UI_FONT_TEXT_STYLE_BODY_POINT_SIZE = 16;
@property BOOL guidedAccessEnabled;
@property BOOL invertColorsEnabled;
@property BOOL monoAudioEnabled;
@property float mFontScale;
@property double mFontScale;
- (void) isScreenReaderRunning:(CDVInvokedUrlCommand*)command;
+57 -47
View File
@@ -1,21 +1,23 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#import "CDVMobileAccessibility.h"
#import <Cordova/CDVAvailability.h>
@@ -23,8 +25,8 @@
@interface CDVMobileAccessibility ()
// add any property overrides
-(int) mGetTextZoom;
-(void) mSetTextZoom:(int)zoom;
-(double) mGetTextZoom;
-(void) mSetTextZoom:(double)zoom;
@end
@implementation CDVMobileAccessibility
@@ -57,12 +59,12 @@
if ([self settingForKey:setting]) {
// set your setting, other init here
}
mFontScale = 1;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
}
// //////////////////////////////////////////////////
@@ -147,37 +149,37 @@
}];
}
-(float) mGetFontScale
-(double) mGetFontScale
{
float fontScale = 1;
double fontScale = 1;
if (iOS7Delta) {
fontScale = [[UIFont preferredFontForTextStyle:UIFontTextStyleBody] pointSize] / BASE_UI_FONT_TEXT_STYLE_BODY_POINT_SIZE;
}
return fontScale;
}
-(int) mGetTextZoom
-(double) mGetTextZoom
{
int zoom = round(mFontScale * 100);
// NSLog(@"mGetTextZoom %d%%'", zoom);
double zoom = round(mFontScale * 100);
// NSLog(@"mGetTextZoom %f%%", zoom);
return zoom;
}
- (void) getTextZoom:(CDVInvokedUrlCommand *)command
{
int zoom = [self mGetTextZoom];
double zoom = [self mGetTextZoom];
[self.commandDelegate runInBackground:^{
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt: zoom];
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble: zoom];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}];
}
-(void) mSetTextZoom:(int)zoom
-(void) mSetTextZoom:(double)zoom
{
// NSLog(@"mSetTextZoom %d%%'", zoom);
// NSLog(@"mSetTextZoom %f%%'", zoom);
mFontScale = zoom/100;
if (iOS7Delta) {
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'", zoom];
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%f%%'", zoom];
[[self webView] stringByEvaluatingJavaScriptFromString:jsString];
}
}
@@ -185,11 +187,11 @@
- (void) setTextZoom:(CDVInvokedUrlCommand *)command
{
if (command != nil && [command.arguments count] > 0) {
int zoom = [[command.arguments objectAtIndex:0] intValue];
double zoom = [[command.arguments objectAtIndex:0] doubleValue];
[self mSetTextZoom:zoom];
[self.commandDelegate runInBackground:^{
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:zoom];
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:zoom];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}];
}
@@ -201,8 +203,16 @@
if (fontScale != mFontScale) {
mFontScale = fontScale;
}
// NSLog(@"updateTextZoom %d%%'", [self mGetTextZoom]);
[self mSetTextZoom:[self mGetTextZoom]];
double zoom = [self mGetTextZoom];
// NSLog(@"updateTextZoom %d%%'", zoom);
[self mSetTextZoom:zoom];
if (command != nil && command.callbackId != nil) {
[self.commandDelegate runInBackground:^{
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:zoom];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
}];
}
}
@@ -211,11 +221,11 @@
CDVPluginResult* result = nil;
uint32_t notificationType = [[command.arguments objectAtIndex:0] intValue];
NSString* notificationString = [command.arguments count] > 1 ? [command.arguments objectAtIndex:1] : @"";
if (notificationString == nil) {
notificationString = @"";
}
if (UIAccessibilityIsVoiceOverRunning() &&
[self isValidNotificationType:notificationType]) {
[self.commandDelegate runInBackground:^{
@@ -223,9 +233,9 @@
self.commandCallbackId = command.callbackId;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityAnnouncementDidFinish:) name:UIAccessibilityAnnouncementDidFinishNotification object:nil];
}
UIAccessibilityPostNotification(notificationType, notificationString);
if (notificationType != UIAccessibilityAnnouncementNotification) {
NSMutableDictionary* data = [NSMutableDictionary dictionaryWithCapacity:2];
[data setObject:notificationString forKey:@"stringValue"];
@@ -251,14 +261,14 @@
- (void)mobileAccessibilityAnnouncementDidFinish:(NSNotification *)dict
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityAnnouncementDidFinishNotification object:nil];
NSString* valueSpoken = [[dict userInfo] objectForKey:UIAccessibilityAnnouncementKeyStringValue];
NSString* wasSuccessful = [[dict userInfo] objectForKey:UIAccessibilityAnnouncementKeyWasSuccessful];
NSMutableDictionary* data = [NSMutableDictionary dictionaryWithCapacity:2];
[data setObject:valueSpoken forKey:@"stringValue"];
[data setObject:wasSuccessful forKey:@"wasSuccessful"];
if (self.commandCallbackId) {
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:data];
[self.commandDelegate sendPluginResult:result callbackId:self.commandCallbackId];
@@ -299,7 +309,7 @@
self.guidedAccessEnabled = UIAccessibilityIsGuidedAccessEnabled();
self.invertColorsEnabled = UIAccessibilityIsInvertColorsEnabled();
self.monoAudioEnabled = UIAccessibilityIsMonoAudioEnabled();
NSMutableDictionary* mobileAccessibilityData = [NSMutableDictionary dictionaryWithCapacity:5];
[mobileAccessibilityData setObject:[NSNumber numberWithBool:self.voiceOverRunning] forKey:@"isScreenReaderRunning"];
[mobileAccessibilityData setObject:[NSNumber numberWithBool:self.closedCaptioningEnabled] forKey:@"isClosedCaptioningEnabled"];
@@ -320,7 +330,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityGuidedAccessStatusDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityInvertColorsStatusDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityMonoAudioStatusDidChangeNotification object:nil];
// Update the callback on start
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self getMobileAccessibilityStatus]];
[result setKeepCallbackAsBool:YES];