385 Commits

Author SHA1 Message Date
Brett Chabot
3523325159 Merge "Include testdata in layoutlib-tests." 2011-06-21 11:27:29 -07:00
Xavier Ducrohet
fc511683b6 Add missing delegate to the layoutlib.
Change-Id: I8de5c1093052c40c0cd327a4d02b01651d3b76b5
2011-06-21 11:03:29 -07:00
Raphael Moll
865c3bef54 Laoutlib_creator: keep original of delegate methods.
For specific methods, Layoublib_create can rewrite the implementation
of a method to invoke a delegate instead of the original code. This
allows layoutlib to implement native code or override existing behavior.

This patch also 'saves' the original implementation of a rewritten
method so that the delegate can access the original implementation
as needed. Obviously this is only done for non-native methods.

Given a non-native SomeClass.MethodName, we generate 2 methods:
- A copy of the original method named "SomeClass.MethodName_original".
  The content is the original method as-is from the reader.
- A brand new implementation of SomeClass.MethodName which calls to a
  non-existing method named "SomeClass_delegate.MethodName".
  The implementation of this 'delegate' method is done in layoutlib_brigde.

Change-Id: I5ca2cd3ac55991a8e8a51c417e75ee447bf9e9e6
2011-06-17 19:07:13 -07:00
Brett Chabot
01f0fd84d0 Include testdata in layoutlib-tests.
Change-Id: I79fff895a13d171079b59db54d4b9d2bec555b3c
2011-06-17 17:03:20 -07:00
Xavier Ducrohet
ea5f0d0543 Bring in more layout lib changes from hc-mr1.
fe051bb2 : Change the way the layoutlib instantiate its XmlPullParser.

A lot of the init code was duplicated so I made a ParserFactory class.

Also created an extension of the KXmlPullParser to override toString().
This allows easier debugging when dealing with multiple parsers (which
is always the case).

Also added some (disabled) debugging printf to deal with parser stack
as it can be tricky figuring out which parsers are in the stack at
which point.

8969147c : Fix case where the int[] attrs doesn't directly match a styleable.

In the case of the FastScroller the int[] is a custom mix of attr
instead of a int[] that exists as R.styleable.foo.

This makes our reflection based mechanism used to find the styleable
fail, so instead we search for each attribute separately (like
we probably should have done from the beginning).

0c264b35: Fix various cases of getDimension to report error if unit is missing.

if getDimention###() is called for a string that has no unit,
then an error is output through LayoutLog, but the rendering keeps
going by using dp as a default.

0beb7eea: Make (Bridge)TypedArray.getInteger() call out to getInt()

Only getInt() resolved attribute flags/enum and I'm not sure why
there's two to begin with.

Change-Id: I015111263d2a2bee76834978ae71eef79defdae3
2011-06-16 18:26:25 -07:00
Xavier Ducrohet
d6465e10c2 CherryPick 06942bc4 from hc-mr1. do not merge.
Layoutlib - use the new getParser callback when possible.

Change-Id: I72b867aa573fcc07d610f139da3c90b1b654633c
2011-06-16 18:26:25 -07:00
Xavier Ducrohet
6b62c82848 CherryPick 988eeeb5 from hc-mr1. do not merge.
Support for custom declare-styleable attr with enum/flag in layoutlib.

Change-Id: I8a5b7cc629d61996ffade9aabd9d4d10961eb411
2011-06-16 18:26:24 -07:00
Xavier Ducrohet
9340ab4a21 am 0be8522b: am d1abd94f: am 04ce8111: Bring in more layout lib changes from hc-mr1.
* commit '0be8522b430aca8d90023d7c7e5ef510aa48adc7':
  Bring in more layout lib changes from hc-mr1.
2011-06-16 14:04:18 -07:00
Xavier Ducrohet
04ce811131 Bring in more layout lib changes from hc-mr1.
fe051bb2 : Change the way the layoutlib instantiate its XmlPullParser.

A lot of the init code was duplicated so I made a ParserFactory class.

Also created an extension of the KXmlPullParser to override toString().
This allows easier debugging when dealing with multiple parsers (which
is always the case).

Also added some (disabled) debugging printf to deal with parser stack
as it can be tricky figuring out which parsers are in the stack at
which point.

8969147c : Fix case where the int[] attrs doesn't directly match a styleable.

In the case of the FastScroller the int[] is a custom mix of attr
instead of a int[] that exists as R.styleable.foo.

This makes our reflection based mechanism used to find the styleable
fail, so instead we search for each attribute separately (like
we probably should have done from the beginning).

0c264b35: Fix various cases of getDimension to report error if unit is missing.

