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

Commit 2a1873be authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Fixed assist hint not aligned screen bottom when there is a bottom cutout"

parents 64effcba 2624bec0
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public class AssistHandleViewController implements NavigationBarTransitions.Dark
    private Handler mHandler;
    private CornerHandleView mAssistHintLeft;
    private CornerHandleView mAssistHintRight;
    private int mBottomOffset;

    @VisibleForTesting
    boolean mAssistHintVisible;
@@ -61,6 +62,23 @@ public class AssistHandleViewController implements NavigationBarTransitions.Dark
        mAssistHintRight.updateDarkness(darkIntensity);
    }

    /**
     * Set the bottom offset.
     *
     * @param bottomOffset the bottom offset to translate.
     */
    public void setBottomOffset(int bottomOffset) {
        if (mBottomOffset != bottomOffset) {
            mBottomOffset = bottomOffset;
            if (mAssistHintVisible) {
                // If assist handles are visible, hide them without animation and then make them
                // show once again (with corrected bottom offset).
                hideAssistHandles();
                setAssistHintVisible(true);
            }
        }
    }

    /**
     * Controls the visibility of the assist gesture handles.
     *
@@ -126,7 +144,8 @@ public class AssistHandleViewController implements NavigationBarTransitions.Dark
                xDirection * translationStart * view.getWidth(),
                xDirection * translationEnd * view.getWidth());
        Animator translateY = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y,
                translationStart * view.getHeight(), translationEnd * view.getHeight());
                translationStart * view.getHeight() + mBottomOffset,
                translationEnd * view.getHeight() + mBottomOffset);

        AnimatorSet set = new AnimatorSet();
        set.play(scaleX).with(scaleY);
+15 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import com.android.systemui.DockedStackExistsListener;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.assist.AssistHandleViewController;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.model.SysUiState;
import com.android.systemui.recents.OverviewProxyService;
@@ -75,6 +76,7 @@ import com.android.systemui.recents.RecentsOnboarding;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.policy.DeadZone;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;

@@ -1198,6 +1200,19 @@ public class NavigationBarView extends FrameLayout implements
        // we're passing the insets onto the gesture handler since the back arrow is only
        // conditionally added and doesn't always get all the insets.
        mEdgeBackGestureHandler.setInsets(leftInset, rightInset);

        // this allows assist handle to be drawn outside its bound so that it can align screen
        // bottom by translating its y position.
        final boolean shouldClip =
                !isGesturalMode(mNavBarMode) || insets.getSystemWindowInsetBottom() == 0;
        setClipChildren(shouldClip);
        setClipToPadding(shouldClip);

        AssistHandleViewController controller = Dependency.get(NavigationBarController.class)
                .getAssistHandlerViewController();
        if (controller != null) {
            controller.setBottomOffset(insets.getSystemWindowInsetBottom());
        }
        return super.onApplyWindowInsets(insets);
    }