summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator_test.cpp
diff options
context:
space:
mode:
authorAndrey Kulikov <andreykulikov@google.com>2018-09-28 00:22:42 +0100
committerAndrey Kulikov <andreykulikov@google.com>2018-09-28 19:40:22 +0000
commit72be97465a2fb9b024f16bd0fa96f2750d180e55 (patch)
tree3f277a79e479673054940499f6ad00470f5009e0 /tools/aapt2/java/JavaClassGenerator_test.cpp
parent914857349e66eb3ce4361c412797319ea0a24386 (diff)
Fix ChangeImageTransform for drawables without intrinsic size
Bug: 68489306 If we use a drawable like ColorDrawable for an ImageView it has intrinsicWidth and intrinsicHeight == -1. 1) Simplified matrix calculation in ChangeImageTransform.captureValues. It makes no sense to return null as a matrix because later in createAnimator it will be considered as the identity matrix. For cases when drawableSize == -1 instead we can just use view.getImageMatrix() which would be the identity matrix. 2) There is an additional check in createAnimator() to start an empty animation if the drawable width or height is 0. But actually it worth to use it also for cases when width or height is -1, as if it goes into else branch matrix transformations will try to incorrectly change the bounds of the drawable to (0, 0, -1, -1). 3) And also actually there is a bug in createNullAnimator() method, we can't provide nulls as values for ObjectAnimator.ofObject, as later it will crash on PropertyValuesHolder.setObjectValues(Object... values) because of "values[0].getClass()". So I changed it to provide some nonnull values like Matrix.IDENTITY_MATRIX. It is not important what to provide here as NULL_MATRIX_EVALUATOR will not use the values anyway. 4) Also I found a bug in ImageView.animateTransform(). If we provide null matrix if will try to update the drawable bounds to the view size but will not take into account paddings(in the same way like configureBounds()). Test: Tested manually on the sample app from the bug and added new tests for both cases: with view bounds change and without it Change-Id: I0750de56f4a011e06b340ed342884b59896d92dc
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions