aboutsummaryrefslogtreecommitdiffstats
path: root/layoutlib_api
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-02-06 15:58:18 -0800
committerTor Norbye <tnorbye@google.com>2011-02-06 18:38:59 -0800
commit1c1c1c869f489b6ee42b7998a6d6e889e12ac4ed (patch)
tree5db302d1e135945191615b0c08b0d88d94e4069e /layoutlib_api
parentfd22f8ba39772c6553d95d07c44bde023db1848f (diff)
downloadsdk-1c1c1c869f489b6ee42b7998a6d6e889e12ac4ed.zip
sdk-1c1c1c869f489b6ee42b7998a6d6e889e12ac4ed.tar.gz
sdk-1c1c1c869f489b6ee42b7998a6d6e889e12ac4ed.tar.bz2
Palette previews with custom themes and other palette fixes
Palette previews are rendered on top of the default theme background. For certain custom themes, where a gradient or image is used, this can look terrible, since the preview images will include portions of the gradient or image. This changeset improves this situation by taking advantage of layoutlib 5's ability to override the background. It now uses theme resolution to find the background color, and paints the previews with the custom background override to force this color. In addition, if the theme background is not a color (but a gradient etc), it uses layoutlib5's new render-drawable support to generate the background, and it extracts a suitable color from it (currently, the center pixel.) This fix also ensures that the foreground color (used to paint labels for the widgets that cannot be rendered, such as layouts) has a suitable contrast with the background. After computing the background, it computes the brightness, and if the foreground and background differ less than 25% in brightness, then the foreground color is forced to white or black depending on whether the background is light or dark. This changeset also contains a bugfix for a palette initialization problem where in some cases the palette could come up empty (because the code which attempts to avoid doing extra work when reloadPalette is called repeatedly could be tricked by a scenario where the SDK target does not change but its "have target data" status did.) The open palette category is now preserved across palette refreshes (which occur when you change palette modes or category/sorting options, along with theme and render target changes). Finally, the changeset also turns off the new window decorations (system bar, action bar, etc) when generating preview images for both palette previews and for drag & drop. Change-Id: I8b8766ad45f2cb6a4a6b79a24c31ed0f08d1e826
Diffstat (limited to 'layoutlib_api')
0 files changed, 0 insertions, 0 deletions