use of android.app.NotificationGroup in project android_packages_apps_CMParts by LineageOS.
the class AppGroupList method addAppGroup.
private void addAppGroup() {
LayoutInflater inflater = getActivity().getLayoutInflater();
View content = inflater.inflate(R.layout.profile_name_dialog, null);
final TextView prompt = (TextView) content.findViewById(R.id.prompt);
final EditText entry = (EditText) content.findViewById(R.id.name);
prompt.setText(R.string.profile_appgroup_name_prompt);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.profile_new_appgroup);
builder.setView(content);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String name = entry.getText().toString();
if (!mProfileManager.notificationGroupExists(name)) {
NotificationGroup newGroup = new NotificationGroup(name);
mProfileManager.addNotificationGroup(newGroup);
refreshList();
} else {
Toast.makeText(getActivity(), R.string.duplicate_appgroup_name, Toast.LENGTH_LONG).show();
}
}
});
builder.setNegativeButton(android.R.string.cancel, null);
AlertDialog dialog = builder.create();
dialog.show();
}
use of android.app.NotificationGroup in project android_packages_apps_CMParts by LineageOS.
the class AppGroupList method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof PreferenceScreen) {
NotificationGroup group = mProfileManager.getNotificationGroup(UUID.fromString(preference.getKey()));
editGroup(group);
}
return super.onPreferenceTreeClick(preference);
}
use of android.app.NotificationGroup in project android_packages_apps_CMParts by LineageOS.
the class SetupActionsFragment method requestActiveAppGroupsDialog.
private void requestActiveAppGroupsDialog() {
final NotificationGroup[] notificationGroups = mProfileManager.getNotificationGroups();
CharSequence[] items = new CharSequence[notificationGroups.length];
boolean[] checked = new boolean[notificationGroups.length];
for (int i = 0; i < notificationGroups.length; i++) {
items[i] = notificationGroups[i].getName();
checked[i] = mProfile.getProfileGroup(notificationGroups[i].getUuid()) != null;
}
DialogInterface.OnMultiChoiceClickListener listener = new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if (isChecked) {
mProfile.addProfileGroup(new ProfileGroup(notificationGroups[which].getUuid(), false));
} else {
mProfile.removeProfileGroup(notificationGroups[which].getUuid());
}
updateProfile();
rebuildItemList();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setMultiChoiceItems(items, checked, listener).setTitle(R.string.profile_appgroups_title).setPositiveButton(android.R.string.ok, null);
builder.show();
}
use of android.app.NotificationGroup in project android_packages_apps_CMParts by LineageOS.
the class AppGroupList method refreshList.
public void refreshList() {
PreferenceScreen appgroupList = getPreferenceScreen();
appgroupList.removeAll();
// Add the existing app groups
for (NotificationGroup group : mProfileManager.getNotificationGroups()) {
PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
pref.setKey(group.getUuid().toString());
pref.setTitle(group.getName());
pref.setPersistent(false);
appgroupList.addPreference(pref);
}
}
Aggregations