Remove suppressions for tiles-material library from message.ignore file
Bug: 295217625
Test: N/A
Change-Id: I6c52283d251e5b0d49b2177ea8ee95254f330d1f
diff --git a/development/build_log_simplifier/messages.ignore b/development/build_log_simplifier/messages.ignore
index 6466de5..cea89d3 100644
--- a/development/build_log_simplifier/messages.ignore
+++ b/development/build_log_simplifier/messages.ignore
@@ -718,125 +718,6 @@
public abstract java\.util\.List<androidx\.room\.integration\.kotlintestapp\.test\.JvmNameInDaoTest\.JvmNameEntity> jvmQuery\(\);
public abstract androidx\.room\.integration\.kotlintestapp\.test\.JvmNameInDaoTest\.JvmNameDao jvmDao\(\);
\^
-Note: \$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator\.java has additional uses or overrides of a deprecated API\.
-Note: \$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/TitleChip\.java has additional uses or overrides of a deprecated API\.
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout\.java:[0-9]+: warning: \[deprecation\] CompactChip in androidx\.wear\.tiles\.material has been deprecated
-Note: \$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Button\.java has additional uses or overrides of a deprecated API\.
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] ButtonDefaults in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] Chip in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.Chip;
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] ChipColors in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.ChipColors;
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] CircularProgressIndicator in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] Colors in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.Colors;
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] CompactChip in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] ProgressIndicatorColors in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.ProgressIndicatorColors;
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] ProgressIndicatorDefaults in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.ProgressIndicatorDefaults;
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] Text in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] TitleChip in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.TitleChip;
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] Typography in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.Typography;
-import static androidx\.wear\.tiles\.material\.Typography\.TYPOGRAPHY_CAPTION[0-9]+;
-import static androidx\.wear\.tiles\.material\.Typography\.TYPOGRAPHY_TITLE[0-9]+;
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/MultiButtonLayoutTest\.java:[0-9]+: warning: \[deprecation\] Button in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/MultiButtonLayoutTest\.java:[0-9]+: warning: \[deprecation\] ButtonDefaults in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest\.java:[0-9]+: warning: \[deprecation\] LayoutDefaults in androidx\.wear\.tiles\.material\.layouts has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest\.java:[0-9]+: warning: \[deprecation\] CompactChip in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.CompactChip;
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest\.java:[0-9]+: warning: \[deprecation\] Text in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.Text;
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/EdgeContentLayoutTest\.java:[0-9]+: warning: \[deprecation\] CircularProgressIndicator in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/layouts/EdgeContentLayoutTest\.java:[0-9]+: warning: \[deprecation\] Text in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/ButtonTest\.java:[0-9]+: warning: \[deprecation\] ButtonDefaults in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/CircularProgressIndicatorTest\.java:[0-9]+: warning: \[deprecation\] ProgressIndicatorDefaults in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.Helper\.checkTag;
-import static androidx\.wear\.tiles\.material\.Helper\.getMetadataTagName;
-import static androidx\.wear\.tiles\.material\.Helper\.getTagBytes;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator\.java:[0-9]+: warning: \[deprecation\] ProgressIndicatorDefaults in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.ProgressIndicatorDefaults\.DEFAULT_COLORS;
-import static androidx\.wear\.tiles\.material\.ProgressIndicatorDefaults\.DEFAULT_END_ANGLE;
-import static androidx\.wear\.tiles\.material\.ProgressIndicatorDefaults\.DEFAULT_PADDING;
-import static androidx\.wear\.tiles\.material\.ProgressIndicatorDefaults\.DEFAULT_START_ANGLE;
-import static androidx\.wear\.tiles\.material\.ProgressIndicatorDefaults\.DEFAULT_STROKE_WIDTH;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/CompactChip\.java:[0-9]+: warning: \[deprecation\] ChipDefaults in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.COMPACT_HEIGHT;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.COMPACT_HEIGHT_TAPPABLE;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.COMPACT_HORIZONTAL_PADDING;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.COMPACT_PRIMARY_COLORS;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/CompactChip\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Chip\.java:[0-9]+: warning: \[deprecation\] ChipDefaults in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.DEFAULT_HEIGHT;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.DEFAULT_MARGIN_PERCENT;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.HORIZONTAL_PADDING;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.ICON_SIZE;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.ICON_SPACER_WIDTH;
-import static androidx\.wear\.tiles\.material\.ChipDefaults\.PRIMARY_COLORS;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Chip\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.Helper\.radiusOf;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Typography\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Chip\.java:[0-9]+: warning: \[deprecation\] Typography in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.Typography\.TypographyName;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Text\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Text\.java:[0-9]+: warning: \[deprecation\] Typography in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.Typography\.TYPOGRAPHY_DISPLAY[0-9]+;
-import static androidx\.wear\.tiles\.material\.Typography\.getFontStyleBuilder;
-import static androidx\.wear\.tiles\.material\.Typography\.getLineHeightForTypography;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Button\.java:[0-9]+: warning: \[deprecation\] ButtonDefaults in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.ButtonDefaults\.DEFAULT_SIZE;
-import static androidx\.wear\.tiles\.material\.ButtonDefaults\.EXTRA_LARGE_SIZE;
-import static androidx\.wear\.tiles\.material\.ButtonDefaults\.LARGE_SIZE;
-import static androidx\.wear\.tiles\.material\.ButtonDefaults\.PRIMARY_COLORS;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Button\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/Button\.java:[0-9]+: warning: \[deprecation\] Typography in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/TitleChip\.java:[0-9]+: warning: \[deprecation\] ChipDefaults in androidx\.wear\.tiles\.material has been deprecated
-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_COLORS;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/TitleChip\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/MultiSlotLayout\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/LayoutDefaults\.java:[0-9]+: warning: \[deprecation\] ButtonDefaults in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.ButtonDefaults;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/MultiSlotLayout\.java:[0-9]+: warning: \[deprecation\] LayoutDefaults in androidx\.wear\.tiles\.material\.layouts has been deprecated
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.MULTI_SLOT_LAYOUT_HORIZONTAL_SPACER_WIDTH;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.Helper\.getMetadataTagBytes;
-import static androidx\.wear\.tiles\.material\.Helper\.isRoundDevice;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout\.java:[0-9]+: warning: \[deprecation\] ProgressIndicatorDefaults in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout\.java:[0-9]+: warning: \[deprecation\] LayoutDefaults in androidx\.wear\.tiles\.material\.layouts has been deprecated
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_ROUND_DP;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_SQUARE_DP;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.EDGE_CONTENT_LAYOUT_PADDING_ABOVE_MAIN_CONTENT_DP;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.EDGE_CONTENT_LAYOUT_PADDING_BELOW_MAIN_CONTENT_DP;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout\.java:[0-9]+: warning: \[deprecation\] CircularProgressIndicator in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.CircularProgressIndicator;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout\.java:[0-9]+: warning: \[deprecation\] LayoutDefaults in androidx\.wear\.tiles\.material\.layouts has been deprecated
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.MULTI_BUTTON_[0-9]+_SIZE;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.MULTI_BUTTON_[0-9]+_PLUS_SIZE;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.MULTI_BUTTON_MAX_NUMBER;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.MULTI_BUTTON_SPACER_HEIGHT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.MULTI_BUTTON_SPACER_WIDTH;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout\.java:[0-9]+: warning: \[deprecation\] Button in androidx\.wear\.tiles\.material has been deprecated
-import androidx\.wear\.tiles\.material\.Button;
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout\.java:[0-9]+: warning: \[deprecation\] ChipDefaults in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout\.java:[0-9]+: warning: \[deprecation\] LayoutDefaults in androidx\.wear\.tiles\.material\.layouts has been deprecated
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.DEFAULT_VERTICAL_SPACER_HEIGHT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_ROUND_DP;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_SQUARE_DP;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_MARGIN_BOTTOM_ROUND_PERCENT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_MARGIN_BOTTOM_SQUARE_PERCENT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_MARGIN_HORIZONTAL_ROUND_PERCENT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_MARGIN_HORIZONTAL_SQUARE_PERCENT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_MARGIN_TOP_ROUND_PERCENT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_MARGIN_TOP_SQUARE_PERCENT;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_ROUND_DP;
-import static androidx\.wear\.tiles\.material\.layouts\.LayoutDefaults\.PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_SQUARE_DP;
-Note: \$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout\.java has additional uses or overrides of a deprecated API\.
[0-9]+ warnings
# Gradle will log if you are not authenticated to upload scans
A build scan was not published as you have not authenticated with server 'ge\.androidx\.dev'\.
@@ -914,14 +795,6 @@
.*xcodebuild.*
# > Task :core:core:compileDebugAndroidTestKotlin
w: file://\$SUPPORT/core/core/src/androidTest/java/androidx/core/util/TypedValueCompatTest\.kt:[0-9]+:[0-9]+ 'scaledDensity: Float' is deprecated\. Deprecated in Java
-# > Task :wear:tiles:tiles-material:compileDebugJavaWithJavac
-\$SUPPORT/wear/tiles/tiles\-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator\.java:[0-9]+: warning: \[deprecation\] Helper in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.Helper\.checkNotNull;
-# > Task :wear:tiles:tiles-material:compileDebugUnitTestJavaWithJavac
-\$SUPPORT/wear/tiles/tiles\-material/src/test/java/androidx/wear/tiles/material/TextTest\.java:[0-9]+: warning: \[deprecation\] Typography in androidx\.wear\.tiles\.material has been deprecated
-import static androidx\.wear\.tiles\.material\.Typography\.TYPOGRAPHY_BODY[0-9]+;
-# > Task :wear:tiles:tiles-material:compileDebugAndroidTestJavaWithJavac
-\$SUPPORT/wear/tiles/tiles\-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator\.java:[0-9]+: warning: \[deprecation\] Button in androidx\.wear\.tiles\.material has been deprecated
# > Task :compose:foundation:foundation:processDebugAndroidTestManifest
\$SUPPORT/compose/foundation/foundation/src/androidAndroidTest/AndroidManifest\.xml:[0-9]+:[0-9]+\-[0-9]+:[0-9]+ Warning:
# > Task :camera:camera-video:compileDebugAndroidTestKotlin
diff --git a/wear/tiles/tiles-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator.java b/wear/tiles/tiles-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator.java
index 03dbe47..5984524 100644
--- a/wear/tiles/tiles-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator.java
+++ b/wear/tiles/tiles-material/src/androidTest/java/androidx/wear/tiles/material/layouts/TestCasesGenerator.java
@@ -21,18 +21,6 @@
import androidx.annotation.Dimension;
import androidx.annotation.NonNull;
-import androidx.wear.tiles.material.Button;
-import androidx.wear.tiles.material.ButtonDefaults;
-import androidx.wear.tiles.material.Chip;
-import androidx.wear.tiles.material.ChipColors;
-import androidx.wear.tiles.material.CircularProgressIndicator;
-import androidx.wear.tiles.material.Colors;
-import androidx.wear.tiles.material.CompactChip;
-import androidx.wear.tiles.material.ProgressIndicatorColors;
-import androidx.wear.tiles.material.ProgressIndicatorDefaults;
-import androidx.wear.tiles.material.Text;
-import androidx.wear.tiles.material.TitleChip;
-import androidx.wear.tiles.material.Typography;
import java.util.HashMap;
import java.util.Map;
@@ -64,10 +52,13 @@
HashMap<String, androidx.wear.tiles.LayoutElementBuilders.LayoutElement> testCases =
new HashMap<>();
- TitleChip content =
- new TitleChip.Builder(context, "Action", clickable, deviceParameters).build();
- CompactChip.Builder primaryChipBuilder =
- new CompactChip.Builder(context, "Action", clickable, deviceParameters);
+ androidx.wear.tiles.material.TitleChip content =
+ new androidx.wear.tiles.material.TitleChip.Builder(
+ context, "Action", clickable, deviceParameters)
+ .build();
+ androidx.wear.tiles.material.CompactChip.Builder primaryChipBuilder =
+ new androidx.wear.tiles.material.CompactChip.Builder(
+ context, "Action", clickable, deviceParameters);
testCases.put(
"default_empty_primarychiplayout_golden" + goldenSuffix,
@@ -78,7 +69,7 @@
"default_longtext_primarychiplayout_golden" + goldenSuffix,
new PrimaryLayout.Builder(deviceParameters)
.setPrimaryChipContent(
- new CompactChip.Builder(
+ new androidx.wear.tiles.material.CompactChip.Builder(
context,
"Too_long_textToo_long_textToo_long_text",
clickable,
@@ -114,7 +105,9 @@
.setContent(content)
.setPrimaryChipContent(
primaryChipBuilder
- .setChipColors(new ChipColors(Color.YELLOW, Color.GREEN))
+ .setChipColors(
+ new androidx.wear.tiles.material.ChipColors(
+ Color.YELLOW, Color.GREEN))
.build())
.build());
testCases.put(
@@ -132,7 +125,7 @@
.setWidth(androidx.wear.tiles.DimensionBuilders.expand())
.setHeight(androidx.wear.tiles.DimensionBuilders.wrap())
.addContent(
- new Chip.Builder(
+ new androidx.wear.tiles.material.Chip.Builder(
context,
clickable,
deviceParameters)
@@ -149,7 +142,7 @@
.DimensionBuilders.dp(4))
.build())
.addContent(
- new Chip.Builder(
+ new androidx.wear.tiles.material.Chip.Builder(
context,
clickable,
deviceParameters)
@@ -162,7 +155,8 @@
.build());
primaryChipBuilder =
- new CompactChip.Builder(context, "Action", clickable, deviceParameters);
+ new androidx.wear.tiles.material.CompactChip.Builder(
+ context, "Action", clickable, deviceParameters);
testCases.put(
"coloredbox_1_chip_columnslayout_golden" + goldenSuffix,
new PrimaryLayout.Builder(deviceParameters)
@@ -321,27 +315,38 @@
.setVerticalSpacerHeight(1)
.build());
- CircularProgressIndicator.Builder progressIndicatorBuilder =
- new CircularProgressIndicator.Builder().setProgress(0.3f);
- Text textContent =
- new Text.Builder(context, "Text")
+ androidx.wear.tiles.material.CircularProgressIndicator.Builder progressIndicatorBuilder =
+ new androidx.wear.tiles.material.CircularProgressIndicator.Builder()
+ .setProgress(0.3f);
+ androidx.wear.tiles.material.Text textContent =
+ new androidx.wear.tiles.material.Text.Builder(context, "Text")
.setColor(color(Color.WHITE))
- .setTypography(Typography.TYPOGRAPHY_DISPLAY1)
+ .setTypography(androidx.wear.tiles.material.Typography.TYPOGRAPHY_DISPLAY1)
.build();
testCases.put(
"default_text_progressindicatorlayout_golden" + goldenSuffix,
new EdgeContentLayout.Builder(deviceParameters)
.setEdgeContent(progressIndicatorBuilder.build())
.setPrimaryLabelTextContent(
- new Text.Builder(context, "Primary label")
- .setTypography(Typography.TYPOGRAPHY_CAPTION1)
- .setColor(color(Colors.PRIMARY))
+ new androidx.wear.tiles.material.Text.Builder(
+ context, "Primary label")
+ .setTypography(
+ androidx.wear.tiles.material.Typography
+ .TYPOGRAPHY_CAPTION1)
+ .setColor(
+ color(androidx.wear.tiles.material.Colors.PRIMARY))
.build())
.setContent(textContent)
.setSecondaryLabelTextContent(
- new Text.Builder(context, "Secondary label")
- .setTypography(Typography.TYPOGRAPHY_CAPTION1)
- .setColor(color(Colors.ON_SURFACE))
+ new androidx.wear.tiles.material.Text.Builder(
+ context, "Secondary label")
+ .setTypography(
+ androidx.wear.tiles.material.Typography
+ .TYPOGRAPHY_CAPTION1)
+ .setColor(
+ color(
+ androidx.wear.tiles.material.Colors
+ .ON_SURFACE))
.build())
.build());
testCases.put(
@@ -356,7 +361,8 @@
.setEdgeContent(
progressIndicatorBuilder
.setCircularProgressIndicatorColors(
- new ProgressIndicatorColors(
+ new androidx.wear.tiles.material
+ .ProgressIndicatorColors(
Color.YELLOW, Color.GREEN))
.build())
.build());
@@ -366,7 +372,8 @@
.setEdgeContent(
progressIndicatorBuilder
.setCircularProgressIndicatorColors(
- ProgressIndicatorDefaults.DEFAULT_COLORS)
+ androidx.wear.tiles.material
+ .ProgressIndicatorDefaults.DEFAULT_COLORS)
.build())
.setContent(
new androidx.wear.tiles.LayoutElementBuilders.Box.Builder()
@@ -387,27 +394,48 @@
.build())
.build());
- Button button1 = new Button.Builder(context, clickable).setTextContent("1").build();
- Button button2 = new Button.Builder(context, clickable).setTextContent("2").build();
- Button button3 = new Button.Builder(context, clickable).setTextContent("3").build();
- Button button4 = new Button.Builder(context, clickable).setTextContent("4").build();
- Button button5 = new Button.Builder(context, clickable).setTextContent("5").build();
- Button button6 = new Button.Builder(context, clickable).setTextContent("6").build();
- Button button7 = new Button.Builder(context, clickable).setTextContent("7").build();
- Button largeButton1 =
- new Button.Builder(context, clickable)
+ androidx.wear.tiles.material.Button button1 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
.setTextContent("1")
- .setSize(ButtonDefaults.LARGE_SIZE)
.build();
- Button largeButton2 =
- new Button.Builder(context, clickable)
+ androidx.wear.tiles.material.Button button2 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
.setTextContent("2")
- .setSize(ButtonDefaults.LARGE_SIZE)
.build();
- Button extraLargeButton =
- new Button.Builder(context, clickable)
+ androidx.wear.tiles.material.Button button3 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("3")
+ .build();
+ androidx.wear.tiles.material.Button button4 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("4")
+ .build();
+ androidx.wear.tiles.material.Button button5 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("5")
+ .build();
+ androidx.wear.tiles.material.Button button6 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("6")
+ .build();
+ androidx.wear.tiles.material.Button button7 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("7")
+ .build();
+ androidx.wear.tiles.material.Button largeButton1 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
.setTextContent("1")
- .setSize(ButtonDefaults.EXTRA_LARGE_SIZE)
+ .setSize(androidx.wear.tiles.material.ButtonDefaults.LARGE_SIZE)
+ .build();
+ androidx.wear.tiles.material.Button largeButton2 =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("2")
+ .setSize(androidx.wear.tiles.material.ButtonDefaults.LARGE_SIZE)
+ .build();
+ androidx.wear.tiles.material.Button extraLargeButton =
+ new androidx.wear.tiles.material.Button.Builder(context, clickable)
+ .setTextContent("1")
+ .setSize(androidx.wear.tiles.material.ButtonDefaults.EXTRA_LARGE_SIZE)
.build();
testCases.put(
"multibutton_layout_1button_golden" + goldenSuffix,
@@ -613,9 +641,10 @@
}
@NonNull
- private static Text buildTextLabel(@NonNull Context context, @NonNull String text) {
- return new Text.Builder(context, text)
- .setTypography(Typography.TYPOGRAPHY_CAPTION1)
+ private static androidx.wear.tiles.material.Text buildTextLabel(
+ @NonNull Context context, @NonNull String text) {
+ return new androidx.wear.tiles.material.Text.Builder(context, text)
+ .setTypography(androidx.wear.tiles.material.Typography.TYPOGRAPHY_CAPTION1)
.setColor(color(Color.WHITE))
.build();
}
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Button.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Button.java
index 5c1a970..b469d86 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Button.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Button.java
@@ -17,15 +17,6 @@
package androidx.wear.tiles.material;
import static androidx.annotation.Dimension.DP;
-import static androidx.wear.tiles.material.ButtonDefaults.DEFAULT_SIZE;
-import static androidx.wear.tiles.material.ButtonDefaults.EXTRA_LARGE_SIZE;
-import static androidx.wear.tiles.material.ButtonDefaults.LARGE_SIZE;
-import static androidx.wear.tiles.material.ButtonDefaults.PRIMARY_COLORS;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagName;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.Helper.radiusOf;
import android.content.Context;
@@ -37,7 +28,6 @@
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.LayoutElementProto;
-import androidx.wear.tiles.material.Typography.TypographyName;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -83,16 +73,19 @@
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Button with text.
*/
static final String METADATA_TAG_TEXT = "TXTBTN";
+
/**
* Tool tag for Metadata in androidx.wear.tiles.ModifiersBuilders.Modifiers, so we know that
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Button with icon.
*/
static final String METADATA_TAG_ICON = "ICNBTN";
+
/**
* Tool tag for Metadata in androidx.wear.tiles.ModifiersBuilders.Modifiers, so we know that
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Button with image.
*/
static final String METADATA_TAG_IMAGE = "IMGBTN";
+
/**
* Tool tag for Metadata in androidx.wear.tiles.ModifiersBuilders.Modifiers, so we know that
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Button with custom content.
@@ -125,13 +118,16 @@
@Nullable private androidx.wear.tiles.LayoutElementBuilders.LayoutElement mCustomContent;
@NonNull private final androidx.wear.tiles.ModifiersBuilders.Clickable mClickable;
@NonNull private CharSequence mContentDescription = "";
- @NonNull private androidx.wear.tiles.DimensionBuilders.DpProp mSize = DEFAULT_SIZE;
+
+ @NonNull
+ private androidx.wear.tiles.DimensionBuilders.DpProp mSize = ButtonDefaults.DEFAULT_SIZE;
+
@Nullable private String mText = null;
@Nullable private Integer mTypographyName = null;
@Nullable private String mIcon = null;
@Nullable private androidx.wear.tiles.DimensionBuilders.DpProp mIconSize = null;
@Nullable private String mImage = null;
- @NonNull private ButtonColors mButtonColors = PRIMARY_COLORS;
+ @NonNull private ButtonColors mButtonColors = ButtonDefaults.PRIMARY_COLORS;
@ButtonType private int mType = NOT_SET;
static {
@@ -147,8 +143,8 @@
* {@link #setImageContent}.
*
* @param context The application's context.
- * @param clickable Associated {@link Clickable} for click events. When the Button is
- * clicked it will fire the associated action.
+ * @param clickable Associated {@link androidx.wear.tiles.ModifiersBuilders.Clickable} for
+ * click events. When the Button is clicked it will fire the associated action.
*/
public Builder(
@NonNull Context context,
@@ -267,7 +263,8 @@
* more than 3 characters, otherwise it will overflow from the edges.
*/
@NonNull
- public Builder setTextContent(@NonNull String text, @TypographyName int typographyName) {
+ public Builder setTextContent(
+ @NonNull String text, @Typography.TypographyName int typographyName) {
resetContent();
this.mText = text;
this.mTypographyName = typographyName;
@@ -309,15 +306,16 @@
.setCorner(
new androidx.wear.tiles.ModifiersBuilders.Corner
.Builder()
- .setRadius(radiusOf(mSize))
+ .setRadius(Helper.radiusOf(mSize))
.build())
.build())
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders.ElementMetadata
.Builder()
.setTagData(
- getTagBytes(
- checkNotNull(TYPE_TO_TAG.get(mType))))
+ Helper.getTagBytes(
+ Helper.checkNotNull(
+ TYPE_TO_TAG.get(mType))))
.build());
if (mContentDescription.length() > 0) {
modifiers.setSemantics(
@@ -349,8 +347,8 @@
: ButtonDefaults.recommendedIconSize(mSize);
content =
new androidx.wear.tiles.LayoutElementBuilders.Image.Builder()
- .setResourceId(checkNotNull(mIcon))
- .setHeight(checkNotNull(iconSize))
+ .setResourceId(Helper.checkNotNull(mIcon))
+ .setHeight(Helper.checkNotNull(iconSize))
.setWidth(iconSize)
.setContentScaleMode(
androidx.wear.tiles.LayoutElementBuilders
@@ -365,13 +363,13 @@
}
case TEXT:
{
- @TypographyName
+ @Typography.TypographyName
int typographyName =
mTypographyName != null
? mTypographyName
: getDefaultTypographyForSize(mSize);
content =
- new Text.Builder(mContext, checkNotNull(mText))
+ new Text.Builder(mContext, Helper.checkNotNull(mText))
.setMaxLines(1)
.setTypography(typographyName)
.setColor(mButtonColors.getContentColor());
@@ -382,7 +380,7 @@
{
content =
new androidx.wear.tiles.LayoutElementBuilders.Image.Builder()
- .setResourceId(checkNotNull(mImage))
+ .setResourceId(Helper.checkNotNull(mImage))
.setHeight(mSize)
.setWidth(mSize)
.setContentScaleMode(
@@ -391,7 +389,7 @@
return content.build();
}
case CUSTOM_CONTENT:
- return checkNotNull(mCustomContent);
+ return Helper.checkNotNull(mCustomContent);
case NOT_SET:
// Shouldn't happen.
default:
@@ -400,11 +398,11 @@
}
}
- private static @TypographyName int getDefaultTypographyForSize(
+ private static @Typography.TypographyName int getDefaultTypographyForSize(
@NonNull androidx.wear.tiles.DimensionBuilders.DpProp size) {
- if (size.getValue() == LARGE_SIZE.getValue()) {
+ if (size.getValue() == ButtonDefaults.LARGE_SIZE.getValue()) {
return Typography.TYPOGRAPHY_TITLE1;
- } else if (size.getValue() == EXTRA_LARGE_SIZE.getValue()) {
+ } else if (size.getValue() == ButtonDefaults.EXTRA_LARGE_SIZE.getValue()) {
return Typography.TYPOGRAPHY_DISPLAY3;
} else {
return Typography.TYPOGRAPHY_TITLE2;
@@ -427,7 +425,7 @@
@Nullable
public String getIconContent() {
androidx.wear.tiles.LayoutElementBuilders.Image icon = getIconContentObject();
- return icon != null ? checkNotNull(icon.getResourceId()).getValue() : null;
+ return icon != null ? Helper.checkNotNull(icon.getResourceId()).getValue() : null;
}
/**
@@ -436,7 +434,7 @@
@Nullable
public String getImageContent() {
androidx.wear.tiles.LayoutElementBuilders.Image image = getImageContentObject();
- return image != null ? checkNotNull(image.getResourceId()).getValue() : null;
+ return image != null ? Helper.checkNotNull(image.getResourceId()).getValue() : null;
}
/** Returns the text content of this Button if it has been added. Otherwise, it returns null. */
@@ -448,7 +446,7 @@
@NonNull
private androidx.wear.tiles.LayoutElementBuilders.LayoutElement getAnyContent() {
- return checkNotNull(mElement.getContents().get(0));
+ return Helper.checkNotNull(mElement.getContents().get(0));
}
@Nullable
@@ -478,14 +476,14 @@
/** Returns click event action associated with this Button. */
@NonNull
public androidx.wear.tiles.ModifiersBuilders.Clickable getClickable() {
- return checkNotNull(checkNotNull(mElement.getModifiers()).getClickable());
+ return Helper.checkNotNull(Helper.checkNotNull(mElement.getModifiers()).getClickable());
}
/** Returns content description for this Button. */
@Nullable
public CharSequence getContentDescription() {
androidx.wear.tiles.ModifiersBuilders.Semantics semantics =
- checkNotNull(mElement.getModifiers()).getSemantics();
+ Helper.checkNotNull(mElement.getModifiers()).getSemantics();
if (semantics == null) {
return null;
}
@@ -495,12 +493,13 @@
/** Returns size for this Button. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.ContainerDimension getSize() {
- return checkNotNull(mElement.getWidth());
+ return Helper.checkNotNull(mElement.getWidth());
}
private androidx.wear.tiles.ColorBuilders.ColorProp getBackgroundColor() {
- return checkNotNull(
- checkNotNull(checkNotNull(mElement.getModifiers()).getBackground()).getColor());
+ return Helper.checkNotNull(
+ Helper.checkNotNull(Helper.checkNotNull(mElement.getModifiers()).getBackground())
+ .getColor());
}
/** Returns button color of this Button. */
@@ -511,16 +510,20 @@
switch (getMetadataTag()) {
case METADATA_TAG_TEXT:
- contentColor = checkNotNull(getTextContentObject()).getColor();
+ contentColor = Helper.checkNotNull(getTextContentObject()).getColor();
break;
case METADATA_TAG_ICON:
contentColor =
- checkNotNull(checkNotNull(getIconContentObject()).getColorFilter())
+ Helper.checkNotNull(
+ Helper.checkNotNull(getIconContentObject())
+ .getColorFilter())
.getTint();
break;
case METADATA_TAG_IMAGE:
contentColor =
- checkNotNull(checkNotNull(getImageContentObject()).getColorFilter())
+ Helper.checkNotNull(
+ Helper.checkNotNull(getImageContentObject())
+ .getColorFilter())
.getTint();
break;
case METADATA_TAG_CUSTOM_CONTENT:
@@ -537,8 +540,8 @@
/** Returns metadata tag set to this Button. */
@NonNull
String getMetadataTag() {
- return getMetadataTagName(
- checkNotNull(checkNotNull(mElement.getModifiers()).getMetadata()));
+ return Helper.getMetadataTagName(
+ Helper.checkNotNull(Helper.checkNotNull(mElement.getModifiers()).getMetadata()));
}
/**
@@ -558,7 +561,7 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), Builder.TYPE_TO_TAG.values())) {
+ if (!Helper.checkTag(boxElement.getModifiers(), Builder.TYPE_TO_TAG.values())) {
return null;
}
// Now we are sure that this element is a Button.
@@ -569,7 +572,7 @@
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
public LayoutElementProto.LayoutElement toLayoutElementProto() {
- return checkNotNull(mElement.toLayoutElementProto());
+ return Helper.checkNotNull(mElement.toLayoutElementProto());
}
@RestrictTo(Scope.LIBRARY_GROUP)
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 97d61f9..741a1a2 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
@@ -17,17 +17,6 @@
package androidx.wear.tiles.material;
import static androidx.annotation.Dimension.DP;
-import static androidx.wear.tiles.material.ChipDefaults.DEFAULT_HEIGHT;
-import static androidx.wear.tiles.material.ChipDefaults.DEFAULT_MARGIN_PERCENT;
-import static androidx.wear.tiles.material.ChipDefaults.HORIZONTAL_PADDING;
-import static androidx.wear.tiles.material.ChipDefaults.ICON_SIZE;
-import static androidx.wear.tiles.material.ChipDefaults.ICON_SPACER_WIDTH;
-import static androidx.wear.tiles.material.ChipDefaults.PRIMARY_COLORS;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagName;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.Helper.radiusOf;
import android.content.Context;
@@ -39,7 +28,6 @@
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.LayoutElementProto;
-import androidx.wear.tiles.material.Typography.TypographyName;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -90,11 +78,13 @@
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Chip with only text.
*/
static final String METADATA_TAG_TEXT = "TXTCHP";
+
/**
* Tool tag for Metadata in androidx.wear.tiles.ModifiersBuilders.Modifiers, so we know that
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Chip with icon.
*/
static final String METADATA_TAG_ICON = "ICNCHP";
+
/**
* Tool tag for Metadata in androidx.wear.tiles.ModifiersBuilders.Modifiers, so we know that
* androidx.wear.tiles.LayoutElementBuilders.Box is actually a Chip with custom content.
@@ -106,6 +96,7 @@
Chip(@NonNull androidx.wear.tiles.LayoutElementBuilders.Box element) {
mElement = element;
}
+
/** Builder class for {@link androidx.wear.tiles.material.Chip}. */
public static final class Builder
implements androidx.wear.tiles.LayoutElementBuilders.LayoutElement.Builder {
@@ -127,18 +118,21 @@
@NonNull private final androidx.wear.tiles.ModifiersBuilders.Clickable mClickable;
@NonNull private CharSequence mContentDescription = "";
@NonNull private androidx.wear.tiles.DimensionBuilders.ContainerDimension mWidth;
- @NonNull private androidx.wear.tiles.DimensionBuilders.DpProp mHeight = DEFAULT_HEIGHT;
- @NonNull private ChipColors mChipColors = PRIMARY_COLORS;
+
+ @NonNull
+ private androidx.wear.tiles.DimensionBuilders.DpProp mHeight = ChipDefaults.DEFAULT_HEIGHT;
+
+ @NonNull private ChipColors mChipColors = ChipDefaults.PRIMARY_COLORS;
@androidx.wear.tiles.LayoutElementBuilders.HorizontalAlignment
private int mHorizontalAlign =
androidx.wear.tiles.LayoutElementBuilders.HORIZONTAL_ALIGN_UNDEFINED;
- @TypographyName private int mPrimaryLabelTypography;
+ @Typography.TypographyName private int mPrimaryLabelTypography;
@NonNull
private androidx.wear.tiles.DimensionBuilders.DpProp mHorizontalPadding =
- HORIZONTAL_PADDING;
+ ChipDefaults.HORIZONTAL_PADDING;
private boolean mIsScalable = true;
private int mMaxLines = 0; // 0 indicates that is not set.
@@ -171,7 +165,7 @@
mClickable = clickable;
mWidth =
androidx.wear.tiles.DimensionBuilders.dp(
- (100 - 2 * DEFAULT_MARGIN_PERCENT)
+ (100 - 2 * ChipDefaults.DEFAULT_MARGIN_PERCENT)
* deviceParameters.getScreenWidthDp()
/ 100);
mPrimaryLabelTypography = Typography.TYPOGRAPHY_BUTTON;
@@ -239,7 +233,7 @@
* <p>Sets the font for the primary label and should only be used internally.
*/
@NonNull
- Builder setPrimaryLabelTypography(@TypographyName int typography) {
+ Builder setPrimaryLabelTypography(@Typography.TypographyName int typography) {
this.mPrimaryLabelTypography = typography;
return this;
}
@@ -356,13 +350,13 @@
.setCorner(
new androidx.wear.tiles.ModifiersBuilders.Corner
.Builder()
- .setRadius(radiusOf(mHeight))
+ .setRadius(Helper.radiusOf(mHeight))
.build())
.build())
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders.ElementMetadata
.Builder()
- .setTagData(getTagBytes(getCorrectMetadataTag()))
+ .setTagData(Helper.getTagBytes(getCorrectMetadataTag()))
.build())
.setSemantics(
new androidx.wear.tiles.ModifiersBuilders.Semantics.Builder()
@@ -427,7 +421,7 @@
}
Text mainTextElement =
- new Text.Builder(mContext, checkNotNull(mPrimaryLabel))
+ new Text.Builder(mContext, Helper.checkNotNull(mPrimaryLabel))
.setTypography(mPrimaryLabelTypography)
.setColor(mChipColors.getContentColor())
.setMaxLines(getCorrectMaxLines())
@@ -471,8 +465,8 @@
.addContent(
new androidx.wear.tiles.LayoutElementBuilders.Image.Builder()
.setResourceId(mImageResourceId)
- .setWidth(ICON_SIZE)
- .setHeight(ICON_SIZE)
+ .setWidth(ChipDefaults.ICON_SIZE)
+ .setHeight(ChipDefaults.ICON_SIZE)
.setColorFilter(
new androidx.wear.tiles.LayoutElementBuilders
.ColorFilter.Builder()
@@ -482,7 +476,7 @@
.addContent(
new androidx.wear.tiles.LayoutElementBuilders.Spacer.Builder()
.setHeight(mHeight)
- .setWidth(ICON_SPACER_WIDTH)
+ .setWidth(ChipDefaults.ICON_SPACER_WIDTH)
.build())
.addContent(texts)
.setVerticalAlignment(
@@ -508,26 +502,27 @@
/** Returns height of this Chip. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.ContainerDimension getHeight() {
- return checkNotNull(mElement.getHeight());
+ return Helper.checkNotNull(mElement.getHeight());
}
/** Returns width of this Chip. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.ContainerDimension getWidth() {
- return checkNotNull(mElement.getWidth());
+ return Helper.checkNotNull(mElement.getWidth());
}
/** Returns click event action associated with this Chip. */
@NonNull
public androidx.wear.tiles.ModifiersBuilders.Clickable getClickable() {
- return checkNotNull(checkNotNull(mElement.getModifiers()).getClickable());
+ return Helper.checkNotNull(Helper.checkNotNull(mElement.getModifiers()).getClickable());
}
/** Returns background color of this Chip. */
@NonNull
private androidx.wear.tiles.ColorBuilders.ColorProp getBackgroundColor() {
- return checkNotNull(
- checkNotNull(checkNotNull(mElement.getModifiers()).getBackground()).getColor());
+ return Helper.checkNotNull(
+ Helper.checkNotNull(Helper.checkNotNull(mElement.getModifiers()).getBackground())
+ .getColor());
}
/** Returns chip colors of this Chip. */
@@ -541,11 +536,12 @@
if (!getMetadataTag().equals(METADATA_TAG_CUSTOM_CONTENT)) {
if (getMetadataTag().equals(METADATA_TAG_ICON)) {
androidx.wear.tiles.LayoutElementBuilders.Image icon =
- checkNotNull(getIconContentObject());
- iconTintColor = checkNotNull(checkNotNull(icon.getColorFilter()).getTint());
+ Helper.checkNotNull(getIconContentObject());
+ iconTintColor =
+ Helper.checkNotNull(Helper.checkNotNull(icon.getColorFilter()).getTint());
}
- contentColor = checkNotNull(getPrimaryLabelContentObject()).getColor();
+ contentColor = Helper.checkNotNull(getPrimaryLabelContentObject()).getColor();
Text label = getSecondaryLabelContentObject();
if (label != null) {
secondaryContentColor = label.getColor();
@@ -570,7 +566,7 @@
@Nullable
public CharSequence getContentDescription() {
androidx.wear.tiles.ModifiersBuilders.Semantics semantics =
- checkNotNull(mElement.getModifiers()).getSemantics();
+ Helper.checkNotNull(mElement.getModifiers()).getSemantics();
if (semantics == null) {
return null;
}
@@ -581,7 +577,7 @@
@Nullable
public androidx.wear.tiles.LayoutElementBuilders.LayoutElement getCustomContent() {
if (getMetadataTag().equals(METADATA_TAG_CUSTOM_CONTENT)) {
- return checkNotNull(checkNotNull(mElement.getContents()).get(0));
+ return Helper.checkNotNull(Helper.checkNotNull(mElement.getContents()).get(0));
}
return null;
}
@@ -604,7 +600,7 @@
@Nullable
public String getIconContent() {
androidx.wear.tiles.LayoutElementBuilders.Image icon = getIconContentObject();
- return icon != null ? checkNotNull(icon.getResourceId()).getValue() : null;
+ return icon != null ? Helper.checkNotNull(icon.getResourceId()).getValue() : null;
}
@Nullable
@@ -669,14 +665,14 @@
/** Returns the horizontal alignment of the content in this Chip. */
@androidx.wear.tiles.LayoutElementBuilders.HorizontalAlignment
public int getHorizontalAlignment() {
- return checkNotNull(mElement.getHorizontalAlignment()).getValue();
+ return Helper.checkNotNull(mElement.getHorizontalAlignment()).getValue();
}
/** Returns metadata tag set to this Chip. */
@NonNull
String getMetadataTag() {
- return getMetadataTagName(
- checkNotNull(checkNotNull(mElement.getModifiers()).getMetadata()));
+ return Helper.getMetadataTagName(
+ Helper.checkNotNull(Helper.checkNotNull(mElement.getModifiers()).getMetadata()));
}
/**
@@ -696,7 +692,7 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), Builder.TYPE_TO_TAG.values())) {
+ if (!Helper.checkTag(boxElement.getModifiers(), Builder.TYPE_TO_TAG.values())) {
return null;
}
// Now we are sure that this element is a Chip.
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator.java
index 1614755..4e83a9a 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CircularProgressIndicator.java
@@ -17,15 +17,6 @@
package androidx.wear.tiles.material;
import static androidx.annotation.Dimension.DP;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagName;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_COLORS;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_END_ANGLE;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_PADDING;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_START_ANGLE;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_STROKE_WIDTH;
import androidx.annotation.Dimension;
import androidx.annotation.FloatRange;
@@ -100,20 +91,25 @@
/** Builder class for {@link CircularProgressIndicator} */
public static final class Builder
implements androidx.wear.tiles.LayoutElementBuilders.LayoutElement.Builder {
- @NonNull private ProgressIndicatorColors mCircularProgressIndicatorColors = DEFAULT_COLORS;
+ @NonNull
+ private ProgressIndicatorColors mCircularProgressIndicatorColors =
+ ProgressIndicatorDefaults.DEFAULT_COLORS;
@NonNull
- private androidx.wear.tiles.DimensionBuilders.DpProp mStrokeWidth = DEFAULT_STROKE_WIDTH;
+ private androidx.wear.tiles.DimensionBuilders.DpProp mStrokeWidth =
+ ProgressIndicatorDefaults.DEFAULT_STROKE_WIDTH;
@NonNull private CharSequence mContentDescription = "";
@NonNull
private androidx.wear.tiles.DimensionBuilders.DegreesProp mStartAngle =
- androidx.wear.tiles.DimensionBuilders.degrees(DEFAULT_START_ANGLE);
+ androidx.wear.tiles.DimensionBuilders.degrees(
+ ProgressIndicatorDefaults.DEFAULT_START_ANGLE);
@NonNull
private androidx.wear.tiles.DimensionBuilders.DegreesProp mEndAngle =
- androidx.wear.tiles.DimensionBuilders.degrees(DEFAULT_END_ANGLE);
+ androidx.wear.tiles.DimensionBuilders.degrees(
+ ProgressIndicatorDefaults.DEFAULT_END_ANGLE);
@FloatRange(from = 0, to = 1)
private float mProgress = 0;
@@ -213,12 +209,14 @@
new androidx.wear.tiles.ModifiersBuilders.Modifiers.Builder()
.setPadding(
new androidx.wear.tiles.ModifiersBuilders.Padding.Builder()
- .setAll(DEFAULT_PADDING)
+ .setAll(ProgressIndicatorDefaults.DEFAULT_PADDING)
.build())
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders.ElementMetadata
.Builder()
- .setTagData(getTagBytes(METADATA_TAG))
+ .setTagData(
+ androidx.wear.tiles.material.Helper.getTagBytes(
+ METADATA_TAG))
.build());
if (mContentDescription.length() > 0) {
@@ -284,25 +282,27 @@
/** Returns angle representing progressed part of this CircularProgressIndicator. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.DegreesProp getProgress() {
- return checkNotNull(mProgress.getLength());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mProgress.getLength());
}
/** Returns stroke width of this CircularProgressIndicator. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.DpProp getStrokeWidth() {
- return checkNotNull(mProgress.getThickness());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mProgress.getThickness());
}
/** Returns start angle of this CircularProgressIndicator. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.DegreesProp getStartAngle() {
- return checkNotNull(mElement.getAnchorAngle());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mElement.getAnchorAngle());
}
/** Returns start angle of this CircularProgressIndicator. */
@NonNull
public androidx.wear.tiles.DimensionBuilders.DegreesProp getEndAngle() {
- float backArcLength = checkNotNull(mBackground.getLength()).getValue();
+ float backArcLength =
+ androidx.wear.tiles.material.Helper.checkNotNull(mBackground.getLength())
+ .getValue();
return androidx.wear.tiles.DimensionBuilders.degrees(
getStartAngle().getValue() + backArcLength);
}
@@ -311,14 +311,16 @@
@NonNull
public ProgressIndicatorColors getCircularProgressIndicatorColors() {
return new ProgressIndicatorColors(
- checkNotNull(mProgress.getColor()), checkNotNull(mBackground.getColor()));
+ androidx.wear.tiles.material.Helper.checkNotNull(mProgress.getColor()),
+ androidx.wear.tiles.material.Helper.checkNotNull(mBackground.getColor()));
}
/** Returns content description of this CircularProgressIndicator. */
@Nullable
public CharSequence getContentDescription() {
androidx.wear.tiles.ModifiersBuilders.Semantics semantics =
- checkNotNull(mElement.getModifiers()).getSemantics();
+ androidx.wear.tiles.material.Helper.checkNotNull(mElement.getModifiers())
+ .getSemantics();
if (semantics == null) {
return null;
}
@@ -331,8 +333,10 @@
*/
@NonNull
String getMetadataTag() {
- return getMetadataTagName(
- checkNotNull(checkNotNull(mElement.getModifiers()).getMetadata()));
+ return androidx.wear.tiles.material.Helper.getMetadataTagName(
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mElement.getModifiers())
+ .getMetadata()));
}
/**
@@ -352,7 +356,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Arc arcElement =
(androidx.wear.tiles.LayoutElementBuilders.Arc) element;
- if (!checkTag(arcElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ arcElement.getModifiers(), METADATA_TAG)) {
return null;
}
// Now we are sure that this element is a CircularProgressIndicator.
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CompactChip.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CompactChip.java
index 093bd13..ef9e6ba 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CompactChip.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/CompactChip.java
@@ -16,14 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.ChipDefaults.COMPACT_HEIGHT;
-import static androidx.wear.tiles.material.ChipDefaults.COMPACT_HEIGHT_TAPPABLE;
-import static androidx.wear.tiles.material.ChipDefaults.COMPACT_HORIZONTAL_PADDING;
-import static androidx.wear.tiles.material.ChipDefaults.COMPACT_PRIMARY_COLORS;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-
import android.content.Context;
import androidx.annotation.NonNull;
@@ -99,15 +91,15 @@
private final androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters
mDeviceParameters;
- @NonNull private ChipColors mChipColors = COMPACT_PRIMARY_COLORS;
+ @NonNull private ChipColors mChipColors = ChipDefaults.COMPACT_PRIMARY_COLORS;
/**
* Creates a builder for the {@link CompactChip} with associated action and the given text
*
* @param context The application's context.
* @param text The text to be displayed in this compact chip.
- * @param clickable Associated {@link Clickable} for click events. When the CompactChip is
- * clicked it will fire the associated action.
+ * @param clickable Associated {@link androidx.wear.tiles.ModifiersBuilders.Clickable} for
+ * click events. When the CompactChip is clicked it will fire the associated action.
* @param deviceParameters The device parameters used for styling text.
*/
public Builder(
@@ -148,9 +140,9 @@
androidx.wear.tiles.LayoutElementBuilders
.HORIZONTAL_ALIGN_CENTER)
.setWidth(androidx.wear.tiles.DimensionBuilders.wrap())
- .setHeight(COMPACT_HEIGHT)
+ .setHeight(ChipDefaults.COMPACT_HEIGHT)
.setMaxLines(1)
- .setHorizontalPadding(COMPACT_HORIZONTAL_PADDING)
+ .setHorizontalPadding(ChipDefaults.COMPACT_HORIZONTAL_PADDING)
.setPrimaryLabelContent(mText)
.setPrimaryLabelTypography(Typography.TYPOGRAPHY_CAPTION1)
.setIsPrimaryLabelScalable(false);
@@ -163,11 +155,14 @@
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders
.ElementMetadata.Builder()
- .setTagData(getTagBytes(METADATA_TAG))
+ .setTagData(
+ androidx.wear.tiles.material
+ .Helper.getTagBytes(
+ METADATA_TAG))
.build())
.build())
.setWidth(androidx.wear.tiles.DimensionBuilders.wrap())
- .setHeight(COMPACT_HEIGHT_TAPPABLE)
+ .setHeight(ChipDefaults.COMPACT_HEIGHT_TAPPABLE)
.setVerticalAlignment(
androidx.wear.tiles.LayoutElementBuilders.VERTICAL_ALIGN_CENTER)
.addContent(chipBuilder.build())
@@ -192,7 +187,7 @@
/** Returns text content of this Chip. */
@NonNull
public String getText() {
- return checkNotNull(mElement.getPrimaryLabelContent());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mElement.getPrimaryLabelContent());
}
/** Returns metadata tag set to this CompactChip, which should be {@link #METADATA_TAG}. */
@@ -218,7 +213,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ boxElement.getModifiers(), METADATA_TAG)) {
return null;
}
// Now to check that inner content of the androidx.wear.tiles.LayoutElementBuilders.Box is
@@ -230,7 +226,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box innerBoxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) innerElement;
- if (!checkTag(innerBoxElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ innerBoxElement.getModifiers(), METADATA_TAG)) {
return null;
}
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Text.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Text.java
index 6500734..2819794 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Text.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Text.java
@@ -16,14 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagName;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.Typography.TYPOGRAPHY_DISPLAY1;
-import static androidx.wear.tiles.material.Typography.getFontStyleBuilder;
-import static androidx.wear.tiles.material.Typography.getLineHeightForTypography;
-
import android.content.Context;
import androidx.annotation.IntRange;
@@ -34,7 +26,6 @@
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.LayoutElementProto;
import androidx.wear.protolayout.proto.ModifiersProto;
-import androidx.wear.tiles.material.Typography.TypographyName;
/**
* Tiles component {@link Text} that represents text object holding any information.
@@ -89,7 +80,7 @@
private androidx.wear.tiles.ColorBuilders.ColorProp mColor =
androidx.wear.tiles.ColorBuilders.argb(Colors.DEFAULT.getOnPrimary());
- private @TypographyName int mTypographyName = TYPOGRAPHY_DISPLAY1;
+ private @Typography.TypographyName int mTypographyName = Typography.TYPOGRAPHY_DISPLAY1;
private boolean mItalic = false;
private int mMaxLines = 1;
private boolean mUnderline = false;
@@ -127,7 +118,7 @@
// There is getFontStyle matching getter for this setter as the serialized format of the
// Tiles do not allow for a direct reconstruction of the all arguments, but it has
// androidx.wear.tiles.LayoutElementBuilders.FontStyle object of that text.
- public Builder setTypography(@TypographyName int typography) {
+ public Builder setTypography(@Typography.TypographyName int typography) {
this.mTypographyName = typography;
return this;
}
@@ -220,7 +211,7 @@
@Override
public Text build() {
androidx.wear.tiles.LayoutElementBuilders.FontStyle.Builder fontStyleBuilder =
- getFontStyleBuilder(mTypographyName, mContext, mIsScalable)
+ Typography.getFontStyleBuilder(mTypographyName, mContext, mIsScalable)
.setColor(mColor)
.setItalic(mItalic)
.setUnderline(mUnderline);
@@ -232,7 +223,7 @@
new androidx.wear.tiles.LayoutElementBuilders.Text.Builder()
.setText(mTextContent)
.setFontStyle(fontStyleBuilder.build())
- .setLineHeight(getLineHeightForTypography(mTypographyName))
+ .setLineHeight(Typography.getLineHeightForTypography(mTypographyName))
.setMaxLines(mMaxLines)
.setMultilineAlignment(mMultilineAlignment)
.setModifiers(addTagToModifiers(mModifiers))
@@ -248,7 +239,9 @@
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders.ElementMetadata
.Builder()
- .setTagData(getTagBytes(METADATA_TAG))
+ .setTagData(
+ androidx.wear.tiles.material.Helper.getTagBytes(
+ METADATA_TAG))
.build()
.toProto())
.build(),
@@ -259,69 +252,84 @@
/** Returns the text of this Text element. */
@NonNull
public String getText() {
- return checkNotNull(checkNotNull(mText.getText()).getValue());
+ return androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mText.getText()).getValue());
}
/** Returns the color of this Text element. */
@NonNull
public androidx.wear.tiles.ColorBuilders.ColorProp getColor() {
- return checkNotNull(checkNotNull(mText.getFontStyle()).getColor());
+ return androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mText.getFontStyle()).getColor());
}
/** Returns the font style of this Text element. */
@NonNull
public androidx.wear.tiles.LayoutElementBuilders.FontStyle getFontStyle() {
- return checkNotNull(mText.getFontStyle());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mText.getFontStyle());
}
/** Returns the line height of this Text element. */
public float getLineHeight() {
- return checkNotNull(mText.getLineHeight()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(mText.getLineHeight()).getValue();
}
/** Returns the max lines of text of this Text element. */
public int getMaxLines() {
- return checkNotNull(mText.getMaxLines()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(mText.getMaxLines()).getValue();
}
/** Returns the multiline alignment of this Text element. */
@androidx.wear.tiles.LayoutElementBuilders.TextAlignment
public int getMultilineAlignment() {
- return checkNotNull(mText.getMultilineAlignment()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(mText.getMultilineAlignment())
+ .getValue();
}
/** Returns the modifiers of this Text element. */
@NonNull
public androidx.wear.tiles.ModifiersBuilders.Modifiers getModifiers() {
- return checkNotNull(mText.getModifiers());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mText.getModifiers());
}
/** Returns the overflow of this Text element. */
@androidx.wear.tiles.LayoutElementBuilders.TextOverflow
public int getOverflow() {
- return checkNotNull(mText.getOverflow()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(mText.getOverflow()).getValue();
}
/** Returns the overflow of this Text element. */
@androidx.wear.tiles.LayoutElementBuilders.FontWeight
public int getWeight() {
- return checkNotNull(checkNotNull(mText.getFontStyle()).getWeight()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mText.getFontStyle())
+ .getWeight())
+ .getValue();
}
/** Returns whether the Text is in italic. */
public boolean isItalic() {
- return checkNotNull(checkNotNull(mText.getFontStyle()).getItalic()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mText.getFontStyle())
+ .getItalic())
+ .getValue();
}
/** Returns whether the Text is underlined. */
public boolean isUnderline() {
- return checkNotNull(checkNotNull(mText.getFontStyle()).getUnderline()).getValue();
+ return androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mText.getFontStyle())
+ .getUnderline())
+ .getValue();
}
/** Returns metadata tag set to this Text, which should be {@link #METADATA_TAG}. */
@NonNull
String getMetadataTag() {
- return getMetadataTagName(checkNotNull(checkNotNull(getModifiers()).getMetadata()));
+ return androidx.wear.tiles.material.Helper.getMetadataTagName(
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(getModifiers())
+ .getMetadata()));
}
/**
@@ -341,7 +349,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Text textElement =
(androidx.wear.tiles.LayoutElementBuilders.Text) element;
- if (!checkTag(textElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ textElement.getModifiers(), METADATA_TAG)) {
return null;
}
// Now we are sure that this element is a Material Text.
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 f45da44..18cd2a1 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
@@ -17,11 +17,6 @@
package androidx.wear.tiles.material;
import static androidx.annotation.Dimension.DP;
-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_COLORS;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
import android.content.Context;
@@ -93,7 +88,7 @@
private final androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters
mDeviceParameters;
- @NonNull private ChipColors mChipColors = TITLE_PRIMARY_COLORS;
+ @NonNull private ChipColors mChipColors = ChipDefaults.TITLE_PRIMARY_COLORS;
@androidx.wear.tiles.LayoutElementBuilders.HorizontalAlignment
private int mHorizontalAlign =
@@ -178,9 +173,9 @@
.setChipColors(mChipColors)
.setContentDescription(mText)
.setHorizontalAlignment(mHorizontalAlign)
- .setHeight(TITLE_HEIGHT)
+ .setHeight(ChipDefaults.TITLE_HEIGHT)
.setMaxLines(1)
- .setHorizontalPadding(TITLE_HORIZONTAL_PADDING)
+ .setHorizontalPadding(ChipDefaults.TITLE_HORIZONTAL_PADDING)
.setPrimaryLabelContent(mText)
.setPrimaryLabelTypography(Typography.TYPOGRAPHY_TITLE2)
.setIsPrimaryLabelScalable(false);
@@ -214,7 +209,7 @@
/** Returns text content of this Chip. */
@NonNull
public String getText() {
- return checkNotNull(mElement.getPrimaryLabelContent());
+ return androidx.wear.tiles.material.Helper.checkNotNull(mElement.getPrimaryLabelContent());
}
/** Returns the horizontal alignment of the content in this Chip. */
@@ -246,7 +241,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ boxElement.getModifiers(), METADATA_TAG)) {
return null;
}
// Now we are sure that this element is a TitleChip.
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Typography.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Typography.java
index 89adc96..dd937c9 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Typography.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/Typography.java
@@ -18,7 +18,6 @@
import static androidx.annotation.Dimension.DP;
import static androidx.annotation.Dimension.SP;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
import android.annotation.SuppressLint;
import android.content.Context;
@@ -115,6 +114,7 @@
TYPOGRAPHY_TO_LINE_HEIGHT_SP.put(TYPOGRAPHY_CAPTION2, 16f);
TYPOGRAPHY_TO_LINE_HEIGHT_SP.put(TYPOGRAPHY_CAPTION3, 14f);
}
+
/**
* Returns the {@link androidx.wear.tiles.LayoutElementBuilders.FontStyle.Builder} for the given
* androidx.wear.tiles.LayoutElementBuilders.FontStyle code with the recommended size, weight
@@ -179,7 +179,9 @@
throw new IllegalArgumentException("Typography " + typography + " doesn't exist.");
}
return androidx.wear.tiles.DimensionBuilders.sp(
- checkNotNull(TYPOGRAPHY_TO_LINE_HEIGHT_SP.get(typography)).intValue());
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ TYPOGRAPHY_TO_LINE_HEIGHT_SP.get(typography))
+ .intValue());
}
@NonNull
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout.java
index 7ef7d33..2f0c55c 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/EdgeContentLayout.java
@@ -16,17 +16,6 @@
package androidx.wear.tiles.material.layouts;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagBytes;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.Helper.isRoundDevice;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_PADDING;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_ROUND_DP;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_SQUARE_DP;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.EDGE_CONTENT_LAYOUT_PADDING_ABOVE_MAIN_CONTENT_DP;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.EDGE_CONTENT_LAYOUT_PADDING_BELOW_MAIN_CONTENT_DP;
-
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -34,7 +23,6 @@
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.LayoutElementProto;
-import androidx.wear.tiles.material.CircularProgressIndicator;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -95,23 +83,28 @@
* optional content is added.
*/
static final byte[] METADATA_TAG_BASE =
- Arrays.copyOf(getTagBytes(METADATA_TAG_PREFIX), FLAG_INDEX + 1);
+ Arrays.copyOf(
+ androidx.wear.tiles.material.Helper.getTagBytes(METADATA_TAG_PREFIX),
+ FLAG_INDEX + 1);
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the edge content is present or not.
*/
static final int EDGE_CONTENT_PRESENT = 0x1;
+
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the primary label is present or not.
*/
static final int PRIMARY_LABEL_PRESENT = 0x2;
+
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the secondary label is present or not.
*/
static final int SECONDARY_LABEL_PRESENT = 0x4;
+
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the main content is present or not.
@@ -228,14 +221,22 @@
@Override
public EdgeContentLayout build() {
float thicknessDp =
- mEdgeContent instanceof CircularProgressIndicator
- ? ((CircularProgressIndicator) mEdgeContent).getStrokeWidth().getValue()
+ mEdgeContent instanceof androidx.wear.tiles.material.CircularProgressIndicator
+ ? ((androidx.wear.tiles.material.CircularProgressIndicator)
+ mEdgeContent)
+ .getStrokeWidth()
+ .getValue()
: 0;
float horizontalPaddingDp =
- isRoundDevice(mDeviceParameters)
- ? EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_ROUND_DP
- : EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_SQUARE_DP;
- float indicatorWidth = 2 * (thicknessDp + DEFAULT_PADDING.getValue());
+ androidx.wear.tiles.material.Helper.isRoundDevice(mDeviceParameters)
+ ? LayoutDefaults.EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_ROUND_DP
+ : LayoutDefaults.EDGE_CONTENT_LAYOUT_MARGIN_HORIZONTAL_SQUARE_DP;
+ float indicatorWidth =
+ 2
+ * (thicknessDp
+ + androidx.wear.tiles.material.ProgressIndicatorDefaults
+ .DEFAULT_PADDING
+ .getValue());
float mainContentHeightDp = mDeviceParameters.getScreenHeightDp() - indicatorWidth;
float mainContentWidthDp = mDeviceParameters.getScreenWidthDp() - indicatorWidth;
@@ -292,7 +293,8 @@
new androidx.wear.tiles.LayoutElementBuilders.Spacer.Builder()
.setHeight(
androidx.wear.tiles.DimensionBuilders.dp(
- EDGE_CONTENT_LAYOUT_PADDING_ABOVE_MAIN_CONTENT_DP))
+ LayoutDefaults
+ .EDGE_CONTENT_LAYOUT_PADDING_ABOVE_MAIN_CONTENT_DP))
.build());
}
@@ -311,7 +313,8 @@
new androidx.wear.tiles.LayoutElementBuilders.Spacer.Builder()
.setHeight(
androidx.wear.tiles.DimensionBuilders.dp(
- EDGE_CONTENT_LAYOUT_PADDING_BELOW_MAIN_CONTENT_DP))
+ LayoutDefaults
+ .EDGE_CONTENT_LAYOUT_PADDING_BELOW_MAIN_CONTENT_DP))
.build());
innerContentBuilder.addContent(mSecondaryLabelText);
}
@@ -344,7 +347,10 @@
/** Returns metadata tag set to this EdgeContentLayout. */
@NonNull
byte[] getMetadataTag() {
- return getMetadataTagBytes(checkNotNull(checkNotNull(mImpl.getModifiers()).getMetadata()));
+ return androidx.wear.tiles.material.Helper.getMetadataTagBytes(
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mImpl.getModifiers())
+ .getMetadata()));
}
/** Returns the inner content from this layout. */
@@ -407,7 +413,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), METADATA_TAG_PREFIX, METADATA_TAG_BASE)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ boxElement.getModifiers(), METADATA_TAG_PREFIX, METADATA_TAG_BASE)) {
return null;
}
// Now we are sure that this element is a EdgeContentLayout.
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/LayoutDefaults.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/LayoutDefaults.java
index 643373d..40b9cb8 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/LayoutDefaults.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/LayoutDefaults.java
@@ -17,7 +17,6 @@
package androidx.wear.tiles.material.layouts;
import androidx.annotation.NonNull;
-import androidx.wear.tiles.material.ButtonDefaults;
/**
* Contains the default values used by layout templates for Tiles.
@@ -128,17 +127,17 @@
* MultiButtonLayout}.
*/
static final androidx.wear.tiles.DimensionBuilders.DpProp MULTI_BUTTON_3_PLUS_SIZE =
- ButtonDefaults.DEFAULT_SIZE;
+ androidx.wear.tiles.material.ButtonDefaults.DEFAULT_SIZE;
/** The default size of button in case when there 2 buttons in the {@link MultiButtonLayout}. */
static final androidx.wear.tiles.DimensionBuilders.DpProp MULTI_BUTTON_2_SIZE =
- ButtonDefaults.LARGE_SIZE;
+ androidx.wear.tiles.material.ButtonDefaults.LARGE_SIZE;
/**
* The default size of button in case when there is 1 button in the {@link MultiButtonLayout}.
*/
static final androidx.wear.tiles.DimensionBuilders.DpProp MULTI_BUTTON_1_SIZE =
- ButtonDefaults.EXTRA_LARGE_SIZE;
+ androidx.wear.tiles.material.ButtonDefaults.EXTRA_LARGE_SIZE;
/** The default width for vertical spacer between buttons in the {@link MultiButtonLayout}. */
static final androidx.wear.tiles.DimensionBuilders.DpProp MULTI_BUTTON_SPACER_WIDTH =
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout.java
index 2f3f43b..4f521ce 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiButtonLayout.java
@@ -16,17 +16,6 @@
package androidx.wear.tiles.material.layouts;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagName;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_BUTTON_1_SIZE;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_BUTTON_2_SIZE;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_BUTTON_MAX_NUMBER;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_BUTTON_SPACER_HEIGHT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_BUTTON_SPACER_WIDTH;
-
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -34,7 +23,6 @@
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.LayoutElementProto;
-import androidx.wear.tiles.material.Button;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -147,10 +135,10 @@
@Override
public MultiButtonLayout build() {
int buttonNum = mButtonsContent.size();
- if (buttonNum > MULTI_BUTTON_MAX_NUMBER) {
+ if (buttonNum > LayoutDefaults.MULTI_BUTTON_MAX_NUMBER) {
throw new IllegalArgumentException(
"Too many buttons are added. Maximum number is "
- + MULTI_BUTTON_MAX_NUMBER
+ + LayoutDefaults.MULTI_BUTTON_MAX_NUMBER
+ ".");
}
@@ -163,7 +151,10 @@
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders
.ElementMetadata.Builder()
- .setTagData(getTagBytes(METADATA_TAG))
+ .setTagData(
+ androidx.wear.tiles.material
+ .Helper.getTagBytes(
+ METADATA_TAG))
.build())
.build())
.addContent(buttons);
@@ -176,10 +167,12 @@
int buttonNum) {
switch (buttonNum) {
case 1:
- return wrapButton(mButtonsContent.get(0), MULTI_BUTTON_1_SIZE);
+ return wrapButton(mButtonsContent.get(0), LayoutDefaults.MULTI_BUTTON_1_SIZE);
case 2:
return build2ButtonRow(
- mButtonsContent.get(0), mButtonsContent.get(1), MULTI_BUTTON_2_SIZE);
+ mButtonsContent.get(0),
+ mButtonsContent.get(1),
+ LayoutDefaults.MULTI_BUTTON_2_SIZE);
case 3:
return build3ButtonRow(
mButtonsContent.get(0), mButtonsContent.get(1), mButtonsContent.get(2));
@@ -189,13 +182,13 @@
build2ButtonRow(
mButtonsContent.get(0),
mButtonsContent.get(1),
- MULTI_BUTTON_3_PLUS_SIZE))
+ LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.addContent(buildVerticalSpacer())
.addContent(
build2ButtonRow(
mButtonsContent.get(2),
mButtonsContent.get(3),
- MULTI_BUTTON_3_PLUS_SIZE))
+ LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.build();
case 5:
return new androidx.wear.tiles.LayoutElementBuilders.Column.Builder()
@@ -208,14 +201,14 @@
: build2ButtonRow(
mButtonsContent.get(0),
mButtonsContent.get(1),
- MULTI_BUTTON_3_PLUS_SIZE))
+ LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.addContent(buildVerticalSpacer())
.addContent(
mFiveButtonDistribution == FIVE_BUTTON_DISTRIBUTION_TOP_HEAVY
? build2ButtonRow(
mButtonsContent.get(3),
mButtonsContent.get(4),
- MULTI_BUTTON_3_PLUS_SIZE)
+ LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE)
: build3ButtonRow(
mButtonsContent.get(2),
mButtonsContent.get(3),
@@ -241,7 +234,7 @@
build2ButtonRow(
mButtonsContent.get(0),
mButtonsContent.get(1),
- MULTI_BUTTON_3_PLUS_SIZE))
+ LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.addContent(buildVerticalSpacer())
.addContent(
build3ButtonRow(
@@ -253,7 +246,7 @@
build2ButtonRow(
mButtonsContent.get(5),
mButtonsContent.get(6),
- MULTI_BUTTON_3_PLUS_SIZE))
+ LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.build();
}
// This shouldn't happen, but return an empty
@@ -270,11 +263,11 @@
return new androidx.wear.tiles.LayoutElementBuilders.Row.Builder()
.setWidth(androidx.wear.tiles.DimensionBuilders.wrap())
.setHeight(androidx.wear.tiles.DimensionBuilders.wrap())
- .addContent(wrapButton(button1, MULTI_BUTTON_3_PLUS_SIZE))
+ .addContent(wrapButton(button1, LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.addContent(buildHorizontalSpacer())
- .addContent(wrapButton(button2, MULTI_BUTTON_3_PLUS_SIZE))
+ .addContent(wrapButton(button2, LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.addContent(buildHorizontalSpacer())
- .addContent(wrapButton(button3, MULTI_BUTTON_3_PLUS_SIZE))
+ .addContent(wrapButton(button3, LayoutDefaults.MULTI_BUTTON_3_PLUS_SIZE))
.build();
}
@@ -295,14 +288,14 @@
@NonNull
private androidx.wear.tiles.LayoutElementBuilders.Spacer buildHorizontalSpacer() {
return new androidx.wear.tiles.LayoutElementBuilders.Spacer.Builder()
- .setWidth(MULTI_BUTTON_SPACER_WIDTH)
+ .setWidth(LayoutDefaults.MULTI_BUTTON_SPACER_WIDTH)
.build();
}
@NonNull
private androidx.wear.tiles.LayoutElementBuilders.Spacer buildVerticalSpacer() {
return new androidx.wear.tiles.LayoutElementBuilders.Spacer.Builder()
- .setHeight(MULTI_BUTTON_SPACER_HEIGHT)
+ .setHeight(LayoutDefaults.MULTI_BUTTON_SPACER_HEIGHT)
.build();
}
@@ -352,8 +345,10 @@
/** Returns metadata tag set to this MultiButtonLayouts. */
@NonNull
String getMetadataTag() {
- return getMetadataTagName(
- checkNotNull(checkNotNull(mElement.getModifiers()).getMetadata()));
+ return androidx.wear.tiles.material.Helper.getMetadataTagName(
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mElement.getModifiers())
+ .getMetadata()));
}
/**
@@ -421,7 +416,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ boxElement.getModifiers(), METADATA_TAG)) {
return null;
}
// Now we are sure that this element is a MultiButtonLayout.
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiSlotLayout.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiSlotLayout.java
index b184a85..104e75e 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiSlotLayout.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/MultiSlotLayout.java
@@ -17,11 +17,6 @@
package androidx.wear.tiles.material.layouts;
import static androidx.annotation.Dimension.DP;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagName;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.MULTI_SLOT_LAYOUT_HORIZONTAL_SPACER_WIDTH;
import android.annotation.SuppressLint;
@@ -94,7 +89,7 @@
@NonNull
private androidx.wear.tiles.DimensionBuilders.DpProp mHorizontalSpacerWidth =
- MULTI_SLOT_LAYOUT_HORIZONTAL_SPACER_WIDTH;
+ LayoutDefaults.MULTI_SLOT_LAYOUT_HORIZONTAL_SPACER_WIDTH;
/**
* Creates a builder for the {@link MultiSlotLayout}. Content inside of it can later be
@@ -143,7 +138,10 @@
.setMetadata(
new androidx.wear.tiles.ModifiersBuilders
.ElementMetadata.Builder()
- .setTagData(getTagBytes(METADATA_TAG))
+ .setTagData(
+ androidx.wear.tiles.material
+ .Helper.getTagBytes(
+ METADATA_TAG))
.build())
.build());
if (!mSlotsContent.isEmpty()) {
@@ -210,8 +208,10 @@
/** Returns metadata tag set to this MultiSlotLayout. */
@NonNull
String getMetadataTag() {
- return getMetadataTagName(
- checkNotNull(checkNotNull(mElement.getModifiers()).getMetadata()));
+ return androidx.wear.tiles.material.Helper.getMetadataTagName(
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mElement.getModifiers())
+ .getMetadata()));
}
/**
@@ -231,7 +231,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Row rowElement =
(androidx.wear.tiles.LayoutElementBuilders.Row) element;
- if (!checkTag(rowElement.getModifiers(), METADATA_TAG)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ rowElement.getModifiers(), METADATA_TAG)) {
return null;
}
// Now we are sure that this element is a MultiSlotLayout.
diff --git a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout.java b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout.java
index 920d6a8..037ba46 100644
--- a/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout.java
+++ b/wear/tiles/tiles-material/src/main/java/androidx/wear/tiles/material/layouts/PrimaryLayout.java
@@ -17,23 +17,6 @@
package androidx.wear.tiles.material.layouts;
import static androidx.annotation.Dimension.DP;
-import static androidx.wear.tiles.material.ChipDefaults.COMPACT_HEIGHT_TAPPABLE;
-import static androidx.wear.tiles.material.Helper.checkNotNull;
-import static androidx.wear.tiles.material.Helper.checkTag;
-import static androidx.wear.tiles.material.Helper.getMetadataTagBytes;
-import static androidx.wear.tiles.material.Helper.getTagBytes;
-import static androidx.wear.tiles.material.Helper.isRoundDevice;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_ROUND_DP;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_SQUARE_DP;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_MARGIN_BOTTOM_ROUND_PERCENT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_MARGIN_BOTTOM_SQUARE_PERCENT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_MARGIN_HORIZONTAL_ROUND_PERCENT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_MARGIN_HORIZONTAL_SQUARE_PERCENT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_MARGIN_TOP_ROUND_PERCENT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_MARGIN_TOP_SQUARE_PERCENT;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_ROUND_DP;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_SQUARE_DP;
import android.annotation.SuppressLint;
@@ -45,7 +28,6 @@
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.LayoutElementProto;
-import androidx.wear.tiles.material.CompactChip;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -105,23 +87,28 @@
* optional content is added.
*/
static final byte[] METADATA_TAG_BASE =
- Arrays.copyOf(getTagBytes(METADATA_TAG_PREFIX), FLAG_INDEX + 1);
+ Arrays.copyOf(
+ androidx.wear.tiles.material.Helper.getTagBytes(METADATA_TAG_PREFIX),
+ FLAG_INDEX + 1);
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the primary chip is present or not.
*/
static final int CHIP_PRESENT = 0x1;
+
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the primary label is present or not.
*/
static final int PRIMARY_LABEL_PRESENT = 0x2;
+
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the secondary label is present or not.
*/
static final int SECONDARY_LABEL_PRESENT = 0x4;
+
/**
* Bit position in a byte on {@link #FLAG_INDEX} index in metadata byte array to check whether
* the content is present or not.
@@ -130,8 +117,10 @@
/** Position of the primary label in its own inner column if exists. */
static final int PRIMARY_LABEL_POSITION = 1;
+
/** Position of the content in its own inner column. */
static final int CONTENT_ONLY_POSITION = 0;
+
/** Position of the primary chip in main layout column. */
static final int PRIMARY_CHIP_POSITION = 1;
@@ -147,9 +136,11 @@
// This contains inner columns and primary chip.
@NonNull
private final List<androidx.wear.tiles.LayoutElementBuilders.LayoutElement> mAllContent;
+
// This contains optional labels, spacers and main content.
@NonNull
private final List<androidx.wear.tiles.LayoutElementBuilders.LayoutElement> mPrimaryLabel;
+
// This contains optional labels, spacers and main content.
@NonNull
private final List<androidx.wear.tiles.LayoutElementBuilders.LayoutElement>
@@ -198,7 +189,7 @@
@NonNull
private androidx.wear.tiles.DimensionBuilders.DpProp mVerticalSpacerHeight =
- DEFAULT_VERTICAL_SPACER_HEIGHT;
+ LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT;
private byte mMetadataContentByte = 0;
@@ -295,7 +286,11 @@
float horizontalPadding = getHorizontalPadding();
float horizontalChipPadding = getChipHorizontalPadding();
- float primaryChipHeight = mPrimaryChip != null ? COMPACT_HEIGHT_TAPPABLE.getValue() : 0;
+ float primaryChipHeight =
+ mPrimaryChip != null
+ ? androidx.wear.tiles.material.ChipDefaults.COMPACT_HEIGHT_TAPPABLE
+ .getValue()
+ : 0;
androidx.wear.tiles.DimensionBuilders.DpProp mainContentHeight =
androidx.wear.tiles.DimensionBuilders.dp(
@@ -460,9 +455,9 @@
private float getBottomPadding() {
return mPrimaryChip != null
? (mDeviceParameters.getScreenHeightDp()
- * (isRoundDevice(mDeviceParameters)
- ? PRIMARY_LAYOUT_MARGIN_BOTTOM_ROUND_PERCENT
- : PRIMARY_LAYOUT_MARGIN_BOTTOM_SQUARE_PERCENT))
+ * (androidx.wear.tiles.material.Helper.isRoundDevice(mDeviceParameters)
+ ? LayoutDefaults.PRIMARY_LAYOUT_MARGIN_BOTTOM_ROUND_PERCENT
+ : LayoutDefaults.PRIMARY_LAYOUT_MARGIN_BOTTOM_SQUARE_PERCENT))
: getTopPadding();
}
@@ -473,9 +468,9 @@
@Dimension(unit = DP)
private float getTopPadding() {
return mDeviceParameters.getScreenHeightDp()
- * (isRoundDevice(mDeviceParameters)
- ? PRIMARY_LAYOUT_MARGIN_TOP_ROUND_PERCENT
- : PRIMARY_LAYOUT_MARGIN_TOP_SQUARE_PERCENT);
+ * (androidx.wear.tiles.material.Helper.isRoundDevice(mDeviceParameters)
+ ? LayoutDefaults.PRIMARY_LAYOUT_MARGIN_TOP_ROUND_PERCENT
+ : LayoutDefaults.PRIMARY_LAYOUT_MARGIN_TOP_SQUARE_PERCENT);
}
/**
@@ -485,9 +480,9 @@
@Dimension(unit = DP)
private float getHorizontalPadding() {
return mDeviceParameters.getScreenWidthDp()
- * (isRoundDevice(mDeviceParameters)
- ? PRIMARY_LAYOUT_MARGIN_HORIZONTAL_ROUND_PERCENT
- : PRIMARY_LAYOUT_MARGIN_HORIZONTAL_SQUARE_PERCENT);
+ * (androidx.wear.tiles.material.Helper.isRoundDevice(mDeviceParameters)
+ ? LayoutDefaults.PRIMARY_LAYOUT_MARGIN_HORIZONTAL_ROUND_PERCENT
+ : LayoutDefaults.PRIMARY_LAYOUT_MARGIN_HORIZONTAL_SQUARE_PERCENT);
}
/**
@@ -496,17 +491,17 @@
*/
@Dimension(unit = DP)
private float getChipHorizontalPadding() {
- return isRoundDevice(mDeviceParameters)
- ? PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_ROUND_DP
- : PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_SQUARE_DP;
+ return androidx.wear.tiles.material.Helper.isRoundDevice(mDeviceParameters)
+ ? LayoutDefaults.PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_ROUND_DP
+ : LayoutDefaults.PRIMARY_LAYOUT_CHIP_HORIZONTAL_PADDING_SQUARE_DP;
}
/** Returns the spacer height to be placed above primary label to accommodate Tile icon. */
@NonNull
private androidx.wear.tiles.DimensionBuilders.DpProp getPrimaryLabelTopSpacerHeight() {
- return isRoundDevice(mDeviceParameters)
- ? PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_ROUND_DP
- : PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_SQUARE_DP;
+ return androidx.wear.tiles.material.Helper.isRoundDevice(mDeviceParameters)
+ ? LayoutDefaults.PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_ROUND_DP
+ : LayoutDefaults.PRIMARY_LAYOUT_PRIMARY_LABEL_SPACER_HEIGHT_SQUARE_DP;
}
}
@@ -570,7 +565,7 @@
}
}
}
- return DEFAULT_VERTICAL_SPACER_HEIGHT.getValue();
+ return LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT.getValue();
}
private boolean areElementsPresent(@ContentBits int elementFlag) {
@@ -580,7 +575,10 @@
/** Returns metadata tag set to this PrimaryLayout. */
@NonNull
byte[] getMetadataTag() {
- return getMetadataTagBytes(checkNotNull(checkNotNull(mImpl.getModifiers()).getMetadata()));
+ return androidx.wear.tiles.material.Helper.getMetadataTagBytes(
+ androidx.wear.tiles.material.Helper.checkNotNull(
+ androidx.wear.tiles.material.Helper.checkNotNull(mImpl.getModifiers())
+ .getMetadata()));
}
/**
@@ -600,7 +598,8 @@
}
androidx.wear.tiles.LayoutElementBuilders.Box boxElement =
(androidx.wear.tiles.LayoutElementBuilders.Box) element;
- if (!checkTag(boxElement.getModifiers(), METADATA_TAG_PREFIX, METADATA_TAG_BASE)) {
+ if (!androidx.wear.tiles.material.Helper.checkTag(
+ boxElement.getModifiers(), METADATA_TAG_PREFIX, METADATA_TAG_BASE)) {
return null;
}
// Now we are sure that this element is a PrimaryLayout.
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ButtonTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ButtonTest.java
index c2749c5..81ac645 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ButtonTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ButtonTest.java
@@ -16,11 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.ButtonDefaults.DEFAULT_SIZE;
-import static androidx.wear.tiles.material.ButtonDefaults.EXTRA_LARGE_SIZE;
-import static androidx.wear.tiles.material.ButtonDefaults.LARGE_SIZE;
-import static androidx.wear.tiles.material.ButtonDefaults.PRIMARY_COLORS;
-
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -61,7 +56,7 @@
assertButton(
button,
- DEFAULT_SIZE,
+ ButtonDefaults.DEFAULT_SIZE,
new ButtonColors(Colors.PRIMARY, 0),
null,
Button.METADATA_TAG_CUSTOM_CONTENT,
@@ -73,7 +68,7 @@
@Test
public void testButtonCustom() {
- androidx.wear.tiles.DimensionBuilders.DpProp mSize = LARGE_SIZE;
+ androidx.wear.tiles.DimensionBuilders.DpProp mSize = ButtonDefaults.LARGE_SIZE;
ButtonColors mButtonColors = new ButtonColors(0x11223344, 0);
Button button =
@@ -107,8 +102,8 @@
assertButton(
button,
- DEFAULT_SIZE,
- PRIMARY_COLORS,
+ ButtonDefaults.DEFAULT_SIZE,
+ ButtonDefaults.PRIMARY_COLORS,
CONTENT_DESCRIPTION,
Button.METADATA_TAG_ICON,
null,
@@ -122,14 +117,14 @@
Button button =
new Button.Builder(CONTEXT, CLICKABLE)
.setIconContent(RESOURCE_ID)
- .setSize(LARGE_SIZE)
+ .setSize(ButtonDefaults.LARGE_SIZE)
.setContentDescription(CONTENT_DESCRIPTION)
.build();
assertButton(
button,
- LARGE_SIZE,
- PRIMARY_COLORS,
+ ButtonDefaults.LARGE_SIZE,
+ ButtonDefaults.PRIMARY_COLORS,
CONTENT_DESCRIPTION,
Button.METADATA_TAG_ICON,
null,
@@ -151,8 +146,8 @@
assertButton(
button,
- DEFAULT_SIZE,
- PRIMARY_COLORS,
+ ButtonDefaults.DEFAULT_SIZE,
+ ButtonDefaults.PRIMARY_COLORS,
CONTENT_DESCRIPTION,
Button.METADATA_TAG_ICON,
null,
@@ -171,8 +166,8 @@
assertButton(
button,
- DEFAULT_SIZE,
- PRIMARY_COLORS,
+ ButtonDefaults.DEFAULT_SIZE,
+ ButtonDefaults.PRIMARY_COLORS,
CONTENT_DESCRIPTION,
Button.METADATA_TAG_TEXT,
TEXT,
@@ -187,13 +182,13 @@
new Button.Builder(CONTEXT, CLICKABLE)
.setTextContent(TEXT)
.setContentDescription(CONTENT_DESCRIPTION)
- .setSize(EXTRA_LARGE_SIZE)
+ .setSize(ButtonDefaults.EXTRA_LARGE_SIZE)
.build();
assertButton(
button,
- EXTRA_LARGE_SIZE,
- PRIMARY_COLORS,
+ ButtonDefaults.EXTRA_LARGE_SIZE,
+ ButtonDefaults.PRIMARY_COLORS,
CONTENT_DESCRIPTION,
Button.METADATA_TAG_TEXT,
TEXT,
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ChipTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ChipTest.java
index d7c2a0a..3e96246 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ChipTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/ChipTest.java
@@ -16,8 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.Utils.areChipColorsEqual;
-
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -286,7 +284,7 @@
.isEqualTo(EXPECTED_WIDTH.toContainerDimensionProto());
assertThat(actualChip.getHeight().toContainerDimensionProto())
.isEqualTo(ChipDefaults.DEFAULT_HEIGHT.toContainerDimensionProto());
- assertThat(areChipColorsEqual(actualChip.getChipColors(), colors)).isTrue();
+ assertThat(Utils.areChipColorsEqual(actualChip.getChipColors(), colors)).isTrue();
assertThat(actualChip.getHorizontalAlignment()).isEqualTo(hAlign);
if (expectedContDesc == null) {
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CircularProgressIndicatorTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CircularProgressIndicatorTest.java
index af91db3..f6b33f8 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CircularProgressIndicatorTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CircularProgressIndicatorTest.java
@@ -16,11 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_COLORS;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_END_ANGLE;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_START_ANGLE;
-import static androidx.wear.tiles.material.ProgressIndicatorDefaults.DEFAULT_STROKE_WIDTH;
-
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -47,10 +42,10 @@
assertProgressIndicator(
circularProgressIndicator,
0,
- DEFAULT_START_ANGLE,
- DEFAULT_END_ANGLE,
- DEFAULT_COLORS,
- DEFAULT_STROKE_WIDTH.getValue(),
+ ProgressIndicatorDefaults.DEFAULT_START_ANGLE,
+ ProgressIndicatorDefaults.DEFAULT_END_ANGLE,
+ ProgressIndicatorDefaults.DEFAULT_COLORS,
+ ProgressIndicatorDefaults.DEFAULT_STROKE_WIDTH.getValue(),
null);
}
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CompactChipTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CompactChipTest.java
index 047c923..3c78bbe 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CompactChipTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/CompactChipTest.java
@@ -16,8 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.Utils.areChipColorsEqual;
-
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -112,7 +110,7 @@
private void assertChipIsEqual(CompactChip actualCompactChip, ChipColors colors) {
assertThat(actualCompactChip.getMetadataTag()).isEqualTo(CompactChip.METADATA_TAG);
assertThat(actualCompactChip.getClickable().toProto()).isEqualTo(CLICKABLE.toProto());
- assertThat(areChipColorsEqual(actualCompactChip.getChipColors(), colors)).isTrue();
+ assertThat(Utils.areChipColorsEqual(actualCompactChip.getChipColors(), colors)).isTrue();
assertThat(actualCompactChip.getText()).isEqualTo(MAIN_TEXT);
}
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TextTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TextTest.java
index e8facbe..075e2f15 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TextTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TextTest.java
@@ -16,12 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.Typography.TYPOGRAPHY_BODY1;
-import static androidx.wear.tiles.material.Typography.TYPOGRAPHY_CAPTION2;
-import static androidx.wear.tiles.material.Typography.TYPOGRAPHY_TITLE1;
-import static androidx.wear.tiles.material.Typography.getFontStyleBuilder;
-import static androidx.wear.tiles.material.Typography.getLineHeightForTypography;
-
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
@@ -48,52 +42,54 @@
@Test
public void testTypography_incorrectTypography_negativeValue() {
- assertThrows(IllegalArgumentException.class, () -> getFontStyleBuilder(-1, CONTEXT));
+ assertThrows(
+ IllegalArgumentException.class, () -> Typography.getFontStyleBuilder(-1, CONTEXT));
}
@Test
public void testTypography_incorrectTypography_positiveValue() {
assertThrows(
IllegalArgumentException.class,
- () -> getFontStyleBuilder(NUM_OF_FONT_STYLE_CONST + 1, CONTEXT));
+ () -> Typography.getFontStyleBuilder(NUM_OF_FONT_STYLE_CONST + 1, CONTEXT));
}
@Test
public void testLineHeight_incorrectTypography_negativeValue() {
- assertThrows(IllegalArgumentException.class, () -> getLineHeightForTypography(-1));
+ assertThrows(
+ IllegalArgumentException.class, () -> Typography.getLineHeightForTypography(-1));
}
@Test
public void testLineHeight_incorrectTypography_positiveValue() {
assertThrows(
IllegalArgumentException.class,
- () -> getLineHeightForTypography(NUM_OF_FONT_STYLE_CONST + 1));
+ () -> Typography.getLineHeightForTypography(NUM_OF_FONT_STYLE_CONST + 1));
}
@Test
public void testTypography_body1() {
androidx.wear.tiles.LayoutElementBuilders.FontStyle fontStyle =
- getFontStyleBuilder(TYPOGRAPHY_BODY1, CONTEXT).build();
+ Typography.getFontStyleBuilder(Typography.TYPOGRAPHY_BODY1, CONTEXT).build();
assertFontStyle(
fontStyle,
16,
androidx.wear.tiles.LayoutElementBuilders.FONT_WEIGHT_NORMAL,
0.01f,
20,
- TYPOGRAPHY_BODY1);
+ Typography.TYPOGRAPHY_BODY1);
}
@Test
public void testTypography_caption2() {
androidx.wear.tiles.LayoutElementBuilders.FontStyle fontStyle =
- getFontStyleBuilder(TYPOGRAPHY_CAPTION2, CONTEXT).build();
+ Typography.getFontStyleBuilder(Typography.TYPOGRAPHY_CAPTION2, CONTEXT).build();
assertFontStyle(
fontStyle,
12,
androidx.wear.tiles.LayoutElementBuilders.FONT_WEIGHT_MEDIUM,
0.01f,
16,
- TYPOGRAPHY_CAPTION2);
+ Typography.TYPOGRAPHY_CAPTION2);
}
@Test
@@ -145,7 +141,7 @@
new Text.Builder(CONTEXT, textContent)
.setItalic(true)
.setColor(androidx.wear.tiles.ColorBuilders.argb(color))
- .setTypography(TYPOGRAPHY_TITLE1)
+ .setTypography(Typography.TYPOGRAPHY_TITLE1)
.setUnderline(true)
.setMaxLines(2)
.setModifiers(modifiers)
@@ -158,7 +154,7 @@
.build();
androidx.wear.tiles.LayoutElementBuilders.FontStyle expectedFontStyle =
- getFontStyleBuilder(TYPOGRAPHY_TITLE1, CONTEXT)
+ Typography.getFontStyleBuilder(Typography.TYPOGRAPHY_TITLE1, CONTEXT)
.setItalic(true)
.setUnderline(true)
.setColor(androidx.wear.tiles.ColorBuilders.argb(color))
@@ -196,7 +192,9 @@
.isEqualTo(androidx.wear.tiles.LayoutElementBuilders.TEXT_ALIGN_END);
assertThat(actualText.getMaxLines()).isEqualTo(2);
assertThat(actualText.getLineHeight())
- .isEqualTo(getLineHeightForTypography(TYPOGRAPHY_TITLE1).getValue());
+ .isEqualTo(
+ Typography.getLineHeightForTypography(Typography.TYPOGRAPHY_TITLE1)
+ .getValue());
}
private void assertFontStyle(
@@ -212,7 +210,7 @@
assertThat(actualFontStyle.getSize().getValue()).isEqualTo(expectedSize);
assertThat(actualFontStyle.getWeight().getValue()).isEqualTo(expectedWeight);
assertThat(actualFontStyle.getLetterSpacing().getValue()).isEqualTo(expectedLetterSpacing);
- assertThat(getLineHeightForTypography(typographyCode).getValue())
+ assertThat(Typography.getLineHeightForTypography(typographyCode).getValue())
.isEqualTo(expectedLineHeight);
}
}
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TitleChipTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TitleChipTest.java
index 0e8f8bf..282fec4 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TitleChipTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/TitleChipTest.java
@@ -16,8 +16,6 @@
package androidx.wear.tiles.material;
-import static androidx.wear.tiles.material.Utils.areChipColorsEqual;
-
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -128,7 +126,7 @@
assertThat(actualTitleChip.getClickable().toProto()).isEqualTo(CLICKABLE.toProto());
assertThat(actualTitleChip.getWidth().toContainerDimensionProto())
.isEqualTo(width.toContainerDimensionProto());
- assertThat(areChipColorsEqual(actualTitleChip.getChipColors(), colors)).isTrue();
+ assertThat(Utils.areChipColorsEqual(actualTitleChip.getChipColors(), colors)).isTrue();
assertThat(actualTitleChip.getText()).isEqualTo(MAIN_TEXT);
}
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/EdgeContentLayoutTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/EdgeContentLayoutTest.java
index 96672cc..f1b5e00 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/EdgeContentLayoutTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/EdgeContentLayoutTest.java
@@ -26,8 +26,6 @@
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.wear.tiles.material.CircularProgressIndicator;
-import androidx.wear.tiles.material.Text;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -44,16 +42,17 @@
.setScreenWidthDp(192)
.setScreenHeightDp(192)
.build();
- private static final Text PRIMARY_LABEL = new Text.Builder(CONTEXT, "Primary label").build();
- private static final Text SECONDARY_LABEL =
- new Text.Builder(CONTEXT, "Secondary label").build();
+ private static final androidx.wear.tiles.material.Text PRIMARY_LABEL =
+ new androidx.wear.tiles.material.Text.Builder(CONTEXT, "Primary label").build();
+ private static final androidx.wear.tiles.material.Text SECONDARY_LABEL =
+ new androidx.wear.tiles.material.Text.Builder(CONTEXT, "Secondary label").build();
@Test
public void testAll() {
androidx.wear.tiles.LayoutElementBuilders.LayoutElement content =
new androidx.wear.tiles.LayoutElementBuilders.Box.Builder().build();
- CircularProgressIndicator progressIndicator =
- new CircularProgressIndicator.Builder().build();
+ androidx.wear.tiles.material.CircularProgressIndicator progressIndicator =
+ new androidx.wear.tiles.material.CircularProgressIndicator.Builder().build();
EdgeContentLayout layout =
new EdgeContentLayout.Builder(DEVICE_PARAMETERS)
.setContent(content)
@@ -77,8 +76,8 @@
@Test
public void testIndicatorOnly() {
- CircularProgressIndicator progressIndicator =
- new CircularProgressIndicator.Builder().build();
+ androidx.wear.tiles.material.CircularProgressIndicator progressIndicator =
+ new androidx.wear.tiles.material.CircularProgressIndicator.Builder().build();
EdgeContentLayout layout =
new EdgeContentLayout.Builder(DEVICE_PARAMETERS)
.setEdgeContent(progressIndicator)
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/MultiButtonLayoutTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/MultiButtonLayoutTest.java
index c17e2ae..cf38c56 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/MultiButtonLayoutTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/MultiButtonLayoutTest.java
@@ -26,8 +26,6 @@
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.wear.tiles.material.Button;
-import androidx.wear.tiles.material.ButtonDefaults;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,10 +49,10 @@
@Test
public void test_1button() {
- Button button1 =
- new Button.Builder(CONTEXT, CLICKABLE)
+ androidx.wear.tiles.material.Button button1 =
+ new androidx.wear.tiles.material.Button.Builder(CONTEXT, CLICKABLE)
.setTextContent("1")
- .setSize(ButtonDefaults.EXTRA_LARGE_SIZE)
+ .setSize(androidx.wear.tiles.material.ButtonDefaults.EXTRA_LARGE_SIZE)
.build();
MultiButtonLayout layout =
@@ -65,8 +63,14 @@
@Test
public void test_2buttons() {
- Button button1 = new Button.Builder(CONTEXT, CLICKABLE).setTextContent("1").build();
- Button button2 = new Button.Builder(CONTEXT, CLICKABLE).setTextContent("2").build();
+ androidx.wear.tiles.material.Button button1 =
+ new androidx.wear.tiles.material.Button.Builder(CONTEXT, CLICKABLE)
+ .setTextContent("1")
+ .build();
+ androidx.wear.tiles.material.Button button2 =
+ new androidx.wear.tiles.material.Button.Builder(CONTEXT, CLICKABLE)
+ .setTextContent("2")
+ .build();
MultiButtonLayout layout =
new MultiButtonLayout.Builder()
@@ -79,14 +83,17 @@
@Test
public void test_5buttons() {
- List<Button> buttons = new ArrayList<>();
+ List<androidx.wear.tiles.material.Button> buttons = new ArrayList<>();
int size = 5;
for (int i = 0; i < size; i++) {
- buttons.add(new Button.Builder(CONTEXT, CLICKABLE).setTextContent("" + i).build());
+ buttons.add(
+ new androidx.wear.tiles.material.Button.Builder(CONTEXT, CLICKABLE)
+ .setTextContent("" + i)
+ .build());
}
MultiButtonLayout.Builder layoutBuilder = new MultiButtonLayout.Builder();
- for (Button b : buttons) {
+ for (androidx.wear.tiles.material.Button b : buttons) {
layoutBuilder.addButtonContent(b);
}
layoutBuilder.setFiveButtonDistribution(
@@ -100,7 +107,10 @@
@Test
public void test_too_many_button() {
- Button button = new Button.Builder(CONTEXT, CLICKABLE).setTextContent("1").build();
+ androidx.wear.tiles.material.Button button =
+ new androidx.wear.tiles.material.Button.Builder(CONTEXT, CLICKABLE)
+ .setTextContent("1")
+ .build();
MultiButtonLayout.Builder layoutBuilder = new MultiButtonLayout.Builder();
for (int i = 0; i < LayoutDefaults.MULTI_BUTTON_MAX_NUMBER + 1; i++) {
layoutBuilder.addButtonContent(button);
@@ -142,7 +152,9 @@
assertThat(MultiButtonLayout.fromLayoutElement(box)).isNull();
}
- private void assertLayout(MultiButtonLayout actualLayout, List<Button> expectedButtons) {
+ private void assertLayout(
+ MultiButtonLayout actualLayout,
+ List<androidx.wear.tiles.material.Button> expectedButtons) {
assertLayoutIsEqual(actualLayout, expectedButtons);
androidx.wear.tiles.LayoutElementBuilders.Box box =
@@ -158,7 +170,9 @@
assertThat(MultiButtonLayout.fromLayoutElement(actualLayout)).isEqualTo(actualLayout);
}
- private void assertLayoutIsEqual(MultiButtonLayout actualLayout, List<Button> expectedButtons) {
+ private void assertLayoutIsEqual(
+ MultiButtonLayout actualLayout,
+ List<androidx.wear.tiles.material.Button> expectedButtons) {
int size = expectedButtons.size();
assertThat(actualLayout.getMetadataTag()).isEqualTo(MultiButtonLayout.METADATA_TAG);
assertThat(actualLayout.getButtonContents()).hasSize(size);
diff --git a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest.java b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest.java
index 641340d..f2e689f 100644
--- a/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest.java
+++ b/wear/tiles/tiles-material/src/test/java/androidx/wear/tiles/material/layouts/PrimaryLayoutTest.java
@@ -16,8 +16,6 @@
package androidx.wear.tiles.material.layouts;
-import static androidx.wear.tiles.material.layouts.LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT;
-
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -28,8 +26,6 @@
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.wear.tiles.material.CompactChip;
-import androidx.wear.tiles.material.Text;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,18 +50,27 @@
.build();
private static final androidx.wear.tiles.LayoutElementBuilders.LayoutElement CONTENT =
new androidx.wear.tiles.LayoutElementBuilders.Box.Builder().build();
- private static final CompactChip PRIMARY_CHIP =
- new CompactChip.Builder(CONTEXT, "Compact", CLICKABLE, DEVICE_PARAMETERS).build();
- private static final Text PRIMARY_LABEL = new Text.Builder(CONTEXT, "Primary label").build();
- private static final Text SECONDARY_LABEL =
- new Text.Builder(CONTEXT, "Secondary label").build();
+ private static final androidx.wear.tiles.material.CompactChip PRIMARY_CHIP =
+ new androidx.wear.tiles.material.CompactChip.Builder(
+ CONTEXT, "Compact", CLICKABLE, DEVICE_PARAMETERS)
+ .build();
+ private static final androidx.wear.tiles.material.Text PRIMARY_LABEL =
+ new androidx.wear.tiles.material.Text.Builder(CONTEXT, "Primary label").build();
+ private static final androidx.wear.tiles.material.Text SECONDARY_LABEL =
+ new androidx.wear.tiles.material.Text.Builder(CONTEXT, "Secondary label").build();
@Test
public void testOnlyContent() {
PrimaryLayout layout =
new PrimaryLayout.Builder(DEVICE_PARAMETERS).setContent(CONTENT).build();
- assertLayout(DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(), layout, CONTENT, null, null, null);
+ assertLayout(
+ LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
+ layout,
+ CONTENT,
+ null,
+ null,
+ null);
}
@Test
@@ -77,7 +82,7 @@
.build();
assertLayout(
- DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
+ LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
layout,
CONTENT,
PRIMARY_CHIP,
@@ -94,7 +99,7 @@
.build();
assertLayout(
- DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
+ LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
layout,
CONTENT,
null,
@@ -111,7 +116,7 @@
.build();
assertLayout(
- DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
+ LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT.getValue(),
layout,
CONTENT,
null,