Final renamings for LargeChip -> TitleChip.
Relnote: Renamed final LargeChip constants to TitleChip.
Test: Manually verified.
Change-Id: I14f4c754286cc4c424dfa533506bdc7913d34324
diff --git a/wear/tiles/tiles-material/api/current.txt b/wear/tiles/tiles-material/api/current.txt
index 89abafc..9b96f94 100644
--- a/wear/tiles/tiles-material/api/current.txt
+++ b/wear/tiles/tiles-material/api/current.txt
@@ -78,18 +78,20 @@
}
public class ChipDefaults {
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp COMPACT_HEIGHT;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp COMPACT_HORIZONTAL_PADDING;
field public static final androidx.wear.tiles.material.ChipColors COMPACT_PRIMARY;
field public static final androidx.wear.tiles.material.ChipColors COMPACT_SECONDARY;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp DEFAULT_HEIGHT;
field public static final float DEFAULT_MARGIN_PERCENT = 5.2f;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp HORIZONTAL_PADDING;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp ICON_SIZE;
- field public static final androidx.wear.tiles.DimensionBuilders.DpProp LARGE_HEIGHT;
- field public static final androidx.wear.tiles.DimensionBuilders.DpProp LARGE_HORIZONTAL_PADDING;
- field public static final androidx.wear.tiles.material.ChipColors LARGE_PRIMARY;
- field public static final androidx.wear.tiles.material.ChipColors LARGE_SECONDARY;
field public static final androidx.wear.tiles.material.ChipColors PRIMARY;
field public static final androidx.wear.tiles.material.ChipColors SECONDARY;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp TITLE_HEIGHT;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp TITLE_HORIZONTAL_PADDING;
+ field public static final androidx.wear.tiles.material.ChipColors TITLE_PRIMARY;
+ field public static final androidx.wear.tiles.material.ChipColors TITLE_SECONDARY;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp VERTICAL_PADDING;
}
diff --git a/wear/tiles/tiles-material/api/public_plus_experimental_current.txt b/wear/tiles/tiles-material/api/public_plus_experimental_current.txt
index 89abafc..9b96f94 100644
--- a/wear/tiles/tiles-material/api/public_plus_experimental_current.txt
+++ b/wear/tiles/tiles-material/api/public_plus_experimental_current.txt
@@ -78,18 +78,20 @@
}
public class ChipDefaults {
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp COMPACT_HEIGHT;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp COMPACT_HORIZONTAL_PADDING;
field public static final androidx.wear.tiles.material.ChipColors COMPACT_PRIMARY;
field public static final androidx.wear.tiles.material.ChipColors COMPACT_SECONDARY;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp DEFAULT_HEIGHT;
field public static final float DEFAULT_MARGIN_PERCENT = 5.2f;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp HORIZONTAL_PADDING;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp ICON_SIZE;
- field public static final androidx.wear.tiles.DimensionBuilders.DpProp LARGE_HEIGHT;
- field public static final androidx.wear.tiles.DimensionBuilders.DpProp LARGE_HORIZONTAL_PADDING;
- field public static final androidx.wear.tiles.material.ChipColors LARGE_PRIMARY;
- field public static final androidx.wear.tiles.material.ChipColors LARGE_SECONDARY;
field public static final androidx.wear.tiles.material.ChipColors PRIMARY;
field public static final androidx.wear.tiles.material.ChipColors SECONDARY;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp TITLE_HEIGHT;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp TITLE_HORIZONTAL_PADDING;
+ field public static final androidx.wear.tiles.material.ChipColors TITLE_PRIMARY;
+ field public static final androidx.wear.tiles.material.ChipColors TITLE_SECONDARY;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp VERTICAL_PADDING;
}
diff --git a/wear/tiles/tiles-material/api/restricted_current.txt b/wear/tiles/tiles-material/api/restricted_current.txt
index 89abafc..9b96f94 100644
--- a/wear/tiles/tiles-material/api/restricted_current.txt
+++ b/wear/tiles/tiles-material/api/restricted_current.txt
@@ -78,18 +78,20 @@
}
public class ChipDefaults {
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp COMPACT_HEIGHT;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp COMPACT_HORIZONTAL_PADDING;
field public static final androidx.wear.tiles.material.ChipColors COMPACT_PRIMARY;
field public static final androidx.wear.tiles.material.ChipColors COMPACT_SECONDARY;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp DEFAULT_HEIGHT;
field public static final float DEFAULT_MARGIN_PERCENT = 5.2f;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp HORIZONTAL_PADDING;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp ICON_SIZE;
- field public static final androidx.wear.tiles.DimensionBuilders.DpProp LARGE_HEIGHT;
- field public static final androidx.wear.tiles.DimensionBuilders.DpProp LARGE_HORIZONTAL_PADDING;
- field public static final androidx.wear.tiles.material.ChipColors LARGE_PRIMARY;
- field public static final androidx.wear.tiles.material.ChipColors LARGE_SECONDARY;
field public static final androidx.wear.tiles.material.ChipColors PRIMARY;
field public static final androidx.wear.tiles.material.ChipColors SECONDARY;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp TITLE_HEIGHT;
+ field public static final androidx.wear.tiles.DimensionBuilders.DpProp TITLE_HORIZONTAL_PADDING;
+ field public static final androidx.wear.tiles.material.ChipColors TITLE_PRIMARY;
+ field public static final androidx.wear.tiles.material.ChipColors TITLE_SECONDARY;
field public static final androidx.wear.tiles.DimensionBuilders.DpProp VERTICAL_PADDING;
}
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Chip.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Chip.java
index cc25e58..6108c03 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Chip.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Chip.java
@@ -186,8 +186,10 @@
* Sets the content of the {@link Chip} to be the given primary text. Any previously added
* content will be overridden. Primary text can be on 1 or 2 lines, depending on the length.
*/
+ // There are multiple methods to set different type of content, but there is general getter
+ // getContent that will return LayoutElement set by any of it. b/217197259
@NonNull
- @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
+ @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
public Builder setPrimaryTextContent(@NonNull String primaryText) {
this.mPrimaryText = primaryText;
this.mLabelText = null;
@@ -196,11 +198,9 @@
}
/**
- * Used for creating CompactChip and LargeChip.
+ * Used for creating CompactChip and TitleChip.
*
- * <p>Sets the content of the {@link Chip} to be the given primary text. Any previously
- * added content will be overridden. Primary text can be on 1 or 2 lines, depending on the
- * length.
+ * <p>Sets the font for the primary text and should only be used internally.
*/
@NonNull
Builder setPrimaryTextFontStyle(@NonNull FontStyle fontStyle) {
@@ -214,7 +214,7 @@
* only.
*/
@NonNull
- @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
+ @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
public Builder setPrimaryTextLabelContent(
@NonNull String primaryText, @NonNull String label) {
this.mPrimaryText = primaryText;
@@ -230,7 +230,7 @@
* chosen alpha channel and not an actual image.
*/
@NonNull
- @SuppressWarnings("MissingGetterMatchingBuilder")
+ @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
public Builder setPrimaryTextIconContent(
@NonNull String primaryText, @NonNull String resourceId) {
this.mPrimaryText = primaryText;
@@ -247,7 +247,7 @@
* channel and not an actual image. Primary text can be shown on 1 line only.
*/
@NonNull
- @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
+ @SuppressWarnings("MissingGetterMatchingBuilder") // There's getContent() method.
public Builder setPrimaryTextLabelIconContent(
@NonNull String primaryText, @NonNull String label, @NonNull String resourceId) {
this.mPrimaryText = primaryText;
@@ -273,8 +273,8 @@
// TODO(b/207350548): In RTL mode, should icon still be on the left.
/**
* Sets the horizontal alignment in the chip. It is strongly recommended that the content of
- * the chip is start-aligned if there is more than primary text in it. If not set,
- * {@link HorizontalAlignment#HORIZONTAL_ALIGN_START} will be used.
+ * the chip is start-aligned if there is more than primary text in it. If not set, {@link
+ * HorizontalAlignment#HORIZONTAL_ALIGN_START} will be used.
*/
@NonNull
public Builder setHorizontalAlignment(@HorizontalAlignment int horizontalAlignment) {
@@ -282,35 +282,35 @@
return this;
}
- /** Used for creating CompactChip and LargeChip. */
+ /** Used for creating CompactChip and TitleChip. */
@NonNull
Builder setHorizontalPadding(@NonNull DpProp horizontalPadding) {
this.mHorizontalPadding = horizontalPadding;
return this;
}
- /** Used for creating CompactChip and LargeChip. */
+ /** Used for creating CompactChip and TitleChip. */
@NonNull
Builder setVerticalPadding(@NonNull DpProp verticalPadding) {
this.mVerticalPadding = verticalPadding;
return this;
}
- /** Used for creating CompactChip and LargeChip. */
+ /** Used for creating CompactChip and TitleChip. */
@NonNull
Builder setHeight(@NonNull DpProp height) {
this.mHeight = height;
return this;
}
- /** Used for creating CompactChip and LargeChip. */
+ /** Used for creating CompactChip and TitleChip. */
@NonNull
Builder setWidth(@NonNull ContainerDimension width) {
this.mWidth = width;
return this;
}
- /** Used for creating CompactChip and LargeChip. */
+ /** Used for creating CompactChip and TitleChip. */
@NonNull
Builder setMaxLines(int maxLines) {
this.mMaxLines = maxLines;
@@ -366,7 +366,7 @@
if (mType == NOT_SET) {
throw new IllegalStateException(
"No content set. Use setPrimaryTextContent or similar method to add"
- + " content");
+ + " content");
}
if (mType == CUSTOM_CONTENT) {
return checkNotNull(mCustomContent);
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/ChipDefaults.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/ChipDefaults.java
index 96500c9d..35282dc 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/ChipDefaults.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/ChipDefaults.java
@@ -26,13 +26,13 @@
private ChipDefaults() {}
/** The default height for standard {@link Chip} */
- @NonNull static final DpProp DEFAULT_HEIGHT = dp(52);
+ @NonNull public static final DpProp DEFAULT_HEIGHT = dp(52);
/** The default height for standard {@link CompactChip} */
- @NonNull static final DpProp COMPACT_HEIGHT = dp(32);
+ @NonNull public static final DpProp COMPACT_HEIGHT = dp(32);
/** The default height for standard {@link TitleChip} */
- @NonNull public static final DpProp LARGE_HEIGHT = dp(60);
+ @NonNull public static final DpProp TITLE_HEIGHT = dp(60);
/** The recommended horizontal margin used for width for standard {@link Chip} */
public static final float DEFAULT_MARGIN_PERCENT = 5.2f;
@@ -44,7 +44,7 @@
@NonNull public static final DpProp COMPACT_HORIZONTAL_PADDING = dp(12);
/** The recommended horizontal padding for standard {@link TitleChip} */
- @NonNull public static final DpProp LARGE_HORIZONTAL_PADDING = dp(16);
+ @NonNull public static final DpProp TITLE_HORIZONTAL_PADDING = dp(16);
/** The recommended vertical padding for standard {@link Chip} */
@NonNull public static final DpProp VERTICAL_PADDING = dp(6);
@@ -72,11 +72,11 @@
/** The recommended colors for a primary {@link TitleChip}. */
@NonNull
- public static final ChipColors LARGE_PRIMARY =
+ public static final ChipColors TITLE_PRIMARY =
new ChipColors(Colors.PRIMARY, Colors.ON_PRIMARY);
/** The recommended colors for a secondary {@link TitleChip}. */
@NonNull
- public static final ChipColors LARGE_SECONDARY =
+ public static final ChipColors TITLE_SECONDARY =
new ChipColors(Colors.SURFACE, Colors.ON_SURFACE);
}
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/TitleChip.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/TitleChip.java
index 74853001..37a565a 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/TitleChip.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/TitleChip.java
@@ -19,9 +19,9 @@
import static androidx.annotation.Dimension.DP;
import static androidx.wear.tiles.DimensionBuilders.dp;
import static androidx.wear.tiles.LayoutElementBuilders.HORIZONTAL_ALIGN_CENTER;
-import static androidx.wear.tiles.material.ChipDefaults.LARGE_HEIGHT;
-import static androidx.wear.tiles.material.ChipDefaults.LARGE_HORIZONTAL_PADDING;
-import static androidx.wear.tiles.material.ChipDefaults.LARGE_PRIMARY;
+import static androidx.wear.tiles.material.ChipDefaults.TITLE_HEIGHT;
+import static androidx.wear.tiles.material.ChipDefaults.TITLE_HORIZONTAL_PADDING;
+import static androidx.wear.tiles.material.ChipDefaults.TITLE_PRIMARY;
import androidx.annotation.Dimension;
import androidx.annotation.NonNull;
@@ -32,7 +32,6 @@
import androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters;
import androidx.wear.tiles.DimensionBuilders.ContainerDimension;
import androidx.wear.tiles.DimensionBuilders.DpProp;
-import androidx.wear.tiles.LayoutElementBuilders;
import androidx.wear.tiles.LayoutElementBuilders.FontStyles;
import androidx.wear.tiles.LayoutElementBuilders.HorizontalAlignment;
import androidx.wear.tiles.LayoutElementBuilders.LayoutElement;
@@ -41,11 +40,11 @@
/**
* Tiles component {@link TitleChip} that represents clickable object with the text.
*
- * <p>The Large Chip is Stadium shaped object with a larger height then standard Chip and it will
+ * <p>The Title Chip is Stadium shaped object with a larger height then standard Chip and it will
* take one line of text of {@link FontStyles#title2} style.
*
* <p>The recommended set of {@link ChipColors} styles can be obtained from {@link ChipDefaults},
- * e.g. {@link ChipDefaults#LARGE_PRIMARY} to get a color scheme for a primary {@link TitleChip}
+ * e.g. {@link ChipDefaults#TITLE_PRIMARY} to get a color scheme for a primary {@link TitleChip}
* which by default will have a solid background of {@link Colors#PRIMARY} and text color of {@link
* Colors#ON_PRIMARY}.
*/
@@ -62,8 +61,8 @@
@NonNull private final Action mAction;
@NonNull private final String mClickableId;
@NonNull private final DeviceParameters mDeviceParameters;
- @NonNull private ChipColors mChipColors = LARGE_PRIMARY;
- private @HorizontalAlignment int mHorizontalAlignment = HORIZONTAL_ALIGN_CENTER;
+ @NonNull private ChipColors mChipColors = TITLE_PRIMARY;
+ private @HorizontalAlignment int mHorizontalAlign = HORIZONTAL_ALIGN_CENTER;
// Indicates that the width isn't set, so it will be automatically set by Chip.Builder
// constructor.
@@ -72,9 +71,9 @@
/**
* Creates a builder for the {@link TitleChip} with associated action and the given text
*
- * @param text The text to be displayed in this large chip. Text will be displayed in 1 line
+ * @param text The text to be displayed in this title chip. Text will be displayed in 1 line
* and truncated if it doesn't fit.
- * @param action Associated Actions for click events. When the LargeChip is clicked it will
+ * @param action Associated Actions for click events. When the TitleChip is clicked it will
* fire the associated action.
* @param clickableId The ID associated with the given action's clickable.
* @param deviceParameters The device parameters used for styling text.
@@ -96,7 +95,7 @@
* Sets the colors for the {@link TitleChip}. If set, {@link
* ChipColors#getBackgroundColor()} will be used for the background of the button and {@link
* ChipColors#getContentColor()} for the text. If not set, {@link
- * ChipDefaults#LARGE_PRIMARY} will be used.
+ * ChipDefaults#TITLE_PRIMARY} will be used.
*/
@NonNull
public Builder setChipColors(@NonNull ChipColors chipColors) {
@@ -107,7 +106,7 @@
/** Sets the horizontal alignment in the chip. If not set, content will be centered. */
@NonNull
public Builder setHorizontalAlignment(@HorizontalAlignment int horizontalAlignment) {
- mHorizontalAlignment = horizontalAlignment;
+ mHorizontalAlign = horizontalAlignment;
return this;
}
@@ -139,10 +138,10 @@
new Chip.Builder(mAction, mClickableId, mDeviceParameters)
.setChipColors(mChipColors)
.setContentDescription(mText)
- .setHorizontalAlignment(mHorizontalAlignment)
- .setHeight(LARGE_HEIGHT)
+ .setHorizontalAlignment(mHorizontalAlign)
+ .setHeight(TITLE_HEIGHT)
.setMaxLines(1)
- .setHorizontalPadding(LARGE_HORIZONTAL_PADDING)
+ .setHorizontalPadding(TITLE_HORIZONTAL_PADDING)
.setPrimaryTextContent(mText)
.setPrimaryTextFontStyle(FontStyles.title2(mDeviceParameters).build());
@@ -191,7 +190,7 @@
}
/** Returns the horizontal alignment of the content in this Chip. */
- public @LayoutElementBuilders.HorizontalAlignment int getHorizontalAlignment() {
+ public @HorizontalAlignment int getHorizontalAlignment() {
return mElement.getHorizontalAlignment();
}