Loading quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +3 −7 Original line number Diff line number Diff line Loading @@ -79,7 +79,6 @@ import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.TouchDelegate; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; Loading Loading @@ -700,13 +699,10 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView super.onTouchEvent(ev); TaskView taskView = getCurrentPageTaskView(); if (taskView != null) { TouchDelegate mChildTouchDelegate = taskView.getIconTouchDelegate(ev); if (mChildTouchDelegate != null && mChildTouchDelegate.onTouchEvent(ev)) { if (taskView != null && taskView.offerTouchToChildren(ev)) { // Keep consuming events to pass to delegate return true; } } final int x = (int) ev.getX(); final int y = (int) ev.getY(); Loading quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +34 −2 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { * delegated bounds only to be updated. */ private TransformingTouchDelegate mIconTouchDelegate; private TransformingTouchDelegate mChipTouchDelegate; private static final List<Rect> SYSTEM_GESTURE_EXCLUSION_RECT = Collections.singletonList(new Rect()); Loading Loading @@ -200,6 +201,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private View mContextualChipWrapper; private View mContextualChip; private final float[] mIconCenterCoords = new float[2]; private final float[] mChipCenterCoords = new float[2]; public TaskView(Context context) { this(context, null); Loading Loading @@ -263,11 +265,22 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { mIconTouchDelegate = new TransformingTouchDelegate(mIconView); } public TouchDelegate getIconTouchDelegate(MotionEvent event) { /** * Whether the taskview should take the touch event from parent. Events passed to children * that might require special handling. */ public boolean offerTouchToChildren(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { computeAndSetIconTouchDelegate(); computeAndSetChipTouchDelegate(); } if (mIconTouchDelegate != null && mIconTouchDelegate.onTouchEvent(event)) { return true; } if (mChipTouchDelegate != null && mChipTouchDelegate.onTouchEvent(event)) { return true; } return mIconTouchDelegate; return false; } private void computeAndSetIconTouchDelegate() { Loading @@ -282,6 +295,23 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { (int) (mIconCenterCoords[1] + iconHalfSize)); } private void computeAndSetChipTouchDelegate() { if (mContextualChipWrapper != null) { float chipHalfWidth = mContextualChipWrapper.getWidth() / 2f; float chipHalfHeight = mContextualChipWrapper.getHeight() / 2f; mChipCenterCoords[0] = chipHalfWidth; mChipCenterCoords[1] = chipHalfHeight; getDescendantCoordRelativeToAncestor(mContextualChipWrapper, mActivity.getDragLayer(), mChipCenterCoords, false); mChipTouchDelegate.setBounds( (int) (mChipCenterCoords[0] - chipHalfWidth), (int) (mChipCenterCoords[1] - chipHalfHeight), (int) (mChipCenterCoords[0] + chipHalfWidth), (int) (mChipCenterCoords[1] + chipHalfHeight)); } } /** * The modalness of this view is how it should be displayed when it is shown on its own in the * modal state of overview. Loading Loading @@ -725,6 +755,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { mContextualChip.animate().scaleX(1f).scaleY(1f).setDuration(50); } if (mContextualChipWrapper != null) { mChipTouchDelegate = new TransformingTouchDelegate(mContextualChipWrapper); mContextualChipWrapper.animate().alpha(1f).setDuration(50); } } Loading @@ -746,6 +777,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { View oldContextualChipWrapper = mContextualChipWrapper; mContextualChipWrapper = null; mContextualChip = null; mChipTouchDelegate = null; return oldContextualChipWrapper; } Loading Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +3 −7 Original line number Diff line number Diff line Loading @@ -79,7 +79,6 @@ import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.TouchDelegate; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; Loading Loading @@ -700,13 +699,10 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView super.onTouchEvent(ev); TaskView taskView = getCurrentPageTaskView(); if (taskView != null) { TouchDelegate mChildTouchDelegate = taskView.getIconTouchDelegate(ev); if (mChildTouchDelegate != null && mChildTouchDelegate.onTouchEvent(ev)) { if (taskView != null && taskView.offerTouchToChildren(ev)) { // Keep consuming events to pass to delegate return true; } } final int x = (int) ev.getX(); final int y = (int) ev.getY(); Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +34 −2 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { * delegated bounds only to be updated. */ private TransformingTouchDelegate mIconTouchDelegate; private TransformingTouchDelegate mChipTouchDelegate; private static final List<Rect> SYSTEM_GESTURE_EXCLUSION_RECT = Collections.singletonList(new Rect()); Loading Loading @@ -200,6 +201,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private View mContextualChipWrapper; private View mContextualChip; private final float[] mIconCenterCoords = new float[2]; private final float[] mChipCenterCoords = new float[2]; public TaskView(Context context) { this(context, null); Loading Loading @@ -263,11 +265,22 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { mIconTouchDelegate = new TransformingTouchDelegate(mIconView); } public TouchDelegate getIconTouchDelegate(MotionEvent event) { /** * Whether the taskview should take the touch event from parent. Events passed to children * that might require special handling. */ public boolean offerTouchToChildren(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { computeAndSetIconTouchDelegate(); computeAndSetChipTouchDelegate(); } if (mIconTouchDelegate != null && mIconTouchDelegate.onTouchEvent(event)) { return true; } if (mChipTouchDelegate != null && mChipTouchDelegate.onTouchEvent(event)) { return true; } return mIconTouchDelegate; return false; } private void computeAndSetIconTouchDelegate() { Loading @@ -282,6 +295,23 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { (int) (mIconCenterCoords[1] + iconHalfSize)); } private void computeAndSetChipTouchDelegate() { if (mContextualChipWrapper != null) { float chipHalfWidth = mContextualChipWrapper.getWidth() / 2f; float chipHalfHeight = mContextualChipWrapper.getHeight() / 2f; mChipCenterCoords[0] = chipHalfWidth; mChipCenterCoords[1] = chipHalfHeight; getDescendantCoordRelativeToAncestor(mContextualChipWrapper, mActivity.getDragLayer(), mChipCenterCoords, false); mChipTouchDelegate.setBounds( (int) (mChipCenterCoords[0] - chipHalfWidth), (int) (mChipCenterCoords[1] - chipHalfHeight), (int) (mChipCenterCoords[0] + chipHalfWidth), (int) (mChipCenterCoords[1] + chipHalfHeight)); } } /** * The modalness of this view is how it should be displayed when it is shown on its own in the * modal state of overview. Loading Loading @@ -725,6 +755,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { mContextualChip.animate().scaleX(1f).scaleY(1f).setDuration(50); } if (mContextualChipWrapper != null) { mChipTouchDelegate = new TransformingTouchDelegate(mContextualChipWrapper); mContextualChipWrapper.animate().alpha(1f).setDuration(50); } } Loading @@ -746,6 +777,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { View oldContextualChipWrapper = mContextualChipWrapper; mContextualChipWrapper = null; mContextualChip = null; mChipTouchDelegate = null; return oldContextualChipWrapper; } Loading