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;
}
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;
}
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);
}
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);
}
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());
}
Aggregations