diff --git a/demo-app/src/main/AndroidManifest.xml b/demo-app/src/main/AndroidManifest.xml
index bb1141d01..38d9b6426 100644
--- a/demo-app/src/main/AndroidManifest.xml
+++ b/demo-app/src/main/AndroidManifest.xml
@@ -56,6 +56,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ when (quickEditorResult) {
+ GravatarQuickEditorResult.AVATAR_SELECTED -> {
+ profileChanges++
+ Toast.makeText(this, "Avatar selected", Toast.LENGTH_SHORT).show()
+ }
+
+ GravatarQuickEditorResult.DISMISSED -> {
+ Toast.makeText(this, "Dismissed", Toast.LENGTH_SHORT).show()
+ }
+
+ else -> {
+ Toast.makeText(this, "Unexpected...", Toast.LENGTH_SHORT).show()
+ }
+ }
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_quick_editor_test)
@@ -41,9 +66,12 @@ class QuickEditorTestActivity : AppCompatActivity() {
private fun setupViews() {
val profileCard = findViewById(R.id.profile_card)
val btnUpdateAvatar = findViewById
+```
+
+_Note the important difference here: the `tools:node="merge"` attribute. This is necessary to merge the intent filter with the one defined in the library._
+
+The `GravatarQuickEditorActivity` defines an Activity Result contract that you can use to launch the Quick Editor and handle the result. Here's an example of how you can use it:
+
+```kotlin
+private val getQEResult = registerForActivityResult(GetQuickEditorResult()) { quickEditorResult ->
+ when (quickEditorResult) {
+ GravatarQuickEditorResult.AVATAR_SELECTED -> { ... }
+
+ GravatarQuickEditorResult.DISMISSED -> { ... }
+
+ else -> { ... }
+ }
+}
+
+getQEResult.launch(
+ GravatarQuickEditorActivity.GravatarEditorActivityArguments(
+ GravatarQuickEditorParams { ... },
+ AuthenticationMethod.OAuth(
+ OAuthParams { ... },
+ ),
+ ),
+)
+```
+
+It's important to note that using the `GravatarQuickEditorActivity` you'll only receive the result of the Quick Editor when it's dismissed not instantly as with using the `@Composable` component from your `singleTask` activity (see [Section 1.1](#11-using-you-own-activity-with-androidlaunchmodesingletask-recommended)).
+
+In the `demo-app` you can find a detailed implementation showing how to use the provided activity. See `QuickEditorTestActivity`.
+
#### Exclude Data Store files from Android backup (optional, but recommended)
Data Store files are subject to Android backups. Encrypted files from the backup won't work when restored on a different device so we have to exclude those files.
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index af812cff1..5a8a9efe0 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -90,5 +90,6 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
openapi-generator = { id = "org.openapi.generator", version.ref = "openapi" }
+parcelize = { id = "kotlin-parcelize" }
publish-to-s3 = { id = "com.automattic.android.publish-to-s3", version.ref = "publishToS3" }
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }
diff --git a/gravatar-quickeditor/api/gravatar-quickeditor.api b/gravatar-quickeditor/api/gravatar-quickeditor.api
index 26cc58984..db301ad0a 100644
--- a/gravatar-quickeditor/api/gravatar-quickeditor.api
+++ b/gravatar-quickeditor/api/gravatar-quickeditor.api
@@ -10,6 +10,51 @@ public final class com/gravatar/quickeditor/GravatarQuickEditor {
public static synthetic fun show$default (Landroidx/fragment/app/Fragment;Lcom/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams;Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
}
+public final class com/gravatar/quickeditor/ui/GetQuickEditorResult : androidx/activity/result/contract/ActivityResultContract {
+ public static final field $stable I
+ public fun ()V
+ public fun createIntent (Landroid/content/Context;Lcom/gravatar/quickeditor/ui/GravatarQuickEditorActivity$GravatarEditorActivityArguments;)Landroid/content/Intent;
+ public synthetic fun createIntent (Landroid/content/Context;Ljava/lang/Object;)Landroid/content/Intent;
+ public fun parseResult (ILandroid/content/Intent;)Lcom/gravatar/quickeditor/ui/GravatarQuickEditorResult;
+ public synthetic fun parseResult (ILandroid/content/Intent;)Ljava/lang/Object;
+}
+
+public final class com/gravatar/quickeditor/ui/GravatarQuickEditorActivity : androidx/appcompat/app/AppCompatActivity {
+ public static final field $stable I
+ public static final field ACTIVITY_RESULT Ljava/lang/String;
+ public static final field EXTRA_QE_ARGUMENTS Ljava/lang/String;
+ public static final field RESULT_AVATAR_SELECTED I
+ public static final field RESULT_DISMISSED I
+ public fun ()V
+ public fun finish ()V
+}
+
+public final class com/gravatar/quickeditor/ui/GravatarQuickEditorActivity$GravatarEditorActivityArguments : android/os/Parcelable {
+ public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
+ public fun (Lcom/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams;Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod;)V
+ public fun describeContents ()I
+ public final fun getAuthenticationMethod ()Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod;
+ public final fun getGravatarQuickEditorParams ()Lcom/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
+}
+
+public final class com/gravatar/quickeditor/ui/GravatarQuickEditorActivity$GravatarEditorActivityArguments$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/GravatarQuickEditorActivity$GravatarEditorActivityArguments;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/GravatarQuickEditorActivity$GravatarEditorActivityArguments;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
+}
+
+public final class com/gravatar/quickeditor/ui/GravatarQuickEditorResult : java/lang/Enum {
+ public static final field AVATAR_SELECTED Lcom/gravatar/quickeditor/ui/GravatarQuickEditorResult;
+ public static final field DISMISSED Lcom/gravatar/quickeditor/ui/GravatarQuickEditorResult;
+ public static fun getEntries ()Lkotlin/enums/EnumEntries;
+ public static fun valueOf (Ljava/lang/String;)Lcom/gravatar/quickeditor/ui/GravatarQuickEditorResult;
+ public static fun values ()[Lcom/gravatar/quickeditor/ui/GravatarQuickEditorResult;
+}
+
public final class com/gravatar/quickeditor/ui/avatarpicker/ComposableSingletons$AvatarPickerKt {
public static final field INSTANCE Lcom/gravatar/quickeditor/ui/avatarpicker/ComposableSingletons$AvatarPickerKt;
public static field lambda-1 Lkotlin/jvm/functions/Function2;
@@ -169,46 +214,90 @@ public final class com/gravatar/quickeditor/ui/components/ComposableSingletons$V
public final fun getLambda-4$gravatar_quickeditor_release ()Lkotlin/jvm/functions/Function2;
}
-public abstract class com/gravatar/quickeditor/ui/editor/AuthenticationMethod {
+public abstract class com/gravatar/quickeditor/ui/editor/AuthenticationMethod : android/os/Parcelable {
public static final field $stable I
}
public final class com/gravatar/quickeditor/ui/editor/AuthenticationMethod$Bearer : com/gravatar/quickeditor/ui/editor/AuthenticationMethod {
public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun (Ljava/lang/String;)V
+ public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getToken ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
+}
+
+public final class com/gravatar/quickeditor/ui/editor/AuthenticationMethod$Bearer$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod$Bearer;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod$Bearer;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
}
public final class com/gravatar/quickeditor/ui/editor/AuthenticationMethod$OAuth : com/gravatar/quickeditor/ui/editor/AuthenticationMethod {
public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun (Lcom/gravatar/quickeditor/ui/oauth/OAuthParams;)V
+ public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getOAuthParams ()Lcom/gravatar/quickeditor/ui/oauth/OAuthParams;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
+}
+
+public final class com/gravatar/quickeditor/ui/editor/AuthenticationMethod$OAuth$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod$OAuth;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/editor/AuthenticationMethod$OAuth;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
}
-public abstract class com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout {
+public abstract class com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout : android/os/Parcelable {
public static final field $stable I
}
public final class com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Horizontal : com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout {
public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public static final field INSTANCE Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Horizontal;
+ public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
+}
+
+public final class com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Horizontal$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Horizontal;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Horizontal;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
}
public final class com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Vertical : com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout {
public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public static final field INSTANCE Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Vertical;
+ public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
+}
+
+public final class com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Vertical$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Vertical;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout$Vertical;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
}
public abstract class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorDismissReason {
@@ -239,14 +328,17 @@ public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorDismiss
public fun toString ()Ljava/lang/String;
}
-public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams {
+public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams : android/os/Parcelable {
public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public synthetic fun (Lcom/gravatar/types/Email;Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getAvatarPickerContentLayout ()Lcom/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout;
public final fun getEmail ()Lcom/gravatar/types/Email;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
}
public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams$Builder {
@@ -261,6 +353,14 @@ public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams$
public final synthetic fun setEmail (Lcom/gravatar/types/Email;)V
}
+public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
+}
+
public final class com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParamsKt {
public static final synthetic fun GravatarQuickEditorParams (Lkotlin/jvm/functions/Function1;)Lcom/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams;
}
@@ -283,14 +383,17 @@ public final class com/gravatar/quickeditor/ui/oauth/ComposableSingletons$OAuthP
public final fun getLambda-1$gravatar_quickeditor_release ()Lkotlin/jvm/functions/Function2;
}
-public final class com/gravatar/quickeditor/ui/oauth/OAuthParams {
+public final class com/gravatar/quickeditor/ui/oauth/OAuthParams : android/os/Parcelable {
public static final field $stable I
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getClientId ()Ljava/lang/String;
public final fun getRedirectUri ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
}
public final class com/gravatar/quickeditor/ui/oauth/OAuthParams$Builder {
@@ -305,6 +408,14 @@ public final class com/gravatar/quickeditor/ui/oauth/OAuthParams$Builder {
public final synthetic fun setRedirectUri (Ljava/lang/String;)V
}
+public final class com/gravatar/quickeditor/ui/oauth/OAuthParams$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/quickeditor/ui/oauth/OAuthParams;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/quickeditor/ui/oauth/OAuthParams;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
+}
+
public final class com/gravatar/quickeditor/ui/oauth/OAuthParamsKt {
public static final synthetic fun OAuthParams (Lkotlin/jvm/functions/Function1;)Lcom/gravatar/quickeditor/ui/oauth/OAuthParams;
}
diff --git a/gravatar-quickeditor/build.gradle.kts b/gravatar-quickeditor/build.gradle.kts
index 8d9aa4085..4f47afb4d 100644
--- a/gravatar-quickeditor/build.gradle.kts
+++ b/gravatar-quickeditor/build.gradle.kts
@@ -2,6 +2,7 @@ import org.jetbrains.dokka.gradle.DokkaTaskPartial
plugins {
id(libs.plugins.android.library.get().pluginId)
+ alias(libs.plugins.parcelize)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.publish.to.s3)
// Ktlint
diff --git a/gravatar-quickeditor/src/main/AndroidManifest.xml b/gravatar-quickeditor/src/main/AndroidManifest.xml
index c09d6602e..effe38e86 100644
--- a/gravatar-quickeditor/src/main/AndroidManifest.xml
+++ b/gravatar-quickeditor/src/main/AndroidManifest.xml
@@ -5,6 +5,12 @@
+
+
= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ overrideActivityTransition(OVERRIDE_TRANSITION_OPEN, 0, 0)
+ } else {
+ @Suppress("DEPRECATION")
+ overridePendingTransition(0, 0)
+ }
+
+ val arguments = requireNotNull(intent.parcelable(EXTRA_QE_ARGUMENTS))
+ setContent {
+ GravatarQuickEditorBottomSheet(
+ gravatarQuickEditorParams = arguments.gravatarQuickEditorParams,
+ authenticationMethod = arguments.authenticationMethod,
+ onAvatarSelected = { avatarHasChanged = true },
+ onDismiss = { finishWithResult() },
+ )
+ }
+ }
+
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ outState.putBoolean(AVATAR_HAS_CHANGED_KEY, avatarHasChanged)
+ }
+
+ override fun onRestoreInstanceState(savedInstanceState: Bundle) {
+ super.onRestoreInstanceState(savedInstanceState)
+ avatarHasChanged = savedInstanceState.getBoolean(AVATAR_HAS_CHANGED_KEY)
+ }
+
+ private fun finishWithResult() {
+ val resultIntent = Intent().apply {
+ putExtra(
+ ACTIVITY_RESULT,
+ if (avatarHasChanged) {
+ RESULT_AVATAR_SELECTED
+ } else {
+ RESULT_DISMISSED
+ },
+ )
+ }
+ setResult(Activity.RESULT_OK, resultIntent)
+ finish()
+ }
+
+ override fun finish() {
+ super.finish()
+ if (SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ overrideActivityTransition(OVERRIDE_TRANSITION_CLOSE, 0, 0)
+ } else {
+ @Suppress("DEPRECATION")
+ overridePendingTransition(0, 0)
+ }
+ }
+
+ /**
+ * Arguments for the [GravatarQuickEditorActivity].
+ *
+ * [gravatarQuickEditorParams] The parameters to configure the Quick Editor.
+ * [authenticationMethod] The method used for authentication with the Gravatar REST API.
+ */
+ @Parcelize
+ public class GravatarEditorActivityArguments(
+ public val gravatarQuickEditorParams: GravatarQuickEditorParams,
+ public val authenticationMethod: AuthenticationMethod,
+ ) : Parcelable
+
+ internal companion object {
+ const val EXTRA_QE_ARGUMENTS: String = "qeArguments"
+ private const val AVATAR_HAS_CHANGED_KEY: String = "avatarHasChanged"
+
+ const val ACTIVITY_RESULT: String = "activityResult"
+ const val RESULT_DISMISSED: Int = 1000
+ const val RESULT_AVATAR_SELECTED: Int = 1001
+ }
+}
+
+/**
+ * Activity result contract to get the result from the [GravatarQuickEditorActivity].
+ *
+ * @see GravatarQuickEditorResult
+ * @see GravatarEditorActivityArguments
+ */
+public class GetQuickEditorResult :
+ ActivityResultContract() {
+ override fun createIntent(context: Context, input: GravatarEditorActivityArguments): Intent {
+ return Intent(context, GravatarQuickEditorActivity::class.java).apply {
+ putExtra(GravatarQuickEditorActivity.EXTRA_QE_ARGUMENTS, input)
+ }
+ }
+
+ override fun parseResult(resultCode: Int, intent: Intent?): GravatarQuickEditorResult? {
+ return when (intent?.getIntExtra(GravatarQuickEditorActivity.ACTIVITY_RESULT, -1)) {
+ GravatarQuickEditorActivity.RESULT_AVATAR_SELECTED -> GravatarQuickEditorResult.AVATAR_SELECTED
+ GravatarQuickEditorActivity.RESULT_DISMISSED -> GravatarQuickEditorResult.DISMISSED
+ else -> null
+ }
+ }
+}
+
+/**
+ * Result enum for the [GravatarQuickEditorActivity].
+ */
+public enum class GravatarQuickEditorResult {
+ AVATAR_SELECTED,
+ DISMISSED,
+}
+
+private inline fun Intent.parcelable(key: String): T? = when {
+ SDK_INT >= TIRAMISU -> getParcelableExtra(key, T::class.java)
+ else -> {
+ @Suppress("DEPRECATION")
+ getParcelableExtra(key) as? T
+ }
+}
diff --git a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AuthenticationMethod.kt b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AuthenticationMethod.kt
index 1f1560e79..43a542a96 100644
--- a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AuthenticationMethod.kt
+++ b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AuthenticationMethod.kt
@@ -1,12 +1,15 @@
package com.gravatar.quickeditor.ui.editor
+import android.os.Parcelable
import com.gravatar.quickeditor.ui.oauth.OAuthParams
+import kotlinx.parcelize.Parcelize
import java.util.Objects
/**
* Represents the authentication method used for the Gravatar Quick Editor.
*/
-public sealed class AuthenticationMethod {
+@Parcelize
+public sealed class AuthenticationMethod : Parcelable {
/**
* OAuth authentication method.
*
diff --git a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout.kt b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout.kt
index 1320c0948..6d25c5ec4 100644
--- a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout.kt
+++ b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/AvatarPickerContentLayout.kt
@@ -1,16 +1,22 @@
package com.gravatar.quickeditor.ui.editor
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
/**
* The layout direction of the Avatar picker in the Quick Editor.
*/
-public sealed class AvatarPickerContentLayout {
+@Parcelize
+public sealed class AvatarPickerContentLayout : Parcelable {
/**
- * Horizontal scrolling for the Avatars.
+ * Horizontal layout.
*/
+ @Parcelize
public data object Horizontal : AvatarPickerContentLayout()
/**
- * Vertical scrolling for the Avatars.
+ * Vertical layout.
*/
+ @Parcelize
public data object Vertical : AvatarPickerContentLayout()
}
diff --git a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams.kt b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams.kt
index f4941d0f9..511fd1161 100644
--- a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams.kt
+++ b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/editor/GravatarQuickEditorParams.kt
@@ -1,6 +1,8 @@
package com.gravatar.quickeditor.ui.editor
+import android.os.Parcelable
import com.gravatar.types.Email
+import kotlinx.parcelize.Parcelize
import java.util.Objects
/**
@@ -9,10 +11,11 @@ import java.util.Objects
* @property email The email of the user
* @property avatarPickerContentLayout The layout direction used in the Avatar Picker.
*/
+@Parcelize
public class GravatarQuickEditorParams private constructor(
public val email: Email,
public val avatarPickerContentLayout: AvatarPickerContentLayout,
-) {
+) : Parcelable {
override fun toString(): String =
"GravatarQuickEditorParams(email='$email', avatarPickerContentLayout=$avatarPickerContentLayout)"
diff --git a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/oauth/OAuthParams.kt b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/oauth/OAuthParams.kt
index 0aba3e384..3484cc1f9 100644
--- a/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/oauth/OAuthParams.kt
+++ b/gravatar-quickeditor/src/main/java/com/gravatar/quickeditor/ui/oauth/OAuthParams.kt
@@ -1,5 +1,7 @@
package com.gravatar.quickeditor.ui.oauth
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
import java.util.Objects
/**
@@ -8,10 +10,11 @@ import java.util.Objects
* @property clientId The clientId of your WP.com application
* @property redirectUri The redirect URI configured for your WP.com application
*/
+@Parcelize
public class OAuthParams private constructor(
public val clientId: String,
public val redirectUri: String,
-) {
+) : Parcelable {
override fun toString(): String = "OAuthParams(clientId=$clientId, redirectUri=$redirectUri)"
override fun equals(other: Any?): Boolean {
diff --git a/gravatar-quickeditor/src/main/res/values/themes.xml b/gravatar-quickeditor/src/main/res/values/themes.xml
new file mode 100644
index 000000000..d3465386e
--- /dev/null
+++ b/gravatar-quickeditor/src/main/res/values/themes.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/gravatar/api/gravatar.api b/gravatar/api/gravatar.api
index 7f252229c..2d6f9f5a3 100644
--- a/gravatar/api/gravatar.api
+++ b/gravatar/api/gravatar.api
@@ -781,10 +781,21 @@ public final class com/gravatar/services/ProfileService {
public final fun retrieveCatching (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
-public final class com/gravatar/types/Email {
+public final class com/gravatar/types/Email : android/os/Parcelable {
+ public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun (Ljava/lang/String;)V
+ public fun describeContents ()I
public final fun hash ()Lcom/gravatar/types/Hash;
public fun toString ()Ljava/lang/String;
+ public fun writeToParcel (Landroid/os/Parcel;I)V
+}
+
+public final class com/gravatar/types/Email$Creator : android/os/Parcelable$Creator {
+ public fun ()V
+ public final fun createFromParcel (Landroid/os/Parcel;)Lcom/gravatar/types/Email;
+ public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
+ public final fun newArray (I)[Lcom/gravatar/types/Email;
+ public synthetic fun newArray (I)[Ljava/lang/Object;
}
public final class com/gravatar/types/Hash {
diff --git a/gravatar/build.gradle.kts b/gravatar/build.gradle.kts
index bc26a1e0b..2e0b57fad 100644
--- a/gravatar/build.gradle.kts
+++ b/gravatar/build.gradle.kts
@@ -3,6 +3,7 @@ import org.jetbrains.dokka.gradle.DokkaTaskPartial
plugins {
id(libs.plugins.android.library.get().pluginId)
alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.parcelize)
// Ktlint
alias(libs.plugins.ktlint)
// Detekt
diff --git a/gravatar/src/main/java/com/gravatar/types/Email.kt b/gravatar/src/main/java/com/gravatar/types/Email.kt
index 8b70a0fc0..475e472b1 100644
--- a/gravatar/src/main/java/com/gravatar/types/Email.kt
+++ b/gravatar/src/main/java/com/gravatar/types/Email.kt
@@ -1,11 +1,15 @@
package com.gravatar.types
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
/**
* Email address representation.
*
* @param address the email address
*/
-public class Email(private val address: String) {
+@Parcelize
+public class Email(private val address: String) : Parcelable {
/**
* Get a Gravatar hash for a given email address.
*