235 Commits

Author SHA1 Message Date
Deepanshu Gupta
214466c777 Include EpicenterTranslateClipReveal in LayoutLib
Needed by Spinner to create transitions that are then ignored :)

Change-Id: Ibe7167a643ecb186e97c9af446c0e1d2eb2d6f86
2015-07-29 14:30:05 -07:00
Deepanshu Gupta
c714501141 Revert "Replace infinite loop with foreach."
This reverts commit c77f9c76e4142db8dd76a28ad99b8f0395b82eba.

Class.getDeclaredClasses() doesn't return anonymous inner class and
hence the change was wrong.

The revert doesn't undo the typo fixed in the original change.

Change-Id: Id0595c4bc3db1185dd1ce39808a6b8c3610a1e11
2015-07-07 13:13:48 -07:00
Deepanshu Gupta
c77f9c76e4 Replace infinite loop with foreach.
A method call exists to find all inner classes. Use it instead of
manually enumerating the possibilities and checking.

Also fix a typo.

Change-Id: I2af678e92ea0c11b53617b247d8cda324391c185
2015-06-30 15:36:34 -07:00
Deepanshu Gupta
86caef1892 LayoutLib: Skip classes from java package.
Classes in "java" package can't be defined at runtime anyway. No use
including them in LayoutLib.

Change-Id: I7e7c46f0d74e32c893b23093828569b4fa5e3a73
2015-06-01 14:43:28 -07:00
Deepanshu Gupta
bcbe9ba0f9 Merge "Include Shapes in LayoutLib." into mnc-dev 2015-05-26 22:37:27 +00:00
Deepanshu Gupta
59164ec055 Include Shapes in LayoutLib.
Change-Id: Ifb32882c478f8d407ad904e224b67fe2bd65dc08
2015-05-26 16:28:53 +00:00
Deepanshu Gupta
476e582d2f LayoutLib: Change nullity annotations.
Switch from using tools nullity annotations (com.android.annotations)
to android framework annotations (android.annotation).

A new sdk-common prebuilt is required for LayoutLib tests. The new
sdk-common requires an updated tools-common. The updated tools-common
doesn't have nullity annotations. So, instead of adding the annotation
dependency, just reuse the platform ones. This also paves the way to
include other platform annotations like IdRes etc.

Change-Id: I87b8f767d3681d914abe7d1329e26a87f49f50a7
2015-05-22 17:57:29 -07:00
Deepanshu Gupta
d5b8284545 Make DatePicker rendering not fail.
Ensures that having a DatePicker in the layout doesn't crash the
complete rendering. The rendering is still not perfect, but at least it
works.

- Return a non-null window token so that ViewPager thinks that it's
  attached to a window and doesn't skip populating the views.
- Fix a style not found issue.

Change-Id: Ied2b71de5b32bcb640bf4ec445e8a39509f800e9
2015-05-20 18:01:48 -07:00
Deepanshu Gupta
bfc9c3bcbe Inject anonymous inner classes of injected classes
When injecting classes in LayoutLib (eg. CreateInfo), so that LayoutLib
can refer back to the changes, also inject the anonymous inner classes.
Without this, the injected classes are not loadable. Although, LayoutLib
itself doesn't load these classes, but some tests do.

Change-Id: Ib5f6b779ef4d79dec8d614d3dbb26eeac88a1064
2015-05-20 23:31:31 +00:00
Deepanshu Gupta
f8ea750455 Make Context.getClassLoader() work.
Context.getClassLoader() is used by the LayoutInflater and can be used
by custom views. However, when called from the LayoutInflater, this
needs to return only the Framework classes. This is so that the IDE gets
a chance to instantiate the custom views, which helps in better error
reporting and better fallback in case of exceptions, like MockView.

To workaround this need of the same method returning different results
based on where it's called from, the method call in LayoutInflater is
renamed to getFrameworkClassLoader() and the new method is injected in
Context. The implementation of getFrameworkClassLoader() maintains the
existing behaviour of getClassLoader().

Context.getClassLoader() is now modified to return classes from both
Framework and the app namespace.

Also, update the list of packages to search for Framework views.

Change-Id: I1a6be4aa1fc5c1c5520b5440a348a52f10b6eb3b
2015-05-19 19:56:20 -07:00
Deepanshu Gupta
eca056926a Load ICU data in LayoutLib
Also return the correct version numbers for ICU data.

Change-Id: I7de973b5553c73948870b97bdc12a880bb2fdd85
2015-05-13 18:15:32 -07:00
Deepanshu Gupta
d77b9ed7dc Add missing delegates for M preview.
- Remove ICU dependency (use the version bundled with platform).
- Restructure intelliJ project to move dependencies to module.
- Minor fixes to layoutlib tests.

