Hide taskbar when certain floating views are open
Test: Open widgets, ensure taskbar hides Bug: 171917176 Change-Id: Ib78182fe0ca1ea5ffbd28ab42f49ab8f0e535a18
This commit is contained in:
1 parent
a79c7e4227
commit
e5695f9196
3 files changed
+21
-3
No files matched your search
@@ -19,7 +19,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_TASKBAR;
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_REPLACE_TASKBAR_WITH_HOTSEAT;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
@@ -486,11 +486,15 @@ public class TaskbarController {
|
||||
|
||||
private void replaceTaskbarWithHotseatOrViceVersa() {
|
||||
boolean replaceTaskbarWithHotseat = AbstractFloatingView.getTopOpenViewWithType(mLauncher,
|
||||
TYPE_ALL & TYPE_REPLACE_TASKBAR_WITH_HOTSEAT) != null;
|
||||
TYPE_REPLACE_TASKBAR_WITH_HOTSEAT) != null;
|
||||
if (!mLauncher.hasBeenResumed()) {
|
||||
replaceTaskbarWithHotseat = false;
|
||||
}
|
||||
setReplaceTaskbarWithHotseat(replaceTaskbarWithHotseat);
|
||||
|
||||
boolean hideTaskbar = AbstractFloatingView.getTopOpenViewWithType(mLauncher,
|
||||
TYPE_HIDE_TASKBAR) != null;
|
||||
mTaskbarVisibilityController.animateToVisibilityForFloatingView(hideTaskbar ? 0f : 1f);
|
||||
}
|
||||
|
||||
private void setReplaceTaskbarWithHotseat(boolean replaceTaskbarWithHotseat) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.android.systemui.shared.system.QuickStepContract;
|
||||
public class TaskbarVisibilityController {
|
||||
|
||||
private static final long IME_VISIBILITY_ALPHA_DURATION = 120;
|
||||
private static final long FLOATING_VIEW_VISIBILITY_ALPHA_DURATION = 120;
|
||||
|
||||
private final BaseQuickstepLauncher mLauncher;
|
||||
private final TaskbarController.TaskbarVisibilityControllerCallbacks mTaskbarCallbacks;
|
||||
@@ -44,6 +45,8 @@ public class TaskbarVisibilityController {
|
||||
this::updateVisibilityAlpha);
|
||||
private AnimatedFloat mTaskbarVisibilityAlphaForIme = new AnimatedFloat(
|
||||
this::updateVisibilityAlpha);
|
||||
private AnimatedFloat mTaskbarVisibilityAlphaForFloatingView = new AnimatedFloat(
|
||||
this::updateVisibilityAlpha);
|
||||
|
||||
public TaskbarVisibilityController(BaseQuickstepLauncher launcher,
|
||||
TaskbarController.TaskbarVisibilityControllerCallbacks taskbarCallbacks) {
|
||||
@@ -59,6 +62,7 @@ public class TaskbarVisibilityController {
|
||||
boolean isImeVisible = (SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags()
|
||||
& QuickStepContract.SYSUI_STATE_IME_SHOWING) != 0;
|
||||
mTaskbarVisibilityAlphaForIme.updateValue(isImeVisible ? 0f : 1f);
|
||||
mTaskbarVisibilityAlphaForFloatingView.updateValue(1f);
|
||||
|
||||
onTaskbarBackgroundAlphaChanged();
|
||||
updateVisibilityAlpha();
|
||||
@@ -82,6 +86,11 @@ public class TaskbarVisibilityController {
|
||||
.setDuration(IME_VISIBILITY_ALPHA_DURATION).start();
|
||||
}
|
||||
|
||||
protected void animateToVisibilityForFloatingView(float toAlpha) {
|
||||
mTaskbarVisibilityAlphaForIme.animateToValue(mTaskbarVisibilityAlphaForFloatingView.value,
|
||||
toAlpha).setDuration(FLOATING_VIEW_VISIBILITY_ALPHA_DURATION).start();
|
||||
}
|
||||
|
||||
private void onTaskbarBackgroundAlphaChanged() {
|
||||
mTaskbarCallbacks.updateTaskbarBackgroundAlpha(mTaskbarBackgroundAlpha.value);
|
||||
updateVisibilityAlpha();
|
||||
@@ -93,7 +102,8 @@ public class TaskbarVisibilityController {
|
||||
// LauncherState if Launcher is paused.
|
||||
float alphaDueToLauncher = Math.max(mTaskbarBackgroundAlpha.value,
|
||||
mTaskbarVisibilityAlphaForLauncherState.value);
|
||||
float alphaDueToOther = mTaskbarVisibilityAlphaForIme.value;
|
||||
float alphaDueToOther = mTaskbarVisibilityAlphaForIme.value
|
||||
* mTaskbarVisibilityAlphaForFloatingView.value;
|
||||
float taskbarAlpha = alphaDueToLauncher * alphaDueToOther;
|
||||
mTaskbarCallbacks.updateTaskbarVisibilityAlpha(taskbarAlpha);
|
||||
|
||||
|
||||
@@ -101,6 +101,10 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
// When these types of floating views are open, hide the taskbar hotseat and show the real one.
|
||||
public static final int TYPE_REPLACE_TASKBAR_WITH_HOTSEAT = TYPE_FOLDER | TYPE_ACTION_POPUP;
|
||||
|
||||
// Hide the taskbar when these types of floating views are open.
|
||||
public static final int TYPE_HIDE_TASKBAR = TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGETS_FULL_SHEET
|
||||
| TYPE_ON_BOARD_POPUP;
|
||||
|
||||
public static final int TYPE_ACCESSIBLE = TYPE_ALL & ~TYPE_DISCOVERY_BOUNCE & ~TYPE_LISTENER
|
||||
& ~TYPE_ALL_APPS_EDU;
|
||||
|
||||
|
||||
Reference in new issue
Block a user