584 Commits

Author SHA1 Message Date
Xavier Ducrohet
ffb42f6c50 LayoutLib: Adapt to new LayoutLib
API now uses ResourceValue instead of IResourceValue
Capabilities renamed Capability

Change-Id: Ia5d2b6c8d536e020a1f5496fb2285f67fc4346c4
2010-12-10 11:40:27 -08:00
Kenny Root
ddb76c4644 Change assets to use 64-bit API
The asset system and supporting libraries were using off_t instead of
off64_t to access files larger than 2GB (32-bit signed). This change
replaces all off_t with off64_t and lseek64.

There is a new utils/Compat.h added for Mac OS compatibility.

Also fixed some size-related compiler warnings.

Bug: 3205336
Change-Id: I9097b3cb7a602e811fe52f245939d8975da55e9e
2010-12-08 11:21:30 -08:00
Xavier Ducrohet
8d74c978bb LayoutLib: explicitely override PropertyValuesHolder native code.
Change-Id: Ic7dd9efc990d01b20db144117cb11eb130349048
2010-12-07 12:10:51 -08:00
Xavier Ducrohet
864f33a9f8 Merge "LayoutLib: Update font object when text info changes in paint delegate" 2010-12-06 11:32:43 -08:00
Xavier Ducrohet
b5ddf041d6 LayoutLib: Update font object when text info changes in paint delegate
Change-Id: I6ff7e1ec4513918256aee99acc5ea298a5fdb8a8
2010-12-06 11:12:47 -08:00
Xavier Ducrohet
168677c9e2 LayoutLib: Fix logging.
- Use the new logging API
- remove log object reference everywhere but in Bridge
- all logging code accesses Bridge.getLog()
- prepareScene sets the current scene log object in Bridge.

Change-Id: Ib0517ccd6454c4baf218b6baa978a126f91671e7
2010-12-06 10:11:44 -08:00
Xavier Ducrohet
e1179ea065 LayoutLib: Animation support in insert/move/removeChild actions.
Also update to use the new SceneResult API.

Change-Id: Iaac6df0c250fbefc8758310c37e0cf47cae6875d
2010-12-03 11:50:36 -08:00
Xavier Ducrohet
01811aa862 LayoutLib: Create new layoutparams when moving a child
Change-Id: Ie2183490e8d26ef194030a9d87fe7745f24f1d83
2010-12-02 18:58:25 -08:00
Xavier Ducrohet
3c78f2de35 LayoutLib: Update to use the new moveChild API.
Also, return supported capabilities.

Change-Id: I824120d50f2865a667dc6c81d455ae19321966b6
2010-12-02 17:49:11 -08:00
Jeff Brown
9065504a63 Improve support for external keyboards.
Use Vendor ID, Product ID and optionally the Version to
locate keymaps and configuration files for external devices.

Moved virtual key definition parsing to native code so that
EventHub can identify touch screens with virtual keys and load
the appropriate key layout file.

Cleaned up a lot of old code in EventHub.

Fixed a regression in ViewRoot's fallback event handling.

Fixed a minor bug in FileMap that caused it to try to munmap
or close invalid handled when released if the attempt to map
the file failed.

Added a couple of new String8 conveniences for formatting strings.

Modified Tokenizer to fall back to open+read when mmap fails since
we can't mmap sysfs files as needed to open the virtual key
definition files in /sys/board_properties/.

Change-Id: I6ca5e5f9547619fd082ddac47e87ce185da69ee6
2010-12-02 16:01:32 -08:00
Xavier Ducrohet
c8aec064f9 Layoutlib: update with new add/movechild API.
Change-Id: I33e3a07cd7db7fe996d1f52b84b4b3bf21065a51
2010-12-02 12:26:23 -08:00
Xavier Ducrohet
9eb6d412af LayoutLib: Reuse canvas when possible.
Also moved the prepare/cleanupThread methods to Bridge
as they are not really specific to the scene anymore.

