Example usage for android.widget PopupMenu show

List of usage examples for android.widget PopupMenu show

Introduction

In this page you can find the example usage for android.widget PopupMenu show.

Prototype

public void show() 

Source Link

Document

Show the menu popup anchored to the view specified during construction.

Usage

From source file:com.owncloud.android.ui.trashbin.TrashbinActivity.java

@Override
public void onOverflowIconClicked(TrashbinFile file, View view) {
    PopupMenu popup = new PopupMenu(this, view);
    popup.inflate(R.menu.trashbin_actions_menu);

    popup.setOnMenuItemClickListener(item -> {
        trashbinPresenter.removeTrashbinFile(file);

        return true;
    });// w w  w. ja va 2 s .  c  o m
    popup.show();
}

From source file:com.filepager.afilechooser.FileChooserActivity.java

public void showPopUp(View v) {
    PopupMenu popup = new PopupMenu(this, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.file_type_selection, popup.getMenu());
    popup.show();

}

From source file:za.ac.uct.cs.lwsjam005.eshelf.activities.ReadActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case android.R.id.home:
        // go back home

        // ensure we are resuming the existing activity
        Intent intent = new Intent(this, MainActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(ARG_CURRENT_PAGE, currentPage);
        intent.putExtra(ARG_BOOKMARKS, thisBook.getBookmarks());
        intent.setAction(MainActivity.ACTION_RETURN_FROM_READ);

        startActivity(intent);/*from ww w  . ja v  a2 s  .c  o m*/

        return true;

    case R.id.action_previous:
        // Go to the previous step in the wizard. If there is no previous
        // step,
        // setCurrentItem will do nothing.
        mPager.setCurrentItem(mPager.getCurrentItem() - 1);
        return true;

    case R.id.action_next:
        // Advance to the next step in the wizard. If there is no next step,
        // setCurrentItem
        // will do nothing.
        mPager.setCurrentItem(mPager.getCurrentItem() + 1);
        return true;
    case R.id.action_bookmarks:
        PopupMenu popup = new PopupMenu(this, this.findViewById(R.id.action_bookmarks));
        popup.setOnMenuItemClickListener(this);
        MenuInflater inflater = popup.getMenuInflater();
        inflater.inflate(R.menu.popup_menu_bookmarks, popup.getMenu());

        popup.show();

        return true;
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.tcity.android.ui.overview.project.ProjectOverviewActivity.java

void projectOptionsClick(@NotNull String id, @NotNull View anchor) {
    PopupMenu menu = new PopupMenu(this, anchor);

    menu.inflate(R.menu.menu_concept);/*  w ww. ja v  a2 s.  c o  m*/

    menu.setOnMenuItemClickListener(new PopupMenuListener(WebLocator.getProjectUrl(id, new Preferences(this))));

    menu.show();
}

From source file:net.margaritov.preference.colorpicker.ColorPickerDialog.java

private void showResetPopupMenu(View v) {
    PopupMenu popup = new PopupMenu(getContext(), v);
    popup.setOnMenuItemClickListener(this);
    popup.inflate(R.menu.reset);//from  ww w. j a  va2 s .c  o  m
    popup.show();
}

From source file:net.margaritov.preference.colorpicker.ColorPickerDialog.java

private void showPalettePopupMenu(View v) {
    PopupMenu popup = new PopupMenu(getContext(), v);
    popup.setOnMenuItemClickListener(this);
    popup.inflate(R.menu.palette);//from  w  ww .j ava 2s  .com
    popup.show();
}

From source file:com.scooter1556.sms.androidtv.fragment.AudioDirectoryDetailsFragment.java

public void showOptionsMenu(View v) {
    PopupMenu popup = new PopupMenu(getActivity(), v);

    // This activity implements OnMenuItemClickListener
    popup.setOnMenuItemClickListener(this);
    popup.inflate(R.menu.menu_audio_element);
    popup.show();
}

From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java

private void showMenu(View v) {
    PopupMenu popup = new PopupMenu(mActivity, v);

    // This activity implements OnMenuItemClickListener
    popup.setOnMenuItemClickListener(this);
    popup.inflate(R.menu.fab_menu);/* w  w  w  .j av  a 2s .  co  m*/
    popup.show();
}

From source file:com.tcity.android.ui.overview.project.ProjectOverviewActivity.java

void buildConfigurationOptionsClick(@NotNull String id, @NotNull View anchor) {
    PopupMenu menu = new PopupMenu(this, anchor);

    menu.inflate(R.menu.menu_concept);//from   w w  w .j  a  va2 s. co m

    menu.setOnMenuItemClickListener(
            new PopupMenuListener(WebLocator.getBuildConfigurationUrl(id, new Preferences(this))));

    menu.show();
}

From source file:at.ac.uniklu.mobile.sportal.DashboardActivity.java

@TargetApi(11)
@Override//  ww w  . j a v a  2  s.  c  o  m
public void openOptionsMenu() {
    // Honeycomb and ICS tablet menu workaround
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        /* Android >= 3 with holo theme doesn't support the options menu, so 
         * display a popup menu below the overflow action button. */
        PopupMenu m = new PopupMenu(this, findViewById(R.id.actionbar_overflow));
        m.getMenuInflater().inflate(R.menu.dashboard_menu, m.getMenu());
        m.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                return onOptionsItemSelected(item);
            }
        });
        m.show();
    } else {
        // show default options menu on Android 2.x
        super.openOptionsMenu();
    }
}