summaryrefslogtreecommitdiffstats
path: root/src/android/java
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-03-17 17:52:34 +0200
committerBogDan Vatra <bogdan@kdab.com>2016-03-22 09:14:14 +0000
commita3269e18012129bab69d9744147f48025f42ddf1 (patch)
tree6ed2c8b0926c0b2036a0cbaecdb81d808d4d2f18 /src/android/java
parente4d79e1fdeb6b26ba0b12b578daacf7cd672b960 (diff)
Allow the user to choose how much from Android theme is extracted
This way Quick Controls 2 users will have a much faster start up and the extraction time is reduced x10. [ChangeLog][Android] Allow the user to choose how much from Android theme is extracted. Change-Id: I063086251880d50d7fdd72ee35536c4094b47f74 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/android/java')
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
index 0963220b0d..3efdbf7a7c 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
@@ -90,6 +90,7 @@ public abstract class QtLoader {
public static final String STATIC_INIT_CLASSES_KEY = "static.init.classes";
public static final String NECESSITAS_API_LEVEL_KEY = "necessitas.api.level";
public static final String EXTRACT_STYLE_KEY = "extract.android.style";
+ private static final String EXTRACT_STYLE_MINIMAL_KEY = "extract.android.style.option";
/// Ministro server parameter keys
public static final String REQUIRED_MODULES_KEY = "required.modules";
@@ -111,12 +112,11 @@ public abstract class QtLoader {
// and must be separated with "\t"
// e.g "-param1\t-param2=value2\t-param3\tvalue3"
- public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\tQT_USE_ANDROID_NATIVE_DIALOGS=1\t";
+ public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_DIALOGS=1";
// use this variable to add any environment variables to your application.
// the env vars must be separated with "\t"
// e.g. "ENV_VAR1=1\tENV_VAR2=2\t"
// Currently the following vars are used by the android plugin:
- // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available.
// * QT_USE_ANDROID_NATIVE_DIALOGS -1 to use the android native dialogs.
public String[] QT_ANDROID_THEMES = null; // A list with all themes that your application want to use.
@@ -593,8 +593,22 @@ public abstract class QtLoader {
String themePath = m_context.getApplicationInfo().dataDir + "/qt-reserved-files/android-style/";
String stylePath = themePath + m_displayDensity + "/";
- if (!(new File(stylePath)).exists())
+
+ String extractOption = "full";
+ if (m_contextInfo.metaData.containsKey("android.app.extract_android_style")) {
+ extractOption = m_contextInfo.metaData.getString("android.app.extract_android_style");
+ if (!extractOption.equals("full") && !extractOption.equals("minimal") && !extractOption.equals("none")) {
+ Log.e(QtApplication.QtTAG, "Invalid extract_android_style option \"" + extractOption + "\", defaulting to full");
+ extractOption = "full";
+ }
+ }
+
+ if (!(new File(stylePath)).exists() && !extractOption.equals("none")) {
loaderParams.putString(EXTRACT_STYLE_KEY, stylePath);
+ loaderParams.putBoolean(EXTRACT_STYLE_MINIMAL_KEY, extractOption.equals("minimal"));
+ if (extractOption.equals("full"))
+ ENVIRONMENT_VARIABLES += "\tQT_USE_ANDROID_NATIVE_STYLE=1";
+ }
ENVIRONMENT_VARIABLES += "\tMINISTRO_ANDROID_STYLE_PATH=" + stylePath
+ "\tQT_ANDROID_THEMES_ROOT_PATH=" + themePath;