Example usage for android.view MenuItem getMenuInfo

List of usage examples for android.view MenuItem getMenuInfo

Introduction

In this page you can find the example usage for android.view MenuItem getMenuInfo.

Prototype

public ContextMenuInfo getMenuInfo();

Source Link

Document

Gets the extra information linked to this menu item.

Usage

From source file:net.dian1.player.activity.DownloadActivity.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.add_to_playlist:
        //         addToPlaylist(getJob(info.position));
        return true;
    case R.id.play_download:
        //playNow(info.position);
        return true;
    case R.id.delete_download:
        //         deleteJob(getJob(info.position));
        return true;
    default:/*from   w  w w  .ja  v a  2  s.  c om*/
        return super.onContextItemSelected(item);
    }
}

From source file:de.hshannover.f4.trust.ironcontrol.view.list_activities.ListSavedPublishsActivity.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    String listItemId = Long.toString(info.id);
    switch (item.getItemId()) {
    case REMOVE_ID:
        removePublish(listItemId);//w  w w.  j a v  a2  s.  c o m
        break;
    case EDIT_ID:
        startEditActivity(listItemId);
        break;
    case UPDATE_ID:
        createPublish(listItemId, R.id.bPublishUpdate);
        break;
    case NOTIFY_ID:
        createPublish(listItemId, R.id.bPublishNotify);
        break;
    case DELETE_ID:
        createPublish(listItemId, R.id.bPublishDelete);
        break;
    }
    return super.onContextItemSelected(item);
}

From source file:edu.illinois.whereru.FriendListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {

    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();

    switch (item.getItemId()) {

    case FRIEND_SETTING_MENU_ID:
        loadSettings(info.position);//from w w w  .  ja  va2s  .c  om
        return true;

    case FRIEND_REMOVE_MENU_ID:
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:it.reyboz.bustorino.ActivityFavorites.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();

    Stop busStop = (Stop) favoriteListView.getItemAtPosition(info.position);

    switch (item.getItemId()) {
    case R.id.action_favourite_entry_delete:
        UserDB.deleteStop(busStop, this.userDB);
        createFavoriteList();/*from  ww  w  . j  a va2 s . co m*/
        return true;
    case R.id.action_rename_bus_stop_username:
        showBusStopUsernameInputDialog(busStop);
        return true;
    case R.id.action_view_on_map:
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(busStop.getGeoURL()));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:com.g_node.gca.abstracts.AbstractNotesFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case 3: {// w ww .j a v  a 2 s .  com
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
        Log.i("GCA-Abs-Frag", "Menu info id: " + info.id);
        DatabaseHelper.deleteFromABSTRACT_NOTES(info.id);
        populateListView();
        return (true);
    }
    case 2: {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
        Log.i("GCA-Abs-Frag", "Menu info id: " + info.id);

        EditNoteDialogFragment editNoteFragment = EditNoteDialogFragment.newInstance(value,
                String.valueOf(info.id));
        editNoteFragment.show(getFragmentManager(), "fragment_edit_note");
        //DatabaseHelper.deleteFromABSTRACT_NOTES(info.id);
        //update in dialogefragment positive button method 
        Log.i("GCA-Abs-Frag", "After EditNote Dialog");
        //populateListView();
        return (true);
    }
    }

    return (super.onOptionsItemSelected(item));
}

From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Fragments.NodeListFragment.java

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
    final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case 0: // edit
        editNode(adapter.getItem(info.position), info.position);
        break;//ww w  .  j ava  2  s .  c o  m
    case 1: // delete
        Edit edit = new RemoveNodeEdit(session, info.position);
        edit.perform();
        break;
    }
    return true;
}

From source file:com.royclarkson.springagram.GalleryListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.action_delete:
        deleteGallery(info.position);/*from   w  w w  .  jav a2 s .  co m*/
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:de.androvdr.fragments.RecordingsFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.rec_play:
        mController.action(RecordingController.RECORDING_ACTION_PLAY, info.position);
        return true;
    case R.id.rec_play_start:
        mController.action(RecordingController.RECORDING_ACTION_PLAY_START, info.position);
        return true;
    case R.id.rec_remote:
        mController.action(RecordingController.RECORDING_ACTION_REMOTE);
        return true;
    case R.id.rec_delete:
        AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
        builder.setMessage(R.string.rec_delete_recording).setCancelable(false)
                .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                        mController.action(RecordingController.RECORDING_ACTION_DELETE, info.position);
                    }/*  w  w w  .ja  va  2s . c o  m*/
                }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:org.riksa.a3.fragment.KeyListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    KeyListSimpleAdapter adapter = (KeyListSimpleAdapter) getListAdapter();
    AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    String id = adapter.getKeyIdAtPosition(menuInfo.position);
    A3Key key = keyChain.getKeyWithId(id);

    switch (item.getItemId()) {
    case R.id.menu_delete:
        keyChain.removeKey(key);//from  www  .j  a  v a  2  s .c o  m
        break;
    case R.id.menu_copy_public_key:
        if (key != null) {
            log.debug("Public key={}", key.getPublicKey());
        }
        break;
    default:
        log.warn("Unhandled menu item clicked");
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.github.nutomic.pegasus.activities.ProfileList.java

/**
 * Context menu selection, edit, rename or delete profile.
 *//*from  w  ww.ja  v  a2 s  .c  om*/
@Override
public boolean onContextItemSelected(MenuItem item) {
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    final Database db = Database.getInstance(this);
    switch (item.getItemId()) {
    case R.id.edit:
        Intent i = new Intent(this, ProfileEdit.class);
        i.putExtra(ProfileEdit.PROFILE_ID, info.id);
        startActivity(i);
        return true;
    case R.id.rename:
        renameProfile(info.id, getProfileName((AdapterContextMenuInfo) item.getMenuInfo()));
        return true;
    case R.id.delete:
        new Builder(this).setTitle(R.string.profilelist_delete).setMessage(R.string.profilelist_delete_message)
                .setPositiveButton(android.R.string.yes, new OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                        new UpdateTask() {

                            @Override
                            protected Long doInBackground(Void... arg0) {
                                db.getWritableDatabase().delete(ProfileColumns.TABLE_NAME,
                                        ProfileColumns._ID + " = ?", new String[] { Long.toString(info.id) });
                                return null;
                            }
                        }.execute((Void) null);
                    }
                }).setNegativeButton(android.R.string.no, null).show();
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}