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;
import org.chromium.ui.modelutil.PropertyModel.WritableIntPropertyKey;
import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey;
/**
* Model for the Status view.
*/
/** Model properties for the Status. */
class StatusProperties {
// 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. */
......@@ -101,56 +99,67 @@ class StatusProperties {
}
}
/** Enables / disables animations. */
/** Whether animations are turned on. */
static final WritableBooleanPropertyKey ANIMATIONS_ENABLED = new WritableBooleanPropertyKey();
/** Specifies the icon. */
static final WritableObjectPropertyKey<StatusIconResource> STATUS_ICON_RESOURCE =
new WritableObjectPropertyKey<>();
/** Whether the incognito badge is visible. */
static final WritableBooleanPropertyKey INCOGNITO_BADGE_VISIBLE =
new WritableBooleanPropertyKey();
/** Specifies the icon alpha. */
static final WritableFloatPropertyKey STATUS_ICON_ALPHA = new WritableFloatPropertyKey();
/** The status separator color. */
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();
/** Specifies accessibility string presented to user upon long click on security icon. */
public static final WritableIntPropertyKey STATUS_ICON_ACCESSIBILITY_TOAST_RES =
/** The handler of status click events. */
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();
/** Specifies string resource holding content description for security icon. */
static final WritableIntPropertyKey STATUS_ICON_DESCRIPTION_RES = new WritableIntPropertyKey();
/** Alpha of the icon. */
static final WritableFloatPropertyKey STATUS_ICON_ALPHA = new WritableFloatPropertyKey();
/** Specifies status separator color. */
static final WritableIntPropertyKey SEPARATOR_COLOR_RES = new WritableIntPropertyKey();
/** The string resource used for the description for security icon. */
static final WritableIntPropertyKey STATUS_ICON_DESCRIPTION_RES = new WritableIntPropertyKey();
/** Specifies object to receive status click events. */
static final WritableObjectPropertyKey<View.OnClickListener> STATUS_CLICK_LISTENER =
/** The icon resource. */
static final WritableObjectPropertyKey<StatusIconResource> STATUS_ICON_RESOURCE =
new WritableObjectPropertyKey<>();
/** Text color of the verbose status text field. */
static final WritableIntPropertyKey VERBOSE_STATUS_TEXT_COLOR_RES =
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 =
new WritableIntPropertyKey();
/** Specifies whether verbose status text view is visible. */
/** Whether verbose status text field is visible. */
static final WritableBooleanPropertyKey VERBOSE_STATUS_TEXT_VISIBLE =
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();
/** Specifies whether the incognito badge is visible or not. */
static final WritableBooleanPropertyKey INCOGNITO_BADGE_VISIBLE =
new WritableBooleanPropertyKey();
public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {ANIMATIONS_ENABLED,
STATUS_ICON_ACCESSIBILITY_TOAST_RES, STATUS_ICON_RESOURCE, STATUS_ICON_ALPHA,
SHOW_STATUS_ICON, STATUS_ICON_DESCRIPTION_RES, SEPARATOR_COLOR_RES,
STATUS_CLICK_LISTENER, VERBOSE_STATUS_TEXT_COLOR_RES, VERBOSE_STATUS_TEXT_STRING_RES,
VERBOSE_STATUS_TEXT_VISIBLE, VERBOSE_STATUS_TEXT_WIDTH, INCOGNITO_BADGE_VISIBLE};
static final PropertyKey[] ALL_KEYS = new PropertyKey[] {
ANIMATIONS_ENABLED,
INCOGNITO_BADGE_VISIBLE,
SEPARATOR_COLOR_RES,
SHOW_STATUS_ICON,
STATUS_CLICK_LISTENER,
STATUS_ICON_ACCESSIBILITY_TOAST_RES,
STATUS_ICON_ALPHA,
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() {}
}
......@@ -19,26 +19,28 @@ class StatusViewBinder implements ViewBinder<PropertyModel, StatusView, Property
public void bind(PropertyModel model, StatusView view, PropertyKey propertyKey) {
if (StatusProperties.ANIMATIONS_ENABLED.equals(propertyKey)) {
view.setAnimationsEnabled(model.get(StatusProperties.ANIMATIONS_ENABLED));
} else if (StatusProperties.STATUS_ICON_RESOURCE.equals(propertyKey)) {
StatusIconResource res = model.get(StatusProperties.STATUS_ICON_RESOURCE);
if (res == null) {
view.setStatusIconResources(null);
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.INCOGNITO_BADGE_VISIBLE.equals(propertyKey)) {
view.setIncognitoBadgeVisibility(model.get(StatusProperties.INCOGNITO_BADGE_VISIBLE));
} else if (StatusProperties.SEPARATOR_COLOR_RES.equals(propertyKey)) {
view.setSeparatorColor(model.get(StatusProperties.SEPARATOR_COLOR_RES));
} else if (StatusProperties.SHOW_STATUS_ICON.equals(propertyKey)) {
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)) {
view.setStatusIconAccessibilityToast(
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)) {
view.setStatusIconDescription(model.get(StatusProperties.STATUS_ICON_DESCRIPTION_RES));
} else if (StatusProperties.SEPARATOR_COLOR_RES.equals(propertyKey)) {
view.setSeparatorColor(model.get(StatusProperties.SEPARATOR_COLOR_RES));
} else if (StatusProperties.STATUS_CLICK_LISTENER.equals(propertyKey)) {
view.setStatusClickListener(model.get(StatusProperties.STATUS_CLICK_LISTENER));
} else if (StatusProperties.STATUS_ICON_RESOURCE.equals(propertyKey)) {
StatusIconResource res = model.get(StatusProperties.STATUS_ICON_RESOURCE);
if (res == null) {
view.setStatusIconResources(null);
return;
}
view.setStatusIconResources(res.getDrawable(view.getContext(), view.getResources()));
} else if (StatusProperties.VERBOSE_STATUS_TEXT_COLOR_RES.equals(propertyKey)) {
view.setVerboseStatusTextColor(
model.get(StatusProperties.VERBOSE_STATUS_TEXT_COLOR_RES));
......@@ -50,8 +52,6 @@ class StatusViewBinder implements ViewBinder<PropertyModel, StatusView, Property
model.get(StatusProperties.VERBOSE_STATUS_TEXT_VISIBLE));
} else if (StatusProperties.VERBOSE_STATUS_TEXT_WIDTH.equals(propertyKey)) {
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 {
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