464 Commits

Author SHA1 Message Date
Xavier Ducrohet
515a08b018 Merge 59aad78e from master. do not merge.
LayoutLib: don't render when shader's local matrix is set to 0 scale.

Change-Id: I02c0ddd856026357f468dcc8b81e0520470118de
2011-04-07 12:02:31 -07:00
Xavier Ducrohet
c5aeac7f15 LayoutLib: Fix issue with rendering mode.
When the layout content is embedded inside a decor layout
to emulate system bar (top or bottom) and title bar (or action bar)
then the code computing the full required size based on the RenderingMode
would fail because the decor layout would prevents the content layout to
take as much room as possible.
There is also an issue with the way we know render dialogs as the
dialogs usually as a frame with some padding and the previous measurements
would not take into account the dialog padding when increasing the
screen size.

This fix makes the code measure the size of the content layout in the
normal rendering, and then separately from the root layout with the proper
MeasureSpec to let the content grown. The difference in size is then added
to the screen size.

Bug: http://code.google.com/p/android/issues/detail?id=15892

Change-Id: Ibb9ca2a67c6c450d10d9f9a8050536e094650f8b
2011-04-05 20:45:48 -07:00
Xavier Ducrohet
67450db03e LayoutLib: TypedArray.getDimensionPixelSize can actually return <0
Change-Id: I17853dc242e28f0c59916cad1b2a57beed480a57
2011-03-17 14:11:23 -07:00
Xavier Ducrohet
9d76581faf LayoutLib: Fix Arc rendering.
Looks like Java2D and Skia go in different directions for angles.

Change-Id: Ia0c9c70cd66c9a0941fa9921fecf8e4e83538af3
2011-03-14 15:12:21 -07:00
Xavier Ducrohet
adaa12cd9e LayoutLib: fix Capabilities and getDimensionPixelSize
Commented out a Capability that is not in ADT 10.

BridgeTypedArray.getDimensionPixelSize shouldn't call
getDimension since most of the code is duplicated, and
it prevents use from properly detecting malformed attribute
values.

Change-Id: I005b17061590dc0668729af16e896fad815f1973
2011-03-08 15:00:35 -08:00
Xavier Ducrohet
6f2fb57064 LayoutLib: Fix dimension parsing to handle negative value.
Also make TypedArray.getDimensionPixelSize properly
handle negative values (which are not allowed).

Change-Id: I960fc1c9e8ad97852d4a14e4f0f71a2c2034b4e7
2011-03-07 20:50:21 -08:00
Xavier Ducrohet
c12b409351 LayoutLib: Implement some missing add###() method in Path.
Change-Id: Ib62b5df0361ba81846483b1e5f8d7cbdbcb57d40
2011-03-07 20:19:38 -08:00
Dianne Hackborn
6482517101 Fix issue #3485923: Gmail crash
Allow application to try to recover if a surface OOM error
happens on the client side.

Change-Id: I0308bd99647a35e4bcac448340b7fc6330a828f6
2011-03-02 22:38:58 -08:00
Xavier Ducrohet
a4510a7575 LayoutLib: fix incorrect indices in one of the 2 native_drawTextRun methods.
Fixes http://b.android.com/15007

Change-Id: Iff06180def92c5fa25e82520b76192c089edd8cc
2011-02-24 18:58:27 -08:00
Xavier Ducrohet
1911a6f781 LayoutLib: move tests to their own project.
Change-Id: I8a9e128e4a17ab57ec7b126a378035d9ce5bc168
2011-02-24 13:51:26 -08:00
Xavier Ducrohet
f0a53435f1 LayoutLib: Add debug mode.
Change-Id: If4263c7dba63a063f84e0c6988c270eb6d291ac3
2011-02-23 18:12:49 -08:00
Xavier Ducrohet
b2c7dd5986 LayoutLib: downsize the SparseArray when possible.
Change-Id: I570b93ab161414b7729f8d2dce8ddadb706f186b
2011-02-23 15:02:58 -08:00
Xavier Ducrohet
c6083f2c9e LayoutLib: misc fixes.
- implement some Paint methods that are needed for 2.x
- fix the phone system bar to display the icons on the right.