Change-Id: I7b93821913ce4d2fcbe3d8be489be6533ff87e57
2010-12-02 10:58:19 -08:00
Xavier Ducrohet
c14e7dd8ba LayoutLib: implement insert/move/removeChild.
Change-Id: I1c05ff4dc80e5ee4ea67d322acaf9c94276f84e1
2010-12-01 16:14:38 -08:00
Xavier Ducrohet
30c77d689e LayoutLib: get AWT image from new image factory.
Change-Id: Ib760af8a77fefac2571b8b4e48b4728e158aab2f
2010-11-29 21:10:24 -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
Jeff Brown
c97e6f9f35 Merge "Fix build on Linux due to different strrchr prototype." 2010-11-23 16:32:54 -08:00
Jeff Brown
ab841350f9 Fix build on Linux due to different strrchr prototype.
It seems Linux host build has a fancy strrchr overload that preserves
constness.  That's nice but it broke this.

Change-Id: I3c9b57b9ce9abc5d334d1e7b2498a3248bd20a6a
2010-11-23 16:29:54 -08:00
Jeff Brown
42e514b0d1 Merge "Port Emulator keymaps." 2010-11-23 15:51:27 -08:00
Jeff Brown
061cf75884 Port Emulator keymaps.
Also added a validation tool for keymaps (not currently integrated
into the build system but getting there).

This change brings back Android.mk with the intent that it will
be used to validate keymaps in a later change.

Added some missing keys that are present on phones.

Bug: 3215210
Bug: 3225421
Change-Id: Id817c6e2215164616942c51a42752915d9ceacd3
2010-11-23 15:26:48 -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
Kenny Root
7c71023b7f Add knowledge of mipmap to aapt
New mipmap drawable type that does not get filtered according to
configuration. Useful for things that get built as part of the system.

Change-Id: I556033d065e504079271dce79c23c90d3c387ce4
2010-11-22 22:28:44 -08:00
Xavier Ducrohet
9223b6737c Layoutlib: support for editing embedded layouts.
When Resources.getLayout(int) is called to return a parser
for an embedded layout, this queries the current parser for
a custom parser (Eclipse will provide one on top of the current
XML model being edited)

Change-Id: Ia9e837358f67daed0a835e1b3f4f50c0516ceee9
2010-11-19 16:17:27 -08:00
Xavier Ducrohet
fb25cae191 LayoutLib: use the new expand API.
Change-Id: I248de70ebe97aa6fb1cbcb5b6572a4a46c5ca1ba
2010-11-19 14:27:37 -08:00
Xavier Ducrohet
d73868859b LayoutLib: fix some tests
Change-Id: Iacd641e2fac663ff12fe2a08ba093c4eaa2e8862
2010-11-19 12:53:20 -08:00
Xavier Ducrohet
55acd60be3 Layoutlib: support viewkey in include nodes.
When an include tag is parsed, the custom bridge
code never has access to both parsers at the same
time.
The child parser is created out of an in (representing
the layout id), and the code inflating the content of
the include layout doesn't see the parent parser either.

This changeset adds a parser stack in the BridgeContext
in order to allow access to the parent parser when setting
the viewkey. This is only used if the current parser depth
is 1 (top node), as we only want to set the include
node to the top node of the included layout.

Change-Id: I2ac3b72a0c84a269d9019f44f98cbc0b615ab959
2010-11-18 22:17:14 -08:00
Xavier Ducrohet
755b46d597 Layoutlib: use int[] wrapper to use as map keys.
This fixes the SlidingDrawer that failed to load.

For some reason, in case of the SlidingDrawer, when the constructor
uses android.R.styleable.SlidingDrawer it's the same values but not
the same instance as the array read from android.R through reflection.

So what works for all other widgets, and has worked since the very first
layoutlib isn't working anymore, and we'll now have to use a wrapper
similarly to what we use in ADT in the project callback.

We should probably provide a single int[] wrapper class in layoutlib
API for all to use.

Change-Id: I4d7d038540f8a24541a588696f1059a020b589e5
2010-11-18 19:51:30 -08:00
Xavier Ducrohet
5a09488a15 Layoutlib: Properly dispose of bitmap delegate.
This is done by initializing the android.util.Finalizers that's
reponsible for calling out to the native bitmap destructor.
Also implemented the native bitmap destructor

Also fix Bridge by removing obsolete API methods, and removing
some unneeded synchronized blocks now that the whole rendering
(and scene creation) is protected by a synchronized on the bridge
object anyway.

Change-Id: Ie1792da6db354836542dfc11f457fe4a6d78ddfb
2010-11-18 18:26:55 -08:00
Xavier Ducrohet
4d9e32f07c Layoutlib: support XML based ColorStateList.
This fixes the rendering of the TabHost in Eclipse.