if getDimention###() is called for a string that has no unit,
then an error is output through LayoutLog, but the rendering keeps
going by using dp as a default.

0beb7eea: Make (Bridge)TypedArray.getInteger() call out to getInt()

Only getInt() resolved attribute flags/enum and I'm not sure why
there's two to begin with.
2011-06-16 13:23:53 -07:00
Xavier Ducrohet
66743a1ec0 Fix changed native method delegates in layoutlib for ICS.
Change-Id: I49306868cd8a41b6b7d919c3e8b108d5c014530e
2011-06-15 14:43:42 -07:00
Xavier Ducrohet
2dcb6e80b9 am 48305f32: am 2e0f7118: am 8ee28811: Merge changes Idbb70f53,I10426a3f into honeycomb-mr2
* commit '48305f327ff3839ddbfa5a6fb42a57150a69480c':
  Merge 06942bc4 from hc-mr1.
  Merge 988eeeb5 from hc-mr1.
2011-06-10 10:31:52 -07:00
Xavier Ducrohet
45b662e1bc Merge 06942bc4 from hc-mr1.
Layoutlib - use the new getParser callback when possible.

Change-Id: Idbb70f5391addd539afa5c2f5b55c70beefed223
2011-06-08 17:11:40 -07:00
Xavier Ducrohet
beb5fb622b Merge 988eeeb5 from hc-mr1.
Support for custom declare-styleable attr with enum/flag in layoutlib.

Change-Id: I10426a3f2c76bed207c03fab7885b4269337a70f
2011-06-08 17:10:11 -07:00
Xavier Ducrohet
f18e311ee5 am abc83871: am f6e47999: am 2a6dc7f1: Merge "Import the Layoutlib from hc-mr1." into honeycomb-mr2
* commit 'abc838716816107754ab0479242d03807ce79fc2':
  Import the Layoutlib from hc-mr1.
2011-06-07 17:17:11 -07:00
Xavier Ducrohet
fb93ce9684 Import the Layoutlib from hc-mr1.
This is squash commit of all the missing patches.

Change-Id: Ie081c46a173290646deddbde503a720d50c4400f
2011-06-03 19:38:14 -07:00
Xavier Ducrohet
156a211b21 Cherrypick d1ed33c4 from hc-mr1. do not merge.
Fix zombie threads in the Layoutlib.

Some widgets can create (indirectly) HandlerThread which are started
but never stopped.

This patch use the delegate methods to override the thread run method
to record which threads are started to be able to call quit() on them
after a render.

Note that we should really fix layoutlib_create to be able to call
the default implementation from a delegate to remove code duplication.

Change-Id: Iaf5432623e9704bb3114a8e0583c8553282c205e
2011-06-03 18:37:09 -07:00
Xavier Ducrohet
21726044a9 Cherrypick 5b61ea6b from hc-mr1
Fix drawCircle in layoutlib.

Change-Id: I035c48b925cad246ed821e9e59a93d37174982ef
2011-06-03 16:02:12 -07:00
Xavier Ducrohet
f174cd86bd LayoutLib: enable the LAYOUT_ONLY capability.
Change-Id: Ib302af47d2a83a7ac3def6256bf0b892823f594f
2011-06-02 16:38:38 -07:00
Xavier Ducrohet
8f17523dca Merge dba35f1b from honeycomb-mr1. do not merge.
Change-Id: Iebda5ea67fd40cac76a8ca3fe3c3cd4ee95ddebe
LayoutLib: Properly configure KXmlParser to read UTF8
2011-06-01 18:32:57 -07:00
Xavier Ducrohet
34f5991ebe Merge 6103e22c from honeycomb-mr1. do not merge.
LayoutLib: custom styles override the default style instead of replacing it.

Intead of reading either the custom or the default style for a widget, we
read both and use the values from the custom style if it exists, or
from the default style otherwise.

Change-Id: Ibcec2e9b1e8a95295ab26ede145c287ff2f30be4
2011-05-24 10:55:30 -07:00
Xavier Ducrohet
c7b87766b2 Merge 2402ad60 from honeycomb-mr1. do not merge.
LayoutLib: Fix Canvas_Delegate.native_concat().

Change-Id: I863c43d65a929816ac7c9e69addcc647dac1878b
2011-05-23 17:51:22 -07:00
Xavier Ducrohet
4c1e73b69a Merge e57aa434 from honeycomb-mr1. do not merge.
LayoutLib: Fix issue where <include> with no layout params wouldn't display.

The issue is that the layout params from the root element of the included
layout should be used but this failed because loading the layout params
from the <include> tag didn't throw a RuntimeException in our modified
code (BridgeTypedArray).

