use of android.support.v7.widget.PopupMenu in project Notes by lguipeng.
the class MainActivity method showNormalPopupMenu.
@Override
public void showNormalPopupMenu(View view, SNote note) {
PopupMenu popup = new PopupMenu(this, view);
popup.getMenuInflater().inflate(R.menu.menu_notes_more, popup.getMenu());
popup.setOnMenuItemClickListener((item -> mainPresenter.onPopupMenuClick(item.getItemId(), note)));
popup.show();
}
use of android.support.v7.widget.PopupMenu in project Notes by lguipeng.
the class MainActivity method showTrashPopupMenu.
@Override
public void showTrashPopupMenu(View view, SNote note) {
PopupMenu popup = new PopupMenu(this, view);
popup.getMenuInflater().inflate(R.menu.menu_notes_trash_more, popup.getMenu());
popup.setOnMenuItemClickListener((item -> mainPresenter.onPopupMenuClick(item.getItemId(), note)));
popup.show();
}
use of android.support.v7.widget.PopupMenu in project bugzy by cpunq.
the class CaseEditActivity method setupAttachmentsRecyclerView.
private void setupAttachmentsRecyclerView() {
mAttachmentsLayoutManager = new LinearLayoutManager(this);
mAttachmentsLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
mAttachmentsRecyclerView.setLayoutManager(mAttachmentsLayoutManager);
mAttachmentsRecyclerView.addItemDecoration(new ItemOffsetDecoration((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8f, getResources().getDisplayMetrics()), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0f, getResources().getDisplayMetrics())));
mAttachmentsRecyclerView.setHasFixedSize(true);
mAttachmentsAdapter = new AttachmentsAdapter(null, this, "");
mAttachmentsRecyclerView.setAdapter(mAttachmentsAdapter);
mAttachmentsAdapter.setOnItemClickListener(new AttachmentsAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
PopupMenu popupMenu = new PopupMenu(CaseEditActivity.this, view);
popupMenu.setOnMenuItemClickListener(item -> {
if (item.getTitle().equals("Remove")) {
mCaseEditViewModel.removeAttachment(position);
} else {
openImageActivity(view, mAttachments.get(position).getUri().getPath());
}
return true;
});
popupMenu.getMenu().add("View");
popupMenu.getMenu().add("Remove");
popupMenu.show();
}
@Override
public void onItemLongClick(View view, int position) {
}
});
}
use of android.support.v7.widget.PopupMenu in project apps-android-wikipedia by wikimedia.
the class CardHeaderView method showOverflowMenu.
private void showOverflowMenu(View anchorView) {
PopupMenu menu = new PopupMenu(anchorView.getContext(), anchorView, Gravity.END);
menu.getMenuInflater().inflate(R.menu.menu_feed_card_header, menu.getMenu());
MenuItem editCardLangItem = menu.getMenu().findItem(R.id.menu_feed_card_edit_card_languages);
editCardLangItem.setVisible(card.type().contentType().isPerLanguage());
menu.setOnMenuItemClickListener(new CardHeaderMenuClickListener());
menu.show();
}
use of android.support.v7.widget.PopupMenu in project apps-android-wikipedia by wikimedia.
the class EditHandler method onMessage.
@Override
public void onMessage(String messageType, JSONObject messagePayload) {
if (!fragment.isAdded()) {
return;
}
if (messageType.equals("editSectionClicked")) {
if (messagePayload.has("mainPencilClicked") && DescriptionEditUtil.isEditAllowed(currentPage)) {
View tempView = new View(fragment.requireContext());
tempView.setX(DimenUtil.dpToPx(messagePayload.optInt("x")));
tempView.setY(DimenUtil.dpToPx(messagePayload.optInt("y")) - fragment.getWebView().getScrollY());
((ViewGroup) fragment.getView()).addView(tempView);
PopupMenu menu = new PopupMenu(fragment.requireContext(), tempView, 0, 0, R.style.PagePopupMenu);
menu.getMenuInflater().inflate(R.menu.menu_page_header_edit, menu.getMenu());
menu.setOnMenuItemClickListener(new EditMenuClickListener());
menu.setOnDismissListener(menu1 -> ((ViewGroup) fragment.getView()).removeView(tempView));
menu.show();
} else if (messagePayload.has("editDescriptionClicked") && DescriptionEditUtil.isEditAllowed(currentPage)) {
fragment.verifyBeforeEditingDescription(null);
} else {
startEditingSection(messagePayload.optInt("sectionID"), null);
}
}
}
Aggregations