Java Code Examples for android.support.v7.widget.PopupMenu#OnMenuItemClickListener

The following examples show how to use android.support.v7.widget.PopupMenu#OnMenuItemClickListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HorizontalBookRecyclerView.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
public HorizontalBookRecyclerView setupRecyclerView(BookCardEventsCallback mListener,
                                                    Cursor bookListCursor,
                                                    String title,
                                                    PopupMenu.OnMenuItemClickListener onMenuItemClickListener,
                                                    int moreMenuRes) {
    setupRecyclerView(mListener, bookListCursor);
    setTitleText(title);
    setOverFlowMenuListener(onMenuItemClickListener, moreMenuRes);
    return this;

}
 
Example 2
Source File: HorizontalBookRecyclerView.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
public void setOverFlowMenuListener(PopupMenu.OnMenuItemClickListener onClickListener, int moreMenuRes) {
    if (moreMenuRes > 0) {
        findViewById(R.id.more_overflow).setOnClickListener(v -> {
            PopupMenu popup = new PopupMenu(getContext(), v);
            popup.setOnMenuItemClickListener(onClickListener);
            popup.inflate(moreMenuRes);
            popup.show();
        });
    }
}
 
Example 3
Source File: DocumentViewModel.java    From spline with Apache License 2.0 5 votes vote down vote up
public DocumentViewModel(Context context, String fileName) {
    this.context = context;
    this.fileName = fileName;

    repository = DocumentRepository.getInstance();

    rectString = context.getString(R.string.rect);
    triangleString = context.getString(R.string.triangle);
    ovalString = context.getString(R.string.oval);

    rectLayers = new ArrayList<>();
    triangleLayers = new ArrayList<>();
    ovalLayers = new ArrayList<>();

    onMenuItemClickListener = new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            String title = (String) item.getTitle();
            if (title.equals(rectString)) {
                addRectLayer();
            } else if (title.equals(triangleString)) {
                addTriangleLayer();
            } else if (title.equals(ovalString)) {
                addOvalLayer();
            }
            return true;
        }
    };

    this.document = new Document();
}
 
Example 4
Source File: PopupWindowFactory.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
public static PopupMenu createAndShowPopupMenu(Context context, View anchor, int menuRes, PopupMenu.OnMenuItemClickListener listener) {
    PopupMenu popup = new PopupMenu(context, anchor);
    popup.getMenuInflater().inflate(menuRes, popup.getMenu());
    popup.setOnMenuItemClickListener(listener);
    popup.show();
    return popup;
}
 
Example 5
Source File: PermissionsPopupMenu.java    From Plumble with GNU General Public License v3.0 5 votes vote down vote up
public PermissionsPopupMenu(Context context, View anchor, int menuRes,
                            IOnMenuPrepareListener enforcer,
                            PopupMenu.OnMenuItemClickListener itemClickListener,
                            IChannel channel, IJumbleService service) {
    mContext = context;
    mChannel = channel;
    mService = service;
    mPrepareListener = enforcer;
    mMenu = new PopupMenu(mContext, anchor);
    mMenu.inflate(menuRes);
    mMenu.setOnDismissListener(this);
    mMenu.setOnMenuItemClickListener(itemClickListener);
}
 
Example 6
Source File: DocumentViewModel.java    From spline with Apache License 2.0 4 votes vote down vote up
public PopupMenu.OnMenuItemClickListener getOnMenuItemClickListener() {
    return onMenuItemClickListener;
}