TODO:
- Load ICU data.
- Hyphenator doesn't work.
- High quality line breaker not present.

Change-Id: I965e096e17bfc97ee995a649c3f4f6f64bb4f70d
2015-05-13 18:15:20 -07:00
Jorim Jaggi
b10e33ff80 Split up android.policy into framework.jar and services.jar 1/3
Change-Id: Ifd69f1f3dd308a7e17a1442e2f3950da8b03cec4
2015-02-10 14:56:02 +01:00
Deepanshu Gupta
321bf43315 am 2d14feb4: Merge "Replace java.util.LinkedHashMap.eldest()" into lmp-mr1-dev
automerge: 03c822a

* commit '03c822aa585c319fb9cd05f392d8518501cc4f79':
  Replace java.util.LinkedHashMap.eldest()
2015-01-08 01:49:23 +00:00
Deepanshu Gupta
1330f79f95 Replace java.util.LinkedHashMap.eldest()
Provide an alternate implementation for the above method and replace the
calls to it, since the method is not available on host VM.

Change-Id: I329d86b457d1859b137da8fb2790ddd7f8efa788
2015-01-07 16:32:21 -08:00
Deepanshu Gupta
e88c120ebf resolve conflict for 8c831b2f -> lmp-mr1-dev-plus-aosp again
The earlier resolution (a2a5ce49b29b8e3bf3cd695ff9f968e5579f4be2)
wasn't the right one. This fixes it.

Change-Id: I6a6dc908d3e7dd510064a46df932d129a58eed98
2015-01-06 14:58:37 -08:00
Deepanshu Gupta
86f96d07c7 am 0db2524c: am b2ebb968: Merge "Remove Time from CreateInfo" into lmp-dev
* commit '0db2524caa01022629075a113d3370a1b7c3da30':
  Remove Time from CreateInfo
2015-01-06 22:22:56 +00:00
Deepanshu Gupta
b88a65df73 am cec8e5a1: am f861c0ce: Merge "Fix default initial value for preferences" into lmp-dev
* commit 'cec8e5a10de413c733223b8b1cc11b70c6254647':
  Fix default initial value for preferences
2015-01-06 22:22:40 +00:00
Deepanshu Gupta
2bd01ebfa9 am 7ed14549: am 7081a114: Merge "Add preferences rendering." into lmp-dev
* commit '7ed145493d3f5bea32c567980f77cc42f613197e':
  Add preferences rendering.
2015-01-06 22:22:36 +00:00
Deepanshu Gupta
4022272a4f Remove Time from CreateInfo
Time_Delegate was removed in change with Change-Id:
Iae5ef65678f0e6c7c5af520c45bd15980ce3fa55. But the name wasn't removed
from CreateInfo. This didn't cause any problems at runtime, but caused
the layoutlib_create tests to fail.

Change-Id: I079b1e024b97d389eb07d4f088fd860efbb02eb3
2015-01-02 13:55:20 -08:00
Deepanshu Gupta
f5b02eb7c4 resolved conflicts for a0bc2e7e to lmp-mr1-dev
The original change wasn't properly merged into lmp-mr1-dev because of
merge conflicts. This change manually resolves the conflicts. The main
reason for the conflict was that TimePickerSpinnerDelegate was swapped
with TimePickerClockDelegate.

This change also fixes the typo in the original change which was fixed
in a subsequent change.

Original commit: 12b6d29b7b5592dcfb6e6fd6f0c21a40f37d014a
fix for typo: cb09bc45c58740af953874f9915306d351fc3d9d

Change-Id: I50bf8c2d86318f632465a38adfad16d1382a9319
2014-12-30 14:07:29 -08:00
Deepanshu Gupta
dfeffd4c0a Fix default initial value for preferences
NO_SQ: Depends on unsubmitted changes.
Change-Id: I061cf71f6167d382e9ef060abeb4d5cff83c4104
2014-12-23 12:04:30 -08:00
Deepanshu Gupta
10bb1371dc Add preferences rendering.
NO_SQ: Depends on updating layoutlib-api-prebuilt.jar
Change-Id: Iae93ab74c478e6f2158e1528467bec9ee2d7ee9b
2014-12-23 12:04:30 -08:00
Deepanshu Gupta
302a7cc13a am 4628d51a: am 141c7614: Merge "Fix AnalogClock rendering" into lmp-dev
* commit '4628d51a0d01641ca7fe2cf8403ad551ea6f50ce':
  Fix AnalogClock rendering
