diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java | 29 | ||||
-rw-r--r-- | src/tools/rcc/rcc.cpp | 50 |
2 files changed, 54 insertions, 25 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 b75dbac4b8..2aeb89d5d5 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java +++ b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java @@ -67,6 +67,7 @@ import android.graphics.NinePatch; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.PorterDuff; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ClipDrawable; @@ -820,8 +821,27 @@ public class ExtractStyle { bmp = (Bitmap) drawable; else { - if (drawable instanceof BitmapDrawable) - bmp = ((BitmapDrawable)drawable).getBitmap(); + if (drawable instanceof BitmapDrawable) { + BitmapDrawable bitmapDrawable = (BitmapDrawable)drawable; + bmp = bitmapDrawable.getBitmap(); + try { + json.put("gravity", bitmapDrawable.getGravity()); + json.put("tileModeX", bitmapDrawable.getTileModeX()); + json.put("tileModeY", bitmapDrawable.getTileModeY()); + if (Build.VERSION.SDK_INT >= 18) { + json.put("antialias", (Boolean) BitmapDrawable.class.getMethod("hasAntiAlias").invoke(bitmapDrawable)); + json.put("mipMap", (Boolean) BitmapDrawable.class.getMethod("hasMipMap").invoke(bitmapDrawable)); + } + if (Build.VERSION.SDK_INT >= 21) { + json.put("tintMode", (PorterDuff.Mode) BitmapDrawable.class.getMethod("getTintMode").invoke(bitmapDrawable)); + ColorStateList tintList = (ColorStateList) BitmapDrawable.class.getMethod("getTint").invoke(bitmapDrawable); + if (tintList != null) + json.put("tintList", getColorStateList(tintList)); + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { if (drawable instanceof ScaleDrawable) @@ -1544,6 +1564,11 @@ public class ExtractStyle { json.put("Switch_switchPadding", a.getDimensionPixelSize(getField(styleableClass, "Switch_switchPadding"), 0)); json.put("Switch_thumbTextPadding", a.getDimensionPixelSize(getField(styleableClass, "Switch_thumbTextPadding"), 0)); + if (Build.VERSION.SDK_INT >= 21) { + json.put("Switch_showText", a.getBoolean(getField(styleableClass, "Switch_showText"), true)); + json.put("Switch_splitTrack", a.getBoolean(getField(styleableClass, "Switch_splitTrack"), false)); + } + a.recycle(); jsonWriter.name(styleName).value(json); } catch (Exception e) { diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 7623ce2e4a..5769ed552c 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -730,33 +730,37 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &tempDevice, QIO { m_errorDevice = &errorDevice; - const char pattern[] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' }; if (m_format == Pass2) { - char c; - for (int i = 0; i < 8; ) { - if (!tempDevice.getChar(&c)) { - m_errorDevice->write("No data signature found\n"); - return false; - } - if (c == pattern[i]) { - ++i; - } else { - for (int k = 0; k < i; ++k) - outDevice.putChar(pattern[k]); - outDevice.putChar(c); - i = 0; + const char pattern[] = { 'Q', 'R', 'C', '_', 'D', 'A', 'T', 'A' }; + bool foundSignature = false; + + while (true) { + char c; + for (int i = 0; i < 8; ) { + if (!tempDevice.getChar(&c)) { + if (foundSignature) + return true; + m_errorDevice->write("No data signature found\n"); + return false; + } + if (c == pattern[i]) { + ++i; + } else { + for (int k = 0; k < i; ++k) + outDevice.putChar(pattern[k]); + outDevice.putChar(c); + i = 0; + } } - } - m_outDevice = &outDevice; - quint64 start = outDevice.pos(); - writeDataBlobs(); - quint64 len = outDevice.pos() - start; + m_outDevice = &outDevice; + quint64 start = outDevice.pos(); + writeDataBlobs(); + quint64 len = outDevice.pos() - start; - tempDevice.seek(tempDevice.pos() + len - 8); - outDevice.write(tempDevice.readAll()); - - return true; + tempDevice.seek(tempDevice.pos() + len - 8); + foundSignature = true; + } } //write out |