1078 Commits

Author SHA1 Message Date
Deepanshu Gupta
85d43f01ed Use BlendComposite for advanced PorterDuff Modes.
Not all PorterDuff modes are supported by Java's AlphaComposite. Use
BlendComposite for such modes.

Change-Id: I51486a40f09186cf8a87ce1e6a3d1cfcf39fb2d3
2014-07-15 18:14:00 -07:00
Deepanshu Gupta
303b908d61 Optimize Blend composites.
Removed redundant array allocations to improve performance for various
blending modes.

Change-Id: Iaba1d6ff3ad03eebdc859c599b610cc593370438
(cherry picked from commit 9ce074610413ce3a5dd0cef9295f0ae9061402b7)
2014-07-15 18:13:53 -07:00
Deepanshu Gupta
e6bf903db9 Add BlendComposite.java
The class is adapted from a demo tool for Blending Modes written by
Romain Guy (romainguy@android.com). The tool is available at
http://www.curious-creature.org/2006/09/20/new-blendings-modes-for-java2d/

Change-Id: I8f7c7ca08d3078106056764a4e2f1ce95d990137
(cherry picked from commit 882e08759137a77090c3c7dff8cba425a3393474)
2014-07-15 18:13:46 -07:00
Deepanshu Gupta
1f1a71bed1 Merge "Support Typeface.createFromFile()" into lmp-preview-dev 2014-07-02 18:11:52 +00:00
Deepanshu Gupta
3c937cf5c7 Support Typeface.createFromFile()
Add support for Typeface.createFromFile() for platform fonts. The
feature existed in the KitKat LayoutLib but was dropped for the L
preview. This change adds it back.

Change-Id: Ib1abe67a32c28a1fb0e2a4f3061c358b55129434
2014-07-01 17:32:12 -07:00
Deepanshu Gupta
7ea293bc6a Change font family name.
During the SDK build, rename the Font's Family name and not just the
PS Name. Updating the PS name doesn't work.

Change-Id: I997b5eec9f493ce97b95c33101ee426e773890c1
2014-07-01 17:13:32 -07:00
Deepanshu Gupta
19c5349b73 Merge "Change font family name." into lmp-preview-dev 2014-07-01 23:33:37 +00:00
Deepanshu Gupta
1076be31f1 Update system icon resolution in LayoutLib.
This fixes some bugs with the resolution of icons for Status Bar and
Navigation Bar by separating the icons into v21 and v11 directories. An
icon is searched in v21 directory by default. For simulating older
platforms, v11 directory is searched first and then v21 is used as a
fallback.

This also adds xxhdpi versions of home, back and recent icons.

Change-Id: Ia6eafc83856eacafc4fb0b13d87793d4aa24f106
2014-06-27 11:52:45 -07:00
Deepanshu Gupta
7a139f3fc9 Improve PorterDuff support.
1. Don't cache the src image used for applying the filter. The filter
delegate is not always cleared. This probably results in slighly slower
rendering, but doesn't run Studio out of memory.
2. Support more PorterDuff modes.
3. Fix a bug where the alpha was applied twice and thus the filter had
less effect than it should have had.

Change-Id: I2a481a64ba7f1ff8e9683bbc46ae110433e82ebc
2014-06-24 17:42:34 -07:00
Deepanshu Gupta
ead9ce3ff6 Temporarily change PorterDuff mode MULTIPLY to SRC_IN
Overflow pop up dialog for action bar uses PorterDuff color filters in
mode SRC_IN. The mode is not supported by AlphaComposite currently. So,
in order to render something, we swap it out with SRC_IN.

Change-Id: I987e101728ecb76b5e3d5cd91f831e6f63a4321f
2014-06-23 19:26:32 -07:00
Deepanshu Gupta
16af3691f5 Fix bug to render status bar icons
Change-Id: I653c765105dafb02e30322384ca8e4791ac185d2
2014-06-23 19:25:38 -07:00
Deepanshu Gupta
e1d04d5421 Fix NPE in Ninepatch creation.
Change-Id: Icead69cd8503e90aeb54ff42f9ec297e7af2b518
2014-06-23 18:40:47 -07:00
Deepanshu Gupta
8dcfd4abe8 Resource resolution bug fix.
Fix a bug where "?attr/foo" in framework resources wasn't resolved
properly.

Change-Id: I9a56974f526774fde79685f668f01021136d68f1
2014-06-23 16:48:56 -07:00
Deepanshu Gupta
42c7ce02f4 Add navigtaion bar icons to simulate older platforms.
LayoutLib can simulate older versions of the platform to a very limited
extent. This change adds the old navigtaion bar icons back and moves the
latest ones to directories suffixed with "-v21". The code handles this
resolution in a very crude way.

This also removes a bunch of unused code and fixes some style warnings.

