- Added StashedHandleViewController to provide properties such as ViewOutlineProvider to animate the handle that's shown in place of taskbar while it's stashed - Added TaskbarStashController to coordinate the stashed state, including orchestrating the animation across taskbar controllers - Added TaskbarStashInput consumer to detect long press in the nav region when taskbar is stashed Behavior: - Long pressing taskbar background animates to the stashed state by morphing the TaskbarView into the stashed handle view and offsetting the background offscreen - We persist the stashed state across app launches and reboot; to unstash, long press the stashed handle - We also visually unstash when going back home Test: long press tasbkar background when in an app to stash it, long press the resulting stashed handle to unstash; while stashed, swipe up to home to also unstash until launching another app Bug: 189503603 Change-Id: I698eff785388dff1ef717c76879719d6af236c2d
67 lines
2.2 KiB
Java
67 lines
2.2 KiB
Java
/*
|
|
* Copyright (C) 2021 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.android.quickstep.inputconsumers;
|
|
|
|
import android.content.Context;
|
|
import android.view.GestureDetector;
|
|
import android.view.GestureDetector.SimpleOnGestureListener;
|
|
import android.view.MotionEvent;
|
|
|
|
import com.android.quickstep.BaseActivityInterface;
|
|
import com.android.quickstep.InputConsumer;
|
|
import com.android.systemui.shared.system.InputMonitorCompat;
|
|
|
|
/**
|
|
* Listens for a long press, and cancels the current gesture if that causes Taskbar to be unstashed.
|
|
*/
|
|
public class TaskbarStashInputConsumer extends DelegateInputConsumer {
|
|
|
|
private final BaseActivityInterface mActivityInterface;
|
|
private final GestureDetector mLongPressDetector;
|
|
|
|
public TaskbarStashInputConsumer(Context context, InputConsumer delegate,
|
|
InputMonitorCompat inputMonitor, BaseActivityInterface activityInterface) {
|
|
super(delegate, inputMonitor);
|
|
mActivityInterface = activityInterface;
|
|
|
|
mLongPressDetector = new GestureDetector(context, new SimpleOnGestureListener() {
|
|
@Override
|
|
public void onLongPress(MotionEvent motionEvent) {
|
|
onLongPressDetected(motionEvent);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override
|
|
public int getType() {
|
|
return TYPE_TASKBAR_STASH | mDelegate.getType();
|
|
}
|
|
|
|
@Override
|
|
public void onMotionEvent(MotionEvent ev) {
|
|
mLongPressDetector.onTouchEvent(ev);
|
|
if (mState != STATE_ACTIVE) {
|
|
mDelegate.onMotionEvent(ev);
|
|
}
|
|
}
|
|
|
|
private void onLongPressDetected(MotionEvent motionEvent) {
|
|
if (mActivityInterface.onLongPressToUnstashTaskbar()) {
|
|
setActive(motionEvent);
|
|
}
|
|
}
|
|
}
|