62 Commits

Author SHA1 Message Date
Xavier Ducrohet
f1dee199a0 Layoutlib: add support for ITextServicesManager.
This include a fix in layoutlib_create to properly handle
delegating a static method of an inner class (was broken and
only worked on non static method).

Added a few comments here and there to *_Accessor classes so
that it's a bit more obvious what they are for and how they are
used.

Change-Id: Ifc31dd1a006393bb0c08e22b6a17f500dd62e090
2011-10-03 09:06:07 -07:00
Xavier Ducrohet
7f9f99ea11 Make some methods/fields package private so that layoutlib can access them.
Change-Id: I4aeadfbaf8a4f6a459fa19937c21ac23d9e5fb64
2011-08-11 12:57:51 -07:00
Philip Milne
ea670054d6 Implement native println_native in android.util.Log for LayoutLib
Change-Id: I2ab83a131468490cf789bf17f9c12b6360e953a4
2011-08-09 11:25:25 -07:00
Xavier Ducrohet
d2f664d42c Misc layoutlib fix in preparation of the access change in framework code.
Change-Id: I873adb7345514be6daa5c4fea4ebabb515f203e2
2011-08-01 15:08:26 -07:00
Xavier Ducrohet
4f727fbdc3 am ed07215e: am 55775e5f: am e70b2b8f: am 9bcf26ea: Merge "Layoutlib_create flag -p: don\'t change all accesses to public."
* commit 'ed07215e482cae1ffedbba707284821b3afc310f':
  Layoutlib_create flag -p: don't change all accesses to public.
2011-07-25 17:24:56 -07:00
Xavier Ducrohet
ed07215e48 am 55775e5f: am e70b2b8f: am 9bcf26ea: Merge "Layoutlib_create flag -p: don\'t change all accesses to public."
* commit '55775e5f34af8d7c22ab3212c253b3a7d34a6f8a':
  Layoutlib_create flag -p: don't change all accesses to public.
2011-07-25 12:21:17 -07:00
Xavier Ducrohet
e70b2b8fe0 am 9bcf26ea: Merge "Layoutlib_create flag -p: don\'t change all accesses to public."
* commit '9bcf26ea7aa108ce4bf4e973b4774d3e60eebafe':
  Layoutlib_create flag -p: don't change all accesses to public.
2011-07-21 16:23:18 -07:00
Raphael Moll
caed59d90d Layoutlib_create flag -p: don't change all accesses to public.
Change-Id: Icb1709ed0cb275a5a51ca34030695a5e94091499
2011-07-19 22:36:13 -07:00
Xavier Ducrohet
af64556de0 Layoutlib: misc fix + start of AndroidBidi support.
Change-Id: If2ce0b683da8cce01679322d503eed8dd474e521
2011-07-19 15:10:23 -07:00
Xavier Ducrohet
96131eef38 LayoutLib: updated fake accessbility manager and ensure there's an InputMethodManager
We had replaced the accessibility Manager but it lacked some new API. Obvisouly
this is fragile and should be fixed, but this works for now.

After fixing this there was another issue with the lack of InputMethodManager.
To fix this I had to create an implementation of IInputMethodManager which
normally comes from a binder object.

I may want to do a similar trick with the accessibility manager later.

Change-Id: I28c6494e333f39072f348d0199124efac93256a5
2011-07-12 12:35:50 -07:00
Xavier Ducrohet
0a49635b17 LayoutLib: Delegate for Display and IWindowManager implementation.
This allows ViewConfiguration to be properly implemented which is now
required for the rendering to happen.

Change-Id: I55629689fa8f5f874b43fcac2aa0789ce02d58f4
2011-07-12 11:49:22 -07:00
Raphael Moll
f9705ef6d3 am 2b5f2d01: am e2b41b0d: Merge "Laoutlib_creator: keep original of delegate methods."
* commit '2b5f2d01558ba338042f486c754f63873c4061fe':
  Laoutlib_creator: keep original of delegate methods.
2011-06-22 18:05:22 -07:00
Raphael Moll
2b5f2d0155 am e2b41b0d: Merge "Laoutlib_creator: keep original of delegate methods."
* commit 'e2b41b0d5c8db85a60cd190c7094052db61114b2':
  Laoutlib_creator: keep original of delegate methods.
2011-06-22 17:44: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
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
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
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
13bdc3355c LayoutLib: improved rendering for system/title/action bars.
Change-Id: I926531e9ad4a7b98e04e23cac3837794f7c89449
2011-02-06 10:58:16 -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
345f866bfd Make TimePicker/DatePicker/CalendarView render in Eclipse.
Change-Id: Id5313a6f0f53bf45f6eaabc0e10fcf0660eeac08
2011-02-02 14:04:50 -08:00
Raphael
811820f440 LayoutLib.Create: support Outer_Inner_Delegate renaming.
When generating delegates, LayoutLib.Create support renaming
inner classes. Only one level of inner class is supported.