Change-Id: I333c4d65b18df76871e24a04f0a888ae42ba40ef
2010-11-17 18:26:04 -08:00
Xavier Ducrohet
9e27936e4a Layoutlib: Fix alpha support in Canvas/Paint.
Change-Id: I359098cfc542a7a0b7d99478c0eb13587b4439d0
2010-11-12 14:20:45 -08:00
Xavier Ducrohet
cf52390eee Layoutlib: Fill the default prop value map for View objects.
Change-Id: I35426ced17a10eb092fac2153276f1202692876f
2010-11-12 14:02:49 -08:00
Tor Norbye
135f80dcb4 Fix fill color alpha in layoutlib
new Color(int) ignores the upper 8 bits - it creates a color without
an alpha channel.  In order to pass in rgba we have to use a different
constructor, new Color(int,true).

(In the layout library API we should also specify that the custom
color, if specified, needs to include an alpha, or in particular add
in 0xFF<<24 if the color is opaque.)

Change-Id: I1c44caed8a5780e61b1c799f3b45bef3eb7bc97b
2010-11-11 21:59:23 -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
c2e9651bf3 Layoutlib: New bridge implementation using the new API 5.
Since the new API prepare for stateful layoutlib, major
reorganization of the code.

New "android" sub-package for all extended android classes.
  Also moved BridgeInflater in here so that all extended classes
  are in this package. Only delegates and classes replacing
  renamed classes are in their original android.* packages.
  Also created full file for the empty implementations of
  IWindow and IWindowSession.
New "impl" for the dirty work implementation.
Main package contains the basic implementation of the API.

Most of the code that was in Bridge is now in .impl.LayoutSceneImpl,
with the main init/inflate/render code split into the contrustrutor,
inflate() and render().

Change-Id: Ie15b15e5a1b2388cd6ef82e518345b1fc02ec981
2010-11-11 10:08:19 -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
e0c763f54f Layoutlib: more text drawing.
Change-Id: I32f46d23e746b095be0577a53b61567a868f0b8a
2010-11-08 16:13:28 -08:00
Jean-Baptiste Queru
82849afd71 am 3442611e: am 5580e44c: Merge "Support changing style parent in overlays"
* commit '3442611ee11b2987c83054fe3c7ed5521f27f052':
  Support changing style parent in overlays
2010-11-06 16:25:03 -07:00
Scott Main
41a4833bf2 am 4da6efc8: am 46151652: Merge "fix xlarge support in aapt for gingerbread" into gingerbread
* commit '4da6efc8a3ecfcf46a8988ad1d277ae00ed1f58c':
  fix xlarge support in aapt for gingerbread
2010-11-06 16:24:28 -07:00
Jean-Baptiste Queru
3442611ee1 am 5580e44c: Merge "Support changing style parent in overlays"
* commit '5580e44c250944f5cd011b2682eea5cc2de9706c':
  Support changing style parent in overlays
2010-11-05 14:05:41 -07:00
Scott Main
4da6efc8a3 am 46151652: Merge "fix xlarge support in aapt for gingerbread" into gingerbread
* commit '46151652b8dc562f4a3332e1d12fa799e3638ea8':
  fix xlarge support in aapt for gingerbread
2010-11-05 13:57:41 -07:00
Scott Main
d58fb97ddf fix xlarge support in aapt for gingerbread
Change-Id: I4d8872fb839a6eadc538055215d4455af328846c
2010-11-04 18:33:05 -07:00
Jean-Baptiste Queru
5580e44c25 Merge "Support changing style parent in overlays" 2010-11-04 07:26:37 -07: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
abff653ce8 More layout Canvas/Paint implementation.
Change-Id: Ib3da4a4b2259dc7c53b24444b5c0b78cee15d387
2010-11-01 18:45:20 -07:00
Xavier Ducrohet
5802deabf0 More implementation of the layoutlib Paint/Canvas delegates.
Change-Id: I0c0029b9a679af4ae0178488f70b2a90292ea42d
2010-11-01 17:52:42 -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
65dc3974a1 Fix the layoutlib_bridge .classpath to not use the full layoutlib
Instead this uses the actual output of layoutlib_create, which is
all the modified classes before the content of the bridge is added
to form layoutlib.

Change-Id: I22755f38800cd69206834ff9594a99cb0c1d2139
2010-10-27 18:22:03 -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