Search in sources :

Example 11 with PopupMenu

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;
        }
    });
}
Also used : Context(android.content.Context) GalleryActivity(com.hippo.ehviewer.ui.GalleryActivity) MainActivity(com.hippo.ehviewer.ui.MainActivity) Activity(android.app.Activity) MenuItem(android.view.MenuItem) PopupMenu(androidx.appcompat.widget.PopupMenu)

Example 12 with PopupMenu

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));
    }
}
Also used : LinearLayout(android.widget.LinearLayout) PopupMenu(androidx.appcompat.widget.PopupMenu)

Example 13 with PopupMenu

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);
    }
}
Also used : SpeedDialActionItem(com.leinardi.android.speeddial.SpeedDialActionItem) MenuItem(android.view.MenuItem) ContextMenu(android.view.ContextMenu) Menu(android.view.Menu) PopupMenu(androidx.appcompat.widget.PopupMenu) SpeedDialView(com.leinardi.android.speeddial.SpeedDialView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AutoCompleteTextView(android.widget.AutoCompleteTextView) SuppressLint(android.annotation.SuppressLint) PopupMenu(androidx.appcompat.widget.PopupMenu)

Example 14 with PopupMenu

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();
    }
}
Also used : IFlexible(eu.davidea.flexibleadapter.items.IFlexible) AccountVO(com.xabber.android.presentation.ui.contactlist.viewobjects.AccountVO) PopupMenu(androidx.appcompat.widget.PopupMenu)

Example 15 with PopupMenu

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);
}
Also used : View(android.view.View) PopupMenu(androidx.appcompat.widget.PopupMenu)

Aggregations

PopupMenu (androidx.appcompat.widget.PopupMenu)34 MenuItem (android.view.MenuItem)20 TextView (android.widget.TextView)12 Spannable (android.text.Spannable)8 View (android.view.View)8 Menu (android.view.Menu)7 SwitchCompat (androidx.appcompat.widget.SwitchCompat)5 MenuInflater (android.view.MenuInflater)4 LinearLayout (android.widget.LinearLayout)4 RelativeLayout (android.widget.RelativeLayout)4 Intent (android.content.Intent)3 AdapterView (android.widget.AdapterView)3 ListView (android.widget.ListView)3 SuppressLint (android.annotation.SuppressLint)2 Activity (android.app.Activity)2 Resources (android.content.res.Resources)2 TypedArray (android.content.res.TypedArray)2 Drawable (android.graphics.drawable.Drawable)2 CompoundButton (android.widget.CompoundButton)2 SearchView (androidx.appcompat.widget.SearchView)2