Commit b0545da4 authored by bttk's avatar bttk Committed by Commit Bot

Put StatusProperties in alphabetical order

Bug: 1109369
Change-Id: I7f80348e388471783104dc46b06d299cfaf7ec0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352521Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Commit-Queue: who/bttk <bttk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798953}
parent 3da0177b
...@@ -25,9 +25,7 @@ import org.chromium.ui.modelutil.PropertyModel.WritableFloatPropertyKey; ...@@ -25,9 +25,7 @@ import org.chromium.ui.modelutil.PropertyModel.WritableFloatPropertyKey;
import org.chromium.ui.modelutil.PropertyModel.WritableIntPropertyKey; import org.chromium.ui.modelutil.PropertyModel.WritableIntPropertyKey;
import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey; import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey;
/** /** Model properties for the Status. */
* Model for the Status view.
*/
class StatusProperties { class StatusProperties {
// TODO(wylieb): Investigate the case where we only want to swap the tint (if any). // TODO(wylieb): Investigate the case where we only want to swap the tint (if any).
/** Encapsulates an icon and tint to allow atomic drawable updates for StatusView. */ /** Encapsulates an icon and tint to allow atomic drawable updates for StatusView. */
...@@ -101,56 +99,67 @@ class StatusProperties { ...@@ -101,56 +99,67 @@ class StatusProperties {
} }
} }
/** Enables / disables animations. */ /** Whether animations are turned on. */
static final WritableBooleanPropertyKey ANIMATIONS_ENABLED = new WritableBooleanPropertyKey(); static final WritableBooleanPropertyKey ANIMATIONS_ENABLED = new WritableBooleanPropertyKey();
/** Specifies the icon. */ /** Whether the incognito badge is visible. */
static final WritableObjectPropertyKey<StatusIconResource> STATUS_ICON_RESOURCE = static final WritableBooleanPropertyKey INCOGNITO_BADGE_VISIBLE =
new WritableObjectPropertyKey<>(); new WritableBooleanPropertyKey();
/** Specifies the icon alpha. */ /** The status separator color. */
static final WritableFloatPropertyKey STATUS_ICON_ALPHA = new WritableFloatPropertyKey(); static final WritableIntPropertyKey SEPARATOR_COLOR_RES = new WritableIntPropertyKey();
/** Specifies if the icon should be shown or not. */ /** Whether the icon is shown. */
static final WritableBooleanPropertyKey SHOW_STATUS_ICON = new WritableBooleanPropertyKey(); static final WritableBooleanPropertyKey SHOW_STATUS_ICON = new WritableBooleanPropertyKey();
/** Specifies accessibility string presented to user upon long click on security icon. */ /** The handler of status click events. */
public static final WritableIntPropertyKey STATUS_ICON_ACCESSIBILITY_TOAST_RES = static final WritableObjectPropertyKey<View.OnClickListener> STATUS_CLICK_LISTENER =
new WritableObjectPropertyKey<>();
/** The accessibility string shown upon a long click on security icon. */
static final WritableIntPropertyKey STATUS_ICON_ACCESSIBILITY_TOAST_RES =
new WritableIntPropertyKey(); new WritableIntPropertyKey();
/** Specifies string resource holding content description for security icon. */ /** Alpha of the icon. */
static final WritableIntPropertyKey STATUS_ICON_DESCRIPTION_RES = new WritableIntPropertyKey(); static final WritableFloatPropertyKey STATUS_ICON_ALPHA = new WritableFloatPropertyKey();
/** Specifies status separator color. */ /** The string resource used for the description for security icon. */
static final WritableIntPropertyKey SEPARATOR_COLOR_RES = new WritableIntPropertyKey(); static final WritableIntPropertyKey STATUS_ICON_DESCRIPTION_RES = new WritableIntPropertyKey();
/** Specifies object to receive status click events. */ /** The icon resource. */
static final WritableObjectPropertyKey<View.OnClickListener> STATUS_CLICK_LISTENER = static final WritableObjectPropertyKey<StatusIconResource> STATUS_ICON_RESOURCE =
new WritableObjectPropertyKey<>(); new WritableObjectPropertyKey<>();
/** Text color of the verbose status text field. */
static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_COLOR_RES = static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_COLOR_RES =
new WritableIntPropertyKey(); new WritableIntPropertyKey();
/** Specifies content of the verbose status text field. */ /** The string resource used for the content of the verbose status text field. */
static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_STRING_RES = static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_STRING_RES =
new WritableIntPropertyKey(); new WritableIntPropertyKey();
/** Specifies whether verbose status text view is visible. */ /** Whether verbose status text field is visible. */
static final WritableBooleanPropertyKey VERBOSE_STATUS_TEXT_VISIBLE = static final WritableBooleanPropertyKey VERBOSE_STATUS_TEXT_VISIBLE =
new WritableBooleanPropertyKey(); new WritableBooleanPropertyKey();
/** Specifies width of the verbose status text view. */ /** Specifies width of the verbose status text field. */
static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_WIDTH = new WritableIntPropertyKey(); static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_WIDTH = new WritableIntPropertyKey();
/** Specifies whether the incognito badge is visible or not. */ static final PropertyKey[] ALL_KEYS = new PropertyKey[] {
static final WritableBooleanPropertyKey INCOGNITO_BADGE_VISIBLE = ANIMATIONS_ENABLED,
new WritableBooleanPropertyKey(); INCOGNITO_BADGE_VISIBLE,
SEPARATOR_COLOR_RES,
public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {ANIMATIONS_ENABLED, SHOW_STATUS_ICON,
STATUS_ICON_ACCESSIBILITY_TOAST_RES, STATUS_ICON_RESOURCE, STATUS_ICON_ALPHA, STATUS_CLICK_LISTENER,
SHOW_STATUS_ICON, STATUS_ICON_DESCRIPTION_RES, SEPARATOR_COLOR_RES, STATUS_ICON_ACCESSIBILITY_TOAST_RES,
STATUS_CLICK_LISTENER, VERBOSE_STATUS_TEXT_COLOR_RES, VERBOSE_STATUS_TEXT_STRING_RES, STATUS_ICON_ALPHA,
VERBOSE_STATUS_TEXT_VISIBLE, VERBOSE_STATUS_TEXT_WIDTH, INCOGNITO_BADGE_VISIBLE}; STATUS_ICON_DESCRIPTION_RES,
STATUS_ICON_RESOURCE,
VERBOSE_STATUS_TEXT_COLOR_RES,
VERBOSE_STATUS_TEXT_STRING_RES,
VERBOSE_STATUS_TEXT_VISIBLE,
VERBOSE_STATUS_TEXT_WIDTH,
};
private StatusProperties() {} private StatusProperties() {}
} }
...@@ -19,26 +19,28 @@ class StatusViewBinder implements ViewBinder<PropertyModel, StatusView, Property ...@@ -19,26 +19,28 @@ class StatusViewBinder implements ViewBinder<PropertyModel, StatusView, Property
public void bind(PropertyModel model, StatusView view, PropertyKey propertyKey) { public void bind(PropertyModel model, StatusView view, PropertyKey propertyKey) {
if (StatusProperties.ANIMATIONS_ENABLED.equals(propertyKey)) { if (StatusProperties.ANIMATIONS_ENABLED.equals(propertyKey)) {
view.setAnimationsEnabled(model.get(StatusProperties.ANIMATIONS_ENABLED)); view.setAnimationsEnabled(model.get(StatusProperties.ANIMATIONS_ENABLED));
} else if (StatusProperties.STATUS_ICON_RESOURCE.equals(propertyKey)) { } else if (StatusProperties.INCOGNITO_BADGE_VISIBLE.equals(propertyKey)) {
StatusIconResource res = model.get(StatusProperties.STATUS_ICON_RESOURCE); view.setIncognitoBadgeVisibility(model.get(StatusProperties.INCOGNITO_BADGE_VISIBLE));
if (res == null) { } else if (StatusProperties.SEPARATOR_COLOR_RES.equals(propertyKey)) {
view.setStatusIconResources(null); view.setSeparatorColor(model.get(StatusProperties.SEPARATOR_COLOR_RES));
return;
}
view.setStatusIconResources(res.getDrawable(view.getContext(), view.getResources()));
} else if (StatusProperties.STATUS_ICON_ALPHA.equals(propertyKey)) {
view.setStatusIconAlpha(model.get(StatusProperties.STATUS_ICON_ALPHA));
} else if (StatusProperties.SHOW_STATUS_ICON.equals(propertyKey)) { } else if (StatusProperties.SHOW_STATUS_ICON.equals(propertyKey)) {
view.setStatusIconShown(model.get(StatusProperties.SHOW_STATUS_ICON)); view.setStatusIconShown(model.get(StatusProperties.SHOW_STATUS_ICON));
} else if (StatusProperties.STATUS_CLICK_LISTENER.equals(propertyKey)) {
view.setStatusClickListener(model.get(StatusProperties.STATUS_CLICK_LISTENER));
} else if (StatusProperties.STATUS_ICON_ACCESSIBILITY_TOAST_RES.equals(propertyKey)) { } else if (StatusProperties.STATUS_ICON_ACCESSIBILITY_TOAST_RES.equals(propertyKey)) {
view.setStatusIconAccessibilityToast( view.setStatusIconAccessibilityToast(
model.get(StatusProperties.STATUS_ICON_ACCESSIBILITY_TOAST_RES)); model.get(StatusProperties.STATUS_ICON_ACCESSIBILITY_TOAST_RES));
} else if (StatusProperties.STATUS_ICON_ALPHA.equals(propertyKey)) {
view.setStatusIconAlpha(model.get(StatusProperties.STATUS_ICON_ALPHA));
} else if (StatusProperties.STATUS_ICON_DESCRIPTION_RES.equals(propertyKey)) { } else if (StatusProperties.STATUS_ICON_DESCRIPTION_RES.equals(propertyKey)) {
view.setStatusIconDescription(model.get(StatusProperties.STATUS_ICON_DESCRIPTION_RES)); view.setStatusIconDescription(model.get(StatusProperties.STATUS_ICON_DESCRIPTION_RES));
} else if (StatusProperties.SEPARATOR_COLOR_RES.equals(propertyKey)) { } else if (StatusProperties.STATUS_ICON_RESOURCE.equals(propertyKey)) {
view.setSeparatorColor(model.get(StatusProperties.SEPARATOR_COLOR_RES)); StatusIconResource res = model.get(StatusProperties.STATUS_ICON_RESOURCE);
} else if (StatusProperties.STATUS_CLICK_LISTENER.equals(propertyKey)) { if (res == null) {
view.setStatusClickListener(model.get(StatusProperties.STATUS_CLICK_LISTENER)); view.setStatusIconResources(null);
return;
}
view.setStatusIconResources(res.getDrawable(view.getContext(), view.getResources()));
} else if (StatusProperties.VERBOSE_STATUS_TEXT_COLOR_RES.equals(propertyKey)) { } else if (StatusProperties.VERBOSE_STATUS_TEXT_COLOR_RES.equals(propertyKey)) {
view.setVerboseStatusTextColor( view.setVerboseStatusTextColor(
model.get(StatusProperties.VERBOSE_STATUS_TEXT_COLOR_RES)); model.get(StatusProperties.VERBOSE_STATUS_TEXT_COLOR_RES));
...@@ -50,8 +52,6 @@ class StatusViewBinder implements ViewBinder<PropertyModel, StatusView, Property ...@@ -50,8 +52,6 @@ class StatusViewBinder implements ViewBinder<PropertyModel, StatusView, Property
model.get(StatusProperties.VERBOSE_STATUS_TEXT_VISIBLE)); model.get(StatusProperties.VERBOSE_STATUS_TEXT_VISIBLE));
} else if (StatusProperties.VERBOSE_STATUS_TEXT_WIDTH.equals(propertyKey)) { } else if (StatusProperties.VERBOSE_STATUS_TEXT_WIDTH.equals(propertyKey)) {
view.setVerboseStatusTextWidth(model.get(StatusProperties.VERBOSE_STATUS_TEXT_WIDTH)); view.setVerboseStatusTextWidth(model.get(StatusProperties.VERBOSE_STATUS_TEXT_WIDTH));
} else if (StatusProperties.INCOGNITO_BADGE_VISIBLE.equals(propertyKey)) {
view.setIncognitoBadgeVisibility(model.get(StatusProperties.INCOGNITO_BADGE_VISIBLE));
} else { } else {
assert false : "Unhandled property update"; assert false : "Unhandled property update";
} }
......
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