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:org.totschnig.myexpenses.fragment.SplitPartList.java

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.DELETE_COMMAND:
        ((ProtectedFragmentActivity) getActivity()).startTaskExecution(
                TaskExecutionFragment.TASK_DELETE_TRANSACTION, new Long[] { info.id }, Boolean.valueOf(false),
                0);/*w ww  .  j a va  2  s  .c o  m*/
        return true;
    }
    return super.onContextItemSelected(item);
}

From source file:org.sigimera.app.android.CrisesListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.open:
        Intent crisisActivity = new Intent(getActivity(), CrisisActivity.class);
        crisisActivity.putExtra(Constants.CRISIS_ID, getCrisisID(info.position));
        startActivity(crisisActivity);/*w  w  w  .  j a  v  a  2 s.  c  o  m*/
        return true;
    case R.id.share:
        this.startActivity(Common.shareCrisis(getCrisisID(info.position), getCrisisShortTitle(info.position)));
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:at.ac.tuwien.detlef.fragments.PodListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case R.id.delete_feed:
        /*//from  ww  w . j  a v a 2s. c  om
         * Apparently, the header is counted as a position, so we need
         * to subtract one.
         */
        onDeleteFeedClicked(info.position - 1);
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

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

@Override
protected void onContextItemSelected(MenuItem item, ListHierarchyType type) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    String listItemId = Long.toString(info.id);
    switch (item.getItemId()) {
    case REMOVE_ID:
        remove(listItemId, type);/*from  w ww  .  j  a  v a  2s.  c om*/
        break;
    }
}

From source file:can.yrt.onebusaway.MySearchRoutesFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case CONTEXT_MENU_DEFAULT:
        // Fake a click
        onListItemClick(getListView(), info.targetView, info.position, info.id);
        return true;
    case CONTEXT_MENU_SHOW_ON_MAP:
        HomeActivity.start(getActivity(), getId(getListView(), info.position));
        return true;
    case CONTEXT_MENU_SHOW_URL:
        UIHelp.goToUrl(getActivity(), getUrl(getListView(), info.position));
        return true;
    default://from w w  w .jav  a  2s  . c  o m
        return super.onContextItemSelected(item);
    }
}

From source file:it.sasabz.android.sasabus.classes.dialogs.SelectFavoritenDialog.java

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int menuItemIndex = item.getItemId();
    if (menuItemIndex == 0) {
        Favorit fav = list.get(info.position);
        SQLiteDatabase db = new FavoritenDB(getContext()).getWritableDatabase();
        if (fav.delete(db))
            Log.v("FAVORITENLOESCHEN", "OK");
        else// w  w  w .  j a va 2 s.com
            Log.v("FAVORITENLOESCHEN", "FEHLER");
        db.close();
        list.remove(info.position);
        MyFavoritenListAdapter favoriten = new MyFavoritenListAdapter(SASAbus.getContext(), list);
        ListView liste = (ListView) findViewById(android.R.id.list);
        liste.setAdapter(favoriten);
    }
    return false;
}

From source file:it.sasabz.android.sasabus.classes.dialogs.SelectFavoritenDialog.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int menuItemIndex = item.getItemId();
    if (menuItemIndex == 0) {
        Favorit fav = list.get(info.position);
        SQLiteDatabase db = new FavoritenDB(getContext()).getWritableDatabase();
        if (fav.delete(db))
            Log.v("FAVORITENLOESCHEN", "OK");
        else/*  ww w. j  av  a 2 s . co  m*/
            Log.v("FAVORITENLOESCHEN", "FEHLER");
        db.close();
        list.remove(info.position);
        MyFavoritenListAdapter favoriten = new MyFavoritenListAdapter(SASAbus.getContext(), list);
        ListView liste = (ListView) findViewById(android.R.id.list);
        liste.setAdapter(favoriten);
    }
    return false;
}

From source file:pl.zajecia.cw3.PhotosActivity.java

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

    /** If itemId == remove picture (first and only one), remove pictur
     * from list and refresh gallery/*  ww w  .j a  v a 2s  . c o m*/
     */
    if (item.getItemId() == 0) {
        mPhotos.remove(a.position);
        mPhotosAdapter.notifyDataSetChanged();
        mPhotosGridView.setAdapter(mPhotosAdapter);
        return true;
    }
    return super.onContextItemSelected(item);
}

From source file:org.onebusaway.android.ui.MySearchRoutesFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    switch (item.getItemId()) {
    case CONTEXT_MENU_DEFAULT:
        // Fake a click
        onListItemClick(getListView(), info.targetView, info.position, info.id);
        return true;
    case CONTEXT_MENU_SHOW_ON_MAP:
        HomeActivity.start(getActivity(), getId(getListView(), info.position));
        return true;
    case CONTEXT_MENU_SHOW_URL:
        UIUtils.goToUrl(getActivity(), getUrl(getListView(), info.position));
        return true;
    default:/*  w ww . j av  a2s .  com*/
        return super.onContextItemSelected(item);
    }
}

From source file:org.geometerplus.android.fbreader.network.NetworkCatalogActivity.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    if ((item == null || item.getMenuInfo() == null) && myTree instanceof NetworkCatalogTree) {
        final INetworkLink link = ((NetworkCatalogTree) myTree).Item.Link;
        if (Util.isTopupSupported(this, link)) {
            final TopupActions actions = NetworkView.Instance().getTopupActions();
            if (actions != null && TopupActions.runAction(this, link, item.getItemId())) {
                return true;
            }//from  ww w  .  j a  v  a2s. co  m
        }
    }
    return super.onContextItemSelected(item);
}