2022 Commits

Author SHA1 Message Date
Deepanshu Gupta
9b1ac26921 am 1754824c: am c96ef952: Add documentation about hack in commit: f8ea750455 [DO NOT MERGE]
* commit '1754824c2835d6f3a17c4a2c0ab668991797fcf9':
  Add documentation about hack in commit: f8ea750455 [DO NOT MERGE]
2015-08-26 20:18:47 +00:00
Deepanshu Gupta
6b7f9ae6f5 am 678f0ea2: am b318ff54: Make DatePicker rendering not fail (style search fix). [DO NOT MERGE]
* commit '678f0ea2ba47f06387670e9f75b13637a6446899':
  Make DatePicker rendering not fail (style search fix). [DO NOT MERGE]
2015-08-26 20:18:34 +00:00
Deepanshu Gupta
d6363d8606 am 2e57c1e2: am cc5e69e4: Inject anonymous inner classes of injected classes [DO NOT MERGE]
* commit '2e57c1e23f43bb0ede6280720559ccc1e866024b':
  Inject anonymous inner classes of injected classes [DO NOT MERGE]
2015-08-26 20:18:27 +00:00
Deepanshu Gupta
5b886bb08f am 899daf75: am d7e89906: Update platformDir search in tests. [DO NOT MERGE]
* commit '899daf759e02bef0de14dc1a14b96b4d71f0b9fc':
  Update platformDir search in tests. [DO NOT MERGE]
2015-08-26 20:18:15 +00:00
Deepanshu Gupta
aae9c9309c am 2f50403f: am afedbc47: Make Context.getClassLoader() work. [DO NOT MERGE]
* commit '2f50403fe0a8a035757b047af00c7520fadb9015':
  Make Context.getClassLoader() work. [DO NOT MERGE]
2015-08-26 20:18:09 +00:00
Deepanshu Gupta
522e67e4ac am de3ac8f9: am 92480a9a: Fix include tag rendering. [DO NOT MERGE]
* commit 'de3ac8f9fc5987ac1f1223da02b4275fdbae3d56':
  Fix include tag rendering. [DO NOT MERGE]
2015-08-26 20:18:04 +00:00
Deepanshu Gupta
8df6131ac1 am 50e1406a: am f6b08547: Show better error message for color attr not found. [DO NOT MERGE]
* commit '50e1406a4ad668179a9a3d28c58d68c0eee44237':
  Show better error message for color attr not found. [DO NOT MERGE]
2015-08-26 20:17:51 +00:00
Deepanshu Gupta
59f026e937 am 81990c3f: am b1370c26: Fix build: udpate parser factory method [DO NOT MERGE]
* commit '81990c3f988369c755590288b93508e30024c56c':
  Fix build: udpate parser factory method [DO NOT MERGE]
2015-08-26 20:17:46 +00:00
Deepanshu Gupta
b44f7fda75 am 0a07bb95: am aa729889: Don\'t keep LayoutlibCallback reference. [DO NOT MERGE]
* commit '0a07bb95a1dd94c3457860a934d3ee546919cff2':
  Don't keep LayoutlibCallback reference. [DO NOT MERGE]
2015-08-26 20:17:40 +00:00
Deepanshu Gupta
78d77bc379 am bbbdc2ad: am 5c90c4f4: Remove kxml dependency [DO NOT MERGE]
* commit 'bbbdc2ad8939c28828a8441c0b24812c53a9eb66':
  Remove kxml dependency [DO NOT MERGE]
2015-08-26 20:17:34 +00:00
Deepanshu Gupta
3a6567a86e am 4eb298a9: LayoutLib: Fix true transparency in status bar.
* commit '4eb298a941c3f465944b63f1a06518e911681c89':
  LayoutLib: Fix true transparency in status bar.
2015-08-26 19:51:46 +00:00
Deepanshu Gupta
4eb298a941 LayoutLib: Fix true transparency in status bar.
Change-Id: Ieedf23cde9ab3e36c77501d30cc7e808e66a4782
2015-08-26 19:42:37 +00:00
Deepanshu Gupta
a1be8b43e4 LayoutLib: Update golden test images. [DO NOT MERGE]
Also update the generated classes from the MyApplication test project.

