Commit Graph

156 Commits

Author SHA1 Message Date
Sunny Goyal
a7b018535b Ensure that the cancel and end listener are called when cancelling state animation
Bug: 190856140
Test: Manual
Change-Id: Ib6b869445cee9fad2a97a590d27429140f2b3ba9
2021-06-11 14:53:55 -07:00
Tony Wickham
26ab4621ce Have AlphaUpdateListener update visibility in onAnimationEnd()
Previously we were only updating visibility in onAnimationSuccess(), which doesn't handle the canceled case.

Test: swipe up from nav bar twice in all apps, ensure all apps is invisible/non-interactable
Bug: 190315266
Change-Id: Ic59e6d4b404de4ee2d17c45d6fa59e2aee70c65f
2021-06-07 22:16:22 +00:00
Pat Manning
cc64218e68 Animate task translation on dismissal.
Test: manual
Bug: 186416527
Fix: 186416527
Change-Id: I3919b96b96fdd490e15968b7c2e680dad7f6e5d6
2021-05-17 16:21:38 +00:00
Tony Wickham
38dd6ec901 Fix AnimatorListeners.forEndCallback()
Override onAnimationEnd(Animator), rather than (Animator, boolean)
which may not be called.

Test: Swipe right to quick switch from home, then swipe back left
(in the same gesture), ensure next quick switch isn't broken.
Bug: 185554764

Change-Id: I53e7526ed5b55fbae9aa654ace70a6ef7561e1d8
2021-05-14 14:49:08 -07:00
Sunny Goyal
01b32466c3 Revert "Revert "Exposing AnimatorListeners in StateManager to receive both success and failure callback""
This reverts commit d7f11d5fb9.

Reason for revert: Fixed initial error
Bug: 185554764

Change-Id: I32cc49f9b3820166736ceb347f33577939aa6efa
2021-05-13 10:23:35 -07:00
Winson Chung
d7f11d5fb9 Revert "Exposing AnimatorListeners in StateManager to receive both success and failure callback"
This reverts commit a75f576890.

Reason for revert: b/187887269
Bug: 187887269

Change-Id: I8a56ff7054e71cf30b113fdaa213397dae0c53cb
2021-05-12 21:25:22 +00:00
Sunny Goyal
a75f576890 Exposing AnimatorListeners in StateManager to receive both success and failure callback
Updating various callers to use onSuccess or onEnd appropriately

Test: Manual
Bug: 185554764
Change-Id: I357dd1fdbe111e7a30d4c8dee520fbd7d9956b7d
2021-05-11 13:53:14 -07:00
Jon Miranda
94e43bd7d8 New motion for ArrowPopup open/close.
Bug: 175329686
Test: long press on apps where container opens above & below
      and where container is aligned left & right

Change-Id: I09bbf57b6e19cc6f022b9a96fb48d8c4ae080813
2021-05-07 19:33:22 -07:00
Zak Cohen
4d35ac3020 Allow Workspace Scrim to be colored per state
Make it possible to set the color of workspace scrim to a different color
per state. Motivated by making Overview Scrim and All Apps scrims different
colors.

Bug: 186253733
Test: Local build and flash
Change-Id: Id7c38ce3c9173308eedfcb7592ececa7bd6bf220
2021-04-27 14:04:46 -07:00
Jon Miranda
c9ad2dd6c7 Add new app close implementation.
- We remove the fling completely
- We set damping to 1 for x/y springs so there is no
  bounciness, and updated the stiffness and bounds to tighten
  up the path to the final location.
- During the animation, we translate all launcher content
  down
- When the x/y springs, and rect animator all finish,
  we use a spring to bounce the launcher content back up

- Added AppCloseConfig so that the entire animation can
  be defined in one location, with getter methods so that
  all the involved parties of the animation can access the
  current value.
- The animations are all defined linearly, and then
  interpolated over using a 3 point curve.

Building behind feature flag as we tune the values.

Bug: 173107751
Test: manual, visual
Change-Id: I83ad0fa2c4234cf30004240d43e191354595adc8
2021-04-22 16:11:11 -04:00
Andy Wickham
3aea671e4f Merge "Updates quickswitch animation from Launcher." into sc-dev 2021-04-14 01:56:36 +00:00
Andy Wickham
18694a2545 Updates quickswitch animation from Launcher.
- Workspace/All Apps/Hotseat no longer translate down
 - Fading of these elements and scaling of Workspace are tied to the
   wallpaper depth animation
 - At any point in the drag, you can still swipe up to enter Overview

