Search in sources :

Example 41 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project netxms by netxms.

the class LastValuesFragment method getLastValuesSelection.

/**
 * Get list of selected dci values
 */
private ArrayList<Long> getLastValuesSelection(MenuItem item) {
    ArrayList<Long> idList = new ArrayList<Long>();
    final SparseBooleanArray positions = lv.getCheckedItemPositions();
    if (positions != null && positions.size() > 0)
        for (int i = 0; i < adapter.getCount(); i++) if (positions.get(i))
            idList.add((long) i);
    if (idList.size() == 0) {
        AdapterView.AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
        idList.add((long) (info != null ? info.position : lv.getSelectedItemPosition()));
    }
    return idList;
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) ArrayList(java.util.ArrayList) SparseBooleanArray(android.util.SparseBooleanArray) AdapterView(android.widget.AdapterView) AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo)

Example 42 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project android_packages_apps_Settings by LineageOS.

the class UserDictionarySettings method onContextItemSelected.

@Override
public boolean onContextItemSelected(MenuItem item) {
    ContextMenuInfo menuInfo = item.getMenuInfo();
    if (!(menuInfo instanceof AdapterContextMenuInfo))
        return false;
    AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo) menuInfo;
    String word = getWord(adapterMenuInfo.position);
    if (word == null)
        return true;
    switch(item.getItemId()) {
        case CONTEXT_MENU_DELETE:
            deleteWord(word);
            return true;
        case CONTEXT_MENU_EDIT:
            showAddOrEditDialog(word);
            return true;
    }
    return false;
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) ContextMenuInfo(android.view.ContextMenu.ContextMenuInfo) AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo)

Example 43 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project xabber-android by redsolution.

the class BaseListEditor method onCreateContextMenu.

@SuppressWarnings("unchecked")
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    actionWith = (T) getListView().getItemAtPosition(info.position);
    if (actionWith == null)
        // Add button
        return;
    onCreateContextMenu(menu, actionWith);
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo)

Example 44 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project xabber-android by redsolution.

the class StatusEditActivity method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    actionWithItem = (SavedStatus) getListView().getItemAtPosition(info.position);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.item_status, menu);
}
Also used : MenuInflater(android.view.MenuInflater) AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo)

Example 45 with AdapterContextMenuInfo

use of android.widget.AdapterView.AdapterContextMenuInfo in project Conversations by siacs.

the class ManageAccountActivity method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    ManageAccountActivity.this.getMenuInflater().inflate(R.menu.manageaccounts_context, menu);
    AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
    this.selectedAccount = accountList.get(acmi.position);
    if (this.selectedAccount.isEnabled()) {
        menu.findItem(R.id.mgmt_account_enable).setVisible(false);
        menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(Config.supportOpenPgp());
    } else {
        menu.findItem(R.id.mgmt_account_disable).setVisible(false);
        menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(false);
        menu.findItem(R.id.mgmt_account_publish_avatar).setVisible(false);
    }
    menu.setHeaderTitle(this.selectedAccount.getJid().asBareJid().toEscapedString());
}
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