Search in sources :

Example 91 with PopupMenu

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();
}
Also used : Context(android.content.Context) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) SnackbarUtils(com.lguipeng.notes.utils.SnackbarUtils) Bundle(android.os.Bundle) KeyEvent(android.view.KeyEvent) NotesAdapter(com.lguipeng.notes.adpater.NotesAdapter) SearchView(android.support.v7.widget.SearchView) BaseRecyclerViewAdapter(com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter) OnClick(butterknife.OnClick) MenuItem(android.view.MenuItem) Inject(javax.inject.Inject) MotionEvent(android.view.MotionEvent) Menu(android.view.Menu) View(android.view.View) ToolbarUtils(com.lguipeng.notes.utils.ToolbarUtils) BetterFab(com.lguipeng.notes.view.BetterFab) Bind(butterknife.Bind) AdapterView(android.widget.AdapterView) DialogUtils(com.lguipeng.notes.utils.DialogUtils) DaggerActivityComponent(com.lguipeng.notes.injector.component.DaggerActivityComponent) DrawerLayout(android.support.v4.widget.DrawerLayout) DialogInterface(android.content.DialogInterface) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) MainView(com.lguipeng.notes.mvp.views.impl.MainView) ActivityModule(com.lguipeng.notes.injector.module.ActivityModule) DrawerListAdapter(com.lguipeng.notes.adpater.DrawerListAdapter) ProgressWheel(com.pnikosis.materialishprogress.ProgressWheel) SimpleListAdapter(com.lguipeng.notes.adpater.SimpleListAdapter) ComponentName(android.content.ComponentName) MenuItemCompat(android.support.v4.view.MenuItemCompat) PopupMenu(android.support.v7.widget.PopupMenu) SNote(com.lguipeng.notes.model.SNote) R(com.lguipeng.notes.R) RecyclerView(android.support.v7.widget.RecyclerView) App(com.lguipeng.notes.App) List(java.util.List) AlertDialog(android.support.v7.app.AlertDialog) Toolbar(android.support.v7.widget.Toolbar) Configuration(android.content.res.Configuration) ListView(android.widget.ListView) SearchManager(android.app.SearchManager) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) MainPresenter(com.lguipeng.notes.mvp.presenters.impl.MainPresenter) PopupMenu(android.support.v7.widget.PopupMenu)

Example 92 with PopupMenu

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();
}
Also used : Context(android.content.Context) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) SnackbarUtils(com.lguipeng.notes.utils.SnackbarUtils) Bundle(android.os.Bundle) KeyEvent(android.view.KeyEvent) NotesAdapter(com.lguipeng.notes.adpater.NotesAdapter) SearchView(android.support.v7.widget.SearchView) BaseRecyclerViewAdapter(com.lguipeng.notes.adpater.base.BaseRecyclerViewAdapter) OnClick(butterknife.OnClick) MenuItem(android.view.MenuItem) Inject(javax.inject.Inject) MotionEvent(android.view.MotionEvent) Menu(android.view.Menu) View(android.view.View) ToolbarUtils(com.lguipeng.notes.utils.ToolbarUtils) BetterFab(com.lguipeng.notes.view.BetterFab) Bind(butterknife.Bind) AdapterView(android.widget.AdapterView) DialogUtils(com.lguipeng.notes.utils.DialogUtils) DaggerActivityComponent(com.lguipeng.notes.injector.component.DaggerActivityComponent) DrawerLayout(android.support.v4.widget.DrawerLayout) DialogInterface(android.content.DialogInterface) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) MainView(com.lguipeng.notes.mvp.views.impl.MainView) ActivityModule(com.lguipeng.notes.injector.module.ActivityModule) DrawerListAdapter(com.lguipeng.notes.adpater.DrawerListAdapter) ProgressWheel(com.pnikosis.materialishprogress.ProgressWheel) SimpleListAdapter(com.lguipeng.notes.adpater.SimpleListAdapter) ComponentName(android.content.ComponentName) MenuItemCompat(android.support.v4.view.MenuItemCompat) PopupMenu(android.support.v7.widget.PopupMenu) SNote(com.lguipeng.notes.model.SNote) R(com.lguipeng.notes.R) RecyclerView(android.support.v7.widget.RecyclerView) App(com.lguipeng.notes.App) List(java.util.List) AlertDialog(android.support.v7.app.AlertDialog) Toolbar(android.support.v7.widget.Toolbar) Configuration(android.content.res.Configuration) ListView(android.widget.ListView) SearchManager(android.app.SearchManager) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) MainPresenter(com.lguipeng.notes.mvp.presenters.impl.MainPresenter) PopupMenu(android.support.v7.widget.PopupMenu)

