diff options
Diffstat (limited to 'src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java | 42 |
1 files changed, 10 insertions, 32 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 3f74383a82..e6de354ac4 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java +++ b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java @@ -89,8 +89,6 @@ import android.view.inputmethod.EditorInfo; public class ExtractStyle { - native static int[] extractChunkInfo(byte[] chunkData); - native static int[] extractNativeChunkInfo(int nativeChunk); native static int[] extractChunkInfo20(byte[] chunkData); native static int[] extractNativeChunkInfo20(long nativeChunk); @@ -345,10 +343,7 @@ public class ExtractStyle { } public void drawPatch(Bitmap bmp, byte[] chunks, RectF dst, Paint paint) { - if (Build.VERSION.SDK_INT > 19) - chunkData = extractChunkInfo20(chunks); - else - chunkData = extractChunkInfo(chunks); + chunkData = extractChunkInfo20(chunks); } } @@ -698,10 +693,6 @@ public class ExtractStyle { json.put("thicknessRatio",gradientStateClass.getField("mThicknessRatio").getFloat(obj)); json.put("innerRadius",gradientStateClass.getField("mInnerRadius").getInt(obj)); json.put("thickness",gradientStateClass.getField("mThickness").getInt(obj)); - if (Build.VERSION.SDK_INT < 20) { - json.put("solidColor",gradientStateClass.getField("mSolidColor").getInt(obj)); - json.put("strokeColor",gradientStateClass.getField("mStrokeColor").getInt(obj)); - } } catch (Exception e) { e.printStackTrace(); } @@ -802,14 +793,7 @@ public class ExtractStyle { Object state = getAccessibleField(NinePatchDrawable.class, "mNinePatchState").get(d); np = (NinePatch) getAccessibleField(state.getClass(), "mNinePatch").get(state); } - if (Build.VERSION.SDK_INT < 19) - return getJsonChunkInfo(extractChunkInfo((byte[]) getAccessibleField(np.getClass(), "mChunk").get(np))); - else - { - if (Build.VERSION.SDK_INT > 19) - return getJsonChunkInfo(extractNativeChunkInfo20(getAccessibleField(np.getClass(), "mNativeChunk").getLong(np))); - return getJsonChunkInfo(extractNativeChunkInfo(getAccessibleField(np.getClass(), "mNativeChunk").getInt(np))); - } + return getJsonChunkInfo(extractNativeChunkInfo20(getAccessibleField(np.getClass(), "mNativeChunk").getLong(np))); } class DrawableCache @@ -1016,16 +1000,12 @@ public class ExtractStyle { 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)); - } + json.put("antialias", (Boolean) BitmapDrawable.class.getMethod("hasAntiAlias").invoke(bitmapDrawable)); + json.put("mipMap", (Boolean) BitmapDrawable.class.getMethod("hasMipMap").invoke(bitmapDrawable)); + 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(); } @@ -1758,10 +1738,8 @@ 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)); - } + 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); |