Change-Id: I97bce3737c0cb528a61fa652988a2edb09ec885d
2015-08-25 17:12:16 -07:00
Deepanshu Gupta
c9862b4429 An ugly hack to render CalendarView. [DO NOT MERGE]
This is an ugly hack to switch the field
android.widget.SimpleMonthView.mDayFormatter from
java.text.SimpleDateFormat to icu's version of the same class. The hack
is only for the L version of the LayoutLib. It's done in a better way in
M and even better in N.

Change-Id: Id84a1d32040211c46b20cdaf3a77119676e748b6
2015-08-25 16:06:57 -07:00
Deepanshu Gupta
b1ad4a1559 LayoutLib: Fix true transparency in status bar. [DO NOT MERGE]
Change-Id: Ieedf23cde9ab3e36c77501d30cc7e808e66a4782
(cherry picked from commit f9662c006c650c9f61f19a5e1ea4a76640eb85ca)
2015-08-25 12:06:59 -07:00
Deepanshu Gupta
da687918e1 Make getInt in BridgeTypedArray accept empty String. [DO NOT MERGE]
The XML editor already warns about the empty strings in places where an
int value is required. There's no need to show another warning for it in
the rendering panel. Also, the rendering might have also failed when the
empty string is encountered. Try an continue the rendering, because no
rendering state is really bad.

Change-Id: I85106f37e4462f237e85f0b065b4ce8a4bfabf4d
(cherry picked from commit 0437cac76c24dc6cac7b530e6d80f789565550ec)
2015-08-25 12:06:58 -07:00
Deepanshu Gupta
8c674fda89 Fix layout mirroring. [DO NOT MERGE]
Change-Id: I7db398aa2d11dac1210e84922138f78f0c23bb9b
(cherry picked from commit a9090705efcc44f015486944e5aeb926173a7968)
2015-08-25 12:06:58 -07:00
Deepanshu Gupta
7aa3612940 Fix typo: s/FullScreen/Fullscreen/ in LayoutLib. [DO NOT MERGE]
Change-Id: Ia8d223ae01f08df945ab05615b07075b98a54a32
(cherry picked from commit 5a8f33f1b09b0311f1bbd1ec6b90db706edb5219)
2015-08-25 12:06:57 -07:00
Deepanshu Gupta
92f373fe32 Fix Matrix_Delegate.native_getValues() [DO NOT MERGE]
The bug manifested itself by not rendering the wifi icon in the status
bar.

Change-Id: I7debf3eef387965d774bf66e856812e67c8552a7
(cherry picked from commit 9f280a9301566c94a583cc45b6abea8a4488e33c)
2015-08-25 12:06:57 -07:00
Deepanshu Gupta
66d914018c Revert to using AppTheme for LayoutLib tests. [DO NOT MERGE]
Use AppTheme for all tests other than testExpand. AppTheme contains an
attribute needed by testArrayCheck. Also, since the AppTheme extends
Theme.Material.Light.DarkActionBar, other tests should be unaffected.

Also, update the golden image for the testArrayCheck.

Change-Id: Ib5f53f3b029c5aceef2b622e5ac63952d6b1972a
(cherry picked from commit 89a045c31f4f08bc0d9d533ef47f321e6423f656)
2015-08-25 12:06:57 -07:00
Deepanshu Gupta
6b1b651fed Fix imports. [DO NOT MERGE]
Also remove null checks on return value of ReflectionUtils.getMethod()
as the method always return non null.

Change-Id: Ib476302c2cf0504a0f54db4e795955ad10e5df3f
(cherry picked from commit 671b7f9b99316f7224c1213d6923d449a2de9b62)
2015-08-25 12:06:56 -07:00
Deepanshu Gupta
5ad4dae157 Fix theme namespace in tests. [DO NOT MERGE]
The tests used framework theme (Material), but the ResourceResolver was
created with project theme. This caused tests to fail becasue of missing
resources.

