summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-02-15 19:19:58 +0200
committerBogDan Vatra <bogdan@kdab.com>2016-02-24 17:19:38 +0000
commit3376e67abe3a1ae5b3293b9c71b51e477c026b83 (patch)
tree95358d9ede4447de1444bb6ba8c48b9aca0bc91b /src/corelib
parentc05f2985eb90c7e18dee99676f0a5da3239e30b9 (diff)
Perfect (almost) Qt on Android splash screen.
There is no need to show the splash image immediately when the application starts, because it will be removed shortly in QtActivityDelegate.java, therefore show the splash in QtActivityDelegate.java. This patch also adds a new option to AndroidManifest.xml which keeps the splash screen visible until user to decides to hide it, by using the QtAndroid::hideSplashScreen() function. Change-Id: I8a29a5a757d626c4c9d6a2748a60ca3091ebf82d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp8
-rw-r--r--src/corelib/kernel/qjnihelpers_p.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index f576ed0d1c..76f530ab9c 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -56,6 +56,7 @@ static jobject g_jClassLoader = Q_NULLPTR;
static jint g_androidSdkVersion = 0;
static jclass g_jNativeClass = Q_NULLPTR;
static jmethodID g_runPendingCppRunnablesMethodID = Q_NULLPTR;
+static jmethodID g_hideSplashScreenMethodID = Q_NULLPTR;
Q_GLOBAL_STATIC(std::deque<QtAndroidPrivate::Runnable>, g_pendingRunnables);
Q_GLOBAL_STATIC(QMutex, g_pendingRunnablesMutex);
@@ -338,7 +339,7 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
g_runPendingCppRunnablesMethodID = env->GetStaticMethodID(jQtNative,
"runPendingCppRunnablesOnUiThread",
"()V");
-
+ g_hideSplashScreenMethodID = env->GetStaticMethodID(jQtNative, "hideSplashScreen", "()V");
g_jNativeClass = static_cast<jclass>(env->NewGlobalRef(jQtNative));
env->DeleteLocalRef(jQtNative);
@@ -424,4 +425,9 @@ void QtAndroidPrivate::unregisterKeyEventListener(QtAndroidPrivate::KeyEventList
g_keyEventListeners()->listeners.removeOne(listener);
}
+void QtAndroidPrivate::hideSplashScreen(JNIEnv *env)
+{
+ env->CallStaticVoidMethod(g_jNativeClass, g_hideSplashScreenMethodID);
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qjnihelpers_p.h b/src/corelib/kernel/qjnihelpers_p.h
index 34bdbf6c80..78ad08a09e 100644
--- a/src/corelib/kernel/qjnihelpers_p.h
+++ b/src/corelib/kernel/qjnihelpers_p.h
@@ -127,6 +127,8 @@ namespace QtAndroidPrivate
Q_CORE_EXPORT void registerKeyEventListener(KeyEventListener *listener);
Q_CORE_EXPORT void unregisterKeyEventListener(KeyEventListener *listener);
+
+ Q_CORE_EXPORT void hideSplashScreen(JNIEnv *env);
}
QT_END_NAMESPACE