Merge "Zen automatic rule page ui changes"

This commit is contained in:
TreeHugger Robot
2018-01-19 19:09:12 +00:00
committed by Android (Google) Code Review
9 changed files with 126 additions and 74 deletions

View File

@@ -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);