From d82c4e1cb1148d2b6a039c21ec37fbe995d37d68 Mon Sep 17 00:00:00 2001 From: Edric Date: Fri, 10 May 2024 23:39:29 +0800 Subject: [PATCH] refactor(browser-ktx): make enum classes implement `ValueEnum` * Update API dump --- .../browser/browser-ktx/api/browser-ktx.api | 35 +++++++++++-------- .../ktx/enums/ActivityHeightResizeBehavior.kt | 7 ++-- .../enums/ActivitySideSheetDecorationType.kt | 7 ++-- .../ktx/enums/ActivitySideSheetPosition.kt | 7 ++-- ...ActivitySideSheetRoundedCornersPosition.kt | 7 ++-- .../browser/ktx/enums/CloseButtonPosition.kt | 7 ++-- .../androidx/browser/ktx/enums/ColorScheme.kt | 7 ++-- .../androidx/browser/ktx/enums/ShareState.kt | 7 ++-- 8 files changed, 56 insertions(+), 28 deletions(-) diff --git a/androidx/browser/browser-ktx/api/browser-ktx.api b/androidx/browser/browser-ktx/api/browser-ktx.api index dfd5f61..689a4fe 100644 --- a/androidx/browser/browser-ktx/api/browser-ktx.api +++ b/androidx/browser/browser-ktx/api/browser-ktx.api @@ -88,13 +88,14 @@ public final class io/github/edricchan03/androidx/browser/ktx/CustomTabIntentExt public abstract interface annotation class io/github/edricchan03/androidx/browser/ktx/annotations/ExperimentalBrowserApi : java/lang/annotation/Annotation { } -public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Adjustable Lio/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior; public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior$Companion; public static final field Default Lio/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior; public static final field Fixed Lio/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior; } @@ -104,14 +105,15 @@ public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeig public synthetic fun fromValueOrNull (Ljava/lang/Object;)Ljava/lang/Enum; } -public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType$Companion; public static final field Default Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType; public static final field Divider Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType; public static final field None Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType; public static final field Shadow Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType; } @@ -121,13 +123,14 @@ public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySide public synthetic fun fromValueOrNull (Ljava/lang/Object;)Ljava/lang/Enum; } -public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition$Companion; public static final field Default Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition; public static final field End Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition; public static final field Start Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition; } @@ -137,13 +140,14 @@ public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySide public synthetic fun fromValueOrNull (Ljava/lang/Object;)Ljava/lang/Enum; } -public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition$Companion; public static final field Default Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition; public static final field None Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition; public static final field Top Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition; } @@ -153,13 +157,14 @@ public final class io/github/edricchan03/androidx/browser/ktx/enums/ActivitySide public synthetic fun fromValueOrNull (Ljava/lang/Object;)Ljava/lang/Enum; } -public final class io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition$Companion; public static final field Default Lio/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition; public static final field End Lio/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition; public static final field Start Lio/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition; } @@ -169,13 +174,14 @@ public final class io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonP public synthetic fun fromValueOrNull (Ljava/lang/Object;)Ljava/lang/Enum; } -public final class io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/ColorScheme$Companion; public static final field Dark Lio/github/edricchan03/androidx/browser/ktx/enums/ColorScheme; public static final field Light Lio/github/edricchan03/androidx/browser/ktx/enums/ColorScheme; public static final field System Lio/github/edricchan03/androidx/browser/ktx/enums/ColorScheme; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/ColorScheme; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/ColorScheme; } @@ -185,13 +191,14 @@ public final class io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme$ public synthetic fun fromValueOrNull (Ljava/lang/Object;)Ljava/lang/Enum; } -public final class io/github/edricchan03/androidx/browser/ktx/enums/ShareState : java/lang/Enum { +public final class io/github/edricchan03/androidx/browser/ktx/enums/ShareState : java/lang/Enum, io/github/edricchan03/androidx/common/enums/ValueEnum { public static final field Companion Lio/github/edricchan03/androidx/browser/ktx/enums/ShareState$Companion; public static final field Default Lio/github/edricchan03/androidx/browser/ktx/enums/ShareState; public static final field Off Lio/github/edricchan03/androidx/browser/ktx/enums/ShareState; public static final field On Lio/github/edricchan03/androidx/browser/ktx/enums/ShareState; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun getValue ()I + public fun getValue ()Ljava/lang/Integer; + public synthetic fun getValue ()Ljava/lang/Object; public static fun valueOf (Ljava/lang/String;)Lio/github/edricchan03/androidx/browser/ktx/enums/ShareState; public static fun values ()[Lio/github/edricchan03/androidx/browser/ktx/enums/ShareState; } diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior.kt index a1dc290..83c9ff8 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivityHeightResizeBehavior.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * Sets the resize behaviour for the custom tab activity. @@ -18,13 +19,15 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.0.1 * @see io.github.edricchan03.androidx.browser.ktx.setInitialActivityHeightPx * @see CustomTabsIntent.Builder.setInitialActivityHeightPx */ public enum class ActivityHeightResizeBehavior( - @CustomTabsIntent.ActivityHeightResizeBehavior public val value: Int -) { + @CustomTabsIntent.ActivityHeightResizeBehavior public override val value: Int +) : ValueEnum { /** * Applies the default height resize behavior for the Custom Tab Activity * when it behaves as a bottom sheet. diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType.kt index d03db4d..a866905 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetDecorationType.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * The type of the decoration that will be used to separate the side sheet from the @@ -20,6 +21,8 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.3.0 * @see CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_DECORATION_TYPE * @see CustomTabsIntent.Builder.setActivitySideSheetDecorationType @@ -27,8 +30,8 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * @see io.github.edricchan03.androidx.browser.ktx.activitySideSheetDecorationType */ public enum class ActivitySideSheetDecorationType( - @CustomTabsIntent.ActivitySideSheetDecorationType public val value: Int -) { + @CustomTabsIntent.ActivitySideSheetDecorationType public override val value: Int +) : ValueEnum { /** * Side sheet's default decoration type. * Same as [Shadow]. diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition.kt index 7586c9c..84b019f 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetPosition.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * Specifies the position of the side sheet. @@ -18,6 +19,8 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.3.0 * @see CustomTabsIntent.EXTRA_ACTIVITY_SIDE_SHEET_POSITION * @see CustomTabsIntent.Builder.setActivitySideSheetPosition @@ -25,8 +28,8 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * @see io.github.edricchan03.androidx.browser.ktx.activitySideSheetPosition */ public enum class ActivitySideSheetPosition( - @CustomTabsIntent.ActivitySideSheetPosition public val value: Int -) { + @CustomTabsIntent.ActivitySideSheetPosition public override val value: Int +) : ValueEnum { /** * Applies the default position for the Custom Tab Activity when it behaves as a side sheet. * Same as [End]. diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition.kt index 54038aa..0927581 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ActivitySideSheetRoundedCornersPosition.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * The type of rounded corners that will be used for the side sheet. @@ -18,14 +19,16 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.3.0 * @see io.github.edricchan03.androidx.browser.ktx.activitySideSheetRoundedCornersPosition * @see io.github.edricchan03.androidx.browser.ktx.setActivitySideSheetRoundedCornersPosition * @see CustomTabsIntent.Builder.setActivitySideSheetRoundedCornersPosition */ public enum class ActivitySideSheetRoundedCornersPosition( - @CustomTabsIntent.ActivitySideSheetRoundedCornersPosition public val value: Int -) { + @CustomTabsIntent.ActivitySideSheetRoundedCornersPosition public override val value: Int +) : ValueEnum { /** * Side sheet's default rounded corner configuration. * Same as [None]. diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition.kt index ec1ec48..78a1a54 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/CloseButtonPosition.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * The position of the close button. @@ -18,13 +19,15 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.0.1 * @see io.github.edricchan03.androidx.browser.ktx.setCloseButtonPosition * @see CustomTabsIntent.Builder.setCloseButtonPosition */ public enum class CloseButtonPosition( - @CustomTabsIntent.CloseButtonPosition public val value: Int -) { + @CustomTabsIntent.CloseButtonPosition public override val value: Int +) : ValueEnum { /** * Same as [CloseButtonPosition.Start]. * @since 0.0.1 diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme.kt index 823b9e9..5117c6a 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ColorScheme.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * The colour scheme to use. @@ -18,13 +19,15 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.0.1 * @see io.github.edricchan03.androidx.browser.ktx.setColorScheme * @see CustomTabsIntent.Builder.setColorScheme */ public enum class ColorScheme( - @CustomTabsIntent.ColorScheme public val value: Int -) { + @CustomTabsIntent.ColorScheme public override val value: Int +) : ValueEnum { /** * Applies either a light or dark colour scheme to the user interface in * the custom tab depending on the user's system settings. diff --git a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ShareState.kt b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ShareState.kt index 3aea114..d37c03f 100644 --- a/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ShareState.kt +++ b/androidx/browser/browser-ktx/src/main/kotlin/io/github/edricchan03/androidx/browser/ktx/enums/ShareState.kt @@ -2,6 +2,7 @@ package io.github.edricchan03.androidx.browser.ktx.enums import androidx.browser.customtabs.CustomTabsIntent import io.github.edricchan03.androidx.common.enums.EnumFromValue +import io.github.edricchan03.androidx.common.enums.ValueEnum /** * The share state to use. @@ -18,13 +19,15 @@ import io.github.edricchan03.androidx.common.enums.EnumFromValue * * @property value The numerical representation. * + * From version 0.3.0, this enum class implements the [ValueEnum] interface, which + * contains the [ValueEnum.value] property. * @since 0.0.1 * @see io.github.edricchan03.androidx.browser.ktx.setShareState * @see CustomTabsIntent.Builder.setShareState */ public enum class ShareState( - @CustomTabsIntent.ShareState public val value: Int -) { + @CustomTabsIntent.ShareState public override val value: Int +) : ValueEnum { /** * Applies the default share settings depending on the browser. * @since 0.0.1