The method Outer$Inner#get(...) generates a call to:
  static Outer_Inner_Delegate#get(Outer instance, Outer$Inner instance, ...)

Change-Id: Ie70f2b8e5e5f311ed9c7f26b7f64637ae6157a51
2011-01-31 13:16:04 -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
Xavier Ducrohet
0de1607093 LayoutLib: fix XmlUtils.convertValueToInt
It looks like the device implementation of Integer.parseInt
is able to handle converting hexa value > 80000000 while the
desktop VM cannot.

This patch provide a fix for this.

While implementing it and running the TestDegates test I realized
that some delegate methods for Region were mising, so this adds them
too.

Change-Id: Ifee1efd47c8c52adc2f4658ec4fc8bd55adb84b4
2011-01-11 12:15:15 -08:00
Xavier Ducrohet
b44b43b157 LayoutLib: Support Region through delegates.
also finish supporting some clip operation
on the canvas.

Change-Id: I743b9e52a7aa6e9340506f1c904cc1cfbf3ff81f
2010-12-24 00:21:51 -08:00
Xavier Ducrohet
d43909c750 LayoutLib: add support for unsupported drawing modifiers.
DrawFilter, Rasterizer, ColorFilter and MaskFilter
are not supported but we need to provide their
JNI counterparts anyway, to at least display warnings
when they are used.

Also improved the API to query Paint for Shaders
and PathEffects, and clean up some code by
moving asserts into the DelegateManager.

Change-Id: I8942514565d28576d5608c6373bda25d86d42ff2
2010-12-24 00:21:51 -08:00
Xavier Ducrohet
d348b6eaa9 LayoutLib: support for Path and BitmapShader using delegates.
Also created delegates for all missing shader, xfermode
and patheffect classes. Moved the logic of the xfermode,
and patheffects that was in Canvas_Delegate into the
xfermode/patheffect classes, and added support (in all
3 clases) for knowing if the shader/xfermode/patheffect
is actually supported or not. Make use of fidelityWarning
in LayoutLog if they are not.
2010-12-21 10:43:18 -08:00
Xavier Ducrohet
8d74c978bb LayoutLib: explicitely override PropertyValuesHolder native code.
Change-Id: Ic7dd9efc990d01b20db144117cb11eb130349048
2010-12-07 12:10:51 -08:00
Xavier Ducrohet
2eea6fab1c Layoutlib: Animation support.
New locking mechanims to prevent concurrent renderings.

There's now a thread specific prepareThread() method (only
prepares the looper) and its associated cleanupThread().

For the rendering itself, acquire must be called before doing
any type of Android specific work on the scene (inflate or rendering)
After instantiation, init() must be called, which also acts as acquire.

Added a lot of checks to make sure method aren't called without
acquire or if scenes try to be rendered while acquire was called
from the same thread but on another scene.

Animation implementation:
- Handler delegate to use our own queue (since the animation runs
  through handler messages). This uses a callback to process
  the message. This callback is per-thread and only used in
  animation threads.
- SystemClock delegate to provide clock implementation.
- AnimationThread to handle playing the animation and calling back
  to the animation listener.

Change-Id: Ia39aba7ed476759df1da3200e413fe3e92590d15
2010-11-29 12:05:43 -08:00
Xavier Ducrohet
2d56b273ef Layoutlib: use default nine patch classes.
Move away from using our own implementation of NinePatchDrawable.
Now use native delegate for a few methods of NinePatch.

The byte[] used to describe the 9-patch chunk is entirely controlled
by the delegate. Therefore, while the default version (JNI) use the
array as a representation of a C struct, this version uses the array
as a serialized version of NinePatchChunk.

A cache mechanism using SoftReferences allows us to not deserialize
the array every time rendering needs to access the chunk itself.

The Bridge-level cache mechanism for bitmaps and nine-patches as
changed. Since the new nine-patches doesn't hold the bitmap
data anymore (it's stored in a normal Android bitmap which
is cached itself through the cache), then the nine-patch cache
has been changed to only contain the nine patch chunk.

Also initialize the canvas with the display metrics to prepare
for correct scaling when density of the assets don't match the target
density.

Still to come: actual density support in the 9-patch drawing code.

Change-Id: Ibefcccf4432e1986e8436e0c41a0107741593536
2010-11-23 11:54:25 -08:00
Xavier Ducrohet
071dee288c Misc fix in layoutlib bridge + View.isIneditMode as delegate.
Change-Id: Ideab29167e933203da99d4270cebcb777726201f
2010-11-11 17:39:50 -08:00
Xavier Ducrohet
7f77524395 Layoutlib: Load fragments
This change does the following:
- Make the bridge context extend Activity instead of Context
so that it can act as a view factory. This is needed because
the Activity is used as factory for Fragment objects.

