summaryrefslogtreecommitdiff
path: root/graphics/java/android/graphics/drawable/InsetDrawable.java
AgeCommit message (Collapse)Author
2020-10-27Add maxTargetSdk restriction to unused APIs.Mathew Inwood
These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2019-12-18Use new UnsupportedAppUsage annotation.Artur Satayev
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I4bc8c9482e4bb1af21363f951affff7ee3fefeab
2018-07-31Add @UnsupportedAppUsage annotationsMathew Inwood
For packages: android.graphics android.graphics.drawable android.graphics.drawable.shapes android.graphics.fonts android.graphics.pdf This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I7fc1162d2c63df8751a4660607e8ce72070efed8
2018-05-09Update Drawable API to expose getOpticalBounds method as well asNader Jawad
the Insets class Updated all Drawable implementations to remove the @hide annotation Fixes: 78942648 Test: Re-run CtsGraphicsTestCases and updated Drawable CTS tests to verify getOpticalBounds implementations Change-Id: Id9b6bbbe15173e310bbf44184b4678fb29ef1cd8
2017-05-04Fix issue in InsetDrawable where master inset attribute get ignored.Hyunyoung Song
Test: builds, and did manual test b/37752336 Change-Id: I85182a4cf94fa5bcb7c2ac09c701496fb3e72f61
2017-04-20Support fraction type for inset* for InsetDrawable.Hyunyoung Song
b/36024318 Test: manually tested on default icons. Test: $ runtest --path=cts/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java adb shell am instrument -e class 'android.graphics.drawable.cts.InsetDrawableTest' -w 'android.graphics.cts/android.support.test.runner.AndroidJUnitRunner' android.graphics.drawable.cts.InsetDrawableTest:........................ Time: 0.132 OK (26 tests) Change-Id: Ie8d24680b6884e65017f07723a371120f5ae610c
2015-12-08Attach drawable resource ID and name to getDrawable() exceptionsAlan Viverette
Wraps the entire getDrawable() method in a try/catch block. Clears the stack trace from the re-thrown exception, since we only need the trace from the original exception. Also clears stack traces from re-thrown RuntimeExceptions in applyTheme implementations. Change-Id: I92396abf9e748eef78777174b297a09e118f5e70
2015-11-12Return correct intrinsic dimensions for inset colorsAlan Viverette
Also updates documentation for getIntrinsicWidth/Height to accurately reflect the behavior of the existing implementations and provide an explanation of what "intrinsic" means. Bug: 25646242 Change-Id: I11daf57e598148adfda922cfc1ba31ed48a16bd7
2015-10-28Support for changing density of DrawableWrapper subclassesAlan Viverette
Includes a refactoring of DrawableWrapper classes so that the wrapper super class handles both drawable management and inflation. This allows us to immediately call through to super() in inflate and applyTheme, which simplifies density management. Bug: 25081461 Change-Id: I8c157d340fd1f28a3a2b786c56850a67cdd452e4
2015-04-01Fix issues with theming of preloaded ColorStateListsAlan Viverette
Ensures changing configurations mask is propagated to the host drawable so that it can be properly cleared from cache on configuration changes. Also fixes constant state handling of the mask in the Inset and Rotate drawables. Hides new ColorStateList methods related to theming, since they should only be used during preloading or internally by framework drawables. Fixes bug where the cached versions of themeable ColorStateLists were modified by calling applyTheme() on the host drawable. Also cleans up some docs and naming in GradientDrawable. Bug: 19966397 Change-Id: I8c8d3cabbaf94b488c2b8fe9fd423e07d824c19c
2015-02-25Create blank state in no-arg RotateDrawable constructorAlan Viverette
Also removes unnecessary constructor in InsetState so that it matches the other DrawableWrapper classes. Bug: 19489698 Change-Id: Ib2e510c6ae90858774970d928e541a9b08cb714a
2015-02-20Unify wrapper-type drawablesAlan Viverette
Fixes several issues with constant state and propagation of drawable property changes to wrapped drawables. Also un-hides the layout direction accessors and hotspot getter. Change-Id: Iff19db6a95059cbcfcbde7af0ac33871ccd41615
2015-02-02Merge "Ensure InsetDrawable propagates state and callback on set drawable"Alan Viverette
2015-02-02Ensure InsetDrawable propagates state and callback on set drawableAlan Viverette
Bug: 19230432 Change-Id: I161e377c5a50fd68718a36cef0038ab06e74c90d
2015-01-30Synchronize mutated constant state's drawable constant stateAlan Viverette
Mutating InsetDrawable's locally-held drawable alters its constant state, so we need to update the InsetDrawable's reference to match. This ensures that any drawables created using getConstantState().newDrawable() will match the mutated versions. Bug: 19213175 Change-Id: If9063bcc0942691a8940443e607f2dc722fc6e13
2015-01-27Move drawable out of inset state, only store constant stateAlan Viverette
This ensures that InsetDrawable's constant state only references other constant states rather than holding an entire Drawable, which provides a clean separation between local and constant state information. This ensures that calls to mutate() can create a new constant state without losing local drawable state and that newDrawable() still relies on the same constant state. Bug: 19156549 Bug: 13877782 Change-Id: I48146f6c7ac3593009cfa323fc341bcd7d8ab21b
2014-12-09Teach AssetAtlas about more drawablesJohn Reck
Bug: 18317479 Change-Id: I16868ee204d24af72af9a2efc987f7e9eb1d266b
2014-12-04Avoid extra saveLayer calls in RippleDrawable, fix docsAlan Viverette
Also fixes opacity returned from InsetDrawable to accurately reflect the transparent inset area and updates button to correctly use tint. BUG: 18226391 Change-Id: Ia9a88d9d663990a6829d2f251c7f59ea2a79d816
2014-10-29Add theme and config change support to more Drawable typesAlan Viverette
BUG: 16045735 Change-Id: Ic03173a1c1779c1bb545c4c389f77afed97011ee
2014-10-14Update preload list, clean up drawable themingAlan Viverette
Removes all implementations of three-arg ConstantState constructor, since we handle mutation and applyTheme() in Resources now. Moves progress bar tinting to android:tint attribute. Correctly implements applyTheme() and canApplyTheme() in all drawable wrapper and container classes. Change-Id: Ic9cb43d0d6228aa4914f3124bed234b837beaa41
2014-10-10Fix inset drawable's intrinsic size, replace ic_text_dot assetAlan Viverette
BUG: 17648301 Change-Id: I8af0f6d1beee7a1cb3a3b9db571ed2c407e24556
2014-10-07Mutate and apply theme if needed before caching themed drawablesAlan Viverette
This ensures that drawables are completely separated from their cached constant states before applying a theme. After this, we can remove the implicit (and incomplete) mutation in the clone constructors. Also implements missing mutate() method on ClipDrawable. BUG: 17646144 Change-Id: If0d66b0a85724d76e0a4f506758c7ba3c0aa3410
2014-10-02Fix theme propagation to contained android:drawable elementsAlan Viverette
BUG: 17790666 Change-Id: I6733a98e779cad0d384b917c57d2b3409a166c02
2014-09-02Fix behavior of inflating InsetDrawableChet Haase
A recent change to InsetDrawable changed the behavior of inflating an InsetDrawable when it already had a valid bitmap. The new behavior avoids throwing an exception with a bad resource where it used to throw, because the existence of the bitmap makes it avoid trying to load the resource at all. The fix is to reintroduce the old behavior of forcing it to load the resource regardless of the state of its bitmap. Issue #17068252 InsetDrawable inflation CTS test is failing Change-Id: I941388730d4479f8f4747a7985754ffdf5133f04
2014-08-27Preserve inner drawable bounds and level on mutateAlan Viverette
Also includes a tiny change to progress bar background alpha, which was too dark to see. BUG: 17285057 Change-Id: I8b0cc1c2c9405558b8163d8db9374d7c748317a2
2014-08-15Throw exception when inset drawable is missing drawable attributeAlan Viverette
BUG: 17068252 Change-Id: I3f5757966c1bb723311a2e2c41d419ed41369061
2014-08-08Add insets to dialog backgroundAlan Viverette
Also adds inset attribute to InsetDrawable to control all four insets. BUG: 16868069 Change-Id: I909d05a6dc69747e9092e9ac34551b18d70d2b9f
2014-08-06Separate tint and tintMode propertiesAlan Viverette
BUG: 16054922 Change-Id: I820fb857b671faf9eb27612e470e820c5c4cd6b5
2014-07-19Tweaks to outline APIChris Craik
b/15283203 b/16142564 Remove boolean return value chaining, as it's redundant with the data in the Outline itself. Change-Id: I3116e57cd1b35c98b74e95195117edd7e39fb2df
2014-07-16Fix hotspot movement on focus changeAlan Viverette
BUG: 15726988 Change-Id: I97f88e5f7e404ecfcd5c254fddd18c8f6616064e
2014-07-07Handle configuration changes in drawable attributesAlan Viverette
Adds themeable attribute support to InsetDrawable, adds support for attribute configuration changes to all themable drawables. BUG: 16045735 Change-Id: I3dc62d28801760ac69d303be81b6c78bb9bb5aca
2014-07-04Make optical insets actually workAlan Viverette
Change-Id: I9fabf4cb939cc7a868f95580e7229745acde0418
2014-06-30Add outline support to InsetDrawableChris Craik
bug:15933107 Change-Id: I3341417dc197a751442d2b4c2645a1520db41095
2014-06-16Add support for setTint in all Drawables, clean up lint warningsAlan Viverette
Change-Id: I962089ca59684cef28cb4a648d4a91e542bdf5d4
2014-06-14Revert "Add support for setTint in all Drawables, clean up lint warnings"Jeff Brown
This reverts commit 381f83b613f7b6e71180983dbb992ff62f8dd6e3. Change-Id: I1181f436c647216ac46162260d9d886197b24568
2014-06-13Add support for setTint in all Drawables, clean up lint warningsAlan Viverette
Change-Id: Ia38b9d3e9d5c0072382050e815bdd9232b672e50
2014-06-02Clean up drawable theming APIsAlan Viverette
Removes APIs for themed creation of a drawable from a stream, since that doesn't involve any inflation. Also cleans up tinting methods left over from previous clean up. BUG: 15089957 Change-Id: I2af7aa9a6d351ae61b33ee1216c674fae1bffe11 Signed-off-by: Alan Viverette <alanv@google.com>
2014-05-21Clean up hotspot bounds APIAlan Viverette
Change-Id: I7daf7e2d360d761f673aa69a0f925b8076ab19c6
2014-05-19TouchFeedbackDrawable is now RippleDrawableAlan Viverette
Change-Id: I59f5f04b73089215c6320560556ac21beb03db06
2014-04-08Make Drawable hotspot APIs publicAlan Viverette
Change-Id: I8377ed735f73f7083636947aa08a5427f1dc3bf6
2014-03-24Implement APIs for obtaining, caching themed DrawablesAlan Viverette
When Drawables are inflated during preload (or otherwise without a theme) they cache their themeable attributes in their constant state as an array keyed on attribute index. Drawables inflated with a theme will simply resolve theme attributes as part of normal inflation, and they will not cache any themeable attributes. Drawables obtained from Resources are pulled from theme-specific cache when possible. If an unthemed Drawable exists in the preload cache, a new constant state will be obtained for the Drawable and the theme will be applied by resolving the cached themeable attributes and overwriting their respective constant state properties. If no cached version exists, a new Drawable is inflated against the desired theme. Constant states from themed drawables may be cached if the applied theme is "pure" and was loaded from a style resource without any subsequent modifications. This CL does not handle applying themes to several Drawable types, but it fully supports BitmapDrawable, GradientDrawable, NinePatchDrawable, ColorDrawable, and TouchFeedbackDrawable. BUG: 12611005 Change-Id: I4e794fbb62f7a371715f4ebdf946ee5f9a5ad1c9
2014-02-05Adds hotspot support to LayerDrawable and InsetDrawableAlan Viverette
Change-Id: Id17f460c8e4e0a6bf9fd39a4a7b8c79fa2df8d29
2013-10-01Fix animations, padding in RTL mode.Jeff Sharkey
Show directory animations coming in from left-side when in RTL language. Also fix NinePatchDrawable to correctly mirror its padding when auto-mirrored, and fix InsetDrawable to propagate the layout direction to the wrapped Drawable. Bug: 10987190, 11030793 Change-Id: I1213802a07d0c4ced93438df1e6ddf5aed3df677
2013-07-30Add missing InsetDrawable.getDrawable() methodRomain Guy
Change-Id: I216b0e8a327f495fd83ebac79013418dbae007b9
2013-05-13am ddd02537: am b4426f15: Merge "Fix bug #8858012 layer-list\'s bitmap ↵Fabrice Di Meglio
item\'s start/end gravity is incorrect on RTL under certain conditions" into jb-mr2-dev * commit 'ddd02537a3fb499a82097453535194f4e29583dc': Fix bug #8858012 layer-list's bitmap item's start/end gravity is incorrect on RTL under certain conditions
2013-05-10Fix bug #8858012 layer-list's bitmap item's start/end gravity is incorrect ↵Fabrice Di Meglio
on RTL under certain conditions - set correct layout direction for Drawable Change-Id: Ic8968acadbc7c9aa0bb68dd4dfbe09aa4e7cfa62
2013-03-08add getAlpha() to DrawableChet Haase
Drawable has setAlpha(int), but no getAlpha() (although some subclasses have added the method). This makes it more tedious to use the property. For example, animations that wish to animate this property must explicitly give it a start value since this value cannot be queried from the object. The trick is that setAlpha(int) is abstract, only implemented by subclasses. We cannot take this approach for getAlpha(), as we would break all subclasses of Drawable until they implemented the method. Instead, we'll add a default method which returns an invalid value, making it easier for clients of the method to detect whether the value is valid. All subclasses of Drawble in frameworks have been changed to add an override of getAlpha() when appropriate. Issue #7485875 Drawables is missing getAlpha() Change-Id: I06b6e35f1a56d202838eca44759c85c82595020a
2011-01-14Don't drop the drawable cache completely on configuration changeChristopher Lais
There was a lot of fancy code just above the clear to ensure that drawables that aren't affected by the change are kept, then the entire array was cleared. This patch removes the clear, so that the drawables that haven't changed are really kept, matching the logs, comments and larger part of the code. This patch also fixes the various constant states to return correct ChangingConfigurations. Change-Id: Ic11f6179537318d3de16dc58286989eb62a07f15 Old-Change-Id: I22495e6ed232dfe056207ce5155405af1fa82428
2010-12-14Make Drawable.mCallback a WeakReference.Romain Guy
Many memory leaks occur because of long lived drawables. This should help. Change-Id: I2e9e8dee26579ec56e8e73f08f6b1d62be7812d9
2010-06-21docs: lots of additions to the resources docsScott Main
new drawable resources add <merge> and <include> to layout resource update drawable class descriptioons to point to resources guide add ID resource type Change-Id: I733eec50bb2671f28c9e6dd7dec14eb6586f5193