diff options
author | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2023-11-02 15:59:27 +0200 |
---|---|---|
committer | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2023-11-10 21:57:11 +0200 |
commit | 2f706df6511e861ee7a038304e136273aa2907f7 (patch) | |
tree | 76886fcfb41da1f11c97cc9c745cae46fc5d87c7 /src/android/java/src/org/qtproject/qt | |
parent | f5e230285147efa95f32594f9b2e2581de819e47 (diff) |
Android: set the default theme directly in QtActivity without reflection
Currently the default theme is looked for using reflection in the
android.R package to get an id and then it's set. This is not needed
if we set the theme directly in the user's QtActivity which would have
access to that id directly pre-deployment.
To make setting a theme more in line with Android, retreat to using
setTheme() call directly for user projects instead of having to maintain
some internal field to store the theme name and have the user set that
if they want a different theme for their app.
Also, the Android plugin seems to set an env var for QT_ANDROID_THEME
with that default theme's name and that's used in QAndroidPlatformTheme
to check a theme specific extracted theme style.json, however, the Java
side doesn't seem to ever write to such a path, making this approach
totally redundant. For that reason, this code path is now removed.
Fixes: QTBUG-114075
Task-number: QTBUG-115017
Task-number: QTBUG-114593
Change-Id: I9ab3c025626aac2c09bc19eb7d846eca14a45070
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Diffstat (limited to 'src/android/java/src/org/qtproject/qt')
-rw-r--r-- | src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java index 9fa8d3ffae..f31bd75fea 100644 --- a/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java @@ -5,15 +5,6 @@ package org.qtproject.qt.android.bindings; import android.os.Bundle; -import android.provider.Browser; -import android.view.ContextMenu; -import android.view.ContextMenu.ContextMenuInfo; -import android.view.KeyEvent; -import android.view.Menu; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.View; -import android.os.Build; import org.qtproject.qt.android.QtActivityBase; @@ -40,21 +31,5 @@ public class QtActivity extends QtActivityBase // Currently the following vars are used by the android plugin: // * QT_USE_ANDROID_NATIVE_DIALOGS - 1 to use the android native dialogs. ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_DIALOGS=1"; - - // A list with all themes that your application want to use. - // The name of the theme must be the same with any theme from - // http://developer.android.com/reference/android/R.style.html - // The most used themes are: - // * "Theme_Light" - // * "Theme_Holo" - // * "Theme_Holo_Light" - - if (Build.VERSION.SDK_INT < 29) { - QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"}; - QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light"; - } else { - QT_ANDROID_THEMES = new String[] {"Theme_DeviceDefault_DayNight"}; - QT_ANDROID_DEFAULT_THEME = "Theme_DeviceDefault_DayNight"; - } } } |