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

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

Merge "Add ability to animate navbar for long press." into main

parents 96be87a7 243b199c
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