summaryrefslogtreecommitdiff
path: root/core/java/android/widget/ImageView.java
Commit message (Collapse)AuthorAgeFilesLines
* Adds checks if level is set on ImageView to override the level on the ↵ramindani2021-06-071-1/+5
| | | | | | | | | | | Drawable in the updateDrawable Test: verified with the tests that level is maintained on the drawable. Change-Id: Ifef75e3108f106bb6ca6dcf6594bcca79e5428ac BUG=129089894 Change-Id: Ic0fc1dc4d48203ef453f6b967330af60abc7b8b5
* Expose tint lists and other runtime functionality to RemoteViewsStevie Kideckel2021-02-221-0/+1
| | | | | | Bug: 180086170 Test: sample app using new methods, atest Change-Id: I5aa5476d95d6c9fb992c4548d97f577234d747a7
* Add RemoteViews.setBlendMode and expose target methodsStevie Kideckel2021-02-121-0/+1
| | | | | | Bug: 180086170 Test: sample app,atest Change-Id: I2323d297412afb64d142bddb6608978ccc8d292f
* Enable Content Capture for ImageViews by defaultNikita Dubrovsky2021-01-141-5/+9
| | | | | | | Bug: 167712713 Test: atest CtsWidgetTestCases:ImageViewTest Test: Manual Change-Id: I5a77f5e19d6021e799c5fe13c4c9b71c039ff8dc
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | 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. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-1/+1
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-1/+1
| | | | | | | | | | 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
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-061-1/+1
| | | | | | | | 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: I41e12e425284e74561c6b61663241df364ae54a1
* docs: Added content desc in ImageView example.Kevin Hufnagle2019-08-141-3/+5
| | | | | | | | | | | The example ImageView at the beginning of the class description now includes a content description attribute. Also updated the links in the first paragraph where code fonts aren't necessary. Test: make ds-docs -j32 Bug: 138856073 Change-Id: I33a75dc31d68289d955979d2fe8afe2ae3d4770e
* Added BlendMode equivalent APIs to replace deprecated PorterDuffNader Jawad2019-04-171-13/+42
| | | | | | | | | | | | | | variants Updated various framework Views to have equivalent BlendMode APIs to replace the deprecated PorterDuff equivalents. Updated InspectableProperty annotations to refer to the same xml attributes as the original tintmode APIs Bug: 126726419 Test: Added CTS tests to verify new BlendMode APIs Change-Id: Id9ab36d3d4d29f351250723e9d13d49bc6062c83 Merged-In: Id9ab36d3d4d29f351250723e9d13d49bc6062c83
* Merge "Update core widgets to save attribute source info."Aurimas Liutikas2019-02-111-0/+2
|\
| * Update core widgets to save attribute source info.Aurimas Liutikas2019-02-071-0/+2
| | | | | | | | | | | | Bug: 111439551 Test: make -j Change-Id: I72997a87122f38b32e38e42a690385acc7d0e521
* | Fix for Hidden API ↵Rahul Ravikumar2019-02-081-1/+1
|/ | | | | | | | | | Landroid/widget/ImageView;->mDrawMatrix:Landroid/graphics/Matrix; in ligt-grey list * Use ImageView#getImageMatrix() and setImageMatrix() instead. Test: N/A Change-Id: I34b489ee872e470358be225528f4b576c753b290 Fixes: b/124051687
* @InspectableProperty coverage for android.widgetAshley Rose2019-02-041-0/+11
| | | | | | | | | A few getters for view properties have been added where they were missing. CTS tests for the new APIs are pending in b/123894719. Test: m framework Bug: 120492712 Change-Id: I743ce693d384eaf749ced3db7f81bda7d19ed275
* Merge "Made ImageView.animateTransform(Matrix) public"TreeHugger Robot2018-11-271-3/+12
|\
| * Made ImageView.animateTransform(Matrix) publicAndrey Kulikov2018-11-271-3/+12
| | | | | | | | | | | | | | | | | | ImageView.animateTransform(Matrix) is now public so we can use it in AndroidX Transitions without a reflection. Also I fixed a bug that we forgot to clear mDrawMatrix when we provide null matrix into a method. Before it doesn't work as expected if ImageView already calculated some draw matix and we wan't to override it. Bug: 117521477 Test: Added new cts tests for both usages with null and not null matrix Change-Id: I9e25e1f673fabdfeb227fabc0b3635056de0a6fd
* | Restrict access to ImageView#mMaxWidth/HeightClara Bayarri2018-11-271-2/+2
|/ | | | | | | | | | These two have getters (since api 16) and setters (since api 1), so no reason to be reflecting anymore. Bug: 117519954 Bug: 117519983 Test: make Change-Id: Ib8f740071c7c05b1869117ab919297d26eae7650
* Fix ChangeImageTransform for drawables without intrinsic sizeAndrey Kulikov2018-09-281-1/+3
| | | | | | | | | | | | | | 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
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-211-0/+20
| | | | | | | | | | | | | | | | For packages: android.widget 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: Ic61019b1df85448a158fc2ba55c326353222c6b9
* Merge "docs: fixed broken link" into pi-dev am: e07aeea926Laura Davis2018-06-251-1/+1
|\ | | | | | | | | | | am: d3f3a2354a Change-Id: I410789175ec49489bb60ca36c7ebb87e5090ccdc
| * docs: fixed broken linkLaura Davis2018-06-191-1/+1
| | | | | | | | | | | | | | Test: make ds-docs Bug: 76021493 Change-Id: Ide61b82925270896e373083fdc1d5c27c9bdc819
| * Removed call to setWillNotCacheDrawing and deprecated it as well asNader Jawad2018-04-061-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | willNotCacheDrawing as intermediate caching layers are obsolete since hardware accelerated rendering was introduced in API 11 ImageView's current implementation of setScaleType would manually disable it's cache if the ScaleType provided was CENTER. This was end up not drawing the ImageView if View.LAYER_TYPE_SOFTWARE was configured on the ImageView as the cache no longer existed. Removed the logic to conditionally disable the drawing cache and marked setWillNotCacheDrawing/willNotCacheDrawing as hardware accelerated rendering makes these facilities obsolete Fixes: 77653694 Fixes: 72139649 Test: Created a test application with an ImageView and manually set a ScaleType of CENTER and forced the ImageView to render in a software layer to confirm that it would render properly with a drawable of the test application's launcher icon Change-Id: Ie73b1e0708a265e3cc2cc74ed13539f4219dbd7d (cherry picked from commit 2ac86880d6888b0508cdb7d6b2f22a1329a66560)
* | Removed applyColorMod method in favor of individually settingNader Jawad2018-04-231-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | properties. Created dedicated applyXfermode, applyColorFilter and applyAlpha methods to ensure that properties are not being overwritten unnecessarily Fixes: 30167384 Test: Re-ran atest CtsWidgeTestCases:ImageViewTest Change-Id: Ie4a18172dbf222559ace1b740a6c6fdfe33f4dfe
* | Removed call to setWillNotCacheDrawing and deprecated it as well asNader Jawad2018-04-051-2/+0
|/ | | | | | | | | | | | | | | | | | | | | | willNotCacheDrawing as intermediate caching layers are obsolete since hardware accelerated rendering was introduced in API 11 ImageView's current implementation of setScaleType would manually disable it's cache if the ScaleType provided was CENTER. This was end up not drawing the ImageView if View.LAYER_TYPE_SOFTWARE was configured on the ImageView as the cache no longer existed. Removed the logic to conditionally disable the drawing cache and marked setWillNotCacheDrawing/willNotCacheDrawing as hardware accelerated rendering makes these facilities obsolete Fixes: 77653694 Fixes: 72139649 Test: Created a test application with an ImageView and manually set a ScaleType of CENTER and forced the ImageView to render in a software layer to confirm that it would render properly with a drawable of the test application's launcher icon Change-Id: Ie73b1e0708a265e3cc2cc74ed13539f4219dbd7d
* Use ImageDecoder in ImageView.getDrawableFromUriLeon Scroggins III2018-01-311-14/+9
| | | | | | | | | | | | Bug: 63909536 Test: Existing CTS tests ImageDecoder will bypass the InputStream if possible, allowing it to be more efficient. In addition, it handles density scaling differently; instead of using more RAM to scale the image up, it results in scaling at draw time. Change-Id: Ied7c0865a736f9ef0de367299264e18ccc3e0b92
* Check default focus highlight for ImageView.Jiaquan He2017-05-261-0/+10
| | | | | | | | | | | | | This commit specially checks isDefaultFocusHighlightNeeded for ImageView. We should also check with the content drawable of the ImageView besides its foreground or background. Bug: 62141891 Test: cts-tradefed run singleCommand cts --skip-device-info --skip-preconditions --abi armeabi-v7a -m CtsViewTestCases -t android.view.cts.View_DefaultFocusHighlightTest#testIsDefaultFocusHighlightNeeded Change-Id: Iaf12a5863d7760d9361d0196a46de07a9ccda74e
* docs: Update Imageview JavaDoc commentsJoe Fernandez2017-04-181-21/+63
| | | | | | | | | | | | | - fix typographic errors (misspellings) - Simplified the overview to essential info - included a code example for common TextView usecase - adds missing javadoc description and param for setScroller method - standardize “text view” as TextView to promote consistency Change-Id: I7d614430599537c3ff5999f9c139cc896f142cde From: BNR vendor, Project 01, android-developer-documentation/pull/1 Test: docs-only change. Tested with a check build
* Optimize ViewStructure for autofill by removing irrelevant nodes.Felipe Leme2017-03-081-0/+5
| | | | | | | Test: CtsAutoFillServiceTestCases (with new tests) pass Fixes: 35840787 Change-Id: Iaa2c1907c8383b4a820fd7204e67fa2d276ad2b8
* Merge "Adding support for async view loading in RemoteViewsAdapter"Sunny Goyal2016-10-271-2/+11
|\
| * Adding support for async view loading in RemoteViewsAdapterSunny Goyal2016-09-291-2/+11
| | | | | | | | | | | | | | | | | | | | | | > When loadingView is no available, the FirstView is always loaded on the background thread > AppWidgetHostView only inflates on the background thread, if the view has any costly operations Test: TBD Change-Id: I701caee7e4e6ba5972d0cf478cb57f8ec950da54
| * docs: Added min/max values and descriptions for alpha getter/setter in ↵Kevin Hufnagle2016-09-271-2/+5
| |\ | | | | | | | | | | | | | | | | | | | | | ImageView am: bdb308a059 am: 3b0cfd76c2 Change-Id: I55d9df11389e0299812019fa4a7c4ed5b1f06a92
* | | Add note about density scaling behavior to setImageURIAlan Viverette2016-10-111-0/+8
| | | | | | | | | | | | | | | Bug: 27327999 Change-Id: I1e348a1fbda20fff9575261df7097fbd46381383
* | | docs: Added min/max values and descriptions for alpha getter/setter in ImageViewKevin Hufnagle2016-09-261-2/+5
|\ \ \ | |/ / |/| / | |/ | | | | am: bdb308a059 Change-Id: Ida297f581f7177cd92ec4157a1b735c91d2e26a4
| * docs: Added min/max values and descriptions for alpha getter/setterKevin Hufnagle2016-09-231-2/+5
| | | | | | | | | | | | | | in ImageView Bug: 12644483 Change-Id: I269d63b50412ecea5269acb99fc09c8110e404b4
* | Fixes for ImageView drawable visibility dispatchAdam Powell2016-08-261-15/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some apps rely on their drawables not getting not-visible hints via setVisible when the window visibility changes. This manifests as additional animations, such as crossfading from placeholders when the window becomes visible again. Apps should be able to handle this case in the future now that we have more detailed reporting via onVisibilityAggregated, but to keep existing apps working as-is, ImageView now operates in a compatibility mode for targetSdkVersion < N and will only dispatch visibility signals based on the same triggers used in M. New apps get the more detailed signals. Fix a bug where window visibility dispatch via onVisibilityAggregated would double-dispatch "not visible" when the window is transitioning from GONE => INVISIBLE or INVISIBLE => GONE. Make the growing set of compatibility check fields in ImageView static, matching the pattern from View. Bug 30216207 Change-Id: I88875260bf6aaa23687c7d51353de8d633383531
* | Always report visibility to new ImageView drawablesAdam Powell2016-08-241-3/+2
| | | | | | | | | | | | | | | | | | | | Fix a regression where some drawables would not be correctly updated with their visibility state if set while an ImageView was not attached to a window. Bug 30216207 Change-Id: Ia30326a78168141c8f85bad9c782710f965623b7
* | Better docs for ImageView legacy tintAlan Viverette2016-07-211-0/+7
|/ | | | | Bug: 30283225 Change-Id: Ic748c2cc341edf44aed0202aa55a57584bd928c1
* Revert "Only call Drawable.setVisible(false) for visible outgoing drawables"Adam Powell2016-03-311-9/+3
| | | | | | | | | | This reverts commit 35e2ea02035e8b7eb7de5d7a1d51bf030dcb5b76. This patch was based on two different wrong assumptions. Bug 27822069 Change-Id: I20b1017f91f3fce3c23dd8446459d6f3e3150a48
* Only call Drawable.setVisible(false) for visible outgoing drawablesAdam Powell2016-03-221-3/+9
| | | | | | | | | | | | | | | | | | | | | | | In framework views where we're handling the new visibility aggregated call we only update the drawable visibility when we're attached to a window. For old outgoing drawables being replaced, gate this on whether the drawable is already marked visible instead. This catches a case where views being inflated might set drawables in in a superclass constructor and have them replaced in a later constructor. Gating the call into a drawable that might invoke its callback (the view being constructed) avoids potential problems where overridden methods are called unexpectedly on a view subclass that has not finished running its constructor. This is a better check than isAttachedToWindow, as isAttachedToWindow will return false if the view has been temporarily detached from its parent by a view-recycling container. In those cases, the view would not correctly update the outgoing drawable. Bug 27461617 Change-Id: I733a2dd3e3df0a8d80d5dc542ca7b30064159d5d
* Dispatch aggregated visibility when performing attachViewToParentAdam Powell2016-03-171-3/+6
| | | | | | | | | | | attachViewToParent is generally used for finishing a temporary detach of a view as seen in ListView, etc. Have it dispatch aggregated visibility to the newly added view so as to correctly update the view as to its new state. Bug 27702014 Change-Id: Ie8a67c78d3edf401641d52ce10bddf7cb49796fe
* Refinement for onVisibilityAggregatedAdam Powell2016-03-161-3/+3
| | | | | | | | | | | | Change the args for onVisibilityAggregated to a single boolean for visibility to the user. Also fix an ordering bug that could trigger a view background drawable call to setVisible before the view would respond true to verifyDrawable, which caused issues with some apps. Bug 27461617 Bug 27689884 Change-Id: I58bdc7c4364264f7fa0863689ba2b76df904ef81
* Add View#onVisibilityAggregatedAdam Powell2016-03-151-20/+5
| | | | | | | | | | | | | | | | There's a common misconception (even across the framework) that View#onVisibilityChanged determines and reports visibility on 'this' up to the changed view and the total visibility within the window. Knowing this is useful for things like starting/stopping animations. onVisibilityChanged only reports the visibility for the specific changed view, not the effects that would have down the tree. Add onVisibilityAggregated to report what some code thought it was getting already, and move ImageView and ProgressBar over to using it. Bug 27461617 Change-Id: I433f41de453e27a53f907f1d9805350f30f31de9
* Add consistent @NonNull annotations for drawable callbacksAlan Viverette2016-03-111-2/+2
| | | | | Bug: 27599515 Change-Id: I33fdc5392302403bfff9cc74a8226173ec962af6
* Added support for async inflation of RemoteViewsSunny Goyal2016-01-111-36/+83
| | | | | | | | | | | | | | When enabled, the View inflation as well as some of the drawable loading is done on the background thread. It also assumes that all the views support inflation on the background thread, which is true for the default views supported by the platform For ViewGroup opetations, it maintains a virtual view tree which is used for findViewById. The final operations are applied on the UI thread in the end. Change-Id: Ib3ce55182ec04a344f2b2513981ee03afc8fa2e8
* Merge "Update drawable matrix when bounds change in invalidateDrawable()" ↵Alan Viverette2015-10-201-0/+2
|\ | | | | | | | | | | | | | | | | into mnc-dr-dev am: 840f38905c am: e3d745291e am: c3e46adc77 am: 27c5cbe5a8 * commit '27c5cbe5a87e618f7f8eafce90559525f4c2d70b': Update drawable matrix when bounds change in invalidateDrawable()
| * Update drawable matrix when bounds change in invalidateDrawable()Alan Viverette2015-10-201-0/+2
| | | | | | | | | | Bug: 24797872 Change-Id: Ib2bcce6f7d6fab33633a915882821b00d94e4e44
* | Invalidate when Drawable.setState() returns trueAlan Viverette2015-09-041-3/+4
| | | | | | | | | | | | | | | | Ensures views that manage drawables follow the contract set forth in the Drawable.setState() documentation. Bug: 23792020 Change-Id: I4e5a449cd6535487873fd8443da50555c38e8ed9
* | Pass Resources when loading ImageView source from streamAlan Viverette2015-08-251-3/+9
| | | | | | | | | | | | | | | | Only targets >M since developers may have already had workarounds in place or been relying on the incorrect behavior. Bug: 23383805 Change-Id: Ifa69b204b10b8084cf6486e41d5393969e197826
* | Clean up ImageViewAlan Viverette2015-08-251-99/+92
| | | | | | | | | | | | | | Refactors ImageView to use LOG_TAG constant, fixes indentation, trailing whitespace, uses of final. No functional changes. Change-Id: I9e67d9a152e1c6d646719afa5010c45868db9c6f
* | am ddc15988: am f7d8577e: am 42c70645: am aed2e8ba: am da493aa6: Merge ↵Chet Haase2015-08-061-0/+4
|\| | | | | | | | | | | | | "Avoid changing internal state of shared drawable" into mnc-dev * commit 'ddc1598871be09e132dc49dba011d38007c4335b': Avoid changing internal state of shared drawable