3820 Commits

Author SHA1 Message Date
Diego Perez
ebf3261aa6 Merge "Remove BufferedImage allocation from PorterDuff filter" into mnc-ub-dev 2016-03-22 17:33:05 +00:00
Deepanshu Gupta
86621737fc Merge "Add guard around getXmlFileParser() call" into mnc-ub-dev 2016-03-21 18:53:57 +00:00
Deepanshu Gupta
13d2e2e10b Add guard around getXmlFileParser() call
Prevents the need to update the LayoutLib API level.

Bug: http://b.android.com/202942
Change-Id: I507239148ab8d6d45406624dba569c8b7197f979
2016-03-21 08:53:13 -07:00
Diego Perez
f2af68312b Merge "DO NOT MERGE: Initialize layoutlib variables before using them" into mnc-ub-dev 2016-03-10 16:06:41 +00:00
Siva Velusamy
af0f3bda17 BridgeContext: Fix typo in attr name (toLeft -> toLeftOf)
Change-Id: I214ddf066bd69d56275477712419745cf781cee3
2016-03-08 13:52:02 +00:00
Diego Perez
2591346546 DO NOT MERGE: Initialize layoutlib variables before using them
Change-Id: I0d2059423b46f5eb9eb50eb226cbe9a15e57fe02
2016-03-07 15:00:10 +00:00
Deepanshu Gupta
9b137e27d3 Change BridgeResources to Resources_Delegate [DO NOT MERGE]
Do not merge because the resource implementation has changed in N and
the change is no longer valid there.

This is a very hacky fix to make layoutlib work with the latest support
lib. Inject a couple of fields in android.content.res.Resources to
allow using most of the earlier code as is.

Bug: 27403642
Bug: http://b.android.com/201934
Change-Id: I186cad32b1b4de64164fbad937d989e0110c6976
2016-03-04 20:18:23 +05:30
Diego Perez
b75a0426d8 DO NOT MERGE: Fix Canvas memory leak
Every RenderSession would call the AttachInfo.setAttachInfo but wouldn't
issue a View.dispatchDetachedFromWindow.
This caused some Canvas to be slowly leaked in the DelegateManager in
every session.

Change-Id: Ib0392303e6d00a4fe5494ae484f28135b1fe6b28
2016-02-22 14:09:09 +00:00
Diego Perez
44f92b00d1 Merge "Revert "Fix Canvas memory leak"" into mnc-ub-dev 2016-02-19 20:09:09 +00:00
Diego Perez
cf93572889 Revert "Fix Canvas memory leak"
This reverts commit e82bd72b6e7ab3135d3b28fc2c2694d08af45c3d.

Change-Id: Ie9ef25b17d5f725d5054c039992a8cd2912868a6
2016-02-19 20:07:44 +00:00
Diego Perez
bad0e07ee9 Merge "Fix Canvas memory leak" into mnc-ub-dev 2016-02-19 17:58:17 +00:00
Diego Perez
e82bd72b6e Fix Canvas memory leak
Every RenderSession would call the AttachInfo.setAttachInfo but wouldn't
issue a View.dispatchDetachedFromWindow.
This caused some Canvas to be slowly leaked in the DelegateManager in
every session.

Change-Id: I0322767e5fffc6053ce1be852dd8ca904dfaa137
2016-02-19 17:57:36 +00:00
Diego Perez
aa9c9fb29e Replace SimpleDateFormat implementation
This will process all the classes and replace all the uses of
java.text.DateFormat and java.text.SimpleDateFormat with the
android.icu.text. package implementations. The original ones do not
match the Android platform behaviour.

Change-Id: Id55f103c21117a8d6403bf2124b6c1a0e1fb2f71
2016-02-17 18:54:17 +00:00
Jerome Gaillard
3381cde9f2 Layoutlib supports rounded corners of different sizes
Bug: http://b.android.com/29098
Change-Id: I4e7dc3810559b509baf5ea306221c1d2504be0e1
2016-02-11 12:26:50 +00:00
Diego Perez
c1a8e3311f Remove BufferedImage allocation from PorterDuff filter
Change-Id: Iedc280081e1889d316df17863f6ddf377592bc4c
2016-02-08 14:20:11 +00:00
Deepanshu Gupta
ebdcc80ac2 Remove obsolete try catch
The try catch was to prevent crashing on preview releases of Android
Studio. We don't support them anymore.

Change-Id: I8e33cae98117c0034aea1b56903b623fcb64435e
2016-02-01 14:03:30 -08:00
Jerome Gaillard
ded4d14e33 Deals with translation and scaling in layoutlib
Layoutlib now correctly interprets the translation and scaling
xml attributes of views, by implementing what the Android platform
does in native code.

Change-Id: Ie8465f40ef4508d3c31796200800f12cb8f883a4
2016-01-21 11:21:47 +00:00
Jerome Gaillard
7efb74d54a Merge "Deals with android:rotation attribute in layoutlib" into mnc-ub-dev 2016-01-20 11:44:07 +00:00
Jerome Gaillard
c92d70dff7 Deals with android:rotation attribute in layoutlib
The way Android views deal with their rotation xml attribute is through
native code called for hardware accelerated rendering. So layoutlib
has to bypass that in order to take those attributes into account.

