summaryrefslogtreecommitdiff
path: root/core/java/android/widget/EdgeEffect.java
Commit message (Collapse)AuthorAgeFilesLines
* Limit overscroll stretch for animationGeorge Mount2021-07-011-0/+8
| | | | | | | | | | | | | | | | | | Bug: 192465706 Stretch overscroll was allowing pull distances beyond 1, but the effect only applied until 1. This meant that as the stretch relaxed, it would appear stopped at 1 until it dropped below 1. This CL does two things. First, it limits the pull distance to 1, so that if it is pulled beyond 1, the distance remains 1 and the spring will immediately retract from 1 with onRelease(). Second, when the fling hits 1, it stops the fling animation and immediately begins retracting from a velocity of 0. Test: new tests and manual testing for visual effect Test: I23cd8990fff24dbef36a93c16c115948d774a557 Change-Id: I06f1533aed0ce24756c535789fdcc7e99c5bfb9b
* Linearly complete overscroll stretch when closeGeorge Mount2021-06-231-43/+79
| | | | | | | | | | | | | | | | | | | | | | Fixes: 190475978 Damped spring animations asymptotically approach their destinations. The final pixels can take many frames to complete, but stopping them means that we get a disruptive jump in those final pixels. This CL detects when the edge effect animation is close to the finish and completes the animation with a linear velocity that matches a common velocity at 8 pixels distant. This means that the animation terminates quicker so that touch events directed at the contents after the animation completes (e.g. taps) can interact with the contents soon. The CL also adjusts the delta for detecting zero in the stretch animation as it was jumping by a pixel or more at the end of an otherwise smooth animation. Test: manual testing for the visual effect Change-Id: Ie249b0265c5c5939b597668d5afe4f76d0430821
* Updated EdgeEffect to respect accessibility settingsNader Jawad2021-06-021-11/+45
| | | | | | | | | Modified EdgeEffect to be disabled if the global ValueAnimator#areAnimatorsEnabled flag is false Fixes: 189870180 Test: Added CTS test Change-Id: I7adb00342f6f89655719d6c5b64316fc58589e0a
* Fix overscroll doesn't affect scrolling when releasedGeorge Mount2021-05-211-2/+9
| | | | | | | | | | | | | | | Bug: 188531406 When an EdgeEffect is flung past 0 into negative values, it shows a stretch from the other side. To prevent this, the EdgeEffect animation is now terminated when it reaches 0. I also made it so that dragging to a value of 0 releases the EdgeEffect. I also fixed the nested scrolling so that the stretch release of ListView occurs before the onNestedPreScroll(). Test: new tests and manual testing Change-Id: Ia20a6b96d25cf31ef143511828ddce5c33cee804
* Merge "Update hole punch logic in HWUI" into sc-devNader Jawad2021-05-051-8/+4
|\
| * Update hole punch logic in HWUINader Jawad2021-05-031-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | --Updated HWUI holepunch logic for SurfaceView to also apply the stretch to the hole punch --Updated RenderNode callbacks to also include an offset from the ancestor RenderNode that also has a stretch configured on it --Added new test activity to verify hole punch logic Bug: 179047472 Test: manual Change-Id: Ibbaf8248a31839ba9dc352ecb9fef54e1276918e
* | Allow EdgeEffect to fling during pullGeorge Mount2021-05-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | Bug: 186430321 EdgeEffect was restarting the fling from the start if onAbsorb() was called after onPullDistance(). This CL does not reset the distance in onAbsorb(). Test: new test Change-Id: I0657059c275f42cfe229a3aaa8bf37c87e0394f1
* | Remove edge effect type from the API.George Mount2021-05-031-56/+10
|/ | | | | | | | | | Fixes: 186758538 Relnote: "Removes edge effect type from the API -- EdgeEffect now supports only stretch edge effect for all applications." Test: existing tests, modified to work with stretch Change-Id: Iec7a9d4a0316ff3ba7297c4565bb881a1adcf949
* Reduce animation completion epsilon to avoid early end.George Mount2021-04-221-2/+2
| | | | | | | | | | | Fixes: 184892316 Changed the animation termination epsilons to make sure that the animation doesn't end early and cause a jerky end. Test: visual inspection Change-Id: I56e4ccb50cee95e713e92ffb659eff4dd026dd12
* Merge "Fixed and decreased isAtEquilibrium thresholds" into sc-devMichel Comin Escude2021-04-141-6/+6
|\
| * Fixed and decreased isAtEquilibrium thresholdsMichel Comin Escude2021-04-131-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Distance and speed were multiplied by LINEAR_STRETCH_INTENSITY which is not directly related to speed and and distance. Moreover the velocity threshold was a little bit high (1/0.016, wich means 62 pixels/second) and the distance as well (1 is ok if there's no scale but since there's some stretching the difference was being magnified). Bug: 184892316 Test: EdgeEffectTests and visual Change-Id: Ibd7adb16d1d00df0ab6e96132bfe96a4fa4d45dc
* | Added velocity scalar and updated spring valuesMichel Comin Escude2021-04-141-3/+9
|/ | | | | | | | | | | | Updated spring values to the latest ones agreed in design. In addition, added a velocity multiplier that only affects after it absorbs an impact at the scroll boundary. This will help to increase the spring behavior when we fling the content, but keeping it controlled when we pull and release. Bug: 183768138 Test: ran EdgeEffectTest and visual Change-Id: I4ed7b01dd42a9a5adda637917369c349a6ae2f76
* Adjusted interpolation and stretch intensityMichel Comin Escude2021-04-131-2/+2
| | | | | | | | | Updated stretch intensity to 0.016 and added a new uniform to control the intensity of the interpoloation Bug: 183768138 Test: ran EdgeEffectTest and visual Change-Id: Iac10bee5980802fffe838ed83e02b7c41dee6f71
* Fixed issue with invalid stretch paramsNader Jawad2021-04-121-10/+4
| | | | | | | | | | | | Refactored error checking logic to ignore all invalid parameters for vecX/vecY regardless if NaN parameters were computed through intermediate math operations or provided as inputs Fixes: 183781985 Test: Added CTS test Change-Id: Ib9f3dd1becc0486dc15ce306660bd5d469b81256
* Merge "Fixed NaN exceptions in EdgeEffect" into sc-devTreeHugger Robot2021-04-031-12/+23
|\
| * Fixed NaN exceptions in EdgeEffectNader Jawad2021-04-021-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Added more error checking logic to protect against invalid usages of EdgeEffect that include setSize not being called or invalid bounds parameters. Fixes: 183945458 Fixes: 183895581 Fixes: 183781985 Test: Added CTS test to EdgeEffectTests Change-Id: I1eabd96206216526dbe843d0fb8c0fe6cccd8395
* | Updated Stretch based on design feedbackMichel Comin Escude2021-03-231-3/+3
|/ | | | | | Bug: 179047472 Test: re-ran EdgeEffectTests Change-Id: I1ed6df2d8ec1d69670cf4977cf7286052240b0d1
* Merge "Fixed EdgeEffect drawn on non-RecordingCanvas" into sc-devTreeHugger Robot2021-03-221-2/+9
|\
| * Fixed EdgeEffect drawn on non-RecordingCanvasGeorge Mount2021-03-191-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | Fixes: 183079166 When the EdgeEffect was drawn on a non-RecordingCanvas, the animation was never completed when using TYPE_STRETCH. Because TYPE_STRETCH can only be applied to RecordingCanvas, the animation ends immediately when drawn on a non-RecordingCanvas. Test: manual, I53d59a3b3cd14be658d899ff41c1fa4b83a98a32 Change-Id: I29c04ff7e0aa3269c1b4e9e503dfa641195820a8
* | Change the spring constants for EdgeEffectGeorge Mount2021-03-191-2/+2
|/ | | | | | | | | | | Bug: 171228096 New spring constants for EdgeEffect. Test: EdgeEffectTest, ScrollViewTest, HorizontalScrollViewTest, ListViewTest Change-Id: I094bf6a68e9acc567919eaeb62d601cb84d405a6
* Updated EdgeEffect parameters for overscroll stretchNader Jawad2021-03-181-30/+20
| | | | | | | | | | | | | | | | Added dampening logic to caluclate the distance to overscroll. Updated StretchEffect to support independent maximum stretch amounts for the x/y axis Removed debugging parameters to configure stretch distance since they are no longer used. Removed hidden API calls to configure stretch distance in ScrollView/HorizontalScrollView Bug: 179047472 Test: re-ran EdgeEffectTests Change-Id: I4698669273d364695a21c2cce00ec2cfec41b2cc
* Change targetSdk for USE_STRETCH_EDGE_EFFECT_BY_DEFAULTGeorge Mount2021-03-171-1/+1
| | | | | | | | | We want to test the stretch EdgeEffect for all apps, not just those that target S and higher. Bug: 182191316 Test: None. Change-Id: I29a46a5c9ac6bc64f0abfa8dbd4605ed7d75ea62
* Merge "Fix bug in EdgeEffect with glow" into sc-devTreeHugger Robot2021-03-171-5/+8
|\
| * Fix bug in EdgeEffect with glowGeorge Mount2021-03-161-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: 182499389 With the glow edge effect, using the drag gesture to reduce the edge glow could cause the glow to flip and repeat. This was caused by the update() modifying the determined distance during the pull when it wasn't animating. We also force the alpha to be 0 if the pull distance is 0. Test: manual testing Change-Id: Iacc1df0fcb92e3380523187badf7ea62d7d19d2f
* | Updated EdgeEffect stretch distanceNader Jawad2021-03-161-2/+2
|/ | | | | | | | | Updated stretch constant from 0.1f to 1f Updated distance to be maximum of width/height Bug: 182567334 Test: Re-ran CTS tests Change-Id: I943c7d1013cfabd86bb678fa7b408f0f97a17075
* Fixed crash in EdgeEffect after fling gestureNader Jawad2021-03-121-8/+8
| | | | | | | | | | | | | | Fixed issue where mDistance and mVelocity fields would be infinite/NaN in situations where onAbsorb is called before setSize leading to division by zero issues. Updated constants to be less significant stretch Fixes: 182567334 Test: Updated EdgeEffectTests Change-Id: I4007b03271c6b5e79e95d5fe6c7c44e8c0869cd1
* Merge "Use spring animation for stretch overscroll" into sc-devGeorge Mount2021-03-111-37/+102
|\
| * Use spring animation for stretch overscrollGeorge Mount2021-03-091-37/+102
| | | | | | | | | | | | | | | | | | | | | | Bug: 171228096 Use the spring animation from the prototype in EdgeEffect. Test: manual testing for fling and recede Change-Id: I7eec03a98f5d26153512ba402d6bb5bc5dc70ffb
* | Compatibility feature USE_STRETCH_EDGE_EFFECT_BY_DEFAULTGeorge Mount2021-03-081-5/+39
|/ | | | | | | | | | | | | | | | | | | Bug: 171228096 Added two ChangeIds for stretch overscroll: USE_STRETCH_EDGE_EFFECT_BY_DEFAULT makes stretch overscroll the default. USE_STRETCH_EDGE_EFFECT_FOR_SUPPORTED makes stretch overscroll the default for applications that use the new EdgeEffect constructor that accepts an AttributeSet. This indicates knowledge of stretch overscroll APIs and can be a proxy for supporting stretch overscroll. Test: Both flags on apps that support and don't support new api Change-Id: If2ec832c9656116fe1aa64d33682c489abbde30f
* Wire SKSL based stretch shader to HWUINader Jawad2021-03-031-11/+80
| | | | | | | | | | | | | --Ported SKSL based stretch shader from OpenGL prototype --Hooked up the stretch APIs in RenderNode to the stretch shader. --Updated RenderNode layer logic to promote the RenderNode to a layer if there is a stretch to be applied to it in order to feed the layer as input to the stretch shader Bug: 179047472 Test: builds + sample overscroll stretches + updated CTS test Change-Id: I744ff70099fe251ce07f23d067bf13444a468c08
* Placeholder implementation of stretch overscroll using offsetGeorge Mount2021-02-111-21/+69
| | | | | | | | | | Temporarily use an offset RenderEffect for the stretch overscroll. This makes it possible to visually validate the effect and start writing CTS tests to ensure it is functioning. Bug: 178807038 Test: Iab32812bfa626ae6932f52c1a9af78069b5dc6ac Change-Id: I5b0da0e669d36f4149cd58b4b3aff149a1fa7e14
* Update the EdgeEffect APIGeorge Mount2021-02-101-2/+93
| | | | | | | | | | | | | | Bug: 178807038 EdgeEffect adds getDistance() to allow the developer to determine how much of the pull was consumed by the EdgeEffect. onPullDistance() is similar to onPull() except that it returns the consumed pull distance. A new constructor was added to allow EdgeEffect attributes to apply to Views. Test: I7f6d6153c1a5bc714ad1935ae0c78907e6839547 Change-Id: Ie29b081cb34af0219287bd1702fea8d273a78d74
* Add edgeEffectType attribute and type propertyGeorge Mount2021-02-101-0/+45
| | | | | | | | | | | | | Bug: 178807038 This adds the edgeEffectType property and type attribute. These will be used to enable stretchy edge effect for overscroll. Merged-In: I16f20b36d9a15c08e0a37f98572ef9c9f8fbc88f Test: new CTS test for setting/retrieving the effect type. Test: Ic363f71d241649d15faa86434516457e62b261f4 Change-Id: I16f20b36d9a15c08e0a37f98572ef9c9f8fbc88f
* 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
* Add a EdgeEffect#setBlendMode API.Rahul Ravikumar2019-02-061-4/+41
| | | | | | | | | | * Fixes hidden api usage b/123769450 * Move from setXferMode() to setBlendMode in Paint. Fixes: b/123769450 Test: Added CTS Tests. Change-Id: I1f950e4c14d30dd223cce05835b230c086755089
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-211-0/+3
| | | | | | | | | | | | | | | | 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
* Revert "Revert "Update overscroll and toast UI""Sergey Vasilinets2017-07-271-4/+6
| | | | | | This reverts commit 45c493f2c2908d782e2fb5dbc5aa56fc92d703c9. Change-Id: Idefc8e1b6f954def7ef4cdf08b687042a6091a0d
* Revert "Update overscroll and toast UI"Aurimas Liutikas2017-07-261-6/+4
| | | | | | | | | | This change broke android.uirendering.cts.testclasses.EdgeEffectTests. This reverts commit 6085f8a16b5f6ed6a7a7acf854ec29ff2bef45fa. Bug: 64085792 Change-Id: I70ccebebb54dabf1ec0ee5002adca93e44104a1e
* Update overscroll and toast UIChet Haase2017-07-261-4/+6
| | | | | | | | | | | | | | | | | | | Overscroll updates: Same shape, but smaller radius (doesn't come as far into the view) and more translucent (max 15% instead of 50%). Overall, more subtle. Toast updates: Light background, smaller, dark font, closer to the bottom of the container. Test: manual unit tests. Also: cts test ToastTest for toast changes cts test EdgeEffectTests for EdgeEffect changes (adding some tests to known-failures for now, due to brittle golden-image failures - see CL ag/2596621) Bug: 30563264 Refresh toast visuals for Android ODR Bug: 63010438 Tweaks to overscroll animation Change-Id: I0fac6322b0b81d030c8d174852c134211290bbea
* Fix import statements in android.widget package.Aurimas Liutikas2016-10-111-4/+3
| | | | | | | Additionally this CL removes spaces at the end of the line. Test: code still compiles. Change-Id: I1ce98b4e70aa3ae614f87966c3bc6181fa4389a4
* Annotate ARGB integer parameters with @ColorIntTor Norbye2015-03-051-1/+3
| | | | Change-Id: I307f72a382272cf18ddb6b07d9fcb81228568d9a
* Remove usages of FloatMathNeil Fuller2015-02-121-3/+2
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=36199 Change-Id: Iec8fb663ed54eb967050f6ff25a36ba534204c4d
* Add colorEdgeEffect to themes, default it to colorPrimaryAdam Powell2014-09-191-1/+1
| | | | | | | | | Allow edgeeffect colors to be changed independently of the primary color for the current theme. Bug 16512225 Change-Id: Ibc13ad755f489fe1f6d16af0c61a1d12dd1a61f7
* Material EdgeEffect refinementsAdam Powell2014-09-041-11/+25
| | | | | | | | | | | | | | | | | | | | Add back auto-recede for EdgeEffect, but with a longer delay. Removing it caused compatibility issues in existing custom views that never call onRelease. The longer delay will be a signal that something is amiss without disrupting the UX too badly. Recede the glow more quickly on release. Start translucent and fade to more opaque as the glow grows and is pulled further. Make the opacity stronger in the extreme cases so the glow is more prominent. Equalize glow size across the width and height. Bug 15146438 Bug 15936708 Change-Id: I020d705906e6225b044d0f5303bafa733a679a66
* Avoid arc for edge effect drawing.Chris Craik2014-07-151-6/+2
| | | | | | | | b/16131698 Tessellation doesn't support joins, which filled arcs have. Change-Id: I566d0c1c39f058bb641aa24d2a4488b0aaa1b454
* Avoid texture path drawing for EdgeEffectAdam Powell2014-07-071-1/+1
| | | | | | | | | Make sure we stay on tesselated geometry code paths instead of texture generation. Bug 16131698 Change-Id: I6b934e718e1d3c5164a8ede71b1240ce761eaf71
* Add EdgeEffect#setColorBrian Attwell2014-06-241-0/+16
| | | | | Bug: 15725269 Change-Id: Ifdb0a53d1f17e2433683e51d09588545b69e6238