- Override the default Fragment.instantiate(...) method
through a delegate. This is done to load the Fragment
classes located in the project (similar to custom views).

Change-Id: If62e7c9ff2b7585677077ad825aa1c3591d1b5e0
2010-11-08 18:38:12 -08:00
Xavier Ducrohet
9c05b39728 Layoutlib native delegate: FloatMath.
While the difference is pretty minor since it's a small class,
the point is that the unit test will ensure that we detect
new methods added to FloatMath more easily.

Change-Id: Ia8bfee231cc4ae0cfeb18692be86d02649c187d5
2010-11-03 19:15:07 -07:00
Xavier Ducrohet
4b606da91d Layoutlib native delegate: path effects and xfermode.
Change-Id: Iafaac6dbaf452e2dba3e77c801089dad33ac4ea9
2010-11-03 19:15:07 -07:00
Xavier Ducrohet
251d2e9924 Layoutlib native delegate: primitive shapes and shaders
Change-Id: Id2b0c6231589e82d8e96c9f019042eba348a6583
2010-11-03 13:23:22 -07:00
Xavier Ducrohet
9f63ff263b Layoutlib Canvas and Paint implementation through native delegates
Also fix native delegate generation to put "this" parameter even
for methods that don't have any parameters.

Change-Id: I5dd0c505871370ff7b4cda16de84a5b3ae438f73
2010-11-01 13:31:47 -07:00
Xavier Ducrohet
5de11a18e9 Implement the layoutlib Bitmap through a native delegate.
This does not implement all the native methods of the
android.graphics.Bitmap class, only what's needed to draw an
ImageView object. The rest will be implemented after Canvas and
Paint have been moved to the native delegate.

Change-Id: Ia0c3b2cafa03871c298deaef5817a25ac1c35521
2010-10-29 16:01:40 -07:00
Xavier Ducrohet
5e7ed8da0d Move layoutlib typeface implementation to delegate.
Also move BridgeContentProvider to its own class to make it
less messy in BridgeContentResolver.

Change-Id: Id3462218b500d43d4c9b20b25326ad24e4106fa5
2010-10-27 18:12:27 -07:00
Xavier Ducrohet
4f291d33e1 Reimplement the native matrix method using the new delegate way.
Instead of renaming the old Matrix class into _Original_Matrix
and have layoutlib provide a full new implementation of Matrix,
we keep the old one by only modifying it to implement the native
methods which calls out to a new Matrix_Delegate class.

The goal is to not have to maintain the java portion in
sync between the framework and the layoutlib version.

Change-Id: I3e1aefffbae45e91b75331c0c6ff2260323deacd
2010-10-27 09:55:58 -07:00
Xavier Ducrohet
d815e37048 Fix rendering of digitalClock/Gallery in Eclipse editors.
Change-Id: Iedcd3184cd9f34be8d0695a51eda953ac68683ce
2010-10-26 14:29:23 -07:00
Raphael
f241c40476 Revert "Fix rendering of digitalClock/Gallery in Eclipse editors."
This reverts commit 25e96ce7b99f9736a6024d25bd65a83774c7640f.
2010-10-26 13:55:10 -07:00
Xavier Ducrohet
68404a0125 am a44a5e02: am 1b6180ec: Merge "Fix rendering of digitalClock/Gallery in Eclipse editors." into gingerbread 2010-10-26 12:13:32 -07:00
Xavier Ducrohet
a44a5e02d2 am 1b6180ec: Merge "Fix rendering of digitalClock/Gallery in Eclipse editors." into gingerbread 2010-10-26 12:10:28 -07:00
Xavier Ducrohet
25e96ce7b9 Fix rendering of digitalClock/Gallery in Eclipse editors.
Change-Id: I80f4f90b173529632eaf2fbc3bb5471b7ede8216
2010-10-26 11:18:39 -07:00
Raphael
e2e8ba904b Layoutlib_Create: Fix order of class adapters.
The Transform adapter was running last, instead of
running on the output of the Delegate adapter.

Change-Id: I2cd777add7b0972c6bb197aaac6693d39dd5a103
2010-10-22 15:29:04 -07:00
Raphael
280372e2c7 Layoutlib_create: fix binary name of delegate methods.
Change-Id: Iebd7d730b23e12f770e6ecadafb2f5c3459958db
2010-10-22 13:58:31 -07:00
Raphael
d556d8ba36 Remove dependency on ASM util classes.
Change-Id: I975b103f8c207e727699e4135170755f6ba2a084
2010-10-22 13:33:50 -07:00
Raphael
bc10180624 layoutlib_create: Generate delegate to implement native methods.
- Some new parameters are added to CreateInfo with the list of methods
  or classes to override with delegates.
- DelegateClassAdapter and DelegateMethodAdapter do the work... see javadoc.

Change-Id: I0657cd929837181d81c65db7051d8ccbdc59c741
2010-09-29 14:45:20 -07:00