This makes it feel like the apps are tied to the wallpaper and avoids
moving them orthogonally to the finger.

It also makes the "No recent items" animation more elegant.

Demo: https://drive.google.com/file/d/1phuRCqb69vuMp3ijS6PR5lTEcBHScjie/view?usp=sharing&resourcekey=0-2HXtMLUhQ-YU53hYlYV-fQ
Demo with no recent apps: https://drive.google.com/file/d/1wjexqznxs9ZhiUtCDW4-ZK6c7hKDRaXn/view?usp=sharing&resourcekey=0-GugbpJK8_cnFbUBB2Ar30w

Fixes: 174228745
Test: Manual
Change-Id: I1574ff89a0f382b7e63bf03cf4300ec7c695cfec
2021-04-13 15:35:46 -07:00
shawnlin
ffb976c404 Attached the navigation bar to app for launching from Launcher
- Play the nav bar fade-out animation at the same time when the app
  launching animation starts and make the fade-in animation ends at the
  same time when app launching animation ends.
- To make the nav bar fade-in animation looks like it's attached to the
  app, apply crop rect and translation that the app targets apply to the
  nav target.

Bug: 181638132
Test: manual: click app icon on launcher to launch an activity and
observe the navigation bar animation.

Change-Id: If7e610eca5fccbb747a76c87335a600b018195a6
2021-04-09 04:04:42 +00:00
Alex Chau
dedbc8ac36 Remove grid scaling in Overveiw
- Grid scaling has problem that scales task icon and menu, which makes it hard to control icon size and text size in the manula
- Replaced the whole concept with dedicated Task size calculation in grid layout
- Support different icon size in TaskView in grid and removed task_thumbnail_top_margin
- Removed grid progress in TaskViewSimulator as well
- Refactored how ClearAllButton scroll and translations are calcualted to align clear all properly in grid
- Make page center calculation aware of PagedView pivot and scaling

Bug: 174464863
Test: Manual on two screens
Change-Id: I47b13ef6e55c6e16c52ea04225f5bde02ed82fc2
2021-03-24 18:46:32 +00:00
Sunny Goyal
a0bc6d964e Removing some animation special casing for 2-button mode
This would simplify reusing the same code for 3-button mode

Test: Verified on device
Bug: 175137718
Change-Id: Ia757eec069efc251475baa6af38c690431325f66
2021-03-04 22:25:30 -08:00
Tony Wickham
b956a03067 Fix some task view fling calculations
- Map to progress 1 instead of dividing by 0 if expectedDuration == 0
- Map to starting progress one frame ahead based on velocity
- Change direction of velocity so it's in the same direction as the
  task progress (0 is down and 1 is up).

Change-Id: I5ac3f8a0d6c616bd303ac1a902242964bb33d3c7
2020-12-16 09:31:26 -08:00
Sunny Goyal
ff9e7d6aa9 Removing separate Cancel and End callbacks and using AnimationListener instead
This removes the additional step of invoking these callbacks separately

Change-Id: I0b60047a44f179ba725f15b1e791e336884869c9
2020-11-05 16:35:11 -08:00
Hyunyoung Song
95786e077d Good riddance UserEventDispatcher
Bug: 165675920
Bug: 161381246

TL;DR;;
- nano -> lite proto
- add all the missing logs to WW
- pin item related logging fix
- Removed logging for assistant

sgrep "com.android.launcher3.userevent.nano." | cut -f1 -d: | xargs sed -i -e 's/userevent\.nano\./userevent\./g'

Change-Id: Ie2a49fdd891cacbd7ef40a1dc9e41ff0574c7517
2020-09-27 13:41:49 -07:00
Sunny Goyal
fd58da6a75 Wrapping display properties in a wrapper class
This would allow us to support gestures on multiple-displays

Change-Id: I8f426bbdf04520f4189cadce2bde6aab4933c8d9
2020-08-12 13:43:56 -07:00
Raman Tenneti
ab98166c36 AOSP/Launcher3 - Update language to comply with Android's inclusive language guidance.
See https://source.android.com/setup/contribute/respectful-code for reference

