Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 9e3cb1c

Browse files
committed
Add Parcelable
1 parent 3a412f6 commit 9e3cb1c

File tree

18 files changed

+49
-27
lines changed

18 files changed

+49
-27
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.dropbox.componentbox.foundation
2+
3+
actual typealias Parcelable = android.os.Parcelable

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/BorderStroke.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ import kotlinx.serialization.Serializable
66
data class BorderStroke(
77
val width: Int,
88
val color: Color
9-
)
9+
): Parcelable

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/ButtonVariant.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.dropbox.componentbox.foundation
22

33

44
@kotlinx.serialization.Serializable
5-
enum class ButtonVariant {
5+
enum class ButtonVariant: Parcelable {
66
Contained,
77
Text,
88
Outlined,

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/Component.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.dropbox.componentbox.foundation
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
sealed class Component {
6+
sealed class Component: Parcelable {
77

88
@Serializable
99
data class Box(
@@ -13,7 +13,7 @@ sealed class Component {
1313
var horizontalArrangement: Arrangement? = null,
1414
var verticalAlignment: Alignment? = null,
1515
var action: String? = null,
16-
) : Component()
16+
) : Component(), Parcelable
1717

1818
@Serializable
1919
data class Row(
@@ -24,7 +24,7 @@ sealed class Component {
2424
var verticalAlignment: Alignment? = null,
2525
var action: String? = null,
2626
var isLazy: Boolean? = null
27-
) : Component()
27+
) : Component(), Parcelable
2828

2929
@Serializable
3030
data class Column(
@@ -36,7 +36,7 @@ sealed class Component {
3636
var isLazy: Boolean? = null,
3737
var isTable: Boolean? = null,
3838
var action: String? = null
39-
) : Component()
39+
) : Component(), Parcelable
4040

4141
@Serializable
4242
data class Text(
@@ -45,7 +45,7 @@ sealed class Component {
4545
var text: String? = null,
4646
var color: Color? = null,
4747
var textStyle: String? = null
48-
) : Component()
48+
) : Component(), Parcelable
4949

5050
@Serializable
5151
data class Button(
@@ -55,15 +55,15 @@ sealed class Component {
5555
var isEnabled: Boolean? = null,
5656
var action: String? = null,
5757
var variant: String? = null,
58-
) : Component()
58+
) : Component(), Parcelable
5959

6060
@Serializable
6161
data class Switch(
6262
val id: String,
6363
var isChecked: Boolean? = null,
6464
var modifier: Modifier? = null,
6565
var action: String? = null,
66-
) : Component()
66+
) : Component(), Parcelable
6767

6868
@Serializable
6969
data class Drawable(
@@ -74,7 +74,7 @@ sealed class Component {
7474
var modifier: Modifier? = null,
7575
var alignment: Alignment? = null,
7676
var contentScale: ContentScale? = null
77-
) : Component()
77+
) : Component(), Parcelable
7878

7979
@Serializable
8080
data class Vector(
@@ -84,7 +84,7 @@ sealed class Component {
8484
var alignment: Alignment? = null,
8585
var contentScale: ContentScale? = null,
8686
var color: Color? = null
87-
) : Component()
87+
) : Component(), Parcelable
8888

8989
@Serializable
9090
data class Surface(
@@ -96,6 +96,6 @@ sealed class Component {
9696
var borderStroke: BorderStroke? = null,
9797
var elevation: Int? = null,
9898
var components: MutableList<Component>? = null,
99-
) : Component()
99+
) : Component(), Parcelable
100100
}
101101

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/ComponentBox.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ package com.dropbox.componentbox.foundation
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
sealed class ComponentBox {
6+
sealed class ComponentBox: Parcelable {
77
@Serializable
88
data class Screen(
99
val title: String?,
1010
val verticalArrangement: Arrangement,
1111
val horizontalAlignment: Alignment,
1212
val components: List<Component>
13-
) : ComponentBox()
13+
) : ComponentBox(), Parcelable
1414

1515
@Serializable
1616
data class Modal(
1717
val verticalArrangement: Arrangement,
1818
val horizontalAlignment: Alignment,
1919
val components: List<Component>
20-
) : ComponentBox()
20+
) : ComponentBox(), Parcelable
2121

2222
@Serializable
2323
data class Banner(
2424
val verticalArrangement: Arrangement,
2525
val horizontalAlignment: Alignment,
2626
val components: List<Component>
27-
) : ComponentBox()
27+
) : ComponentBox(), Parcelable
2828
}

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/ComponentBoxType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.dropbox.componentbox.foundation
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
enum class ComponentBoxType {
6+
enum class ComponentBoxType: Parcelable {
77
Screen,
88
Modal,
99
Banner

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/ComponentType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.dropbox.componentbox.foundation
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
enum class ComponentType {
6+
enum class ComponentType: Parcelable {
77
Box,
88
Button,
99
Column,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.dropbox.componentbox.foundation
2+
3+
expect interface Parcelable

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/Shape.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.dropbox.componentbox.foundation
33
import kotlinx.serialization.Serializable
44

55
@Serializable
6-
enum class Shape {
6+
enum class Shape: Parcelable {
77
RectangleShape,
88
RoundedCornerShape,
99
CircleShape

componentbox/src/commonMain/kotlin/com/dropbox/componentbox/foundation/color.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class Color(
1212
val title: String,
1313
val light: Long,
1414
val dark: Long
15-
)
15+
): Parcelable
1616

1717
interface Colors {
1818
val primary: Color

0 commit comments

Comments
 (0)