Because we don't want to throw exception in general we only throw it
when reading the layout params of an include node which is pretty crappy,
but works for now.

Change-Id: I83ccf956e8b476f34dfc9a70aebae2288d53746e
2011-05-20 14:50:45 -07:00
Xavier Ducrohet
d9af22e204 Merge 05b7b69c from honeycomb-mr1. do not merge.
Change-Id: I1aca5774dec2e18ab5f9e860f6fd90b481b2857c
LayoutLib: support the new baseline/margin query API.
2011-05-19 16:52:41 -07:00
Xavier Ducrohet
e172a3fc23 Merge 2fae858d from Honeycomb-mr1. do not merge.
Change-Id: I648f9ffa9745331ce4104dc4772f78ed933a4909
LayoutLib: implement data binding for most AdapterView
2011-05-19 16:52:29 -07:00
Xavier Ducrohet
9f23e60b20 am a13462a9: am 582841e7: am b18e700c: am aa0834e3: Merge "LayoutLib: support the new baseline/margin query API." into honeycomb-mr1
* commit 'a13462a947e634a6893119146a7271369e509586':
  LayoutLib: support the new baseline/margin query API.
2011-05-19 08:58:18 -07:00
Xavier Ducrohet
05b7b69c6c LayoutLib: support the new baseline/margin query API.
Change-Id: I856489df655960820b8eaa4c6179515a5c069b00
2011-05-16 16:29:03 -07:00
Xavier Ducrohet
8c2f85d941 am d0054160: am 6d040a7f: am 738c5e60: am 2fae858d: LayoutLib: implement data binding for most AdapterView
* commit 'd00541603fbbb4e38264e75a2b6abf8705efeb49':
  LayoutLib: implement data binding for most AdapterView
2011-05-13 16:43:37 -07:00
Xavier Ducrohet
2fae858db5 LayoutLib: implement data binding for most AdapterView
Change-Id: I27be96ed2c37573eb22cfbb391d96b6137b3df8c
2011-05-13 15:55:49 -07:00
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
59aad78eae LayoutLib: don't render when shader's local matrix is set to 0 scale.
Change-Id: I7726d87f3dd0475ac662f535a08c6435b8b9ed1f
2011-04-06 17:03:31 -07:00
Xavier Ducrohet
8a18dba48c Merge c5aeac7f from honeycomb.
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: Ie9a6c5e254b16785f817dcb9fae755d4936880aa
2011-04-06 14:24:59 -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
c7c8c599a6 Merge 67450db0 from honeycomb. Do not merge.
Change-Id: I0ca140dd6d9279ff313f930739ad40fbbed4f335
LayoutLib: TypedArray.getDimensionPixelSize can actually return <0
2011-03-17 14:24:50 -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
0a98226e3c Merge 9d76581f from honeycomb. do not merge.
LayoutLib: Fix Arc rendering.

Looks like Java2D and Skia go in different directions for angles.

Change-Id: I4d72db56455afe25b4f51f23a9b29d6c438119ba
2011-03-15 11:34:19 -07:00
Xavier Ducrohet
b243aabdaf Merge adaa12cd from honeycomb. do not merge.
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: I008334af605a89f240247a13c0024009247ec5af
2011-03-15 11:34:18 -07:00
Xavier Ducrohet
2652b618a8 Merge 6f2fb570 from honeycomb. do not merge.
LayoutLib: Fix dimension parsing to handle negative value.

Also make TypedArray.getDimensionPixelSize properly
handle negative values (which are not allowed).

Change-Id: I03ffcef5ab7ec7ef95419566776dcc798845fd88
2011-03-14 15:28:50 -07:00
Xavier Ducrohet
f354ad108c Merge c12b4093 from honeycomb. do not merge.
Change-Id: Icfbb70c097d87bf92415c6f0534346adde4c02fe
LayoutLib: Implement some missing add###() method in Path.
2011-03-14 15:28:50 -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
efe18b5e3f Merge 1911a6f7 into gingerbread. do not merge.
Change-Id: I6d56644c4ab1a70eb4a6d0d2e5d84ea4aa674041
LayoutLib: move tests to their own project.
2011-02-25 14:53:32 -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
031d2f8b6d LayoutLib: Adapt the HC layoutlib to GB. do not merge.
Change-Id: I0b2016987a65fabbc0ce7011514543349e9fb929
2011-02-23 19:47:18 -08:00
Xavier Ducrohet
4b52ec49fe LayoutLib: Original import of Honeycomb's layoutlib. do not merge.
frameworks/base.git @ f0a53435f14d23d9555fc46014352ee6a7baa647

Change-Id: Ibc215751693dc7650683b61bb458f7c8beaf8060
2011-02-23 19:47:02 -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