Change-Id: Ia17ee19054f6689f85e3423e83c1f47a2cc4364f
(cherry picked from commit 4a6ee98d39ab2300b2cd17c60221e43bf4ade8e7)
2015-08-25 12:06:56 -07:00
Deepanshu Gupta
723e136f96 Run setup for full tests only once. [DO NOT MERGE]
Change-Id: Iee64dbd88d473b7be08581f26ccddf649aed8e56
(cherry picked from commit a12ec8f1e28cb5a8601bf606852f1d34d7c91996)
2015-08-25 12:06:55 -07:00
Deepanshu Gupta
3ba16c1d9d LayoutLib: fix layout when nav bar is absent. [DO NOT MERGE]
Change-Id: I0d3ee6fd5a4656156a630d3b298533ea13eb8415
(cherry picked from commit 6e8d8ad2b7cffed751b2a382ac7b761954767188)
2015-08-25 12:06:55 -07:00
Deepanshu Gupta
55a363376b LayoutLib: Fix Status/Navigation Bar color. [DO NOT MERGE]
If the color value for status bar or navigation bar is declared directly
in the theme (i.e. doesn't reference a color resource via @color/foo),
the ResourceType for the attribute is not assigned by the IDE. LayoutLib
used to ignore resources that were not of type color. This change fixes
the issue by also checking the resources without a type.

Change-Id: I94735ec225415282db06ab9db5c3233ad89c052f
(cherry picked from commit e3f9834ebd8a6e4ee155c8e4c9456dfc98e8b832)
2015-08-25 12:06:54 -07:00
Deepanshu Gupta
d861fd81f7 Set support flag for custom layouts for RecyclerView. [DO NOT MERGE]
Change-Id: I3a0349c0482ae45e226b2016a0f24707c85edff4
(cherry picked from commit f7712d3524309c365b68f93497771084e6b5a66b)
2015-08-25 12:06:54 -07:00
Deepanshu Gupta
82fae62153 LayoutLib: translucent sys ui bars [DO NOT MERGE]
Change-Id: I9c294329fc78418c505a5115bc9c07da29595af2
(cherry picked from commit fc8f4aad7395eca11f6d9b82eb266b1f4ee5041b)
2015-08-25 12:06:53 -07:00
Deepanshu Gupta
9068539a48 Update nav bar icons. [DO NOT MERGE]
- Add a script to copy the icons from the original source.
- Update layout used for the navigation bar to be closer to the original
  layout.
- Update test image with the latest rendering.
- Add a nexus 5 landscape device config to help with testing.

Change-Id: I0b6674955e0970a6a8cce148b1b7aa61e1752ccd
(cherry picked from commit 139d6ff12d395a888624113fdd2521861b47d761)
2015-08-25 12:06:53 -07:00
Deepanshu Gupta
e5afc3117b Move the layout code out of RenderSessionImpl. [DO NOT MERGE]
Also, switch to using a RelativeLayout from a LinearLayout. The change
will help in future when enabling transparent status and nav bar.

Change-Id: Ie4db5d28313f1c5ef775603788598a56409f92c7
(cherry picked from commit b1484862e2367d87d3ccbd0fd0a6d2598ed5918a)
2015-08-25 12:06:52 -07:00
Deepanshu Gupta
c989950dbf CalendarView rendering: use R.styleable to find attr. [DO NOT MERGE]
Not all attr are added to R.attr. This results in some attr not being
found and hence a broken rendering. Fix the issue by adding all attr
referenced in R.styleable to the map of attr before adding any remaining
values from R.attr.

Change-Id: I1ebf8a394b9e1edbf7490e011833d20a00d38317
(cherry picked from commit e8018480dbefc896bd26e5eedfdde802ce3731a7)
2015-08-25 12:06:52 -07:00
Deepanshu Gupta
b2fdaca959 Add tools:openDrawer to open a DrawerLayout. [DO NOT MERGE]
Store a list of drawer layouts with tools:openDrawer encountered and
call openDrawer on them during the post-inflation processing.

Change-Id: Idee299a9af1bb106509a03bb2e8424c372b93dc5
(cherry picked from commit ccbc11770397888cf7780925bb4c7cf1d2f2f80e)
2015-08-25 12:06:51 -07:00
Deepanshu Gupta
a14ec6f450 Change tools:list_item to listitem. [DO NOT MERGE]
The listitem is already in use for ListView. Reuse the same attribute
for RecyclerView rather than creating a new one.

Change-Id: I82aabe7d04fbe3e61645bc427a81c14c454d03c5
(cherry picked from commit 111dc04a28f0181bf429e5ded9024d3fdff7be50)
2015-08-25 12:06:51 -07:00
Deepanshu Gupta
b1e21330f8 Implement tools:list_item for RecyclerView. [DO NOT MERGE]
It's now possible to use tools:list_item attribute for RecyclerView to
point to a default layout, rather than always using a TextView.

Change-Id: I5d522b2f0ca38b420fddfcb0f73a26d95707da79
(cherry picked from commit 61f23e9bf7d784e7a52168196758c4f6c6853e77)
2015-08-25 12:06:50 -07:00
Jens Ole Lauridsen
cd4d5b3f38 Support AppBar from Material Design. [DO NOT MERGE]
This CL is a start for making the design able to render the AppBar.
We are still missing support for: system menu and the app icon.

Change-Id: I19600f8ee1e7e6492186a0b7ae7fb38c82e15c02
(cherry picked from commit 4dfe4d43ce5634f059a3ba669e3cac4551c3a3ee)
2015-08-25 12:06:50 -07:00
Deepanshu Gupta
de13095d5d Update tests per new layoutlib_api [DO NOT MERGE]
Change-Id: Idc89ffceaf171abcf2b579f4e934b514ef209210
(cherry picked from commit d7b846c1814de34f2cea8507907f70618ec7cae0)
2015-08-25 12:06:50 -07:00
Deepanshu Gupta
db67caa60c Add missing resolveResValue call. [DO NOT MERGE]
Bug: http://b.android.com/178504
Change-Id: I7dde8094cf762893e4f7ea0d3de87a281c9602cd
(cherry picked from commit 5d1eaf4a197130f561b16c4ed083cf016b20ab92)
2015-08-25 12:06:49 -07:00
Deepanshu Gupta
6eef124657 LayoutLib: Skip classes from java package. [DO NOT MERGE]
Classes in "java" package can't be defined at runtime anyway. No use
including them in LayoutLib.

Change-Id: I7e7c46f0d74e32c893b23093828569b4fa5e3a73
(cherry picked from commit 86caef1892e1ce063e0e880396c8deaa3a6a171d)
2015-08-25 12:06:49 -07:00
Deepanshu Gupta
4f5e6c6315 Skip warnings for some unresolved references. [DO NOT MERGE]
Some applications rename the newer RTL attributes to the older
attributes in order to target RTL locales, but not need to include two
attributes everywhere it's needed. For example, iosched renames
paddingStart to paddingLeft (among other attributes) for API 17 and
above. This leads to hundreds of warnings about missing attributes.
This change suppresses such warnings.

Also, skip adding unresolved attributes to the typed array. This is more
in line with the actual implementation on device, and prevents
unexpected warnings/errors/crashes later.

Change-Id: Iee616fa6295aa9731ede0cf9dcd6dd2bd1fe8f20
(cherry picked from commit b3e872be9e634c8d1f34d07778ea753880bbf2d9)
2015-08-25 12:06:48 -07:00
Deepanshu Gupta
3e875dbb38 Fix import order. [DO NOT MERGE]
Change-Id: I50bfbf4011290683a1c6adb94e0b6fa301dcc75b
(cherry picked from commit b9b8aef94e5bad8f5f03f686a2d3d8a09c045a7b)
2015-08-25 12:06:48 -07:00
Deepanshu Gupta
e5fa12ad78 Fix ParserFactory not initialized error. [DO NOT MERGE]
Bug: http://b.android.com/175129
Change-Id: I2111673767e0f62ee910560022b559a177d55abd
(cherry picked from commit 996458b76c944f78eee26d7bd8cb4d39303b9119)
2015-08-25 12:06:47 -07:00
Deepanshu Gupta
a287b8428a Fix NPE in BridgeContext.obtainStyledAttributes() [DO NOT MERGE]
Replace direct member access with getter that checks for nullness.

Change-Id: I4a56a0ee903ae7d8c89b91d74b128302e1965586
(cherry picked from commit d758e042ce08c46712db3db2d63fc84795028dfe)
2015-08-25 12:06:47 -07:00
Deepanshu Gupta
e698bb27f3 Fix BridgeTypedArray.getType() [DO NOT MERGE]
Also includes some fixes for BridgeTypedArray.getInt() - when value is a
color, when value is an octal int, when value is true/false.

Bug: http://b.android.com/162438
Change-Id: I0b985ea3437be8018d0e116e7a599843cc7aacd6
(cherry picked from commit 5779ad71eabed3aabaefef1e4749693f8320816e)
2015-08-25 12:06:46 -07:00
Deepanshu Gupta
e481e713f2 Include Shapes in LayoutLib. [DO NOT MERGE]
Change-Id: Ifb32882c478f8d407ad904e224b67fe2bd65dc08
(cherry picked from commit 59164ec0551aa49f497acca81222f304cf4f344b)
2015-08-25 12:06:46 -07:00
Deepanshu Gupta
ba5a02c5aa LayoutLib: Support getting resource arrays. [DO NOT MERGE]
- Don't crash when Resources.get<Type>Array() is called.
- If the IDE supports it, actually return the value.
- Add tests for getArray.
- Update test app to latest gradle plugin version.
- Switch to using AppTheme for tests, since the tests depend on some
  custom theme attributes. The AppTheme now inherits from
  Material.Light.DarkActionBar, so other tests should be unaffected.

Depends on a newer version of sdk-common, which fixes the parsing of
array resource in value files.

Bug: 12372031
Change-Id: I313b61511e98ac1402d75056ebfdeeb005ebb96d
(cherry picked from commit 642cff50f8f7a67eed09eac1e56d7133b26a192c)
2015-08-25 12:06:45 -07:00
Deepanshu Gupta
a5ffed0b69 LayoutLib: Change nullity annotations. [DO NOT MERGE]
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
(cherry picked from commit 476e582d2ffdf25102d4c55f8c242baa3d21d37f)
2015-08-25 12:06:45 -07:00
Deepanshu Gupta
c96ef95285 Add documentation about hack in commit: f8ea750455 [DO NOT MERGE]
Change-Id: I9ce871a67fb67e02e0c4df1eb5c3261ea52a914b
(cherry picked from commit 6330971ed293a2777bbdab09288f90ea4b2d0255)
2015-08-25 12:06:44 -07:00
Deepanshu Gupta
b318ff54fc Make DatePicker rendering not fail (style search fix). [DO NOT MERGE]
Only cherry picked for the style not found fix.

Change-Id: Ied2b71de5b32bcb640bf4ec445e8a39509f800e9
(cherry picked from commit d5b82845450beac2d3c7db9cd80e9fc34d43a297)
2015-08-25 12:06:44 -07:00
Deepanshu Gupta
cc5e69e4fe Inject anonymous inner classes of injected classes [DO NOT MERGE]
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
(cherry picked from commit bfc9c3bcbe3b7056d3330f754811c1506f181b88)
2015-08-25 12:06:44 -07:00
Deepanshu Gupta
d7e89906a4 Update platformDir search in tests. [DO NOT MERGE]
When trying to find the SDK Platform Dir for LayoutLib tests, also
test if the dir from which the tests are run is module dir.

Change-Id: Id5c6038d07ebbb122e38f907ad488ed1f2bcde32
(cherry picked from commit 612a05e7e15184b21437731b9aa5db2d1d4fc54c)
2015-08-25 12:06:43 -07:00
Deepanshu Gupta
afedbc47b3 Make Context.getClassLoader() work. [DO NOT MERGE]
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
(cherry picked from commit f8ea750455eec81e4e6d877b3e18e29a86d4ec95)
2015-08-25 12:06:43 -07:00