Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4aefc12 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Stash taskbar when IME is present, including during gestures" into sc-v2-dev

parents 226bd5b9 821e37b4
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -46,16 +46,13 @@ public class FallbackTaskbarUIController extends TaskbarUIController {
                }
            };

    // Initialized in init.
    TaskbarControllers mControllers;

    public FallbackTaskbarUIController(RecentsActivity recentsActivity) {
        mRecentsActivity = recentsActivity;
    }

    @Override
    protected void init(TaskbarControllers taskbarControllers) {
        mControllers = taskbarControllers;
        super.init(taskbarControllers);

        mRecentsActivity.setTaskbarUIController(this);
        mRecentsActivity.getStateManager().addStateListener(mStateListener);
+9 −7
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.os.RemoteException;
import android.util.Log;
import android.view.MotionEvent;
import android.view.TaskTransitionSpec;
import android.view.View;
import android.view.WindowManagerGlobal;

import androidx.annotation.NonNull;
@@ -62,7 +61,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
            this::onStashedInAppChanged;

    // Initialized in init.
    private TaskbarControllers mControllers;
    private AnimatedFloat mTaskbarOverrideBackgroundAlpha;
    private TaskbarKeyguardController mKeyguardController;
    private final TaskbarLauncherStateController
@@ -83,7 +81,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {

    @Override
    protected void init(TaskbarControllers taskbarControllers) {
        mControllers = taskbarControllers;
        super.init(taskbarControllers);

        mTaskbarLauncherStateController.init(mControllers, mLauncher);
        mTaskbarOverrideBackgroundAlpha = mControllers.taskbarDragLayerController
@@ -168,10 +166,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        return mControllers.taskbarDragController.isDragging();
    }

    public View getRootView() {
        return mControllers.taskbarActivityContext.getDragLayer();
    }

    @Override
    protected void onStashedInAppChanged() {
        onStashedInAppChanged(mLauncher.getDeviceProfile());
@@ -251,4 +245,12 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        mLauncher.logAppLaunch(mControllers.taskbarActivityContext.getStatsLogManager(), item,
                instanceId);
    }

    @Override
    public void setSystemGestureInProgress(boolean inProgress) {
        super.setSystemGestureInProgress(inProgress);
        // Launcher's ScrimView will draw the background throughout the gesture. But once the
        // gesture ends, start drawing taskbar's background again since launcher might stop drawing.
        forceHideBackground(inProgress);
    }
}
+1 −7
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BA
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH;
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_RECENTS;
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_IME;
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_KEYGUARD;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
@@ -140,11 +139,6 @@ public class NavbarButtonsViewController {
        mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
        mNavButtonTranslationYMultiplier.value = 1;

        mPropertyHolders.add(new StatePropertyHolder(
                mControllers.taskbarViewController.getTaskbarIconAlpha()
                        .getProperty(ALPHA_INDEX_IME),
                flags -> (flags & FLAG_IME_VISIBLE) == 0, MultiValueAlpha.VALUE, 1, 0));

        boolean isThreeButtonNav = mContext.isThreeButtonNav();
        // IME switcher
        View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
@@ -196,7 +190,7 @@ public class NavbarButtonsViewController {
            }

            // Animate taskbar background when any of these flags are enabled
            int flagsToShowBg = FLAG_IME_VISIBLE | FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE
            int flagsToShowBg = FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE
                    | FLAG_NOTIFICATION_SHADE_EXPANDED;
            mPropertyHolders.add(new StatePropertyHolder(
                    mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
+24 −9
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
package com.android.launcher3.taskbar;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Outline;
@@ -23,8 +25,6 @@ import android.graphics.Rect;
import android.view.View;
import android.view.ViewOutlineProvider;

import androidx.annotation.Nullable;

import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.RevealOutlineAnimation;
@@ -66,7 +66,10 @@ public class StashedHandleViewController {
    private final Rect mStashedHandleBounds = new Rect();
    private float mStashedHandleRadius;

    private boolean mIsAtStashedRevealBounds = true;
    // When the reveal animation is cancelled, we can assume it's about to create a new animation,
    // which should start off at the same point the cancelled one left off.
    private float mStartProgressForNextRevealAnim;
    private boolean mWasLastRevealAnimReversed;

    public StashedHandleViewController(TaskbarActivityContext activity,
            StashedHandleView stashedHandleView) {
@@ -148,15 +151,27 @@ public class StashedHandleViewController {
     * shape and size. When stashed, the shape is a thin rounded pill. When unstashed, the shape
     * morphs into the size of where the taskbar icons will be.
     */
    public @Nullable Animator createRevealAnimToIsStashed(boolean isStashed) {
        if (mIsAtStashedRevealBounds == isStashed) {
            return null;
        }
        mIsAtStashedRevealBounds = isStashed;
    public Animator createRevealAnimToIsStashed(boolean isStashed) {
        final RevealOutlineAnimation handleRevealProvider = new RoundedRectRevealOutlineProvider(
                mStashedHandleRadius, mStashedHandleRadius,
                mControllers.taskbarViewController.getIconLayoutBounds(), mStashedHandleBounds);
        return handleRevealProvider.createRevealAnimator(mStashedHandleView, !isStashed);

        boolean isReversed = !isStashed;
        boolean changingDirection = mWasLastRevealAnimReversed != isReversed;
        mWasLastRevealAnimReversed = isReversed;
        if (changingDirection) {
            mStartProgressForNextRevealAnim = 1f - mStartProgressForNextRevealAnim;
        }

        ValueAnimator revealAnim = handleRevealProvider.createRevealAnimator(mStashedHandleView,
                isReversed, mStartProgressForNextRevealAnim);
        revealAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mStartProgressForNextRevealAnim = ((ValueAnimator) animation).getAnimatedFraction();
            }
        });
        return revealAnim;
    }

    public void onIsStashed(boolean isStashed) {
+7 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public class TaskbarDragLayerController {
    private final AnimatedFloat mKeyguardBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
    private final AnimatedFloat mNotificationShadeBgTaskbar = new AnimatedFloat(
            this::updateBackgroundAlpha);
    private final AnimatedFloat mImeBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
    // Used to hide our background color when someone else (e.g. ScrimView) is handling it.
    private final AnimatedFloat mBgOverride = new AnimatedFloat(this::updateBackgroundAlpha);

@@ -74,6 +75,7 @@ public class TaskbarDragLayerController {
        mBgTaskbar.value = 1;
        mKeyguardBgTaskbar.value = 1;
        mNotificationShadeBgTaskbar.value = 1;
        mImeBgTaskbar.value = 1;
        mBgOverride.value = 1;
        updateBackgroundAlpha();
    }
@@ -108,6 +110,10 @@ public class TaskbarDragLayerController {
        return mNotificationShadeBgTaskbar;
    }

    public AnimatedFloat getImeBgTaskbar() {
        return mImeBgTaskbar;
    }

    public AnimatedFloat getOverrideBackgroundAlpha() {
        return mBgOverride;
    }
@@ -119,7 +125,7 @@ public class TaskbarDragLayerController {
    private void updateBackgroundAlpha() {
        final float bgNavbar = mBgNavbar.value;
        final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value
                * mNotificationShadeBgTaskbar.value;
                * mNotificationShadeBgTaskbar.value * mImeBgTaskbar.value;
        mLastSetBackgroundAlpha = mBgOverride.value * Math.max(bgNavbar, bgTaskbar);
        mTaskbarDragLayer.setTaskbarBackgroundAlpha(mLastSetBackgroundAlpha);

Loading