diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/widget/AbsListView.java | 11 | ||||
| -rw-r--r-- | core/java/android/widget/ActionMenuPresenter.java | 3 | ||||
| -rw-r--r-- | core/java/android/widget/ListPopupWindow.java | 14 |
3 files changed, 23 insertions, 5 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 50cdc0e34660..8f8876bec297 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -2495,6 +2495,17 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } /** + * Positions the selector in a way that mimics touch. + */ + void positionSelectorLikeTouch(int position, View sel, float x, float y) { + positionSelectorLikeFocus(position, sel); + + if (mSelector != null && position != INVALID_POSITION) { + mSelector.setHotspot(x, y); + } + } + + /** * Positions the selector in a way that mimics keyboard focus. */ void positionSelectorLikeFocus(int position, View sel) { diff --git a/core/java/android/widget/ActionMenuPresenter.java b/core/java/android/widget/ActionMenuPresenter.java index 1fddf3e78c35..7123b9a1e231 100644 --- a/core/java/android/widget/ActionMenuPresenter.java +++ b/core/java/android/widget/ActionMenuPresenter.java @@ -668,7 +668,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter private SubMenuBuilder mSubMenu; public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) { - super(context, subMenu); + super(context, subMenu, null, false, + com.android.internal.R.attr.actionOverflowMenuStyle); mSubMenu = subMenu; MenuItemImpl item = (MenuItemImpl) subMenu.getItem(); diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java index f91865b61553..84b213bd9b2a 100644 --- a/core/java/android/widget/ListPopupWindow.java +++ b/core/java/android/widget/ListPopupWindow.java @@ -1363,7 +1363,13 @@ public class ListPopupWindow { // Forward converted event to destination view, then recycle it. final boolean handled = dst.onForwardedEvent(dstEvent, mActivePointerId); dstEvent.recycle(); - return handled; + + // Always cancel forwarding when the touch stream ends. + final int action = srcEvent.getActionMasked(); + final boolean keepForwarding = action != MotionEvent.ACTION_UP + && action != MotionEvent.ACTION_CANCEL; + + return handled && keepForwarding; } private class DisallowIntercept implements Runnable { @@ -1492,7 +1498,7 @@ public class ListPopupWindow { } final View child = getChildAt(position - getFirstVisiblePosition()); - setPressedItem(child, position); + setPressedItem(child, position, x, y); handledEvent = true; if (actionMasked == MotionEvent.ACTION_UP) { @@ -1555,7 +1561,7 @@ public class ListPopupWindow { } } - private void setPressedItem(View child, int position) { + private void setPressedItem(View child, int position, float x, float y) { mDrawsInPressedState = true; // Ordering is essential. First update the pressed state and layout @@ -1565,7 +1571,7 @@ public class ListPopupWindow { // Ensure that keyboard focus starts from the last touched position. setSelectedPositionInt(position); - positionSelectorLikeFocus(position, child); + positionSelectorLikeTouch(position, child, x, y); // Refresh the drawable state to reflect the new pressed state, // which will also update the selector state. |