Bug: http://b.android.com/73300
Change-Id: Ieb5bf0567a25a9021491ebf3250cedd0752f7863
2016-01-19 18:31:06 +00:00
Diego Perez
ada8c117b1 Fix bug in PropertyValuesHolder_Delegate method index
The method index in PropertyValuesHolder was using only the method name
+ the number of parameters in the call to index the different properties
methods. This worked ok most of the time because, for a given method
name (let's say setTrimStartOffset), the class is usually the same.
However, if the same method name is used in multiple classes, this will
cause collisions and will most likely crash.

Change-Id: Ie6fa8872c5c5e69e690f4f1bb79191a31bef2a28
2016-01-19 10:42:19 +00:00
Diego Perez
b9c48d8f49 New path interpolation to paint vector drawables
Before this CL, PathMeasure_Delegate would use Path_Delegate.approximate
to get a path segment to draw. Path_Delegate.approximate uses a
flattening iterator to do the path approximation.
Unfortunately, because we do not control the stroke mode while painting,
in some cases the approximation would draw unwanted artifacts caused by
the rough approximation and the use of wrong miter values.
This CL does a much better calculation of the path and interpolates the
segments of the curves instead of replacing them with line segments.

This also fixes an issue with the calculation of empty paths.

Bug: http://b.android.com/187256

Change-Id: I450f7aa4c3d9efcbf902a40c3b4d6d388546893f
2016-01-19 10:14:46 +00:00
Deepanshu Gupta
f5984d5fce Merge "Fix custom font rendering" into mnc-ub-dev 2016-01-14 23:48:17 +00:00
Deepanshu Gupta
2ea852541f Fix custom font rendering
The context was using the wrong asset manager.

Bug: http://b.android.com/198897
Change-Id: Id58473a4539ed93a9f338c730686128c7089fc92
2016-01-14 23:46:42 +00:00
Deepanshu Gupta
1665a621da LayoutLib: Fix device used comments in intensive tests
Change-Id: I65ee2f8bdf096ea991e72c99777c8981da7b5ae2
2016-01-14 23:19:29 +00:00
Deepanshu Gupta
0c08fc0fc5 Merge "Fix ninepatch scaling." into mnc-ub-dev 2016-01-11 18:09:45 +00:00
Jerome Gaillard
171a2a9322 Merge "Get color state list file content from PSI instead of disk" into mnc-ub-dev 2016-01-11 18:06:10 +00:00
Jerome Gaillard
b63da06a7a Get color state list file content from PSI instead of disk
Use new functionality from callback to get the content of state list files
from PSI instead of disks.

Bug: http://b.android.com/183767
Change-Id: Ic256d1e7787209d772ccd42c2e3c7f409cac2964
2016-01-11 11:37:19 +00:00
Jerome Gaillard
3b90b74cf9 Create new Navigation Bar for the Theme Editor Preview
The standard navigation bar was not working well in the Theme Editor preview
when in a wide configuration. The bar then did not fit entirely inside the display.
So we created a new Navigation Bar to use in the Theme Editor preview, that fixes
the size problem.

Bug: http://b.android.com/198179
Change-Id: Ifb1fa7b8f399f17392934de89078696337eca3e1
2016-01-04 15:38:12 +00:00
Jerome Gaillard
4b0fe7f14b Use RenderDrawable to render mipmaps
Bug: http://b.android.com/179714
Change-Id: If05e71b33ee3a95590eb892f4fffbff4cfca1867
2015-12-11 15:05:46 +00:00
Deepanshu Gupta
95e58deaa2 Fix ninepatch scaling.
Really fix the bug now. Also add tests for the same and update
allwidgets golden file for M.

Bug: http://b.android.com/187939
Change-Id: I98cd55da0561fef9d47d8759bcd287ee36d03cc2
2015-12-07 14:48:38 -08:00
Diego Perez
29ed07524c Add support for Choreographer animations
First step to add support for Choreographer based animations. The
Choreographer_Delegate avoid using a handler so the animation callbacks
can be called on-demand (by using doFrame). This allows things like
frame by frame animation or selecting a specific frame, and doesn't need
a separate thread to run.

The CL also changes the System and SystemClock implementations to allow
to set specific times. Because animations heavily rely on the system
time, this allows controlling it. It can also be useful to ensure that
the rendering produces a deterministic result when using controls like
the Calendar widget.

Change-Id: Iff221d2698a82075cafbb60f341be01741f7aa13
2015-12-01 10:14:52 +00:00
Deepanshu Gupta
35f7562495 Merge "Revert "Revert "Update StaticLayout_Delegate to use new nLoadHyphenator""" into mnc-ub-dev 2015-11-19 20:49:55 +00:00
Deepanshu Gupta
66098964e2 Revert "Revert "Update StaticLayout_Delegate to use new nLoadHyphenator""
This reverts commit 65a834980cdbb9407a3f27e48cd0a8c472182cd6.


The original revert was only for cherry-pick to release
branch.

Change-Id: Ib78f9a06ce49681c767f65b262058f18a670e38e
2015-11-19 20:49:35 +00:00
Deepanshu Gupta
8c971ae5a0 Merge "Revert "Update StaticLayout_Delegate to use new nLoadHyphenator"" into mnc-ub-dev 2015-11-19 20:48:52 +00:00
Deepanshu Gupta
65a834980c Revert "Update StaticLayout_Delegate to use new nLoadHyphenator"
This reverts commit 631c2ffd6ff1bfa7463d29a39a7ee74be019b3f9.

The revert is only for cherry-pick back to mnc-sdk-release.

Change-Id: I42cb392528b7890b58d689c732f90c3b9ba5f74c
2015-11-19 20:47:26 +00:00
Diego Perez
603544d4c4 Merge "Fix delegation of methods within inner static classes" into mnc-ub-dev 2015-11-17 22:34:08 +00:00
Deepanshu Gupta
4ea74d2960 Revert "LayoutLib: Fix true transparency in status bar."
This reverts commit 4eb298a941c3f465944b63f1a06518e911681c89.

Even though this is techinically closer to what the framework does, the
fix is not complete. As a result, it looks worse when using AppCompat
themes. Revert the change for the release.

Change-Id: I67c1002ea17dee7234d78e2d13aab876467bd70f
2015-11-17 12:25:25 -08:00
Deepanshu Gupta
42a893b50b Merge "AppCompatActionBar: use findClass to test presence" into mnc-ub-dev 2015-11-17 20:22:43 +00:00
Deepanshu Gupta
22931224d9 LayoutLib: IntelliJ changed project files.
Change-Id: I1f99ab678067c26ba2e9938c9dce40c99a6725c3
2015-11-17 11:37:35 -08:00
Deepanshu Gupta
99b54b364b AppCompatActionBar: use findClass to test presence
To test the presence of WindowDecorActionBar class, use findClass()
instead of loadClass() which logs warnings.

Change-Id: Ice8a5a6badd764c7f75b5a64a07c48f0a7cfef98
2015-11-17 11:34:32 -08:00
Deepanshu Gupta
2b0551175d WindowDecorActionBar name change fix.
In change id I7582e242c7564c32feeb044fc9eff6bfb5c56536,
WindowDecorActionBar's package name was changed. This breaks layoutlib.
Fix the issue by checking both package names when loading the class.

Change-Id: I5723a97f0f164d61c56061fef6cff18e3cdafaee
2015-11-16 15:46:12 -08:00
Diego Perez
6777f54fa4 Fix delegation of methods within inner static classes
Currently, delegation of inner static classes methods is broken since
the rewritten method tries to pass an instance to the outer class. This
updates the method generation to only pass the reference if the inner
class is not static.

Change-Id: I8493929cafdbd80968989b422af0f956fa65681a
2015-11-13 14:06:50 +00:00
Deepanshu Gupta
d30c141a2d Improve error reporting on Exceptions in fw views.
When there's an exception during the inflation of a framework view (for
example invalid attributes), report the exception correctly. The earlier
behaviour assumed the exception to be a ClassNotFoundException and tried
to load it from the user's project. This is not longer the case.

