Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,13 @@ public class PipManager implements BasePipManager { mTouchHandler.showPictureInPictureMenu(); } /** * Sets a customized touch gesture that replaces the default one. */ public void setTouchGesture(PipTouchGesture gesture) { mTouchHandler.setTouchGesture(gesture); } /** * Sets both shelf visibility and its height. */ Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchGesture.java +3 −3 Original line number Diff line number Diff line Loading @@ -24,19 +24,19 @@ public abstract class PipTouchGesture { /** * Handle the touch down. */ void onDown(PipTouchState touchState) {} public void onDown(PipTouchState touchState) {} /** * Handle the touch move, and return whether the event was consumed. */ boolean onMove(PipTouchState touchState) { public boolean onMove(PipTouchState touchState) { return false; } /** * Handle the touch up, and return whether the gesture was consumed. */ boolean onUp(PipTouchState touchState) { public boolean onUp(PipTouchState touchState) { return false; } } packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +13 −18 Original line number Diff line number Diff line Loading @@ -126,8 +126,8 @@ public class PipTouchHandler { // Touch state private final PipTouchState mTouchState; private final FlingAnimationUtils mFlingAnimationUtils; private final PipTouchGesture[] mGestures; private final PipMotionHelper mMotionHelper; private PipTouchGesture mGesture; // Temp vars private final Rect mTmpBounds = new Rect(); Loading Loading @@ -185,9 +185,7 @@ public class PipTouchHandler { mSnapAlgorithm = new PipSnapAlgorithm(mContext); mFlingAnimationUtils = new FlingAnimationUtils(context.getResources().getDisplayMetrics(), 2.5f); mGestures = new PipTouchGesture[] { mDefaultMovementGesture }; mGesture = new DefaultPipTouchGesture(); mMotionHelper = new PipMotionHelper(mContext, mActivityManager, mActivityTaskManager, mMenuController, mSnapAlgorithm, mFlingAnimationUtils); mTouchState = new PipTouchState(mViewConfig, mHandler, Loading @@ -210,6 +208,10 @@ public class PipTouchHandler { this::onAccessibilityShowMenu, mHandler); } public void setTouchGesture(PipTouchGesture gesture) { mGesture = gesture; } public void setTouchEnabled(boolean enabled) { mTouchState.setAllowTouches(enabled); } Loading Loading @@ -363,18 +365,13 @@ public class PipTouchHandler { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: { mMotionHelper.synchronizePinnedStackBounds(); for (PipTouchGesture gesture : mGestures) { gesture.onDown(mTouchState); } mGesture.onDown(mTouchState); break; } case MotionEvent.ACTION_MOVE: { for (PipTouchGesture gesture : mGestures) { if (gesture.onMove(mTouchState)) { if (mGesture.onMove(mTouchState)) { break; } } shouldDeliverToMenu = !mTouchState.isDragging(); break; Loading @@ -384,11 +381,9 @@ public class PipTouchHandler { // dragging (ie. when the IME shows) updateMovementBounds(mMenuState); for (PipTouchGesture gesture : mGestures) { if (gesture.onUp(mTouchState)) { if (mGesture.onUp(mTouchState)) { break; } } // Fall through to clean up } Loading Loading @@ -591,7 +586,7 @@ public class PipTouchHandler { /** * Gesture controlling normal movement of the PIP. */ private PipTouchGesture mDefaultMovementGesture = new PipTouchGesture() { private class DefaultPipTouchGesture extends PipTouchGesture { // Whether the PiP was on the left side of the screen at the start of the gesture private boolean mStartedOnLeft; private final Point mStartPosition = new Point(); Loading Loading @@ -623,7 +618,7 @@ public class PipTouchHandler { } @Override boolean onMove(PipTouchState touchState) { public boolean onMove(PipTouchState touchState) { if (!touchState.isUserInteracting()) { return false; } Loading Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,13 @@ public class PipManager implements BasePipManager { mTouchHandler.showPictureInPictureMenu(); } /** * Sets a customized touch gesture that replaces the default one. */ public void setTouchGesture(PipTouchGesture gesture) { mTouchHandler.setTouchGesture(gesture); } /** * Sets both shelf visibility and its height. */ Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchGesture.java +3 −3 Original line number Diff line number Diff line Loading @@ -24,19 +24,19 @@ public abstract class PipTouchGesture { /** * Handle the touch down. */ void onDown(PipTouchState touchState) {} public void onDown(PipTouchState touchState) {} /** * Handle the touch move, and return whether the event was consumed. */ boolean onMove(PipTouchState touchState) { public boolean onMove(PipTouchState touchState) { return false; } /** * Handle the touch up, and return whether the gesture was consumed. */ boolean onUp(PipTouchState touchState) { public boolean onUp(PipTouchState touchState) { return false; } }
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +13 −18 Original line number Diff line number Diff line Loading @@ -126,8 +126,8 @@ public class PipTouchHandler { // Touch state private final PipTouchState mTouchState; private final FlingAnimationUtils mFlingAnimationUtils; private final PipTouchGesture[] mGestures; private final PipMotionHelper mMotionHelper; private PipTouchGesture mGesture; // Temp vars private final Rect mTmpBounds = new Rect(); Loading Loading @@ -185,9 +185,7 @@ public class PipTouchHandler { mSnapAlgorithm = new PipSnapAlgorithm(mContext); mFlingAnimationUtils = new FlingAnimationUtils(context.getResources().getDisplayMetrics(), 2.5f); mGestures = new PipTouchGesture[] { mDefaultMovementGesture }; mGesture = new DefaultPipTouchGesture(); mMotionHelper = new PipMotionHelper(mContext, mActivityManager, mActivityTaskManager, mMenuController, mSnapAlgorithm, mFlingAnimationUtils); mTouchState = new PipTouchState(mViewConfig, mHandler, Loading @@ -210,6 +208,10 @@ public class PipTouchHandler { this::onAccessibilityShowMenu, mHandler); } public void setTouchGesture(PipTouchGesture gesture) { mGesture = gesture; } public void setTouchEnabled(boolean enabled) { mTouchState.setAllowTouches(enabled); } Loading Loading @@ -363,18 +365,13 @@ public class PipTouchHandler { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: { mMotionHelper.synchronizePinnedStackBounds(); for (PipTouchGesture gesture : mGestures) { gesture.onDown(mTouchState); } mGesture.onDown(mTouchState); break; } case MotionEvent.ACTION_MOVE: { for (PipTouchGesture gesture : mGestures) { if (gesture.onMove(mTouchState)) { if (mGesture.onMove(mTouchState)) { break; } } shouldDeliverToMenu = !mTouchState.isDragging(); break; Loading @@ -384,11 +381,9 @@ public class PipTouchHandler { // dragging (ie. when the IME shows) updateMovementBounds(mMenuState); for (PipTouchGesture gesture : mGestures) { if (gesture.onUp(mTouchState)) { if (mGesture.onUp(mTouchState)) { break; } } // Fall through to clean up } Loading Loading @@ -591,7 +586,7 @@ public class PipTouchHandler { /** * Gesture controlling normal movement of the PIP. */ private PipTouchGesture mDefaultMovementGesture = new PipTouchGesture() { private class DefaultPipTouchGesture extends PipTouchGesture { // Whether the PiP was on the left side of the screen at the start of the gesture private boolean mStartedOnLeft; private final Point mStartPosition = new Point(); Loading Loading @@ -623,7 +618,7 @@ public class PipTouchHandler { } @Override boolean onMove(PipTouchState touchState) { public boolean onMove(PipTouchState touchState) { if (!touchState.isUserInteracting()) { return false; } Loading