Zen automatic rule page ui changes
- Can change rule name from header - Text for turning on/off rule is now "Use rule" instead of on/off Test: make ROBOTEST_FILTER=EntityHeaderControllerTest RunSettingsRoboTests -j40 Test: manual (Settings > Sound > Do Not Disturb > Turn On Automatically) Bug: 63077372 Change-Id: Id55b02de0509f168c2470a4f875e84140eb840fa
This commit is contained in:
@@ -63,12 +63,14 @@ public class EntityHeaderController {
|
||||
|
||||
@IntDef({ActionType.ACTION_NONE,
|
||||
ActionType.ACTION_APP_PREFERENCE,
|
||||
ActionType.ACTION_NOTIF_PREFERENCE})
|
||||
ActionType.ACTION_NOTIF_PREFERENCE,
|
||||
ActionType.ACTION_DND_RULE_PREFERENCE,})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ActionType {
|
||||
int ACTION_NONE = 0;
|
||||
int ACTION_APP_PREFERENCE = 1;
|
||||
int ACTION_NOTIF_PREFERENCE = 2;
|
||||
int ACTION_DND_RULE_PREFERENCE = 3;
|
||||
}
|
||||
|
||||
public static final String PREF_KEY_APP_HEADER = "pref_app_header";
|
||||
@@ -99,6 +101,8 @@ public class EntityHeaderController {
|
||||
|
||||
private boolean mIsInstantApp;
|
||||
|
||||
private View.OnClickListener mEditRuleNameOnClickListener;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the controller.
|
||||
*
|
||||
@@ -212,6 +216,11 @@ public class EntityHeaderController {
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityHeaderController setEditZenRuleNameListener(View.OnClickListener listener) {
|
||||
this.mEditRuleNameOnClickListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Done mutating entity header, rebinds everything and return a new {@link LayoutPreference}.
|
||||
*/
|
||||
@@ -330,6 +339,16 @@ public class EntityHeaderController {
|
||||
return;
|
||||
}
|
||||
switch (action) {
|
||||
case ActionType.ACTION_DND_RULE_PREFERENCE: {
|
||||
if (mEditRuleNameOnClickListener == null) {
|
||||
button.setVisibility(View.GONE);
|
||||
} else {
|
||||
button.setImageResource(R.drawable.ic_mode_edit);
|
||||
button.setVisibility(View.VISIBLE);
|
||||
button.setOnClickListener(mEditRuleNameOnClickListener);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case ActionType.ACTION_NOTIF_PREFERENCE: {
|
||||
if (mAppNotifPrefIntent == null) {
|
||||
button.setVisibility(View.GONE);
|
||||
|
Reference in New Issue
Block a user