2014-12-04 07:00:14 +00:00
Deepanshu Gupta
17a6170c62 Fix AnalogClock rendering
1. Change calls to java.lang.System.log* since they don't exist on the
host.
2. Clean up method rewrite mechanism in ReplaceMethodCallsAdapter.
3. Stub out creation of uninitialized GregorianCalendar.
4. Memory map the time zone data base file and provide a custom
implementation of BufferIterator for use by ZoneInfoDB
5. Delete unused Time_Delegate

Also fixed a comment in BridgeAssetManager and an error message in
FontFamily_Delegate.

Bug: http://b.android.com/79160
Change-Id: Iae5ef65678f0e6c7c5af520c45bd15980ce3fa55
2014-11-26 12:03:39 +00:00
Deepanshu Gupta
12b6d29b7b LayoutLib: Stub AM/PM keycodes in Time Picker.
TimePickerSpinnerDelegate doesn't need to deal with input when running
inside LayoutLib. So, we just return the keycodes as if it's running in
English locale.

Bug: http://b.android.com/79189
Change-Id: Ife0ae91a1e34a8dac379bc1dda1c1c8ed461c164
2014-11-18 22:02:40 +00:00
Deepanshu Gupta
2c5cddbd07 Don't skip loading object animator.
This is used by Buttons as part of StateListAnimator.

Change-Id: Id370869e71898d46e11bbd17ad31169c9f9f5274
2014-11-11 15:21:19 +00:00
Deepanshu Gupta
796e9b7f99 Add primitive shadows support to LayoutLib
The shadows rendered are not the same as rendered by the framework. The
main purpose of the shadows here is let the user know when shadows will
be cast.

Currently rectangular shadows are available in only two intensities. Any
elevation below 10dp uses one shadow and any elevation over 10 dp uses
the other.

Also, even though the code for arbitrary shapes exist, it doesn't quite
work yet. No shadows are visible when that code is run.

Change-Id: Ie8235ffccf1d3809713f5d8f82afde434817d6b2
2014-11-07 22:26:11 +00:00
Deepanshu Gupta
75bf1b1c6a Merge "Skip loading animations." into lmp-dev 2014-10-29 00:13:54 +00:00
Deepanshu Gupta
0b42936d86 Skip loading animations.
This is a temporary fix until Path.approximate() is supported.

Bug: http://b.android.com/77865
Change-Id: I28739e58f51fabaaf1dcc1c9be61cd0b17e84eec
2014-10-28 15:07:25 -07:00
Deepanshu Gupta
b6444c4309 Fix multiple styles case in resource resolution.
When multiple styles are applied to a theme, we only remembered the last
one. This change fixes the issue.

Change-Id: I46490e882edc3eabe522a641c83366234b5bb25d
2014-10-28 11:11:10 -07:00
Deepanshu Gupta
908a4f9a43 am 4f133894: Exclude KXmlParser from LayoutLib.
* commit '4f133894a6e98d8d30557ea42cec92cfb21fa5c9':
  Exclude KXmlParser from LayoutLib.
2014-10-08 17:34:12 +00:00
Deepanshu Gupta
4f133894a6 Exclude KXmlParser from LayoutLib.
The class was incorrectly being included in the LayoutLib.

Change-Id: I3c86662efa068019fe9165f2fc49a00d0a1b7f2d
2014-10-08 10:12:11 -07:00
Deepanshu Gupta
11b14e3996 LayoutLib: Use ICU's line break algo. [DO NOT MERGE]
Change-Id: I7e5b0ab7423a72f5a4b0e1163d0a537f0b03ba07
(cherry picked from commit 760f6394d0f65fbb5365186e8e068d53c506b653)
2014-10-08 02:05:05 +00:00
Deepanshu Gupta
039d5849ea Build layoutlib create tests as part of sdk build. [DO NOT MERGE]
LayoutLib Create tests are now built whenever LayoutLib create is built.

Change-Id: Id215e8690e435019579dba1734090a0d585f37e1
(cherry picked from commit 4efe6264f1251fa200427f54ea6f5dd4c4d03665)
2014-10-01 12:44:05 -07:00
Deepanshu Gupta
6fb5fdc233 Add layoutlib tests to DIST_DIR [DO NOT MERGE]
Add the layoutlib and layoutlib-create tests to DIST_DIR for sdk
targets. These can be used for continuous testing on the build server.

Change-Id: I747dddcddfd8009937668bec4d75cb99bf63235f
(cherry picked from commit f9c749c9901c459f77ffc6f4fbbc15f4142c6e0a)
2014-10-01 12:43:52 -07:00
Deepanshu Gupta
bd4133133a Build layoutlib_create tests. [DO NOT MERGE]
Change-Id: Ia13a090f8ec29b2b2a107825b6a13d7db77e6d61
(cherry picked from commit 2294f939bc79ce902a40db37def64cc28394d56b)
2014-10-01 12:43:43 -07:00
Deepanshu Gupta
b6a37d897a Add testing framework to LayoutLib. [DO NOT MERGE]
This change adds an end to end test which loads the framework resources
and a test app and ensures that no exceptions or warnings are thrown.