Change-Id: I3a938b14ec9a449dbc23a33303a3c8405a5369a8
2011-02-23 12:00:42 -08:00
Xavier Ducrohet
cc4977d0fd LayoutLib: Hold onto delegate references.
When an object is given a delegate to hold onto, keep
the reference to the delegate instead of its native integer.

Also change the way the finalizer works by not explicitely deleting
the delegate. Instead we want the delegate to be deleted when
nothing holds a reference to it. To do this, instead of using
a regular SparseArray, we use a SparseArray of WeakReferences.
Because the main Java object that "owns" the delegate does not
actually holds a reference to the delegate, we fake this by
having the delegate manager hold a reference to delegates for
the main object. This is added/removed as the object is created
and the native finalized is called.

This makes layoutlib behave more like the JNI code where the native
objects are reference counted, and where the Java object can be
deleted but the delegate it owns is kept around (usually because
another type of delegates hold a reference on it.)

To properly handle the WeakReferences, we need to be able to
regularly clear the SparseArray of WeakReference that were
referencing objects that have been GC'ed.
Since the SparseArray is regularly being compacted (actually only
when items are removed), we use a custom SparseWeakArray (started
as a straight copy of SparseArray) that handles the WeakReference
and takes care of compacting the array by removing deleted indices
and WeakReference that returns null. Since our specific use case
doesn't call actually delete() or remove(), the compacting
only happens when the array needs to be resized.

Change-Id: Iacc5c1ff5b21732b8816fda87eb090da12d034e0
2011-02-23 12:00:41 -08:00
Xavier Ducrohet
8cb6fc184d LayoutLib: Import of SparseArray as SparseWeakArray.
This is a straight copy for easy review of the customization.

Change-Id: I351ec570c3e7a025561939ab05c1ae7eded30b38
2011-02-23 12:00:41 -08:00
Xavier Ducrohet
1ca584a2bb LayoutLib: remove assert in resource resolution.
These code paths were valid in case there's a mismatch
between the style/theme/version of Android

Change-Id: I8cb3b2a3f3a1ef5c37ccec0c8ddbb7add69bfbe0
2011-02-18 18:48:08 -08:00
Xavier Ducrohet
3e87bfa191 LayoutLib: support defStyleRes in obtainStyledAttributes.
This fix the Spinner rendering.

Change-Id: I20a71d9e07f6c86652a74fba3fc05a027a057ff8
2011-02-18 17:50:38 -08:00
Xavier Ducrohet
f20999965b LayoutLib: properly handle @null references in more places.
Change-Id: I240298ab79c19ab0e49cb6da19d6b0187493d3b5
2011-02-18 17:19:08 -08:00
Xavier Ducrohet
10df650f0d LayoutLib: add support for layout_only render.
Change-Id: I1cd791cf9560156c1ac488f8e454240c84e29cc6
2011-02-17 10:24:46 -08:00
Xavier Ducrohet
559358fdf6 am 1858c95e: am 02d2b5a4: LayoutLib: When possible ensure parsers are popped from the stack.
* commit '1858c95e99f81ac46eea93288cb8866260b3d5d8':
  LayoutLib: When possible ensure parsers are popped from the stack.
2011-02-14 09:59:58 -08:00
Xavier Ducrohet
02d2b5a403 LayoutLib: When possible ensure parsers are popped from the stack.
Some parser consumers (seems to be mostly resource inflation)
don't use the pull parser up to the END_DOCUMENT tag, making
the parser not pop itself from the parser stack automatically.

This is likely due to the XML resources being very shallow (1-2 levels
max), and the inflater just reading the content that it expects instead
of parsing till the document is done.

This ensures that *some* parsers are pop'ed from the stack when
used. Some other parsers we don't really control and hope the
user will parse till END_DOCUMENT.

Change-Id: Ie1f5762983fed2b2ae97b896218ae12b493e7ad9
2011-02-14 09:42:19 -08:00
Xavier Ducrohet
8a80a85552 LayoutLib: remove some exceptions.
We need to move away from throwing anything and instead
log errors/warnings.

