Add the Undefined category to ImageSize.
This category would allow dynamic sizing without restriction to other fixed size categories.
Bug: 247595125
Test: Integration Test Demo
Relnote: Add the Undefined category to ImageSize.
Change-Id: I2fa39a9987a4675733003fb5ccee8b0e93f917cf
diff --git a/glance/glance/api/current.txt b/glance/glance/api/current.txt
index 038574a..01c8711 100644
--- a/glance/glance/api/current.txt
+++ b/glance/glance/api/current.txt
@@ -513,9 +513,11 @@
method public int getLarge();
method public int getMedium();
method public int getSmall();
+ method public int getUndefined();
property public final int Large;
property public final int Medium;
property public final int Small;
+ property public final int Undefined;
}
@kotlin.jvm.JvmInline public final value class ListStyle {
diff --git a/glance/glance/api/public_plus_experimental_current.txt b/glance/glance/api/public_plus_experimental_current.txt
index 038574a..01c8711 100644
--- a/glance/glance/api/public_plus_experimental_current.txt
+++ b/glance/glance/api/public_plus_experimental_current.txt
@@ -513,9 +513,11 @@
method public int getLarge();
method public int getMedium();
method public int getSmall();
+ method public int getUndefined();
property public final int Large;
property public final int Medium;
property public final int Small;
+ property public final int Undefined;
}
@kotlin.jvm.JvmInline public final value class ListStyle {
diff --git a/glance/glance/api/restricted_current.txt b/glance/glance/api/restricted_current.txt
index 038574a..01c8711 100644
--- a/glance/glance/api/restricted_current.txt
+++ b/glance/glance/api/restricted_current.txt
@@ -513,9 +513,11 @@
method public int getLarge();
method public int getMedium();
method public int getSmall();
+ method public int getUndefined();
property public final int Large;
property public final int Medium;
property public final int Small;
+ property public final int Undefined;
}
@kotlin.jvm.JvmInline public final value class ListStyle {
diff --git a/glance/glance/src/androidMain/kotlin/androidx/glance/template/GlanceTemplate.kt b/glance/glance/src/androidMain/kotlin/androidx/glance/template/GlanceTemplate.kt
index 2b6996e..c5503e2c 100644
--- a/glance/glance/src/androidMain/kotlin/androidx/glance/template/GlanceTemplate.kt
+++ b/glance/glance/src/androidMain/kotlin/androidx/glance/template/GlanceTemplate.kt
@@ -197,13 +197,13 @@
*
* @param images The sequence of images or just one image for display. Default to empty list.
* @param aspectRatio The preferred aspect ratio of the images. Default to [AspectRatio.Ratio1x1].
- * @param size The preferred size type of the images. Default to [ImageSize.Small].
+ * @param size The preferred size type of the images.
* @param priority The display priority number relative to other blocks such as a [TextBlock].
*/
class ImageBlock(
val images: List<TemplateImageWithDescription> = listOf(),
val aspectRatio: AspectRatio = AspectRatio.Ratio1x1,
- val size: ImageSize = ImageSize.Small,
+ val size: ImageSize = ImageSize.Undefined,
@IntRange(from = 0)
val priority: Int = 0,
) {
@@ -320,19 +320,24 @@
value class ImageSize private constructor(private val value: Int) {
companion object {
/**
+ * Unknown image scale for dynamic sizing by image hosting space available.
+ */
+ val Undefined: ImageSize = ImageSize(0)
+
+ /**
* Small sized image.
*/
- val Small: ImageSize = ImageSize(0)
+ val Small: ImageSize = ImageSize(1)
/**
* Medium sized image.
*/
- val Medium: ImageSize = ImageSize(1)
+ val Medium: ImageSize = ImageSize(2)
/**
* Large sized image.
*/
- val Large: ImageSize = ImageSize(2)
+ val Large: ImageSize = ImageSize(3)
}
}