diff options
author | Dave Kover <kover@cyngn.com> | 2016-04-13 15:37:33 -0700 |
---|---|---|
committer | Dave Kover <kover@cyngn.com> | 2016-04-14 13:47:37 -0700 |
commit | b5f89235f519d7c20e05e66156ffe4ceb4fa9491 (patch) | |
tree | 8ec48e9ad2b32e7641b9b9f96c23bbf9c93dd763 /src | |
parent | 89e9807d6580b83e872511cbea27adda44ac1171 (diff) | |
download | android_packages_providers_ThemesProvider-b5f89235f519d7c20e05e66156ffe4ceb4fa9491.tar.gz android_packages_providers_ThemesProvider-b5f89235f519d7c20e05e66156ffe4ceb4fa9491.tar.bz2 android_packages_providers_ThemesProvider-b5f89235f519d7c20e05e66156ffe4ceb4fa9491.zip |
Update controls preview to properly render themed assets.
The style preview card does not use assets which are overridden
by most themes. This results in an inaccurate preview of the
included controls, ie checkbox and radio buttons. Additionally,
the font size is cut off on the button in the preview. Increase
button height and decrease font size to compensate.
Ticket: CYNGNOS-874
Change-Id: I286f801afa7b6366ecf50395075240f33bc3d0ac
Diffstat (limited to 'src')
-rw-r--r-- | src/org/cyanogenmod/themes/provider/util/LayoutRenderUtils.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/org/cyanogenmod/themes/provider/util/LayoutRenderUtils.java b/src/org/cyanogenmod/themes/provider/util/LayoutRenderUtils.java index c174d8e..5ccd196 100644 --- a/src/org/cyanogenmod/themes/provider/util/LayoutRenderUtils.java +++ b/src/org/cyanogenmod/themes/provider/util/LayoutRenderUtils.java @@ -18,6 +18,7 @@ package org.cyanogenmod.themes.provider.util; import android.graphics.Bitmap; import android.graphics.Canvas; import android.view.View; +import android.view.ViewGroup; import android.widget.FrameLayout; public class LayoutRenderUtils { @@ -35,6 +36,17 @@ public class LayoutRenderUtils { // Assign a size and position to the view and all of its descendants view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); + // Make sure views with stateful drawables are in their correct state + if (view instanceof ViewGroup) { + final ViewGroup vg = (ViewGroup) view; + final int N = vg.getChildCount(); + for (int i = 0; i < N; i++) { + vg.getChildAt(i).jumpDrawablesToCurrentState(); + } + } else { + view.jumpDrawablesToCurrentState(); + } + // Create the bitmap Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), |