The change also adds project configuration for intelliJ.

Change-Id: I7b67c0f1a2af2dac95df7f3231cab537b9826d7d
(cherry picked from commit a8e9517470869fa29946ae1fa1ceeb24c7970391)
2014-10-01 12:43:11 -07:00
Deepanshu Gupta
8f92d92a09 Build layoutlib create tests as part of sdk build.
LayoutLib Create tests are now built whenever LayoutLib create is built.

Change-Id: Id215e8690e435019579dba1734090a0d585f37e1
2014-09-08 18:38:57 -07:00
Deepanshu Gupta
a0904bf7aa Add layoutlib tests to DIST_DIR
Add the layoutlib and layoutlib-create tests to DIST_DIR for sdk
targets. These can be used for continuous testing on the build server.

Change-Id: I747dddcddfd8009937668bec4d75cb99bf63235f
2014-09-05 14:01:27 -07:00
Deepanshu Gupta
b988c8fa66 Build layoutlib_create tests.
Change-Id: Ia13a090f8ec29b2b2a107825b6a13d7db77e6d61
2014-09-03 12:57:12 -07:00
Deepanshu Gupta
6ebeefa04c am 904d7711: am 7b561be3: am 09c3c2ed: am ba31d628: am db94ea9e: am f970d2c2: am 79c3f678: am 206c691b: am 72cf03a2: am 3a544a81: resolved conflicts for merge of a232a68d to jb-mr1.1-docs
* commit '904d77118bab63139174470ef728ca9a53e75a15':
  Fix SystemProperties in LayoutLib.
2014-08-06 22:51:47 +00:00
Deepanshu Gupta
7b561be3a6 am 09c3c2ed: am ba31d628: am db94ea9e: am f970d2c2: am 79c3f678: am 206c691b: am 72cf03a2: am 3a544a81: resolved conflicts for merge of a232a68d to jb-mr1.1-docs
* commit '09c3c2edb2391d3ffed9a07ec360b9f75b9f7637':
  Fix SystemProperties in LayoutLib.
2014-08-06 22:37:10 +00:00
Deepanshu Gupta
db94ea9ed0 am f970d2c2: am 79c3f678: am 206c691b: am 72cf03a2: am 3a544a81: resolved conflicts for merge of a232a68d to jb-mr1.1-docs
* commit 'f970d2c201649843b8d51d094b865f16b15bc0bc':
  Fix SystemProperties in LayoutLib.
2014-08-06 22:21:54 +00:00
Deepanshu Gupta
f970d2c201 am 79c3f678: am 206c691b: am 72cf03a2: am 3a544a81: resolved conflicts for merge of a232a68d to jb-mr1.1-docs
* commit '79c3f678d21f6b3c058623217cbe5dd57a553fe8':
  Fix SystemProperties in LayoutLib.
2014-08-06 22:18:04 +00:00
Deepanshu Gupta
72cf03a27a am 3a544a81: resolved conflicts for merge of a232a68d to jb-mr1.1-docs
* commit '3a544a81b3d2d529b2995f4b5db2077760d440b5':
  Fix SystemProperties in LayoutLib.
2014-08-06 22:05:38 +00:00
Deepanshu Gupta
3a544a81b3 resolved conflicts for merge of a232a68d to jb-mr1.1-docs
Change-Id: I1ea220e3e0a81880db68abab87beab56dc4a336c
2014-08-06 15:00:14 -07:00
Deepanshu Gupta
a232a68d4c resolved conflicts for merge of 5476cfee to jb-mr1-dev
Change-Id: I5197271e6fdd36fed9ca9f9b7221d9a99141a4b4
2014-08-06 14:41:02 -07:00
Deepanshu Gupta
5476cfee6b am 505c675c: Fix SystemProperties in LayoutLib.
* commit '505c675c3a536ac7c6ad264eb62542537532119c':
  Fix SystemProperties in LayoutLib.
2014-08-06 21:28:24 +00:00
Deepanshu Gupta
505c675c3a Fix SystemProperties in LayoutLib.
Not all System Properties were used via Build class. Also, properties
like SDK_INT which called SystemProperties directly were not initialized
properly.

This change is essentially cherry picking of the relevant parts from the
following commits:
984749bf75c9ce9d3401b8410ea7d6276544b6ee
167bc25bceea9280bbe4858db4cb8233f86ce325

Bug: http://b.android.com/73046
Change-Id: Ia0fb467ee6d5fdedda500d57d02be20006f115df
2014-08-05 17:47:30 -07:00