From 59569fd0202c52a16860fba5634e743286a19fd2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 31 Oct 2013 16:14:54 +0100 Subject: Android: Differ between ShowMaximized and ShowFullScreen The default is now ShowMaximized which behaves as it did before, i.e. each window will fill the screen but the status bar will be visible. Calling showFullScreen() explicitly will now hide the status bar to maximize the amount of screen real estate occupied by the application. Task-number: QTBUG-33135 Change-Id: If0d0a2ab72f8026e76818290e2b953dbc0dec156 Reviewed-by: BogDan Vatra --- .../platforms/android/src/androidjnimain.cpp | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/plugins/platforms/android/src/androidjnimain.cpp') diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index 8b29a895b1..9ce79f445a 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -97,6 +97,9 @@ static jmethodID m_createBitmapMethodID = 0; static jobject m_ARGB_8888_BitmapConfigValue = 0; static jobject m_RGB_565_BitmapConfigValue = 0; +jmethodID m_setFullScreenMethodID = 0; +static bool m_statusBarShowing = true; + static jclass m_bitmapDrawableClass = 0; static jmethodID m_bitmapDrawableConstructorMethodID = 0; @@ -310,6 +313,36 @@ namespace QtAndroid return m_activityObject; } + void showStatusBar() + { + if (m_statusBarShowing) + return; + + QtAndroid::AttachedJNIEnv env; + if (env.jniEnv == 0) { + qWarning("Failed to get JNI Environment."); + return; + } + + env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, false); + m_statusBarShowing = true; + } + + void hideStatusBar() + { + if (!m_statusBarShowing) + return; + + QtAndroid::AttachedJNIEnv env; + if (env.jniEnv == 0) { + qWarning("Failed to get JNI Environment."); + return; + } + + env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, true); + m_statusBarShowing = false; + } + void setApplicationActive() { if (m_activityActive) @@ -753,6 +786,7 @@ static int registerNatives(JNIEnv *env) jclass clazz; FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative"); m_applicationClass = static_cast(env->NewGlobalRef(clazz)); + GET_AND_CHECK_STATIC_METHOD(m_setFullScreenMethodID, m_applicationClass, "setFullScreen", "(Z)V"); if (env->RegisterNatives(m_applicationClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) { __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed"); -- cgit v1.2.3