BUG=161896447

Test: make and Presubmit verify.

Change-Id: I44e903046dd4cd9c7c07872fc56a8d552eb09522
2020-08-04 00:35:03 +00:00
Tony Wickham
03c38c5c66 Rewrite long swipe resistance ("pullback") logic
- Rename "pullback" to "resistance" to reduce confusion.
- Remove mDragLengthFactorStartPullback & mDragLengthFactorMaxPullback
- Add AnimatorControllerWithResistance, which has 2 controllers, one
  for the normal shift to overview, then one to apply the resistance
  when swiping beyond that.
- Don't hack animator interpolators/progress; insteaad, allow progress
  to go > 1 (which will run the separate resistance animator).
- Don't start launcher controller separately from window controller;
  instead, both are controlled by mCurrentShift in updateFinalShift().
- The resistance animation logic is shared by both the active window
  and launcher (RecentsView).

Bug: 149934536
Change-Id: Ib0f9da18e10cc9ddf1a2f82ed767f237c89d3a41
2020-08-03 13:59:38 -07:00
Jonathan Miranda
f496ea4634 Revert "Fix bug where double swipe gets us stuck in Hint state while in Overview."
This reverts commit a8c08584a7.

Reason for revert: "caused a regression with quick switch from home: if you start the gesture then swipe back to the left, it ends up launching the task anyway"

Change-Id: I8e12e2de46b6fc6a3faeb0336762da08080c61d6
2020-07-29 19:03:29 +00:00
Jon Miranda
a8c08584a7 Fix bug where double swipe gets us stuck in Hint state while in Overview.
With the second swipe, we never complete the swipe to Overview

NoButtonNavbarToOverviewTouchController#maybeSwipeInteractionToOverviewComplete
- mReachedOverview = true
- mDetector.isSettlingState = false

And then the second swipe starts the state transition to Hint but then
it never gets completed because:
1. The animation starts
2. Gets cancelled
3. Starts again
4. Finishes, but is not marked as success since the cancel in #2 was never
   set back to false

Bug: 160759508
Change-Id: I8c3972e6209c3d5a4a0bdd9f9b7683de18105d57
2020-07-20 10:29:29 -07:00
Tony Wickham
d2d9837b3e Merge "Skip fling anim if it is a no-op, to save a frame of aniamtion" into ub-launcher3-rvc-dev 2020-06-12 21:10:29 +00:00
Tony Wickham
5112cdd30b Skip fling anim if it is a no-op, to save a frame of aniamtion
Bug: 158701272
Change-Id: Id2bc502d1caaeefeca339d5e5ad355ad8ba6d7ec
2020-06-12 14:23:46 -05:00
Tony Wickham
fe54c36822 Apply PendingAnimation#mDuration to all added anims
Doing this at the root instead of individually for all added
animators ensures none fall through the cracks.

Fixes: shelf moving too quickly in 2 button mode
Change-Id: I0de1ba9cee3fb8f1d6161371625d97e4b2305129
2020-06-09 18:35:07 -05:00
Sunny Goyal
341fa84c5e Fixing animation jittering during swipe-up
AnimatorPlaybackController was using setCurrentPlayTime to control animation,
which converts progress (float) to duration (long) causing the progress to
loose accuracy.
Instead calling setCurrentFraction(float) on the target animation.

Bug: 155164803
Change-Id: I3e4c93c5a75a9ba16e80adee97229c974ffc86b1
2020-06-01 17:55:25 -07:00
Tony Wickham
244e173a68 Fix all apps alpha applying twice
Test: quick switch from home, ensure QSB fades out at the same
rate as the workspace/hotsea

Change-Id: I59ecd0c65a6abf3e24ea1c2bfba3c84f6a88e653
2020-05-29 11:10:10 -05:00
Sunny Goyal
b9abae9f0f Using taskView simulator for animation a task to recentsView
Also applying transform params in DeviceLockedInputConsumer directly
instead of going through AppWindowAnimationHelper

Bug: 156398988
Bug: 155816922
Change-Id: I791e1a9feb07c4fb787130f8d040a4f404faf734
2020-05-15 14:07:29 -07:00
Tony Wickham
f0c7966a77 Only set spring end value if animation wasn't canceled
Animations should only be canceled (as opposed to ended) if the
caller is intending to update the state from there. In that case,
we shouldn't jump to the end value.