Change-Id: Ib6e7bfd8dfb34b2ccd87f660ca979eb5ef14bae7
2014-06-23 14:49:01 -07:00
Deepanshu Gupta
f2af1f5d8a LayoutLib: Support PorterDuffColorFilter
Add support for select modes for PorterDuffColorFilter.

Change-Id: Ia7b4a6a92c326be977dd87a70f54c1f8954b546d
2014-06-22 13:02:54 -07:00
Deepanshu Gupta
367a0ce902 Fix SurfaceView in LayoutLib.
Added missing constructor.

Change-Id: I3dc8eb510bf4210568d4bb71ad551446d6835ae2
2014-06-21 19:47:25 -07:00
Deepanshu Gupta
b337295654 Merge "LayoutLib: Better support for compact/elegant fonts." into lmp-preview-dev 2014-06-20 21:00:34 +00:00
Deepanshu Gupta
17f6f35f90 Material navigation bar for layoutlib.
Change-Id: Id65600e5f4ffb3cd0f90c3c710f88d9b668f754f
2014-06-18 15:27:02 -07:00
Deepanshu Gupta
86837dc24a LayoutLib: Better support for compact/elegant fonts.
Change-Id: I67439924bc6323490ea0c7d7864985b400906f8c
2014-06-12 11:11:28 -07:00
Deepanshu Gupta
352d84fb07 Merge "Remove lxml dependency." into lmp-preview-dev 2014-06-10 22:12:51 +00:00
Deepanshu Gupta
125714173b Remove lxml dependency.
The encoding for the .ttx file generated is now hard-coded to be utf-8.

Change-Id: I71c208327995651fcf44b6961510f84bafb05848
2014-06-10 17:00:29 -07:00
Deepanshu Gupta
b54b78e215 LayoutLib: Support more ContextThemeWrappers
ContextThemeWrapper may be the base context for another
ContextThemeWrapper. We now extract the base context till we reach the
final context.

Change-Id: I034444a2d1579241543fd24248530b299e72498a
2014-06-10 17:44:37 -07:00
Deepanshu Gupta
1160e6d2f7 LayoutLib: Fix EditText rendering
Framework has overloaded java.lang.System.arraycopy() for char[]. The
method is not present on the Desktop VMs. This change replaces the calls
to this method by its more general alternative - the one using Objects.

TODO: Make it more configurable and flexible to allow rewrite of any
such methods in the future.

Change-Id: I6823b13e52b1c555eb257d02b79707d84e73236f
2014-06-10 17:44:14 -07:00
Deepanshu Gupta
acb119f0a2 Merge "Build LayoutLib with Java 6" into lmp-preview-dev 2014-06-07 23:32:10 +00:00
Deepanshu Gupta
f4058c8d6b Build LayoutLib with Java 6
Add source and target flags to LayoutLib Bridge to enable compatibility
with Java 6.

Change-Id: I81266af758bb57df037541d6e82600e5020a3c0d
2014-06-07 11:19:03 -07:00
Amith Yamasani
da8738fabd Add missing abstract method override in BridgePowerManager.
Change-Id: I28a24f33f8a598e487ec21861e918a39a8875d43
2014-06-06 12:28:27 -07:00
Dianne Hackborn
421e2fd044 Merge "Improvements to low power mode." into lmp-preview-dev 2014-06-06 17:46:11 +00:00
Dianne Hackborn
eb94fa7975 Improvements to low power mode.
Add new public API for monitoring low power mode.

BatteryService now puts device in to low power mode when
battery level is low.

Window manager now watches low power mode to turn off
animations.

Modifying the animator scale now gets propagated to all
processes.

Change-Id: I8fa566994764ddd4e1977631e28381ab9409f8ee
2014-06-06 10:25:36 -07:00
Deepanshu Gupta
a19b8c111b LayoutLib: Add assertions for typeface.
Framework passes typeface along with the paint object at many places.
Paint_Delegate is supposed to have the typeface object with it. Add
assertions to ensure that the two typefaces are indeed the same.

Change-Id: I68193513c2d99f269c0458d6493f23025bbda385
2014-06-05 14:42:14 -07:00
Deepanshu Gupta
ad69aee5ed LayoutLib: Font variants
Update to support font variants properly.

Change-Id: Iabe37babd9ddce80a9ba9eca7e0e5a0ffb090646
2014-06-05 10:34:12 -07:00
Deepanshu Gupta
c8e2d0a4f8 LayoutLib: Add capability to simulate old versions
Let the IDE know that we can simulate older versions of platform.

