Commit 9c0d6b5f authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Commit Bot

[Autofill Assistant] Add BUTTON_DISABLE type.

Change-Id: I89b17d286c9790912ecfa107bd4de0a6fb0ca65b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1503328
Commit-Queue: Jordan Demeulenaere <jdemeulenaere@chromium.org>
Reviewed-by: default avatarStephane Zermatten <szermatt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638085}
parent 067e75a5
......@@ -13,12 +13,14 @@ import java.lang.annotation.RetentionPolicy;
* A chip to display to the user.
*/
public class AssistantChip {
@IntDef({Type.CHIP_ASSISTIVE, Type.BUTTON_FILLED_BLUE, Type.BUTTON_HAIRLINE})
@IntDef({Type.CHIP_ASSISTIVE, Type.BUTTON_FILLED_BLUE, Type.BUTTON_HAIRLINE,
Type.BUTTON_FILLED_DISABLED})
@Retention(RetentionPolicy.SOURCE)
public @interface Type {
int CHIP_ASSISTIVE = 0;
int BUTTON_FILLED_BLUE = 1;
int BUTTON_HAIRLINE = 2;
int BUTTON_FILLED_DISABLED = 3;
}
private final @Type int mType;
......
......@@ -31,6 +31,7 @@ class AssistantChipViewHolder extends ViewHolder {
case AssistantChip.Type.CHIP_ASSISTIVE:
resId = R.layout.autofill_assistant_chip_assistive;
break;
case AssistantChip.Type.BUTTON_FILLED_DISABLED:
case AssistantChip.Type.BUTTON_FILLED_BLUE:
resId = R.layout.autofill_assistant_button_filled;
break;
......@@ -40,8 +41,13 @@ class AssistantChipViewHolder extends ViewHolder {
default:
assert false : "Unsupported view type " + viewType;
}
return new AssistantChipViewHolder(
(TextView) layoutInflater.inflate(resId, /* root= */ null));
TextView view = (TextView) layoutInflater.inflate(resId, /* root= */ null);
if (viewType == AssistantChip.Type.BUTTON_FILLED_DISABLED) {
view.setEnabled(false);
}
return new AssistantChipViewHolder(view);
}
public void bind(AssistantChip chip) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment