mirror of
https://gitee.com/shuto-github/phonegap-mobile-accessibility.git
synced 2026-01-28 00:00:08 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
435745aa91 | ||
|
|
3256a29085 | ||
|
|
e9af64bc44 | ||
|
|
3efce21dfd | ||
|
|
37a7d11251 | ||
|
|
b35a21f724 | ||
|
|
852cec5240 | ||
|
|
2fb3aa4c2b | ||
|
|
b8f90d3841 | ||
|
|
d0db5b05b5 | ||
|
|
c924261c26 |
21
README.md
21
README.md
@@ -1,23 +1,4 @@
|
||||
<!--
|
||||
The following copyright message should appear at the top of all
|
||||
source files. This file can be removed from your repository.
|
||||
|
||||
Copyright (c) 2013-2014 Adobe Systems Incorporated. All rights reserved.
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
|
||||
# com.phonegap.plugin.mobile-accessibility
|
||||
# phonegap-plugin-mobile-accessibility
|
||||
==========================================
|
||||
|
||||
This plugin exposes information on the status of various accessibility features of mobile operating systems, including, for example, whether a screen reader is running, invert colors is enabled, and the preferred scaling for text. It also allows an application to send a string to be spoken by the screen reader, or a command to stop the screen reader from speaking.
|
||||
|
||||
37
package.json
Normal file
37
package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "phonegap-plugin-mobile-accessibility",
|
||||
"description": "PhoneGap Mobile Accessibility Plugin",
|
||||
"version": "1.0.0",
|
||||
"homepage": "http://github.com/phonegap/phonegap-mobile-accessibility#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/phonegap/phonegap-mobile-accessibility.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/phonegap/phonegap-mobile-accessibility/issues"
|
||||
},
|
||||
"cordova": {
|
||||
"id": "phonegap-plugin-mobile-accessibility",
|
||||
"platforms": [
|
||||
"ios",
|
||||
"android",
|
||||
"windows"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"phonegap",
|
||||
"mobile accessibility",
|
||||
"ecosystem:cordova",
|
||||
"cordova-ios",
|
||||
"cordova-android",
|
||||
"cordova-windows"
|
||||
],
|
||||
"engines": [
|
||||
{
|
||||
"name": "cordova",
|
||||
"version": ">=3.0.0"
|
||||
}
|
||||
],
|
||||
"author": "Adobe PhoneGap Team",
|
||||
"license": "Apache 2.0"
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="com.phonegap.plugin.mobile-accessibility"
|
||||
version="0.1.2">
|
||||
id="phonegap-plugin-mobile-accessibility"
|
||||
version="1.0.0">
|
||||
<name>Mobile Accessibility</name>
|
||||
<description>PhoneGap Mobile Accessibility Plugin</description>
|
||||
<license>Apache 2.0</license>
|
||||
@@ -21,8 +20,8 @@
|
||||
<clobbers target="MobileAccessibilityNotifications" />
|
||||
</js-module>
|
||||
|
||||
<dependency id="org.apache.cordova.device" url="https://github.com/apache/cordova-plugin-device.git" />
|
||||
<dependency id="org.apache.cordova.network-information" url="https://github.com/apache/cordova-plugin-network-information.git" />
|
||||
<dependency id="cordova-plugin-device" url="https://github.com/apache/cordova-plugin-device.git" />
|
||||
<dependency id="cordova-plugin-network-information" url="https://github.com/apache/cordova-plugin-network-information.git" />
|
||||
|
||||
<!-- ios -->
|
||||
<platform name="ios">
|
||||
|
||||
@@ -38,7 +38,12 @@ public class DonutMobileAccessibilityHelper extends
|
||||
@Override
|
||||
public void initialize(MobileAccessibility mobileAccessibility) {
|
||||
mMobileAccessibility = mobileAccessibility;
|
||||
mWebView = mobileAccessibility.webView;
|
||||
try {
|
||||
mWebView = (WebView) mobileAccessibility.webView;
|
||||
} catch (ClassCastException ce) { // cordova-android 4.0+
|
||||
mWebView = (WebView) mobileAccessibility.webView.getView();
|
||||
}
|
||||
|
||||
mAccessibilityManager = (AccessibilityManager) mMobileAccessibility.cordova.getActivity().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.phonegap.plugin.mobileaccessibility.MobileAccessibility;
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.webkit.WebView;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public class JellyBeanMobileAccessibilityHelper extends
|
||||
@@ -33,8 +34,14 @@ public class JellyBeanMobileAccessibilityHelper extends
|
||||
|
||||
@Override
|
||||
public void initialize(MobileAccessibility mobileAccessibility) {
|
||||
WebView view;
|
||||
super.initialize(mobileAccessibility);
|
||||
mParent = mobileAccessibility.webView.getParentForAccessibility();
|
||||
try {
|
||||
view = (WebView) mobileAccessibility.webView;
|
||||
} catch (ClassCastException ce) { // cordova android 4.0+
|
||||
view = (WebView) mobileAccessibility.webView.getView();
|
||||
}
|
||||
mParent = view.getParentForAccessibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.os.Build;
|
||||
import android.webkit.WebView;
|
||||
|
||||
/**
|
||||
* This class provides information on the status of native accessibility services to JavaScript.
|
||||
@@ -132,9 +133,15 @@ public class MobileAccessibility extends CordovaPlugin {
|
||||
stop();
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
webView.reload();
|
||||
}
|
||||
});
|
||||
WebView view;
|
||||
try {
|
||||
view = (WebView) webView;
|
||||
} catch(ClassCastException ce) { // cordova-android 4.0+
|
||||
view = (WebView) webView.getView();
|
||||
}
|
||||
view.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
var argscheck = require('cordova/argscheck'),
|
||||
utils = require('cordova/utils'),
|
||||
exec = require('cordova/exec'),
|
||||
device = require('org.apache.cordova.device.device'),
|
||||
network = require('org.apache.cordova.network-information.network'),
|
||||
connection = require('org.apache.cordova.network-information.Connection'),
|
||||
MobileAccessibilityNotifications = require('com.phonegap.plugin.mobile-accessibility.MobileAccessibilityNotifications');
|
||||
device = require('cordova-plugin-device.device'),
|
||||
network = require('cordova-plugin-network-information.network'),
|
||||
connection = require('cordova-plugin-network-information.Connection'),
|
||||
MobileAccessibilityNotifications = require('phonegap-plugin-mobile-accessibility.MobileAccessibilityNotifications');
|
||||
|
||||
var MobileAccessibility = function() {
|
||||
this._isScreenReaderRunning = false;
|
||||
|
||||
Reference in New Issue
Block a user