Change-Id: Idec6d24296dd0ae04a2d808c14604629e265d458
2014-06-04 17:08:48 -07:00
Deepanshu Gupta
58ff7de971 Fix build.
Change-Id: I877532b5056a035dbd4b0c6c55b5969d6292846a
2014-06-04 16:50:07 -07:00
Deepanshu Gupta
648a309d9b Merge "Add basic support for simulating older versions." into lmp-preview-dev 2014-06-04 23:37:37 +00:00
Deepanshu Gupta
e43dcc1d64 Merge "Distinguish between menus in ActionBar and popup." into lmp-preview-dev 2014-06-04 22:11:37 +00:00
Craig Mautner
8a0da0184f Force all windows to redraw before unblanking screen
The screen turning on would show windows as they were when the screen
turned off. This fix forces all showing windows to redraw first and
only then allow the screen to turn on.

Fixes bug 15092354.

Change-Id: I52c3f47438176a5ac00ba9a4d5205b56a5aa48f9
2014-06-03 17:08:02 -07:00
Jeff Sharkey
2ee3c1e189 Per-app media directories on external storage.
This change defines per-app directories on external storage that
will be scanned and included in MediaStore.  This gives apps a way
to write content to secondary shared storage in a way that can
easily be surfaced to other apps.

Bug: 14382377
Change-Id: I4cb367c870509e76f0c2c598f01e2f699780030a
2014-05-30 16:26:45 -07:00
Deepanshu Gupta
3885220ed5 Distinguish between menus in ActionBar and popup.
Mark the menus in the ActionBar and the ones in the Overflow popup
separately. This enables the IDE to differentiate between the two and
enable gestures such as double-click to open the menu xml for menus in
the ActionBar and single click for the menus in the Overflow popup.

Change-Id: I7a23f87d34d618a134ffbe3a665be695915d4bae
2014-05-29 18:22:04 -07:00
Craig Mautner
8bd94d502d implement keyguardGoingAway() fixes build.
Fix bug 15326529.

Change-Id: I9095fe70721bfb031dd1080da1d61ff4e1a8c8ab
2014-05-29 10:53:46 -07:00
Deepanshu Gupta
85c69944bd Merge "Recurse into directories to find fonts. [DO NOT MERGE]" into lmp-preview-dev 2014-05-29 15:38:17 +00:00
Deepanshu Gupta
f251b06089 Merge "Parallel processing of the fonts. [DO NOT MERGE]" into lmp-preview-dev 2014-05-29 15:37:55 +00:00
Deepanshu Gupta
28b13b2332 Merge "Add multiple dir support to build_font.py [DO NOT MERGE]" into lmp-preview-dev 2014-05-29 15:37:45 +00:00
Deepanshu Gupta
2cb50d45a8 Merge "Layoutlib: Fix FontFamily_Delegate use after unref" into lmp-preview-dev 2014-05-29 15:37:24 +00:00
Deepanshu Gupta
1a5b0de877 Merge "Update delegates" into lmp-preview-dev 2014-05-29 15:37:07 +00:00
Xavier Ducrohet
7ee26070ea Merge "Stopgap fix for layoutlib." into lmp-preview-dev 2014-05-29 05:27:32 +00:00
Brian Carlstrom
312da405eb Tracking ActionBarView change 1181f77bdfaa7bf8a8250cdd13c7b7a1d6ee0c44
Change-Id: I29a486557428806f26f900974e74f42f3afa4ad4
2014-05-28 21:43:35 -07:00
Brian Carlstrom
8c9360f3aa Tracking IWindowManager change 2ea3814083f27567ae07a1b449da3d596dd4d9d5
Change-Id: I6945cc9b4be174b55173ac2081edc5ee1bee6e67
2014-05-28 21:37:52 -07:00
Deepanshu Gupta
dc62340f18 Stopgap fix for layoutlib.
This is a temporary fix for changes made to TypedArray regrading theme
attributes.

Change-Id: I173fde6d8d3259479b0654ff331bc27bf2814fb0
2014-05-28 16:52:01 -07:00
Deepanshu Gupta
5a73454845 Add basic support for simulating older versions.
This adds rudimentary support for older versions of layoutlib by
changing the color of the status bar to white for froyo and earlier and
omitting the navigation bar for pre-ICS devices.

The color of the icons in the status bar is not changed yet.

Change-Id: I56a16b206ad357b6f3bc5c3d10701d03551847bc
2014-05-28 16:37:39 -07:00
Deepanshu Gupta
9113968f95 Layoutlib: Fix FontFamily_Delegate use after unref
FontFamily_Delegate was being reused after the nUnref call. The issue is
fixed by storing the reference to the FontFamily_Delegate directly in
the Typeface_Delegate rather than storing the native pointer.

Change-Id: I0db724a83c4be3d7b64ccba0989cd64129f2a785
2014-05-28 16:15:32 -07:00
Deepanshu Gupta
79ee46172b Update delegates
Update layoutlib delegates in response to commit
a631a36de986acea2ef6fdfbaf3441a28b914b15

Change-Id: I897a7e3a61286bfae9054415d555febe16410106
2014-05-28 15:04:50 -07:00