ZenRuleNameDialog.java revision f57bad7d5b0f9044231fc52351ed27e14013f491
145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock/* 245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * Copyright (C) 2015 The Android Open Source Project 345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * 445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * Licensed under the Apache License, Version 2.0 (the "License"); 545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * you may not use this file except in compliance with the License. 645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * You may obtain a copy of the License at 745fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * 845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * http://www.apache.org/licenses/LICENSE-2.0 945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * 1045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * Unless required by applicable law or agreed to in writing, software 1145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * distributed under the License is distributed on an "AS IS" BASIS, 1245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * See the License for the specific language governing permissions and 1445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock * limitations under the License. 1545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock */ 1645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 1745fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockpackage com.android.settings.notification; 1845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 1945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.app.AlertDialog; 20c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.content.ComponentName; 2145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.content.Context; 2245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.content.DialogInterface; 23c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.content.DialogInterface.OnDismissListener; 24c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.content.pm.ServiceInfo; 25c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.net.Uri; 26c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.service.notification.ZenModeConfig; 27f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlockimport android.service.notification.ZenModeConfig.EventInfo; 28c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.service.notification.ZenModeConfig.ScheduleInfo; 2945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.text.Editable; 3045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.text.TextUtils; 3145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.text.TextWatcher; 3245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.util.ArraySet; 33c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.util.Log; 3445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.view.LayoutInflater; 3545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.view.View; 3645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport android.widget.EditText; 37c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.widget.RadioButton; 38c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport android.widget.RadioGroup; 3945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 4045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockimport com.android.settings.R; 4145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 42c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlockimport java.util.List; 43c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 4445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlockpublic abstract class ZenRuleNameDialog { 45c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private static final String TAG = ZenModeSettings.TAG; 46c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private static final boolean DEBUG = ZenModeSettings.DEBUG; 47c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 4845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock private final AlertDialog mDialog; 4945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock private final EditText mEditText; 50c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private final RadioGroup mTypes; 5145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock private final ArraySet<String> mExistingNames; 52c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private final ServiceListing mServiceListing; 53c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private final RuleInfo[] mExternalRules = new RuleInfo[3]; 54f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock private final boolean mIsNew; 5545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 56c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public ZenRuleNameDialog(Context context, ServiceListing serviceListing, String ruleName, 57c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock ArraySet<String> existingNames) { 58c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mServiceListing = serviceListing; 59f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock mIsNew = ruleName == null; 6045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock final View v = LayoutInflater.from(context).inflate(R.layout.zen_rule_name, null, false); 6145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mEditText = (EditText) v.findViewById(R.id.rule_name); 62f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock if (!mIsNew) { 63c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mEditText.setText(ruleName); 64c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 6545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mEditText.setSelectAllOnFocus(true); 66c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mTypes = (RadioGroup) v.findViewById(R.id.rule_types); 67c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (mServiceListing != null) { 68c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock bindType(R.id.rule_type_schedule, defaultNewSchedule()); 69f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock bindType(R.id.rule_type_event, defaultNewEvent()); 70c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock bindExternalRules(); 71c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mServiceListing.addCallback(mServiceListingCallback); 72c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mServiceListing.reload(); 73f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock } else { 74f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock mTypes.setVisibility(View.GONE); 75c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 7645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mDialog = new AlertDialog.Builder(context) 77f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock .setTitle(mIsNew ? R.string.zen_mode_add_rule : R.string.zen_mode_rule_name) 7845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock .setView(v) 7945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock .setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() { 8045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock @Override 8145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock public void onClick(DialogInterface dialog, int which) { 82c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock onOk(trimmedText(), selectedRuleInfo()); 83c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 84c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock }) 85c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock .setOnDismissListener(new OnDismissListener() { 86c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock @Override 87c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public void onDismiss(DialogInterface dialog) { 88c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (mServiceListing != null) { 89c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mServiceListing.removeCallback(mServiceListingCallback); 90c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 9145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 9245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock }) 9345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock .setNegativeButton(R.string.cancel, null) 9445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock .create(); 9545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mEditText.addTextChangedListener(new TextWatcher() { 9645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock @Override 9745fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock public void onTextChanged(CharSequence s, int start, int before, int count) { 9845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock // noop 9945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 10045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 10145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock @Override 10245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock public void beforeTextChanged(CharSequence s, int start, int count, int after) { 10345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock // noop 10445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 10545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 10645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock @Override 10745fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock public void afterTextChanged(Editable s) { 10845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock updatePositiveButton(); 10945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 11045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock }); 11145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mExistingNames = new ArraySet<String>(existingNames.size()); 11245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock for (String existingName : existingNames) { 11345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mExistingNames.add(existingName.toLowerCase()); 11445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 11545fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 11645fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 117c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock abstract public void onOk(String ruleName, RuleInfo ruleInfo); 11845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 11945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock public void show() { 12045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mDialog.show(); 12145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock updatePositiveButton(); 12245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 12345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 124c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private void bindType(int id, RuleInfo ri) { 125c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock final RadioButton rb = (RadioButton) mTypes.findViewById(id); 126c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (ri == null) { 127c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock rb.setVisibility(View.GONE); 128c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock return; 129c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 130c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock rb.setVisibility(View.VISIBLE); 131c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (ri.caption != null) { 132c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock rb.setText(ri.caption); 133c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 134c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock rb.setTag(ri); 135c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 136c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 137c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private RuleInfo selectedRuleInfo() { 138c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock final int id = mTypes.getCheckedRadioButtonId(); 139c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (id == -1) return null; 140c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock final RadioButton rb = (RadioButton) mTypes.findViewById(id); 141c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock return (RuleInfo) rb.getTag(); 142c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 143c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 144c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private String trimmedText() { 145c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock return mEditText.getText() == null ? null : mEditText.getText().toString().trim(); 146c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 147c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 14845fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock private void updatePositiveButton() { 14945fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock final String name = trimmedText(); 15045fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock final boolean validName = !TextUtils.isEmpty(name) 15145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock && !mExistingNames.contains(name.toLowerCase()); 15245fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(validName); 15345fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock } 15445fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock 155c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private static RuleInfo defaultNewSchedule() { 156c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock final ScheduleInfo schedule = new ScheduleInfo(); 157c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock schedule.days = ZenModeConfig.ALL_DAYS; 158c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock schedule.startHour = 22; 159c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock schedule.endHour = 7; 160c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock final RuleInfo rt = new RuleInfo(); 161c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock rt.settingsAction = ZenModeScheduleRuleSettings.ACTION; 162c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock rt.defaultConditionId = ZenModeConfig.toScheduleConditionId(schedule); 163c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock return rt; 164c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 165c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 166f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock private static RuleInfo defaultNewEvent() { 167f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock final EventInfo event = new EventInfo(); 168f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock event.calendar = 0; // any 169f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock event.attendance = EventInfo.ATTENDANCE_REQUIRED_OR_OPTIONAL; 170f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock event.reply = EventInfo.REPLY_ANY_EXCEPT_NO; 171f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock final RuleInfo rt = new RuleInfo(); 172f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock rt.settingsAction = ZenModeEventRuleSettings.ACTION; 173f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock rt.defaultConditionId = ZenModeConfig.toEventConditionId(event); 174f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock return rt; 175f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock } 176f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock 177c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private void bindExternalRules() { 178f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock bindType(R.id.rule_type_3, mExternalRules[0]); 179f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock bindType(R.id.rule_type_4, mExternalRules[1]); 180f57bad7d5b0f9044231fc52351ed27e14013f491John Spurlock bindType(R.id.rule_type_5, mExternalRules[2]); 181c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 182c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 183c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock private final ServiceListing.Callback mServiceListingCallback = new ServiceListing.Callback() { 184c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock @Override 185c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public void onServicesReloaded(List<ServiceInfo> services) { 186c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (DEBUG) Log.d(TAG, "Services reloaded: count=" + services.size()); 187c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mExternalRules[0] = mExternalRules[1] = mExternalRules[2] = null; 188c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock int i = 0; 189c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock for (ServiceInfo si : services) { 190c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock final RuleInfo ri = ZenModeExternalRuleSettings.getRuleInfo(si); 191c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (ri != null) { 192c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock mExternalRules[i] = ri; 193c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock i++; 194c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock if (i == mExternalRules.length) { 195c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock break; 196c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 197c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 198c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 199c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock bindExternalRules(); 200c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 201c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock }; 202c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 203c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public static class RuleInfo { 204c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public String caption; 205c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public String settingsAction; 206c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public Uri defaultConditionId; 207c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public ComponentName serviceComponent; 208c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock public ComponentName configurationActivity; 209c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock } 210c96a5dcbfc3f37f71e8b3e8b962f9571b1e7ceafJohn Spurlock 21145fa140b8c6846b4546fdeabebf989ae9102cebbJohn Spurlock}