mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Optimize system bar switching animations
- Fix a bug where the wrong time was used when the activity was in overview, but overview wasn't actually visible. - Fixing this looks pretty bad. Introduce a pre-delay since our animations decelarate heavily at the end. - Consolidate logic between swipe-up and swipe-down. Take a middle value that is most in line with the other animations. Test: Open/close apps from home and recents with and without swiping. Fixes: 109906294 Change-Id: I9cd5568c60fe7281d0f71a75981a3003770e659e
This commit is contained in:
@@ -92,8 +92,16 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
|
||||
implements OnDeviceProfileChangeListener {
|
||||
|
||||
private static final String TAG = "LauncherTransition";
|
||||
|
||||
/** Duration of status bar animations. */
|
||||
public static final int STATUS_BAR_TRANSITION_DURATION = 120;
|
||||
|
||||
/**
|
||||
* Since our animations decelerate heavily when finishing, we want to start status bar animations
|
||||
* x ms before the ending.
|
||||
*/
|
||||
public static final int STATUS_BAR_TRANSITION_PRE_DELAY = 96;
|
||||
|
||||
private static final String CONTROL_REMOTE_APP_TRANSITION_PERMISSION =
|
||||
"android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS";
|
||||
|
||||
@@ -210,9 +218,14 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
|
||||
}
|
||||
};
|
||||
|
||||
int duration = findTaskViewToLaunch(launcher, v, null) != null
|
||||
? RECENTS_LAUNCH_DURATION : APP_LAUNCH_DURATION;
|
||||
int statusBarTransitionDelay = duration - STATUS_BAR_TRANSITION_DURATION;
|
||||
boolean fromRecents = mLauncher.getStateManager().getState().overviewUi
|
||||
&& findTaskViewToLaunch(launcher, v, null) != null;
|
||||
int duration = fromRecents
|
||||
? RECENTS_LAUNCH_DURATION
|
||||
: APP_LAUNCH_DURATION;
|
||||
|
||||
int statusBarTransitionDelay = duration - STATUS_BAR_TRANSITION_DURATION
|
||||
- STATUS_BAR_TRANSITION_PRE_DELAY;
|
||||
return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(
|
||||
runner, duration, statusBarTransitionDelay));
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
|
||||
|
||||
import static com.android.launcher3.LauncherAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION;
|
||||
import static com.android.launcher3.LauncherAppTransitionManagerImpl.STATUS_BAR_TRANSITION_DURATION;
|
||||
import static com.android.launcher3.LauncherAppTransitionManagerImpl.STATUS_BAR_TRANSITION_PRE_DELAY;
|
||||
import static com.android.quickstep.TaskUtils.getRecentsWindowAnimator;
|
||||
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
||||
@@ -186,7 +187,8 @@ public class RecentsActivity extends BaseDraggingActivity {
|
||||
};
|
||||
return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(
|
||||
runner, RECENTS_LAUNCH_DURATION,
|
||||
RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION));
|
||||
RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION
|
||||
- STATUS_BAR_TRANSITION_PRE_DELAY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_FROM_APP_START_DURATION;
|
||||
import static com.android.quickstep.TouchConsumer.INTERACTION_NORMAL;
|
||||
import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB;
|
||||
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -560,8 +561,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
? mSyncTransactionApplier
|
||||
: null);
|
||||
|
||||
// TODO: This logic is spartanic!
|
||||
boolean passedThreshold = shift > 0.12f;
|
||||
boolean passedThreshold = shift > 1 - UPDATE_SYSUI_FLAGS_THRESHOLD;
|
||||
mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold);
|
||||
if (mActivityControlHelper.shouldMinimizeSplitScreen()) {
|
||||
mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold);
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
|
||||
|
||||
private static final int DISMISS_TASK_DURATION = 300;
|
||||
// The threshold at which we update the SystemUI flags when animating from the task into the app
|
||||
private static final float UPDATE_SYSUI_FLAGS_THRESHOLD = 0.6f;
|
||||
public static final float UPDATE_SYSUI_FLAGS_THRESHOLD = 0.85f;
|
||||
|
||||
private static final float[] sTempFloatArray = new float[3];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user