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

Commit 2e85f988 authored by Doris Liu's avatar Doris Liu Committed by Android (Google) Code Review
Browse files

Merge "Fix for popuping being hard to dismiss" into gb-ub-photos-bryce

parents 31a50d72 f9adf16c
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -309,9 +309,7 @@ public class PhotoUI implements PieListener,
    }
    }


    public boolean dispatchTouchEvent(MotionEvent m) {
    public boolean dispatchTouchEvent(MotionEvent m) {
        if (mPopup != null) {
        if (mGestures != null && mRenderOverlay != null) {
            return mActivity.superDispatchTouchEvent(m);
        } else if (mGestures != null && mRenderOverlay != null) {
            return mGestures.dispatchTouch(m);
            return mGestures.dispatchTouch(m);
        }
        }
        return false;
        return false;
@@ -382,6 +380,7 @@ public class PhotoUI implements PieListener,
                LayoutParams.WRAP_CONTENT);
                LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.CENTER;
        lp.gravity = Gravity.CENTER;
        ((FrameLayout) mRootView).addView(mPopup, lp);
        ((FrameLayout) mRootView).addView(mPopup, lp);
        mGestures.addTouchReceiver(mPopup);
    }
    }


    public void dismissPopup(boolean topPopupOnly) {
    public void dismissPopup(boolean topPopupOnly) {
@@ -395,6 +394,7 @@ public class PhotoUI implements PieListener,
        }
        }
        setShowMenu(fullScreen);
        setShowMenu(fullScreen);
        if (mPopup != null) {
        if (mPopup != null) {
            mGestures.removeTouchReceiver(mPopup);
            ((FrameLayout) mRootView).removeView(mPopup);
            ((FrameLayout) mRootView).removeView(mPopup);
            mPopup = null;
            mPopup = null;
        }
        }
+5 −0
Original line number Original line Diff line number Diff line
@@ -128,6 +128,11 @@ public class PreviewGestures
        mReceivers.add(v);
        mReceivers.add(v);
    }
    }


    public void removeTouchReceiver(View v) {
        if (mReceivers == null || v == null) return;
        mReceivers.remove(v);
    }

    public void addUnclickableArea(View v) {
    public void addUnclickableArea(View v) {
        if (mUnclickableAreas == null) {
        if (mUnclickableAreas == null) {
            mUnclickableAreas = new ArrayList<View>();
            mUnclickableAreas = new ArrayList<View>();
+3 −3
Original line number Original line Diff line number Diff line
@@ -281,6 +281,7 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener,
                LayoutParams.WRAP_CONTENT);
                LayoutParams.WRAP_CONTENT);
        lp.gravity = Gravity.CENTER;
        lp.gravity = Gravity.CENTER;
        ((FrameLayout) mRootView).addView(mPopup, lp);
        ((FrameLayout) mRootView).addView(mPopup, lp);
        mGestures.addTouchReceiver(mPopup);
    }
    }


    public void dismissPopup(boolean topLevelOnly) {
    public void dismissPopup(boolean topLevelOnly) {
@@ -294,6 +295,7 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener,
        }
        }
        setShowMenu(fullScreen);
        setShowMenu(fullScreen);
        if (mPopup != null) {
        if (mPopup != null) {
            mGestures.removeTouchReceiver(mPopup);
            ((FrameLayout) mRootView).removeView(mPopup);
            ((FrameLayout) mRootView).removeView(mPopup);
            mPopup = null;
            mPopup = null;
        }
        }
@@ -472,10 +474,8 @@ public class VideoUI implements SurfaceHolder.Callback, PieRenderer.PieListener,
    }
    }


    public boolean dispatchTouchEvent(MotionEvent m) {
    public boolean dispatchTouchEvent(MotionEvent m) {
        if (mPopup == null && mGestures != null && mRenderOverlay != null) {
        if (mGestures != null && mRenderOverlay != null) {
            return mGestures.dispatchTouch(m);
            return mGestures.dispatchTouch(m);
        } else if (mPopup != null) {
            return mActivity.superDispatchTouchEvent(m);
        }
        }
        return false;
        return false;
    }
    }