summaryrefslogtreecommitdiffstats
path: root/src/android/jar
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-04 23:45:09 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-05 14:56:09 +0200
commit74d46a669badc5bf32187686102ca4e644a3c0af (patch)
tree15519feaefba14bfaa3ec527550f376e03673638 /src/android/jar
parent61449e8b59a8b9b2caaba099554ebf6fff30b92a (diff)
Android: extract complete actionBarStyle
Task-number: QTBUG-39215 Change-Id: I67d89ac28b73bc52cd2ed952cfc8db21437d6e3b Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/android/jar')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java37
1 files changed, 36 insertions, 1 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 944486d832..38eb9c4570 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
@@ -1496,6 +1496,41 @@ public class ExtractStyle {
}
}
+ void extractToolBar(SimpleJsonWriter writer, String styleName, String qtClass)
+ {
+ JSONObject json = extractTextAppearanceInformations(styleName, qtClass, null, -1);
+ try {
+ Class<?> attrClass = Class.forName("com.android.internal.R$attr");
+ int styleId = attrClass.getDeclaredField(styleName).getInt(null);
+
+ int[] styleAttrs = (int[]) styleableClass.getDeclaredField("ActionBar").get(null);
+ TypedArray a = m_theme.obtainStyledAttributes(null, styleAttrs, styleId, 0);
+
+ Drawable d = a.getDrawable(getField(styleableClass,"ActionBar_background"));
+ if (d != null)
+ json.put("ActionBar_background", getDrawable(d, styleName + "_ActionBar_background"));
+
+ d = a.getDrawable(getField(styleableClass,"ActionBar_backgroundStacked"));
+ if (d != null)
+ json.put("ActionBar_backgroundStacked", getDrawable(d, styleName + "_ActionBar_backgroundStacked"));
+
+ d = a.getDrawable(getField(styleableClass,"ActionBar_backgroundSplit"));
+ if (d != null)
+ json.put("ActionBar_backgroundSplit", getDrawable(d, styleName + "_ActionBar_backgroundSplit"));
+
+ d = a.getDrawable(getField(styleableClass,"ActionBar_divider"));
+ if (d != null)
+ json.put("ActionBar_divider", getDrawable(d, styleName + "_ActionBar_divider"));
+
+ json.put("ActionBar_itemPadding", a.getDimensionPixelSize(getField(styleableClass, "ActionBar_itemPadding"), 0));
+
+ a.recycle();
+ writer.name(styleName).value(json);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
public ExtractStyle(Context context, String extractPath)
{
// Log.i(MinistroService.TAG, "Extract " + extractPath);
@@ -1535,7 +1570,7 @@ public class ExtractStyle {
extractItemsStyle(jsonWriter);
extractCompoundButton(jsonWriter, "buttonStyleToggle", null);
if (Build.VERSION.SDK_INT > 10) {
- jsonWriter.name("actionBarStyle").value(extractTextAppearanceInformations("actionBarStyle", "QToolBar", null, -1));
+ extractToolBar(jsonWriter, "actionBarStyle", "QToolBar");
jsonWriter.name("actionButtonStyle").value(extractTextAppearanceInformations("actionButtonStyle", "QToolButton", null, -1));
}
} catch (Exception e) {