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

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

Merge "Fix issue with double tapping PiP" into oc-dev

parents 45eed805 34488242
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class PipManager implements BasePipManager {
            // Re-enable touches after the animation completes
            mTouchHandler.setTouchEnabled(true);
            mTouchHandler.onPinnedStackAnimationEnded();
            mMenuController.onPinnedStackAnimationEnded();
        }

        @Override
+13 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class PipMenuActivity extends Activity {
    public static final int MESSAGE_HIDE_MENU = 3;
    public static final int MESSAGE_UPDATE_ACTIONS = 4;
    public static final int MESSAGE_UPDATE_DISMISS_FRACTION = 5;
    public static final int MESSAGE_ANIMATION_ENDED = 6;

    private static final long INITIAL_DISMISS_DELAY = 3500;
    private static final long POST_INTERACTION_DISMISS_DELAY = 2000;
@@ -92,6 +93,7 @@ public class PipMenuActivity extends Activity {

    private int mMenuState;
    private boolean mAllowMenuTimeout = true;
    private boolean mAllowTouches = true;

    private final List<RemoteAction> mActions = new ArrayList<>();

@@ -149,6 +151,10 @@ public class PipMenuActivity extends Activity {
                    updateDismissFraction(data.getFloat(EXTRA_DISMISS_FRACTION));
                    break;
                }
                case MESSAGE_ANIMATION_ENDED: {
                    mAllowTouches = true;
                    break;
                }
            }
        }
    });
@@ -245,6 +251,10 @@ public class PipMenuActivity extends Activity {

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (!mAllowTouches) {
            return super.dispatchTouchEvent(ev);
        }

        // On the first action outside the window, hide the menu
        switch (ev.getAction()) {
            case MotionEvent.ACTION_OUTSIDE:
@@ -284,6 +294,9 @@ public class PipMenuActivity extends Activity {
            boolean allowMenuTimeout) {
        mAllowMenuTimeout = allowMenuTimeout;
        if (mMenuState != menuState) {
            boolean deferTouchesUntilAnimationEnds = (mMenuState == MENU_STATE_FULL) ||
                    (menuState == MENU_STATE_FULL);
            mAllowTouches = !deferTouchesUntilAnimationEnds;
            cancelDelayedFinish();
            updateActionViews(stackBounds);
            if (mMenuContainerAnimator != null) {
+13 −0
Original line number Diff line number Diff line
@@ -197,6 +197,19 @@ public class PipMenuActivityController {
        }
    }

    public void onPinnedStackAnimationEnded() {
        // Note: Only active menu activities care about this event
        if (mToActivityMessenger != null) {
            Message m = Message.obtain();
            m.what = PipMenuActivity.MESSAGE_ANIMATION_ENDED;
            try {
                mToActivityMessenger.send(m);
            } catch (RemoteException e) {
                Log.e(TAG, "Could not notify menu pinned animation ended", e);
            }
        }
    }

    /**
     * Adds a new menu activity listener.
     */