Adding callback to notify LauncherCallbacks when quickstep starts

Bug: 73081875
Change-Id: Ieccba6ecb16553ed5211f277b49e9f2ed2d7c745
This commit is contained in:
Sunny Goyal
2018-02-07 14:44:05 -08:00
parent 03c8e3ffad
commit 3bac2c2b91
3 changed files with 29 additions and 1 deletions
@@ -154,6 +154,8 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
this::initializeLauncherAnimationController);
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN,
this::launcherFrameDrawn);
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_GESTURE_STARTED,
this::notifyGestureStarted);
mStateCallback.addCallback(STATE_SCALED_CONTROLLER_APP | STATE_APP_CONTROLLER_RECEIVED,
this::resumeLastTask);
@@ -220,6 +222,7 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
mStateCallback.setState(oldState);
mLauncherLayoutListener.setHandler(null);
}
mWasLauncherAlreadyVisible = alreadyOnHome;
mLauncher = launcher;
LauncherState startState = mLauncher.getStateManager().getState();
@@ -229,7 +232,6 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
mLauncher.getStateManager().setRestState(startState);
AbstractFloatingView.closeAllOpenViews(launcher, alreadyOnHome);
mWasLauncherAlreadyVisible = alreadyOnHome;
mRecentsView = mLauncher.getOverviewPanel();
mLauncherLayoutListener = new LauncherLayoutListener(mLauncher);
@@ -429,10 +431,22 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
}
public void onGestureStarted() {
if (mLauncher != null) {
notifyGestureStarted();
}
setStateOnUiThread(STATE_GESTURE_STARTED);
mGestureStarted = true;
}
/**
* Notifies the launcher that the swipe gesture has started. This can be called multiple times
* on both background and UI threads
*/
private void notifyGestureStarted() {
mLauncher.onQuickstepGestureStarted(mWasLauncherAlreadyVisible);
}
@WorkerThread
public void onGestureEnded(float endVelocity) {
Resources res = mContext.getResources();
+6
View File
@@ -1193,6 +1193,12 @@ public class Launcher extends BaseActivity
}
}
public void onQuickstepGestureStarted(boolean isVisible) {
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onQuickstepGestureStarted(isVisible);
}
}
public AllAppsTransitionController getAllAppsController() {
return mAllAppsController;
}
@@ -71,4 +71,12 @@ public interface LauncherCallbacks {
* Extensions points for adding / replacing some other aspects of the Launcher experience.
*/
boolean hasSettings();
/**
* Called when launcher integrated quickstep and some quickstep gesture started. It can be
* called multiple times for a single gesture an UI or background thread.
*
* @param isVisible if Launcher was visible when the gesture started.
*/
void onQuickstepGestureStarted(boolean isVisible);
}