summaryrefslogtreecommitdiffstats
path: root/src/android/jar
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-03-28 15:28:43 +0300
committerBogDan Vatra <bogdan@kdab.com>2016-04-15 13:01:31 +0000
commit32a419229ae3a6165e3c793ff132bb9803594fb0 (patch)
tree6e0a992c111210eb501400b37c1564291729f205 /src/android/jar
parentdaebbcf5f4438fec636e7663f272954ce2145ff0 (diff)
Fix wrong style of QMessageBox on Android.
Extracting the theme information seems pretty buggy on some Android devices, so let the platform functions do it instead. Task-number: QTBUG-35687 Change-Id: Ib27e846fad98624c3c396dab06d476281de693f7 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/android/jar')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java
index 341bc159c8..f9ece74de3 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java
@@ -1,6 +1,6 @@
/****************************************************************************
**
- ** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
+ ** Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Android port of the Qt Toolkit.
@@ -172,30 +172,6 @@ public class QtMessageDialogHelper
m_buttonsList.add(new ButtonStruct(this, id, text));
}
- private void setTextAppearance(TextView view, String attr, String style)
- {
- try {
- int[] attrs = (int[]) Class.forName("android.R$styleable").getDeclaredField("TextAppearance").get(null);
- final TypedArray a = m_theme.obtainStyledAttributes(null,
- attrs,
- Class.forName("android.R$attr").getDeclaredField(attr).getInt(null),
- Class.forName("android.R$style").getDeclaredField(style).getInt(null));
- final int textSize = a.getDimensionPixelSize(
- Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textSize").getInt(null), 0);
- if (textSize != 0)
- view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
-
- final int textColor = a.getColor(
- Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textColor").getInt(null), 0x3138);
- if (textColor != 0x3138)
- view.setTextColor(textColor);
-
- a.recycle();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
private Drawable getStyledDrawable(String drawable) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
{
int[] attrs = {Class.forName("android.R$attr").getDeclaredField(drawable).getInt(null)};
@@ -252,7 +228,7 @@ public class QtMessageDialogHelper
view.setLongClickable(true);
view.setText(m_text);
- setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium");
+ view.setTextAppearance(m_activity, android.R.style.TextAppearance_Medium);
RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layout.setMargins(16, 8, 16, 8);
@@ -269,7 +245,7 @@ public class QtMessageDialogHelper
view.setLongClickable(true);
view.setText(m_informativeText);
- setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium");
+ view.setTextAppearance(m_activity, android.R.style.TextAppearance_Medium);
RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layout.setMargins(16, 8, 16, 8);
@@ -289,7 +265,7 @@ public class QtMessageDialogHelper
view.setLongClickable(true);
view.setText(m_detailedText);
- setTextAppearance(view, "textAppearanceSmall", "TextAppearance_Small");
+ view.setTextAppearance(m_activity, android.R.style.TextAppearance_Small);
RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layout.setMargins(16, 8, 16, 8);