Example 93 with PopupMenu

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) {
        }
    });
}
Also used : Bundle(android.os.Bundle) Priority(in.bugzy.data.model.Priority) BaseActivity(in.bugzy.ui.BaseActivity) PackageManager(android.content.pm.PackageManager) ProgressBar(android.widget.ProgressBar) Date(java.util.Date) AttachmentsAdapter(in.bugzy.ui.caseevents.AttachmentsAdapter) Uri(android.net.Uri) FullScreenImageActivity(in.bugzy.ui.casedetails.FullScreenImageActivity) OnClick(butterknife.OnClick) FileProvider(android.support.v4.content.FileProvider) BindView(butterknife.BindView) Manifest(android.Manifest) Area(in.bugzy.data.model.Area) Locale(java.util.Locale) MediaStore(android.provider.MediaStore) NachoTextView(com.hootsuite.nachos.NachoTextView) Attachment(in.bugzy.data.model.Attachment) View(android.view.View) Button(android.widget.Button) ChipTerminatorHandler(com.hootsuite.nachos.terminator.ChipTerminatorHandler) AdapterView(android.widget.AdapterView) TargetApi(android.annotation.TargetApi) Log(android.util.Log) Milestone(in.bugzy.data.model.Milestone) R(in.bugzy.R) ImagePickerSheetView(com.flipboard.bottomsheet.commons.ImagePickerSheetView) Category(in.bugzy.data.model.Category) Status(in.bugzy.data.model.Status) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) PopupMenu(android.support.v7.widget.PopupMenu) ItemOffsetDecoration(in.bugzy.ui.common.ItemOffsetDecoration) ActivityCompat(android.support.v4.app.ActivityCompat) Person(in.bugzy.data.model.Person) List(java.util.List) TextView(android.widget.TextView) Project(in.bugzy.data.model.Project) Nullable(android.support.annotation.Nullable) Snackbar(android.support.design.widget.Snackbar) Case(in.bugzy.data.model.Case) BottomSheetLayout(com.flipboard.bottomsheet.BottomSheetLayout) ButterKnife(butterknife.ButterKnife) Environment(android.os.Environment) CaseEvent(in.bugzy.data.model.CaseEvent) SimpleDateFormat(java.text.SimpleDateFormat) Intent(android.content.Intent) BugzyAlertDialog(in.bugzy.ui.common.BugzyAlertDialog) NonNull(android.support.annotation.NonNull) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) BugzyApp(in.bugzy.BugzyApp) Toast(android.widget.Toast) Menu(android.view.Menu) CaseDetailsActivity(in.bugzy.ui.casedetails.CaseDetailsActivity) Build(android.os.Build) ViewModelProvider(android.arch.lifecycle.ViewModelProvider) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) IOException(java.io.IOException) PropType(in.bugzy.ui.editcase.CaseEditViewModel.PropType) Tag(in.bugzy.data.model.Tag) File(java.io.File) Spinner(android.widget.Spinner) CaseEventsAdapter(in.bugzy.ui.caseevents.CaseEventsAdapter) ViewModelProviders(android.arch.lifecycle.ViewModelProviders) RecyclerView(android.support.v7.widget.RecyclerView) ArrayAdapter(android.widget.ArrayAdapter) AlertDialog(android.support.v7.app.AlertDialog) Const(in.bugzy.common.Const) Glide(com.bumptech.glide.Glide) TypedValue(android.util.TypedValue) Toolbar(android.support.v7.widget.Toolbar) Pair(android.support.v4.util.Pair) CaseStatus(in.bugzy.data.model.CaseStatus) Activity(android.app.Activity) EditText(android.widget.EditText) AttachmentsAdapter(in.bugzy.ui.caseevents.AttachmentsAdapter) ItemOffsetDecoration(in.bugzy.ui.common.ItemOffsetDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) NachoTextView(com.hootsuite.nachos.NachoTextView) View(android.view.View) AdapterView(android.widget.AdapterView) ImagePickerSheetView(com.flipboard.bottomsheet.commons.ImagePickerSheetView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) PopupMenu(android.support.v7.widget.PopupMenu)

Example 94 with PopupMenu

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();
}
Also used : MenuItem(android.view.MenuItem) PopupMenu(android.support.v7.widget.PopupMenu)

Example 95 with PopupMenu

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

Aggregations

PopupMenu (android.support.v7.widget.PopupMenu)142 MenuItem (android.view.MenuItem)116 View (android.view.View)86 TextView (android.widget.TextView)63 RecyclerView (android.support.v7.widget.RecyclerView)54 ImageView (android.widget.ImageView)40 Intent (android.content.Intent)32 PopupMenu (android.widget.PopupMenu)31 List (java.util.List)27 ArrayList (java.util.ArrayList)26 MenuInflater (android.view.MenuInflater)23 Menu (android.view.Menu)22 Bundle (android.os.Bundle)20 LayoutInflater (android.view.LayoutInflater)20 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)20 Context (android.content.Context)18 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)18 AdapterView (android.widget.AdapterView)17 DialogInterface (android.content.DialogInterface)16 ViewGroup (android.view.ViewGroup)15