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

Commit bc7efd06 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing while navication bar in all-apps in 3-button mode." into tm-qpr-dev

parents 7c323889 7450874e
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
import static com.android.launcher3.util.SystemUiController.FLAG_DARK_NAV;
import static com.android.launcher3.util.SystemUiController.FLAG_LIGHT_NAV;
import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
@@ -54,6 +57,7 @@ import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ScrimView;

/**
@@ -73,6 +77,8 @@ public class AllAppsTransitionController
    public static final float SWIPE_ALL_APPS_TO_HOME_MIN_SCALE = 0.9f;
    private static final int REVERT_SWIPE_ALL_APPS_TO_HOME_ANIMATION_DURATION_MS = 200;

    private static final float NAV_BAR_COLOR_FORCE_UPDATE_THRESHOLD = 0.1f;

    public static final FloatProperty<AllAppsTransitionController> ALL_APPS_PROGRESS =
            new FloatProperty<AllAppsTransitionController>("allAppsProgress") {

@@ -151,6 +157,8 @@ public class AllAppsTransitionController

    private final Launcher mLauncher;
    private final AnimatedFloat mAllAppScale = new AnimatedFloat(this::onScaleProgressChanged);
    private final int mNavScrimFlag;

    private boolean mIsVerticalLayout;

    // Whether this class should take care of closing the keyboard.
@@ -177,10 +185,13 @@ public class AllAppsTransitionController
    public AllAppsTransitionController(Launcher l) {
        mLauncher = l;
        DeviceProfile dp = mLauncher.getDeviceProfile();
        setShiftRange(dp.allAppsShiftRange);
        mProgress = 1f;
        mIsVerticalLayout = dp.isVerticalBarLayout();
        mIsTablet = dp.isTablet;
        mNavScrimFlag = Themes.getAttrBoolean(l, R.attr.isMainColorDark)
                ? FLAG_DARK_NAV : FLAG_LIGHT_NAV;

        setShiftRange(dp.allAppsShiftRange);
        mLauncher.addOnDeviceProfileChangeListener(this);
    }

@@ -213,6 +224,11 @@ public class AllAppsTransitionController
        mProgress = progress;
        getAppsViewProgressTranslationY().setValue(mProgress * mShiftRange);
        mLauncher.onAllAppsTransition(1 - progress);

        boolean hasScrim = progress < NAV_BAR_COLOR_FORCE_UPDATE_THRESHOLD
                && mLauncher.getAppsView().getNavBarScrimHeight() > 0;
        mLauncher.getSystemUiController().updateUiState(
                UI_STATE_ALL_APPS, hasScrim ? mNavScrimFlag : 0);
    }

    public float getProgress() {
+9 −2
Original line number Diff line number Diff line
@@ -520,13 +520,20 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
    /**
     * Returns a padding in case a scrim is shown on the bottom of the view and a padding is needed.
     */
    protected int getNavBarScrimHeight(WindowInsets insets) {
    protected int computeNavBarScrimHeight(WindowInsets insets) {
        return 0;
    }

    /**
     * Returns the current height of nav bar scrim
     */
    public int getNavBarScrimHeight() {
        return mNavBarScrimHeight;
    }

    @Override
    public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
        mNavBarScrimHeight = getNavBarScrimHeight(insets);
        mNavBarScrimHeight = computeNavBarScrimHeight(insets);
        applyAdapterSideAndBottomPaddings(mActivityContext.getDeviceProfile());
        return super.dispatchApplyWindowInsets(insets);
    }
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<L
    }

    @Override
    protected int getNavBarScrimHeight(WindowInsets insets) {
    protected int computeNavBarScrimHeight(WindowInsets insets) {
        if (Utilities.ATLEAST_Q) {
            return insets.getTappableElementInsets().bottom;
        } else {
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public class SystemUiController {
    public static final int UI_STATE_SCRIM_VIEW = 1;
    public static final int UI_STATE_WIDGET_BOTTOM_SHEET = 2;
    public static final int UI_STATE_FULLSCREEN_TASK = 3;
    public static final int UI_STATE_ALL_APPS = 4;

    public static final int FLAG_LIGHT_NAV = 1 << 0;
    public static final int FLAG_DARK_NAV = 1 << 1;
@@ -54,7 +55,7 @@ public class SystemUiController {
    public @interface SystemUiControllerFlags {}

    private final Window mWindow;
    private final int[] mStates = new int[4];
    private final int[] mStates = new int[5];

    public SystemUiController(Window window) {
        mWindow = window;