зеркало из https://github.com/mozilla/pjs.git
Bug 739493 - Add "Accessibility:Event" message for Android
This commit is contained in:
Родитель
c97278a127
Коммит
acb7151a76
|
@ -1016,6 +1016,25 @@ abstract public class GeckoApp
|
|||
});
|
||||
}
|
||||
});
|
||||
} else if (event.equals("Accessibility:Event")) {
|
||||
final int eventType = message.getInt("eventType");
|
||||
|
||||
final JSONArray text = message.getJSONArray("text");
|
||||
final int len = text.length();
|
||||
final String[] textList = new String[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
textList[i] = text.getString(i);
|
||||
|
||||
final String description = message.optString("description");
|
||||
final boolean enabled = message.optBoolean("enabled", true);
|
||||
final boolean checked = message.optBoolean("checked");
|
||||
final boolean password = message.optBoolean("password");
|
||||
mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
GeckoAppShell.emitGeckoAccessibilityEvent(eventType, textList, description,
|
||||
enabled, checked, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
|
||||
|
@ -1731,6 +1750,7 @@ abstract public class GeckoApp
|
|||
GeckoAppShell.registerGeckoEventListener("Tab:HasTouchListener", GeckoApp.mAppContext);
|
||||
GeckoAppShell.registerGeckoEventListener("Session:StatePurged", GeckoApp.mAppContext);
|
||||
GeckoAppShell.registerGeckoEventListener("Bookmark:Insert", GeckoApp.mAppContext);
|
||||
GeckoAppShell.registerGeckoEventListener("Accessibility:Event", GeckoApp.mAppContext);
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
SmsManager.getInstance().start();
|
||||
|
|
|
@ -184,7 +184,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
|||
jGetCurrentNetworkInformation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getCurrentNetworkInformation", "()[D");
|
||||
jEnableNetworkNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableNetworkNotifications", "()V");
|
||||
jDisableNetworkNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableNetworkNotifications", "()V");
|
||||
jEmitGeckoAccessibilityEvent = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "emitGeckoAccessibilityEvent", "(I[Ljava/lang/String;Ljava/lang/String;ZZZ)V");
|
||||
|
||||
jGetScreenOrientation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getScreenOrientation", "()S");
|
||||
jEnableScreenOrientationNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableScreenOrientationNotifications", "()V");
|
||||
|
@ -1577,19 +1576,6 @@ AndroidBridge::MarkURIVisited(const nsAString& aURI)
|
|||
env->CallStaticVoidMethod(mGeckoAppShellClass, jMarkUriVisited, jstrURI);
|
||||
}
|
||||
|
||||
void AndroidBridge::EmitGeckoAccessibilityEvent (PRInt32 eventType, const nsTArray<nsString>& text, const nsAString& description, bool enabled, bool checked, bool password) {
|
||||
AutoLocalJNIFrame jniFrame;
|
||||
jobjectArray jarrayText = mJNIEnv->NewObjectArray(text.Length(),
|
||||
jStringClass, 0);
|
||||
for (PRUint32 i = 0; i < text.Length() ; i++) {
|
||||
jstring jstrText = mJNIEnv->NewString(nsPromiseFlatString(text[i]).get(),
|
||||
text[i].Length());
|
||||
mJNIEnv->SetObjectArrayElement(jarrayText, i, jstrText);
|
||||
}
|
||||
jstring jstrDescription = mJNIEnv->NewString(nsPromiseFlatString(description).get(), description.Length());
|
||||
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEmitGeckoAccessibilityEvent, eventType, jarrayText, jstrDescription, enabled, checked, password);
|
||||
}
|
||||
|
||||
PRUint16
|
||||
AndroidBridge::GetNumberOfMessagesForText(const nsAString& aText)
|
||||
{
|
||||
|
|
|
@ -389,8 +389,6 @@ public:
|
|||
|
||||
nsCOMPtr<nsIAndroidDrawMetadataProvider> GetDrawMetadataProvider();
|
||||
|
||||
void EmitGeckoAccessibilityEvent (PRInt32 eventType, const nsTArray<nsString>& text, const nsAString& description, bool enabled, bool checked, bool password);
|
||||
|
||||
void CheckURIVisited(const nsAString& uri);
|
||||
void MarkURIVisited(const nsAString& uri);
|
||||
|
||||
|
@ -527,7 +525,6 @@ protected:
|
|||
jmethodID jHandleGeckoMessage;
|
||||
jmethodID jCheckUriVisited;
|
||||
jmethodID jMarkUriVisited;
|
||||
jmethodID jEmitGeckoAccessibilityEvent;
|
||||
jmethodID jRemovePluginView;
|
||||
|
||||
jmethodID jNumberOfMessages;
|
||||
|
|
Загрузка…
Ссылка в новой задаче