summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-04 14:29:41 +0200
committerBogDan Vatra <bogdan@kde.org>2014-08-06 22:19:10 +0200
commitc8321a9c104116f2b386ac74d227449e0ab831fa (patch)
tree330f204609740f869adf70bde2dc858d0388b4f0 /src
parentc79383968164af885dc8b9364b5198bb11bd3dbd (diff)
Android: extract window style attributes
Task-number: QTBUG-39215 Change-Id: I29120f5dcc97051705bc6ebacfa5843d8953810b Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
index 90e820de96..68e8b26cb1 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
@@ -1687,6 +1687,33 @@ public class ExtractStyle {
}
}
+ private void extractWindow(SimpleJsonWriter writer, String styleName) {
+ JSONObject json = new JSONObject();
+ try
+ {
+ Class<?> attrClass = Class.forName("android.R$attr");
+ int[] windowAttrs = (int[]) styleableClass.getDeclaredField("Window").get(null);
+
+ int backgroundId = attrClass.getDeclaredField("windowBackground").getInt(null);
+ TypedArray a = m_theme.obtainStyledAttributes(null, windowAttrs, backgroundId, 0);
+ Drawable background = a.getDrawable(getField(styleableClass, "Window_windowBackground"));
+ if (background != null)
+ json.put("Window_windowBackground", getDrawable(background, styleName + "_Window_windowBackground"));
+ a.recycle();
+
+ int frameId = attrClass.getDeclaredField("windowFrame").getInt(null);
+ a = m_theme.obtainStyledAttributes(null, windowAttrs, frameId, 0);
+ Drawable frame = a.getDrawable(getField(styleableClass, "Window_windowFrame"));
+ if (frame != null)
+ json.put("Window_windowFrame", getDrawable(frame, styleName + "_Window_windowFrame"));
+ a.recycle();
+
+ writer.name(styleName).value(json);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
public ExtractStyle(Context context, String extractPath)
{
// Log.i(MinistroService.TAG, "Extract " + extractPath);
@@ -1708,6 +1735,7 @@ public class ExtractStyle {
SimpleJsonWriter jsonWriter = new SimpleJsonWriter(m_extractPath+"style.json");
jsonWriter.beginObject();
try {
+ extractWindow(jsonWriter, "windowStyle");
jsonWriter.name("buttonStyle").value(extractTextAppearanceInformations("buttonStyle", "QPushButton", null, -1));
jsonWriter.name("spinnerStyle").value(extractTextAppearanceInformations("spinnerStyle", "QComboBox", null, -1));
extractProgressBar(jsonWriter, "progressBarStyleHorizontal", "QProgressBar");