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

Commit 94bfbab8 authored by Selim Cinek's avatar Selim Cinek
Browse files

Rewrote the back arrow animation

The animation now is based on physics based animations
and nicely appears and disappears. Also we're rending
it in one piece avoiding drawing artifacts.

We're now factoring in the actual position and size of the
arrow instead of just looking at its width.

Bug: 130682266
Test: observe back animations, play around with it
Change-Id: I8fc4475615d0776a082feec7400b4674ea0331a2
parent f2ed3cec
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -41,8 +41,10 @@

    <!-- Size of the nav bar edge panels, should be greater to the
         edge sensitivity + the drag threshold -->
    <dimen name="navigation_edge_panel_width">52dp</dimen>
    <dimen name="navigation_edge_panel_height">52dp</dimen>
    <dimen name="navigation_edge_panel_width">76dp</dimen>
    <!-- Padding at the end of the navigation panel to allow the arrow not to be clipped off -->
    <dimen name="navigation_edge_panel_padding">24dp</dimen>
    <dimen name="navigation_edge_panel_height">84dp</dimen>
    <!-- The threshold to drag to trigger the edge action -->
    <dimen name="navigation_edge_action_drag_threshold">16dp</dimen>
    <!-- The minimum display position of the arrow on the screen -->
+2 −6
Original line number Diff line number Diff line
@@ -327,13 +327,13 @@ public class EdgeBackGestureHandler implements DisplayListener {
                        ? (Gravity.LEFT | Gravity.TOP)
                        : (Gravity.RIGHT | Gravity.TOP);
                mEdgePanel.setIsLeftPanel(mIsOnLeftEdge);
                mEdgePanel.handleTouch(ev);
                updateEdgePanelPosition(ev.getY());
                mWm.updateViewLayout(mEdgePanel, mEdgePanelLp);
                mRegionSamplingHelper.start(mSamplingRect);

                mDownPoint.set(ev.getX(), ev.getY());
                mThresholdCrossed = false;
                mEdgePanel.handleTouch(ev);
            }
        } else if (mAllowGesture) {
            if (!mThresholdCrossed && ev.getAction() == MotionEvent.ACTION_MOVE) {
@@ -360,11 +360,7 @@ public class EdgeBackGestureHandler implements DisplayListener {

            boolean isUp = ev.getAction() == MotionEvent.ACTION_UP;
            if (isUp) {
                float xDiff = ev.getX() - mDownPoint.x;
                boolean exceedsThreshold = mIsOnLeftEdge
                        ? (xDiff > mSwipeThreshold) : (-xDiff > mSwipeThreshold);
                boolean performAction = exceedsThreshold
                        && Math.abs(xDiff) > Math.abs(ev.getY() - mDownPoint.y);
                boolean performAction = mEdgePanel.shouldTriggerBack();
                if (performAction) {
                    // Perform back
                    sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
+574 −165

File changed.

Preview size limit exceeded, changes collapsed.