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

Commit 243b199c authored by Andy Wickham's avatar Andy Wickham
Browse files

Add ability to animate navbar for long press.

Demo: https://drive.google.com/file/d/1MmRZ8xKpJu_lG_6fAPg9kd2TlV0oJZjH/view?usp=drive_link&resourcekey=0-kI37qyrFWgfDSGLNnAk4xg

General control flow for animateNavBarLongPress:
Launcher --systemUiProxy-> OverviewProxyService --notifyAnimateNavBarLongPress-> NavigationBar
   --getHomeHandle-> ButtonDispatcher --animateLongPress-> NavigationHandle

Bug: 306400785
Test: Manual on device
Flag: LEGACY ANIMATE_LPNH TEAMFOOD
Change-Id: I7e767cae50081123db9fc6c384b55ebbeace1d99
parent 0bab1185
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@
    <dimen name="navigation_handle_bottom">10dp</dimen>
    <dimen name="navigation_handle_sample_horizontal_margin">10dp</dimen>
    <dimen name="navigation_home_handle_width">108dp</dimen>
    <!-- Used while animating the navbar during a long press. -->
    <dimen name="navigation_home_handle_additional_width_for_animation">20dp</dimen>
    <dimen name="navigation_home_handle_additional_height_for_animation">4dp</dimen>

    <!-- Size of the nav bar edge panels, should be greater to the
         edge sensitivity + the drag threshold -->
+11 −1
Original line number Diff line number Diff line
@@ -144,5 +144,15 @@ interface ISystemUiProxy {
     */
    oneway void onStatusBarTrackpadEvent(in MotionEvent event) = 52;

    // Next id = 54
    /**
     * Animate the nav bar being long-pressed.
     *
     * @param isTouchDown {@code true} if the button is starting to be pressed ({@code false} if
     *                                released or canceled)
     * @param durationMs how long the animation should take (for the {@code isTouchDown} case, this
     *                   should be the same as the amount of time to trigger a long-press)
     */
    oneway void animateNavBarLongPress(boolean isTouchDown, long durationMs) = 54;

    // Next id = 55
}
+6 −1
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ import com.android.internal.statusbar.LetterboxDetails;
import com.android.internal.util.LatencyTracker;
import com.android.internal.view.AppearanceRegion;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.res.R;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.DisplayId;
@@ -130,6 +129,7 @@ import com.android.systemui.navigationbar.gestural.QuickswitchOrientedNavHandle;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.recents.Recents;
import com.android.systemui.res.R;
import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker;
@@ -398,6 +398,11 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            mAssistManagerLazy.get().setAssistantOverridesRequested(invocationTypes);
        }

        @Override
        public void animateNavBarLongPress(boolean isTouchDown, long durationMs) {
            mView.getHomeHandle().animateLongPress(isTouchDown, durationMs);
        }

        @Override
        public void onHomeRotationEnabled(boolean enabled) {
            mView.getRotationButtonController().setHomeRotationEnabled(enabled);
+8 −0
Original line number Diff line number Diff line
@@ -247,6 +247,14 @@ public class ButtonDispatcher {
        }
    }

    public void animateLongPress(boolean isTouchDown, long durationMs) {
        for (int i = 0; i < mViews.size(); i++) {
            if (mViews.get(i) instanceof ButtonInterface) {
                ((ButtonInterface) mViews.get(i)).animateLongPress(isTouchDown, durationMs);
            }
        }
    }

    public void setLongClickable(boolean isLongClickable) {
        mLongClickable = isLongClickable;
        final int N = mViews.size();
+10 −0
Original line number Diff line number Diff line
@@ -30,4 +30,14 @@ public interface ButtonInterface {
    void setDarkIntensity(float intensity);

    void setDelayTouchFeedback(boolean shouldDelay);

    /**
     * Animate the button being long-pressed.
     *
     * @param isTouchDown {@code true} if the button is starting to be pressed ({@code false} if
     *                                released or canceled)
     * @param durationMs how long the animation should take (for the {@code isTouchDown} case, this
     *                   should be the same as the amount of time to trigger a long-press)
     */
    default void animateLongPress(boolean isTouchDown, long durationMs) {}
}
Loading