Merge "Fix NPE in PopupMenu.getDragToOpenListener()" into klp-dev

This commit is contained in:
Alan Viverette
2013-09-24 21:28:56 +00:00
committed by Android (Google) Code Review

View File

@@ -92,8 +92,21 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
public OnTouchListener getDragToOpenListener() {
if (mDragListener == null) {
mDragListener = new ForwardingListener(mAnchor) {
@Override
protected boolean onForwardingStarted() {
show();
return true;
}
@Override
protected boolean onForwardingStopped() {
dismiss();
return true;
}
@Override
public ListPopupWindow getPopup() {
// This will be null until show() is called.
return mPopup.getPopup();
}
};