Adding a separate state for QuickScrub

Bug: 74014237
Change-Id: Ie86ac589f0ad0e1470fb6b0b71263ec6593eb1e3
This commit is contained in:
Sunny Goyal committed 2018-03-02 15:38:21 -08:00
1 parent ae9e85b8e9
commit 6c6c2f45f7
12 files changed
+92 -44

No files matched your search

@@ -218,7 +218,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
private LauncherTransitionAnimator composeRecentsLaunchAnimator(View v,
RemoteAnimationTargetCompat[] targets) {
// Ensure recents is actually visible
if (!mLauncher.isInState(LauncherState.OVERVIEW)) {
if (!mLauncher.getStateManager().getState().overviewUi) {
return null;
}
@@ -720,7 +720,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
postAtFrontOfQueueAsynchronously(handler, () -> {
if ((Utilities.getPrefs(mLauncher)
.getBoolean("pref_use_screenshot_for_swipe_up", false)
&& mLauncher.isInState(LauncherState.OVERVIEW))
&& mLauncher.getStateManager().getState().overviewUi)
|| !launcherIsATargetWithMode(targets, MODE_OPENING)) {
// We use a separate transition for Overview mode. And we can skip the
// animation in cases where Launcher is not in the set of opening targets.
@@ -13,29 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.uioverrides;
import android.view.MotionEvent;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.TouchInteractionService;
import com.android.launcher3.Launcher;
/**
* Consumes touches when quick scrub is enabled.
* Extension of overview state used for QuickScrub
*/
public class IgnoreTouchesInQuickScrub implements TouchController {
public class FastOverviewState extends OverviewState {
public IgnoreTouchesInQuickScrub() {
private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_DISABLE_RESTORE
| FLAG_PAGE_BACKGROUNDS | FLAG_DISABLE_INTERACTION | FLAG_OVERVIEW_UI;
private static final boolean DEBUG_DIFFERENT_UI = false;
public FastOverviewState(int id) {
super(id, STATE_FLAGS);
}
@Override
public boolean onControllerTouchEvent(MotionEvent ev) {
return true;
}
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
return TouchInteractionService.isQuickScrubEnabled();
public float getHoseatAlpha(Launcher launcher) {
if (DEBUG_DIFFERENT_UI) {
return 0;
}
return super.getHoseatAlpha(launcher);
}
}
@@ -34,10 +34,14 @@ import com.android.quickstep.RecentsView;
public class OverviewState extends LauncherState {
private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED
| FLAG_DISABLE_RESTORE | FLAG_PAGE_BACKGROUNDS;
| FLAG_DISABLE_RESTORE | FLAG_PAGE_BACKGROUNDS | FLAG_OVERVIEW_UI;
public OverviewState(int id) {
super(id, ContainerType.TASKSWITCHER, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
this(id, STATE_FLAGS);
}
protected OverviewState(int id, int stateFlags) {
super(id, ContainerType.TASKSWITCHER, OVERVIEW_TRANSITION_MS, stateFlags);
}
@Override
@@ -60,10 +60,10 @@ public class RecentsViewStateController implements StateHandler {
@Override
public void setState(LauncherState state) {
mWorkspaceCard.setWorkspaceScrollingEnabled(state == OVERVIEW);
setVisibility(state == OVERVIEW);
setTransitionProgress(state == OVERVIEW ? 1 : 0);
if (state == OVERVIEW) {
mWorkspaceCard.setWorkspaceScrollingEnabled(state.overviewUi);
setVisibility(state.overviewUi);
setTransitionProgress(state.overviewUi ? 1 : 0);
if (state.overviewUi) {
for (int i = mRecentsView.getFirstTaskIndex(); i < mRecentsView.getPageCount(); i++) {
((TaskView) mRecentsView.getPageAt(i)).resetVisualProperties();
}
@@ -92,20 +92,20 @@ public class RecentsViewStateController implements StateHandler {
}
ObjectAnimator progressAnim =
mTransitionProgress.animateToValue(toState == OVERVIEW ? 1 : 0);
mTransitionProgress.animateToValue(toState.overviewUi ? 1 : 0);
progressAnim.setDuration(config.duration);
progressAnim.setInterpolator(Interpolators.LINEAR);
progressAnim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
mWorkspaceCard.setWorkspaceScrollingEnabled(toState == OVERVIEW);
mWorkspaceCard.setWorkspaceScrollingEnabled(toState.overviewUi);
mRecentsView.setCurrentPage(mRecentsView.getPageNearestToCenterOfScreen());
}
});
builder.play(progressAnim);
ObjectAnimator visibilityAnim = animateVisibility(toState == OVERVIEW);
ObjectAnimator visibilityAnim = animateVisibility(toState.overviewUi);
visibilityAnim.setDuration(config.duration);
visibilityAnim.setInterpolator(Interpolators.LINEAR);
builder.play(visibilityAnim);
@@ -43,13 +43,11 @@ public class UiFactory {
public static TouchController[] createTouchControllers(Launcher launcher) {
if (FeatureFlags.ENABLE_TWO_SWIPE_TARGETS) {
return new TouchController[] {
new IgnoreTouchesInQuickScrub(),
new EdgeSwipeController(launcher),
new TwoStepSwipeController(launcher),
new OverviewSwipeController(launcher)};
} else {
return new TouchController[] {
new IgnoreTouchesInQuickScrub(),
new TwoStepSwipeController(launcher),
new OverviewSwipeController(launcher)};
}
@@ -21,6 +21,8 @@ import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_POINTER_DOWN;
import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
import static com.android.launcher3.LauncherState.FAST_OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.quickstep.QuickScrubController.QUICK_SWITCH_START_DURATION;
@@ -117,7 +119,6 @@ public class TouchInteractionService extends Service {
@Override
public void onQuickScrubStart() {
mEventQueue.onQuickScrubStart();
sQuickScrubEnabled = true;
TraceHelper.partitionSection("SysUiBinder", "onQuickScrubStart");
}
@@ -130,23 +131,17 @@ public class TouchInteractionService extends Service {
public void onQuickScrubEnd() {
mEventQueue.onQuickScrubEnd();
TraceHelper.endSection("SysUiBinder", "onQuickScrubEnd");
sQuickScrubEnabled = false;
}
};
private final TouchConsumer mNoOpTouchConsumer = (ev) -> {};
private static boolean sConnected = false;
private static boolean sQuickScrubEnabled = false;
public static boolean isConnected() {
return sConnected;
}
public static boolean isQuickScrubEnabled() {
return sQuickScrubEnabled;
}
private ActivityManagerWrapper mAM;
private RunningTaskInfo mRunningTask;
private RecentsModel mRecentsModel;
@@ -190,7 +185,6 @@ public class TouchInteractionService extends Service {
@Override
public void onDestroy() {
sConnected = false;
sQuickScrubEnabled = false;
super.onDestroy();
}
@@ -315,7 +309,7 @@ public class TouchInteractionService extends Service {
} else if (interactionType == INTERACTION_QUICK_SWITCH) {
onComplete = mQuickScrubController::onQuickSwitch;
}
mLauncher.getStateManager().goToState(OVERVIEW, true, 0,
mLauncher.getStateManager().goToState(FAST_OVERVIEW, true, 0,
QUICK_SWITCH_START_DURATION, onComplete);
};
@@ -15,6 +15,7 @@
*/
package com.android.quickstep;
import static com.android.launcher3.LauncherState.FAST_OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -493,6 +494,8 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler {
}
private void onQuickInteractionStart() {
mLauncher.getStateManager().goToState(FAST_OVERVIEW,
mWasLauncherAlreadyVisible || mGestureStarted);
mQuickScrubController.onQuickScrubStart(false);
}