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
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
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.
This is a new way of determining whether an application requires
specific orientations, done by looking at any requirements in its
activity tags. Note that this won't catch all possible issues,
because applications can still force an orientation through Java
APIs, but the vast majority of applications that actually require
a specific orientation should be doing it this way because it the
easiest way and the only way to cleanly launch into the app from
a different orientation without doing some serious activity tricks.
Change-Id: I11d32104f6bc3d2a72aeeff1ca150b8f1c9f5588
Updates aapt to know about these. Also updates aapt badging to:
- No longer crash due to the change to how we match unspecified
configuration resources.
- Report the new "smallest screen" supported screen configs.
- Infer old screen size buckets based on new smallest width attrs.
- Report all of the different labels and icons in an app.
Change-Id: I7376042b817391bd070f549cebbc7f03be4635c8
* commit 'ee1b497648a0c3c03b09c4739619f23315d491fb':
Cherrypick 5b61ea6b from hc-mr1
LayoutLib: enable the LAYOUT_ONLY capability.
Merge dba35f1b from honeycomb-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
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