Change-Id: Ib1af71a90c06e8565fbd0c061ba56f4d19baa3df
2011-02-09 19:39:52 -08:00
Xavier Ducrohet
9a4fe29c8d LayoutLib: Annotate the custom delegate methods.
Every method implementing a delegate needed by the
layoutlib_create bytecode modification must now be
annotated with LayoutlibDelegate.

The methods in the original source code that are delegated
are already automatically annotated. Now with the implementations
being annotated we can do bi-directional tests and find not
only missing implementations but also dead obsolete code.

This will be useful when backporting to earlier versions of
Android, or when native (non public) method disappear. In fact,
the new test detected one such method in Shader.

Change-Id: I491708b68ac2736ca5669aa86cd5e930a00f9db3
2011-02-09 17:29:29 -08:00
Xavier Ducrohet
f3f608452c LayoutLib: now depends on tools-common-prebuilt.
Change-Id: I11196c2363da378027fb8ca001e7dce0f58f657f
2011-02-09 16:19:43 -08:00
Xavier Ducrohet
abc33e014d LayoutLib: fix the background of title/action bars.
The bars are supposed to sit on top of the window so
that if they are transparent (which is the default case
for the action bar), the window background shows through.

Fix this using a layout to represent the window content
(all but the system bar) in which the title/action bars
and the layout content sits. This layout receives the
windowBackground drawable.

Change-Id: I8072c5ff52f585fa32acb589d8526e1c13cbcd94
2011-02-07 20:33:44 -08:00
Xavier Ducrohet
4dd2299d57 LayoutLib: Update to latest API fix.
Change-Id: I5147010e4f16a5c2ea0b98709c42f7ecd9412ff6
2011-02-07 13:05:40 -08:00
Xavier Ducrohet
62a99c0b3b Merge "LayoutLib: Handle color state list in methods returning an int." into honeycomb 2011-02-07 10:18:48 -08:00
Xavier Ducrohet
d96a7403cd LayoutLib: Handle color state list in methods returning an int.
Change-Id: Ia35ea09b992a239873026c7ef1629a01dd2e6cec
2011-02-06 21:05:21 -08:00
Xavier Ducrohet
13bdc3355c LayoutLib: improved rendering for system/title/action bars.
Change-Id: I926531e9ad4a7b98e04e23cac3837794f7c89449
2011-02-06 10:58:16 -08:00
Xavier Ducrohet
fd18f57328 LayoutLib: add implementation of Bridge.renderDrawable()
Change-Id: Ic4d96488fd1a2e5b7d24353bebc8fdb24262c1d1
2011-02-04 19:30:35 -08:00
Xavier Ducrohet
b0d34f9c99 LayoutLib: split RenderSession's base method into RenderAction.
This will allow us to create RenderDrawable that extends RenderAction.

Change-Id: If9cd350453ceffae4859a925a7b436502b311f9c
2011-02-04 18:11:09 -08:00
Xavier Ducrohet
1126422ee1 LayoutLib: update to the new API.
Change-Id: Ice028933cd2270c81c3d17f7bef7c5a9d14bd802
2011-02-04 17:41:43 -08:00
Xavier Ducrohet
779c906592 LayoutLib: Replace custom BitmapFactory by a simpler delegate
Change-Id: Ie61a0a5b4426e64bb71a22d76d05efa4c0865e5e
2011-02-04 16:40:49 -08:00
Xavier Ducrohet
bbbb832602 LayoutLib: render system/title/action bars.
Also a few generic fixes in the layoutlib itself to support
this.

Change-Id: Ie3f24c9056bd3cc72f39f8a4f2c0861be15bff55
2011-02-04 10:46:21 -08:00
Xavier Ducrohet
33758ef8c9 LayoutLib: Fix some rendering issues
Change-Id: I662a39a783de5bc7f3063f46cedaab11c7e6496e
2011-02-02 18:37:59 -08:00
Xavier Ducrohet
345f866bfd Make TimePicker/DatePicker/CalendarView render in Eclipse.
Change-Id: Id5313a6f0f53bf45f6eaabc0e10fcf0660eeac08
2011-02-02 14:04:50 -08:00
Xavier Ducrohet
b353495192 LayoutLib: update with Pair API.
Change-Id: Iba945153f7544872ea84e3311584223aea740e2e
2011-01-28 16:54:15 -08:00
Xavier Ducrohet
35ea7cd4c0 LayoutLib: Update with the new resource map APIs.
Change-Id: I30d83c2bb4569513f4f5e22670cffe938706f105
2011-01-28 11:44:21 -08:00
Xavier Ducrohet
1658422512 LayoutLib: Properly compute available space to layouts.
Also display placeholders for status/title/action bars depending
on if the app is a tablet and its theme.

