Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -31382,6 +31382,7 @@ package android.widget { ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int); ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int, int); method public void clearListSelection(); method public android.view.View.OnTouchListener createDragToOpenListener(android.view.View); method public void dismiss(); method public android.view.View getAnchorView(); method public int getAnimationStyle(); Loading Loading @@ -31593,6 +31594,7 @@ package android.widget { public class PopupMenu { ctor public PopupMenu(android.content.Context, android.view.View); method public void dismiss(); method public android.view.View.OnTouchListener getDragToOpenListener(); method public android.view.Menu getMenu(); method public android.view.MenuInflater getMenuInflater(); method public void inflate(int); core/java/android/widget/ListPopupWindow.java +27 −0 Original line number Diff line number Diff line Loading @@ -964,6 +964,33 @@ public class ListPopupWindow { return false; } /** * Returns an {@link OnTouchListener} that can be added to the source view * to implement drag-to-open behavior. Generally, the source view should be * the same view that was passed to {@link #setAnchorView}. * <p> * When the listener is set on a view, touching that view and dragging * outside of its bounds will open the popup window. Lifting will select the * currently touched list item. * <p> * Example usage: * <pre>ListPopupWindow myPopup = new ListPopupWindow(context); * myPopup.setAnchor(myAnchor); * OnTouchListener dragListener = myPopup.createDragToOpenListener(myAnchor); * myAnchor.setOnTouchListener(dragListener);</pre> * * @param src the view on which the resulting listener will be set * @return a touch listener that controls drag-to-open behavior */ public OnTouchListener createDragToOpenListener(View src) { return new ForwardingListener(src) { @Override public ListPopupWindow getPopup() { return ListPopupWindow.this; } }; } /** * <p>Builds the popup window's content and returns the height the popup * should have. Returns -1 when the content already exists.</p> Loading core/java/android/widget/PopupMenu.java +30 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ListPopupWindow.ForwardingListener; /** * A PopupMenu displays a {@link Menu} in a modal popup window anchored to a {@link View}. Loading @@ -40,6 +42,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback { private MenuPopupHelper mPopup; private OnMenuItemClickListener mMenuItemClickListener; private OnDismissListener mDismissListener; private OnTouchListener mDragListener; /** * Callback interface used to notify the application that the menu has closed. Loading Loading @@ -70,6 +73,33 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback { mPopup.setCallback(this); } /** * Returns an {@link OnTouchListener} that can be added to the anchor view * to implement drag-to-open behavior. * <p> * When the listener is set on a view, touching that view and dragging * outside of its bounds will open the popup window. Lifting will select the * currently touched list item. * <p> * Example usage: * <pre>PopupMenu myPopup = new PopupMenu(context, myAnchor); * myAnchor.setOnTouchListener(myPopup.getDragToOpenListener());</pre> * * @return a touch listener that controls drag-to-open behavior */ public OnTouchListener getDragToOpenListener() { if (mDragListener == null) { mDragListener = new ForwardingListener(mAnchor) { @Override public ListPopupWindow getPopup() { return mPopup.getPopup(); } }; } return mDragListener; } /** * @return the {@link Menu} associated with this popup. Populate the returned Menu with * items before calling {@link #show()}. Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -31382,6 +31382,7 @@ package android.widget { ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int); ctor public ListPopupWindow(android.content.Context, android.util.AttributeSet, int, int); method public void clearListSelection(); method public android.view.View.OnTouchListener createDragToOpenListener(android.view.View); method public void dismiss(); method public android.view.View getAnchorView(); method public int getAnimationStyle(); Loading Loading @@ -31593,6 +31594,7 @@ package android.widget { public class PopupMenu { ctor public PopupMenu(android.content.Context, android.view.View); method public void dismiss(); method public android.view.View.OnTouchListener getDragToOpenListener(); method public android.view.Menu getMenu(); method public android.view.MenuInflater getMenuInflater(); method public void inflate(int);
core/java/android/widget/ListPopupWindow.java +27 −0 Original line number Diff line number Diff line Loading @@ -964,6 +964,33 @@ public class ListPopupWindow { return false; } /** * Returns an {@link OnTouchListener} that can be added to the source view * to implement drag-to-open behavior. Generally, the source view should be * the same view that was passed to {@link #setAnchorView}. * <p> * When the listener is set on a view, touching that view and dragging * outside of its bounds will open the popup window. Lifting will select the * currently touched list item. * <p> * Example usage: * <pre>ListPopupWindow myPopup = new ListPopupWindow(context); * myPopup.setAnchor(myAnchor); * OnTouchListener dragListener = myPopup.createDragToOpenListener(myAnchor); * myAnchor.setOnTouchListener(dragListener);</pre> * * @param src the view on which the resulting listener will be set * @return a touch listener that controls drag-to-open behavior */ public OnTouchListener createDragToOpenListener(View src) { return new ForwardingListener(src) { @Override public ListPopupWindow getPopup() { return ListPopupWindow.this; } }; } /** * <p>Builds the popup window's content and returns the height the popup * should have. Returns -1 when the content already exists.</p> Loading
core/java/android/widget/PopupMenu.java +30 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ListPopupWindow.ForwardingListener; /** * A PopupMenu displays a {@link Menu} in a modal popup window anchored to a {@link View}. Loading @@ -40,6 +42,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback { private MenuPopupHelper mPopup; private OnMenuItemClickListener mMenuItemClickListener; private OnDismissListener mDismissListener; private OnTouchListener mDragListener; /** * Callback interface used to notify the application that the menu has closed. Loading Loading @@ -70,6 +73,33 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback { mPopup.setCallback(this); } /** * Returns an {@link OnTouchListener} that can be added to the anchor view * to implement drag-to-open behavior. * <p> * When the listener is set on a view, touching that view and dragging * outside of its bounds will open the popup window. Lifting will select the * currently touched list item. * <p> * Example usage: * <pre>PopupMenu myPopup = new PopupMenu(context, myAnchor); * myAnchor.setOnTouchListener(myPopup.getDragToOpenListener());</pre> * * @return a touch listener that controls drag-to-open behavior */ public OnTouchListener getDragToOpenListener() { if (mDragListener == null) { mDragListener = new ForwardingListener(mAnchor) { @Override public ListPopupWindow getPopup() { return mPopup.getPopup(); } }; } return mDragListener; } /** * @return the {@link Menu} associated with this popup. Populate the returned Menu with * items before calling {@link #show()}. Loading