Bug 720795 - Screen Orientation API reading and event implementation in Android. r=dougt
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIThreadManager.h"
|
||||
#include "mozilla/dom/sms/PSms.h"
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define ALOG_BRIDGE(args...) ALOG(args)
|
||||
@@ -173,6 +174,10 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
jEnableNetworkNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableNetworkNotifications", "()V");
|
||||
jDisableNetworkNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableNetworkNotifications", "()V");
|
||||
|
||||
jGetScreenOrientation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getScreenOrientation", "()S");
|
||||
jEnableScreenOrientationNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableScreenOrientationNotifications", "()V");
|
||||
jDisableScreenOrientationNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableScreenOrientationNotifications", "()V");
|
||||
|
||||
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
|
||||
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
|
||||
jEGLSurfaceImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLSurfaceImpl"));
|
||||
@@ -1959,3 +1964,24 @@ AndroidBridge::HideSurface(jobject surface)
|
||||
env->CallStaticVoidMethod(cls, method, surface);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::GetScreenOrientation(dom::ScreenOrientationWrapper& aOrientation)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::GetScreenOrientation");
|
||||
aOrientation.orientation = static_cast<dom::ScreenOrientation>(mJNIEnv->CallStaticShortMethod(mGeckoAppShellClass, jGetScreenOrientation));
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::EnableScreenOrientationNotifications()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::EnableScreenOrientationNotifications");
|
||||
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEnableScreenOrientationNotifications);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::DisableScreenOrientationNotifications()
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::DisableScreenOrientationNotifications");
|
||||
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jDisableScreenOrientationNotifications);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user