Search in sources :

Example 51 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project Awful.apk by Awful.

the class ForumDisplayFragment method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu aMenu, View aView, ContextMenuInfo aMenuInfo) {
    super.onCreateContextMenu(aMenu, aView, aMenuInfo);
    if (aMenuInfo instanceof AdapterContextMenuInfo) {
        android.view.MenuInflater inflater = getActivity().getMenuInflater();
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) aMenuInfo;
        Cursor row = mCursorAdapter.getRow(info.id);
        if (row != null && row.getInt(row.getColumnIndex(AwfulThread.BOOKMARKED)) > -1) {
            inflater.inflate(R.menu.thread_longpress, aMenu);
            if (row.getInt(row.getColumnIndex(AwfulThread.BOOKMARKED)) < 1 || !getPrefs().coloredBookmarks) {
                MenuItem bookmarkColor = aMenu.findItem(R.id.thread_bookmark_color);
                if (bookmarkColor != null) {
                    bookmarkColor.setEnabled(false);
                    bookmarkColor.setVisible(false);
                }
            }
        }
    }
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) MenuItem(android.view.MenuItem) Cursor(android.database.Cursor)

Example 52 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project RoboBinding-gallery by RoboBinding.

the class ContextMenuPresentationModel method deleteProduct.

public void deleteProduct(MenuItem menuItem) {
    AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) menuItem.getMenuInfo();
    Product deletedProduct = productStore.remove(menuInfo.position);
    productOperationListener.onProductDeleted(deletedProduct);
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) Product(org.robobinding.gallery.model.Product)

Example 53 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project DroidShows by ltGuillaume.

the class DroidShows method onCreateContextMenu.

/* context menu */
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    menu.add(0, VIEW_SERIEDETAILS_CONTEXT, VIEW_SERIEDETAILS_CONTEXT, getString(R.string.menu_context_view_serie_details));
    if (!logMode && seriesAdapter.getItem(info.position).getUnwatched() > 0)
        menu.add(0, VIEW_EPISODEDETAILS_CONTEXT, VIEW_EPISODEDETAILS_CONTEXT, getString(R.string.messsages_view_ep_details));
    menu.add(0, EXT_RESOURCES_CONTEXT, EXT_RESOURCES_CONTEXT, getString(R.string.menu_context_ext_resources));
    if (!logMode && seriesAdapter.getItem(info.position).getUnwatchedAired() > 0)
        menu.add(0, MARK_NEXT_EPISODE_AS_SEEN_CONTEXT, MARK_NEXT_EPISODE_AS_SEEN_CONTEXT, getString(R.string.menu_context_mark_next_episode_as_seen));
    if (!logMode) {
        menu.add(0, TOGGLE_ARCHIVED_CONTEXT, TOGGLE_ARCHIVED_CONTEXT, getString(R.string.menu_archive));
        menu.add(0, PIN_CONTEXT, PIN_CONTEXT, getString(R.string.menu_context_pin));
        menu.add(0, DELETE_CONTEXT, DELETE_CONTEXT, getString(R.string.menu_context_delete));
    }
    menu.add(0, UPDATE_CONTEXT, UPDATE_CONTEXT, getString(R.string.menu_context_update));
    menu.add(0, SYNOPSIS_LANGUAGE, SYNOPSIS_LANGUAGE, getString(R.string.dialog_change_language) + " (" + seriesAdapter.getItem(info.position).getLanguage() + ")");
    if (!logMode) {
        if (seriesAdapter.getItem(info.position).getPassiveStatus())
            menu.findItem(TOGGLE_ARCHIVED_CONTEXT).setTitle(R.string.menu_unarchive);
        if (pinnedShows.contains(seriesAdapter.getItem(info.position).getSerieId()))
            menu.findItem(PIN_CONTEXT).setTitle(R.string.menu_context_unpin);
    }
    menu.setHeaderTitle(seriesAdapter.getItem(info.position).getName());
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo)

Example 54 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project android-aosp-mms by slvn.

the class SlideshowEditActivity method onContextItemSelected.

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int position = info.position;
    switch(item.getItemId()) {
        case MENU_MOVE_UP:
            if ((position > 0) && (position < mSlideshowModel.size())) {
                mSlideshowEditor.moveSlideUp(position);
                mSlideListAdapter.notifyDataSetChanged();
                mList.setSelection(position - 1);
            }
            break;
        case MENU_MOVE_DOWN:
            if ((position >= 0) && (position < mSlideshowModel.size() - 1)) {
                mSlideshowEditor.moveSlideDown(position);
                mSlideListAdapter.notifyDataSetChanged();
                mList.setSelection(position + 1);
            }
            break;
        case MENU_REMOVE_SLIDE:
            if ((position >= 0) && (position < mSlideshowModel.size())) {
                mSlideshowEditor.removeSlide(position);
                mSlideListAdapter.notifyDataSetChanged();
            }
            break;
        case MENU_ADD_SLIDE:
            addNewSlide();
            break;
        default:
            break;
    }
    return true;
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo)

Aggregations

AdapterContextMenuInfo (android.widget.AdapterView.AdapterContextMenuInfo)54 Intent (android.content.Intent)9 MenuItem (android.view.MenuItem)7 Cursor (android.database.Cursor)6 PrinterInfo (android.print.PrinterInfo)5 MenuInflater (android.view.MenuInflater)5 AdapterView (android.widget.AdapterView)5 AlertDialog (android.app.AlertDialog)3 DialogInterface (android.content.DialogInterface)3 ContextMenuInfo (android.view.ContextMenu.ContextMenuInfo)3 SuppressLint (android.annotation.SuppressLint)2 CheckBoxPreference (android.preference.CheckBoxPreference)2 Preference (android.preference.Preference)2 SubMenu (android.view.SubMenu)2 Account (com.fsck.k9.Account)2 MalformedURLException (java.net.MalformedURLException)2 DatePickerDialog (android.app.DatePickerDialog)1 VpnProfile (android.net.vpn.VpnProfile)1 VpnState (android.net.vpn.VpnState)1 SparseBooleanArray (android.util.SparseBooleanArray)1