Bug: 155335494
Change-Id: I93a21f0e2e1923ccdfab890adcb58c49ceb98a28
2020-05-12 16:22:03 -05:00
Sunny Goyal
4888790bde Simplifying animation creating logic for app-to-overview
Removing optional 'shouldAnimate' flag. This was false only in 3-button mode but
the code was also handling animation, leading to inconsistent expectations. Instead
always assuming animation and finishing the animation promptly.

Change-Id: Ic56476dc5ea64c9a7d7e9744f3e33cd61dfde9e8
2020-05-12 16:37:27 +00:00
Jon Miranda
db02b11340 Ensure final values are set when StaggeredWorkspaceAnim is cancelled/ended.
Was able to repo the bug reliably when calling cancel() and
end() immediately after starting the StaggeredWorkspaceAnim.

Bug: 153584267
Change-Id: I954d38ad69e72a83535f4dd1ec21dba0f61a3cfb
2020-04-29 15:51:10 +00:00
Sunny Goyal
7f9e8e2d27 Fixing animation player not overshooting spring animation; tuning springs
=> setCurrentPlayTime is bounded between [0, duration] by the animation framework
Instead using interpolator so that we can go outside the bounds

=> Tune spring stiffness and dampening for overview card dismiss animations

Bug: 154061408
Change-Id: Iaa31491fff499db916b36d9779ec159b8a89a2de
2020-04-22 12:54:31 -07:00
Sunny Goyal
26729a129a Force finishing spring animation on second touch,
if the animation is close to completion

Bug: 151180649
Change-Id: I7085bb76d4937910d55cbaf1cb71a0e6c24922d5
2020-03-17 15:02:21 -07:00
Sunny Goyal
f3ac703256 Moving animation config so a separate class
Using PendingAnimation for animation builder.
This will allow us to easily add SpringAnimation to stateAnimation

Change-Id: I8d88489a5da6fc85747ef9be7c13858b441cd28a
2020-03-16 19:36:36 -07:00
Sunny Goyal
003782f93c Removing some properties out of AnimationBuilder
AnimationBuilder and PendingAnimation have similar logic. This will
allow to unify the two classes

Change-Id: Id8c1d8a7020d132adbccdc6c80538ed6556cb75e
2020-03-11 16:35:36 -07:00
Sunny Goyal
dbcc63edeb Removing some autoboxing during property animation
Change-Id: Ibd6f20c565a4d66dc6d606b3f0bbc96fec66fe56
2020-03-10 08:43:55 +00:00
Sunny Goyal
add170098c Merge "Converting some anonymous classes to lambda calls" into ub-launcher3-master 2020-03-10 08:43:41 +00:00
Sunny Goyal
cfaa4889e6 Enabling springs for start dismiss animation
> Adding flag support for PendingAnimation which can be used
  to define custom behavior for various animations
> Using SpringAnimationBuild for spring animation instead of
  SpringObjectanimator

Change-Id: I41ca34b0574981bb3fc7894639a321c12e6feac1
2020-03-06 22:59:03 -08:00
Sunny Goyal
4c9ee63540 Converting some anonymous classes to lambda calls
Change-Id: I386046a4a515d84801a8bbd11cfa090ba7adfd71
2020-03-06 15:18:00 -08:00
Jon Miranda
1a3047666a Add more swipe up to home/spring variables as dynamic resources.
Bug: 147302669
Change-Id: I7a13f1eac8324d963302f5f42793478896f10097
2020-03-04 12:52:02 -08:00
Jon Miranda
2e8828bd30 Enable All Apps spring.
Bug: 147302669

Change-Id: I944ce7d181c554d840329a3affe0dee76eed9143
2020-02-03 14:03:47 -08:00
Tony Wickham
4fdba14cfb Two-zone model: swipe up from nav bar vs above it
When ENABLE_OVERVIEW_ACTIONS flag is enabled, swiping up from the nav
bar goes to overview if you hold, or the first home screen if you don't.

- Added NoButtonNavBarToOverviewTouchController, which extends
  FlingAndHoldTouchController but only works if you start from the nav
  bar. Otherwise it falls back to PortraitStatesTouchController to
  handle normal state transition to all apps.
