Add edit and delete buttons to zen rules

Test: atest ZenModeScheduleRuleSettingsTest ZenModeEventRuleSettingsTest
Test: manual
Bug: 111475013
Fixes: 120787343
Fixes: 120758763
Change-Id: If81ce2972e6887fb2a85d4b7262e81b26162e19c
This commit is contained in:
Beverly
2018-12-04 12:32:31 -05:00
parent f80e5b561e
commit 48903ccefe
10 changed files with 194 additions and 41 deletions

View File

@@ -20,6 +20,7 @@ import android.app.AlertDialog;
import android.app.AutomaticZenRule;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.service.notification.ConditionProviderService;
import android.view.Menu;
@@ -44,11 +45,22 @@ import java.util.Map;
@SearchIndexable
public class ZenModeAutomationSettings extends ZenModeSettingsBase {
public static final String DELETE = "DELETE_RULE";
protected final ManagedServiceSettings.Config CONFIG = getConditionProviderConfig();
private CharSequence[] mDeleteDialogRuleNames;
private String[] mDeleteDialogRuleIds;
private boolean[] mDeleteDialogChecked;
@Override
public void onAttach(Context context) {
super.onAttach(context);
Bundle bundle = getArguments();
if (bundle != null && bundle.containsKey(DELETE)) {
mBackend.removeZenRule(bundle.getString(DELETE));
bundle.remove(DELETE);
}
}
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
ZenServiceListing serviceListing = new ZenServiceListing(getContext(), CONFIG);