Also, update the MockView class to a FrameLayout with a single TextView.
This means that the MockView is a ViewGroup and will not choke when
someone attempts to add a View to it (although, the view will be
silently dropped).

Change-Id: Ice003817ceb627ebfbbbb245ab6be10f9141e728
2015-11-12 13:56:14 -08:00
Deepanshu Gupta
c9b8f95c99 Fix Switch colors
The conversion of the PorterDuff mode from int to enum was incorrect
resulting in the wrong PorterDuff Mode being used.

Change-Id: I7607d505b6e4382e6101869971154f6a77db279c
2015-11-05 09:20:07 -08:00
Diego Perez
1c442aca0a Merge "Remove auto-boxing during the inflate" into mnc-ub-dev 2015-11-04 14:26:15 +00:00
Diego Perez
631c2ffd6f Update StaticLayout_Delegate to use new nLoadHyphenator
Small fix to update call parameters

Change-Id: I4322aa212493ec2970ae17ec1918b9b7e2f8e93a
2015-11-04 11:35:34 +00:00
Diego Perez
91fa3ba4cc Remove auto-boxing during the inflate
Change-Id: I3f9ba5d78363f878fa0c58ca8cbf736bd43fe1c0
2015-11-03 14:59:23 +00:00
Deepanshu Gupta
2f01cf2ea6 LayoutLib: Fix android:dependency for preferences.
Bug: http://b.android.com/189314
Change-Id: I229632d11a2529e865f3f2e8eca3a78b47ad462c
2015-10-09 14:54:19 -07:00
Deepanshu Gupta
9969f858c3 LayoutLib: Fix ring rendering.
Bug: http://b.android.com/65503
Change-Id: I6ed901703cffee345f3083ea3ddeb52a28f4ac64
2015-10-07 12:46:15 -07:00
Deepanshu Gupta
8db8bc6362 Merge "Skip drawing empty shapes to keep Apple JRE happy." into mnc-ub-dev 2015-10-07 17:08:30 +00:00