- Added HintState. This is where the workspace/hotseat/qsb scale down
  when you swipe up from the nav bar, to hint that you're about to
  either go to overview or the first home screen.
  - Added getQsbScaleAndTranslation() to allow Overview and Hint states
    to treat it as part of the hotseat.
  - Since Overview needs to show above the QSB as it's animating, bring
    Overview to the front and update OverviewScrim to handle the case
    where there's no view above Overview to draw the scrim beneath.
- ENABLE_OVERVIEW_ACTIONS is always false in 2-button mode, since the
  shelf is crucial to that mode.

Bug: 143361609
Change-Id: I743481bb239dc77f7024dc98ba68a43534da2637
2020-01-28 18:31:10 -08:00
Tony Wickham
37a0970bf5 Improve quick switch from home by tracking both x and y motion
- Add NoButtonQuickSwitchTouchController which uses
  BothAxesSwipeDetector to track horizontal and vertical motion.
- Initially, we only detect swipe left to right to quick switch
  (like before), but then we allow swipe up to either go to
  overview (if you hold) or back home (if you don't hold).
- xDisplacement transitions non-overview components out (e.g. shelf
  and workspace), and translates overview in.
- yDisplacement translates overview up and scales it down

Bug: 126596417
Change-Id: Id679ad84c08246e205c667a78ed5df00d7276258
2019-11-14 15:50:18 -08:00
TreeHugger Robot
791dd73217 Merge "Adding support for building a "spring like animation" with precomputed values" into ub-launcher3-qt-qpr1-dev 2019-09-11 20:16:19 +00:00
Sunny Goyal
3600fb7777 Adding support for building a "spring like animation" with precomputed values
Bug: 138396187
Change-Id: Idba323090ecd9aca43c01414a32ab3b2e292e73e
2019-09-09 17:21:53 -07:00
Tony Wickham
bfdeda96e6 Properly prevent All Apps relayouts by avoiding scrollToPosition
Calling scrollToPosition on RecyclerView internally calls
requestLayout() (to cacluate where to scroll and then go there).
Therefore, we should avoid calling that whenever possible, especially
during transitions. In particular, we can optimize scrollToTop() to not
scrollToPosition() if we are already at the top.

This makes some other workarounds unnecessary, namely setting All Apps
to GONE during system gestures.

Test: Open an app, swipe up, ensure AllAppsRecyclerView doesn't get
onLayout().  If we had scrolled to an app first, we get one layout
in prepareRecentsUi(), but not during the transition.

Bug: 140308849
Change-Id: I62ee341bf5893c121cfc013cc6542559f79d2a42
2019-09-03 16:16:54 -07:00
Tony Wickham
7310bb4b5c Don't update all apps content visibility during home animation
We already set the all apps content visibility = GONE at the start of
the gesture to prevent relayouts, but when animating home we were
inadvertently changing it to INVISIBLE, causing a relayout and jank.

Bug: 140308849
Change-Id: I285746f8ac8f3f857282e22ebec8eebd0b98647f
2019-08-30 22:10:55 +00:00
Tony Wickham
35a4e0eec9 Tie prediction text to all apps interpolator
Now floating headers get 2 interpolators: one for the header content
itselt, and one for the all apps content that follows. That way, they
can choose to intperolate part of their content as if it were part of
all apps instead of the header. Currently, we do this to animate
predicted icons quickly, followed by the all apps icons, predictions
text, all apps scrollbar, and all apps divider as you continue swiping.

Bug: 132455160
Change-Id: Ib3e373c291e174e1306a53854d0ad4dc29eb4b76
2019-07-31 14:45:18 -07:00
Tony Wickham
c088051c29 Add OverviewScrim to show below overview but above workspace
- Refactor some basic scrim logic to Scrim class and have
  WorkspaceAndHotseatScrim and OverviewScrim extend it
- Draw OverviewScrim under recents unless predictions are disabled, in
  which case draw it under hotseat (since that is in recents)
- Remove sysui scrim (behind status bar and nav bar) when overview is
  peeking

Bug: 132455160
Change-Id: Ia5d6f54582a4c5a70e3b2d4a98281567edd68519
2019-07-31 14:44:28 -07:00