Change-Id: I651c1a2e5cfde165e004c11b236e6df056853dec
2011-01-27 15:41:38 -08:00
Xavier Ducrohet
31fd1cf769 LayoutLib: put a default image on the quickcontactbadge.
Change-Id: I64b3f4004801ec03f374460384f9a492e66bfaf0
2011-01-26 17:30:59 -08:00
Xavier Ducrohet
5a82d8c58b LayoutLib: properly erase the bitmap when rendering a new session.
This fix the issue where going from a full theme to a dialog theme
would show the dialog on top of the previous rendering.

Change-Id: Ib52b9719f44b04969423547b9de8d039f90b6f46
2011-01-26 16:34:53 -08:00
Xavier Ducrohet
7d7016e724 LayoutLib: return ViewInfo for all merged items + Build init.
android.os.Build is now initialized from the build properties
parsed from the SDK build.prop file.

Change-Id: If16953215ca90fb0beacb51bf405b89a5c8a34fa
2011-01-25 15:55:16 -08:00
Xavier Ducrohet
82b9232565 LayoutLib: Use special view cookie for include-merge case.
All items directly under the <merge> tag now return the view cookie
of the referencing <include> tag using a special class for
easy differentiation in the calling client.

Change-Id: I7a2a4e642be9564f47e256fd1586012497d34792
2011-01-24 14:14:53 -08:00
Joe Onorato
664644d9e0 visibility ("lights out") API.
1. Views may setSystemUiVisibility() to recommend that
the system chrome (status bar or other UI) show or hide
itself.  (This functionality was previously available only
via the FLAG_FULLSCREEN window flag for some SystemUI
implementations.)

2. Views may register a OnSystemUiVisibilityChangedListener
on a view, and find out when the system UI actually
appears or disappears, allowing apps to coordinate the
appearance of their own UI if desired.

Bug: 3241144
Change-Id: Ia1758d94099182d49a1e3688ea2738ae4995b829
2011-01-23 19:22:52 -08:00
Xavier Ducrohet
9d0577ec0c LayoutLib: properly configure ApplicationInfo with targetSdkVersion.
Change-Id: I1bfef890206552843d1a7a8d0564741f2a37494f
2011-01-17 22:58:41 -08:00
Tor Norbye
796992a942 Allow TabHosts to have no children in the tabcontent widget
Replace the code which throws an exception if there are no children in
the FrameLayout that is the tabcontent, with code to add a single
dummy tab.

This makes the TabHost renderable in those scenarios where the real
tabs are added dynamically rather than via XML.

Change-Id: I72442bd7d40eddd875b3507585c1f372fcae3329
2011-01-17 21:57:34 -08:00
Xavier Ducrohet
70552fb92d LayoutLib: Update to use the new RenderResources API.
Change-Id: Ic64eff3f324c4519da89bab10e6d59f0a9341a04
2011-01-17 14:00:29 -08:00
Xavier Ducrohet
87ab45c0fe Merge "LayoutLib: extract resource resolution into its own class." into honeycomb 2011-01-16 19:38:33 -08:00
Jeff Brown
fbf0977321 Support non-rectangular input regions.
This enables the system bar to carve out a region through which
events will be sent to the IME behind it.

Bug: 3238092
Change-Id: I69b855a8d9b5b3ee525266c0861826e53e5b5028
2011-01-16 18:58:49 -08:00
Xavier Ducrohet
d1d6fafc7f LayoutLib: extract resource resolution into its own class.
Next step is to make it a jar that will also live in
ADT.
The version in layoutlib will be through a prebuilt jar
file, like ninepatch.

Also add ninepatch.jar inside the layoutlib.jar file.

Change-Id: I4a0cc9f2dd99709de6408386054c6d4abae7c824
2011-01-16 11:18:28 -08:00