use of androidx.appcompat.widget.PopupMenu in project EhViewer by seven332.
the class GalleryDetailScene method ensurePopMenu.
private void ensurePopMenu() {
if (mPopupMenu != null) {
return;
}
Context context = getContext2();
AssertUtils.assertNotNull(context);
PopupMenu popup = new PopupMenu(context, mOtherActions, Gravity.TOP);
mPopupMenu = popup;
popup.getMenuInflater().inflate(R.menu.scene_gallery_detail, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_open_in_other_app:
String url = getGalleryDetailUrl(false);
Activity activity = getActivity2();
if (null != url && null != activity) {
UrlOpener.openUrl(activity, url, false);
}
break;
case R.id.action_refresh:
if (mState != STATE_REFRESH && mState != STATE_REFRESH_HEADER) {
adjustViewVisibility(STATE_REFRESH, true);
request();
}
break;
}
return true;
}
});
}
use of androidx.appcompat.widget.PopupMenu in project MTweaks-KernelAdiutorMOD by morogoku.
the class CardView method refresh.
@Override
protected void refresh() {
super.refresh();
if (mTitle != null) {
if (mTitleText != null) {
mTitle.setText(mTitleText);
mTitleParent.setVisibility(View.VISIBLE);
if (mLayoutParent != null) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) mLayout.getLayoutParams();
layoutParams.topMargin = -mLayout.getPaddingLeft();
mLayout.requestLayout();
mLayout.setPadding(mLayout.getPaddingLeft(), 0, mLayout.getPaddingRight(), mLayout.getPaddingBottom());
}
} else {
mTitleParent.setVisibility(View.GONE);
}
}
if (mMenuButton != null && mOnMenuListener != null) {
mMenuButton.setVisibility(View.VISIBLE);
mPopupMenu = new PopupMenu(mMenuButton.getContext(), mMenuButton);
mOnMenuListener.onMenuReady(this, mPopupMenu);
}
if (mRootView != null && getOnItemClickListener() != null) {
mRootView.setOnClickListener(view -> getOnItemClickListener().onClick(CardView.this));
}
}
use of androidx.appcompat.widget.PopupMenu in project Conversations by siacs.
the class StartConversationActivity method inflateFab.
private void inflateFab(final SpeedDialView speedDialView, @MenuRes final int menuRes) {
speedDialView.clearActionItems();
final PopupMenu popupMenu = new PopupMenu(this, new View(this));
popupMenu.inflate(menuRes);
final Menu menu = popupMenu.getMenu();
for (int i = 0; i < menu.size(); i++) {
final MenuItem menuItem = menu.getItem(i);
final SpeedDialActionItem actionItem = new SpeedDialActionItem.Builder(menuItem.getItemId(), menuItem.getIcon()).setLabel(menuItem.getTitle() != null ? menuItem.getTitle().toString() : null).setFabImageTintColor(ContextCompat.getColor(this, R.color.white)).create();
speedDialView.addActionItem(actionItem);
}
}
use of androidx.appcompat.widget.PopupMenu in project xabber-android by redsolution.
the class ContactListFragment method onAccountMenuClick.
@Override
public void onAccountMenuClick(int adapterPosition, View view) {
IFlexible item = adapter.getItem(adapterPosition);
if (item != null && item instanceof AccountVO) {
PopupMenu popup = new PopupMenu(getActivity(), view);
popup.inflate(R.menu.item_account_group);
ContextMenuHelper.setUpAccountMenu(getActivity(), presenter, ((AccountVO) item).getAccountJid(), popup.getMenu());
popup.show();
}
}
use of androidx.appcompat.widget.PopupMenu in project RxBinding by JakeWharton.
the class RxPopupMenuTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View anchor = new View(this);
setContentView(anchor);
popupMenu = new PopupMenu(this, anchor);
}
Aggregations