use of org.cyanogenmod.cmparts.widget.PackageListAdapter.PackageItem in project android_packages_apps_CMParts by LineageOS.
the class AppGroupConfig method onContextItemSelected.
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo aMenuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
PackageItem selectedGroup = (PackageItem) mListView.getItemAtPosition(aMenuInfo.position);
switch(item.getItemId()) {
case R.string.profile_menu_delete_title:
deleteAppFromGroup(selectedGroup);
return true;
}
return super.onOptionsItemSelected(item);
}
use of org.cyanogenmod.cmparts.widget.PackageListAdapter.PackageItem in project android_packages_apps_CMParts by LineageOS.
the class AppGroupConfig method onCreateDialog.
@Override
public Dialog onCreateDialog(int id) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final Dialog dialog;
switch(id) {
case DIALOG_APPS:
final ListView list = new ListView(getActivity());
list.setAdapter(mAppAdapter);
builder.setTitle(R.string.profile_choose_app);
builder.setView(list);
dialog = builder.create();
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
PackageItem info = (PackageItem) parent.getItemAtPosition(position);
mNotificationGroup.addPackage(info.packageName);
updatePackages();
dialog.cancel();
}
});
break;
case DELETE_CONFIRM:
builder.setMessage(R.string.profile_app_delete_confirm);
builder.setTitle(R.string.profile_menu_delete_title);
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
doDelete();
}
});
builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialog = builder.create();
break;
case DELETE_GROUP_CONFIRM:
builder.setMessage(R.string.profile_delete_appgroup);
builder.setTitle(R.string.profile_menu_delete_title);
builder.setIconAttribute(android.R.attr.alertDialogIcon);
builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mProfileManager.removeNotificationGroup(mNotificationGroup);
mNotificationGroup = null;
finish();
}
});
builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
dialog = builder.create();
break;
default:
dialog = null;
}
return dialog;
}
use of org.cyanogenmod.cmparts.widget.PackageListAdapter.PackageItem in project android_packages_apps_CMParts by LineageOS.
the class NotificationLightSettings method onCreateDialog.
/**
* Utility classes and supporting methods
*/
@Override
public Dialog onCreateDialog(int id) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final Dialog dialog;
switch(id) {
case DIALOG_APPS:
final ListView list = new ListView(getActivity());
list.setAdapter(mPackageAdapter);
builder.setTitle(R.string.choose_app);
builder.setView(list);
dialog = builder.create();
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Add empty application definition, the user will be able to edit it later
PackageItem info = (PackageItem) parent.getItemAtPosition(position);
addCustomApplicationPref(info.packageName);
dialog.cancel();
}
});
break;
default:
dialog = null;
}
return dialog;
}
Aggregations