Skip to content

Commit 9487648

Browse files
authored
Merge pull request #54 from cheonjaeung/boxgriditemspan-default
Add default parameter to BoxGridItemSpan
2 parents c2e18ca + 95cb74c commit 9487648

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

grid/api/android/grid.api

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
public final class com/cheonjaeung/compose/grid/BoxGridItemSpan {
2-
public static final field Companion Lcom/cheonjaeung/compose/grid/BoxGridItemSpan$Companion;
32
public static final synthetic fun box-impl (J)Lcom/cheonjaeung/compose/grid/BoxGridItemSpan;
43
public static final fun component1-impl (J)I
54
public static final fun component2-impl (J)I
@@ -15,9 +14,6 @@ public final class com/cheonjaeung/compose/grid/BoxGridItemSpan {
1514
public final synthetic fun unbox-impl ()J
1615
}
1716

18-
public final class com/cheonjaeung/compose/grid/BoxGridItemSpan$Companion {
19-
}
20-
2117
public abstract interface class com/cheonjaeung/compose/grid/BoxGridItemSpanScope {
2218
public abstract fun getMaxColumnSpan ()I
2319
public abstract fun getMaxCurrentColumnSpan ()I
@@ -38,6 +34,7 @@ public final class com/cheonjaeung/compose/grid/BoxGridScope$DefaultImpls {
3834

3935
public final class com/cheonjaeung/compose/grid/BoxGridSpanKt {
4036
public static final fun BoxGridItemSpan (II)J
37+
public static synthetic fun BoxGridItemSpan$default (IIILjava/lang/Object;)J
4138
}
4239

4340
public abstract interface annotation class com/cheonjaeung/compose/grid/ExperimentalGridApi : java/lang/annotation/Annotation {

grid/api/jvm/grid.api

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
public final class com/cheonjaeung/compose/grid/BoxGridItemSpan {
2-
public static final field Companion Lcom/cheonjaeung/compose/grid/BoxGridItemSpan$Companion;
32
public static final synthetic fun box-impl (J)Lcom/cheonjaeung/compose/grid/BoxGridItemSpan;
43
public static final fun component1-impl (J)I
54
public static final fun component2-impl (J)I
@@ -15,9 +14,6 @@ public final class com/cheonjaeung/compose/grid/BoxGridItemSpan {
1514
public final synthetic fun unbox-impl ()J
1615
}
1716

18-
public final class com/cheonjaeung/compose/grid/BoxGridItemSpan$Companion {
19-
}
20-
2117
public abstract interface class com/cheonjaeung/compose/grid/BoxGridItemSpanScope {
2218
public abstract fun getMaxColumnSpan ()I
2319
public abstract fun getMaxCurrentColumnSpan ()I
@@ -38,6 +34,7 @@ public final class com/cheonjaeung/compose/grid/BoxGridScope$DefaultImpls {
3834

3935
public final class com/cheonjaeung/compose/grid/BoxGridSpanKt {
4036
public static final fun BoxGridItemSpan (II)J
37+
public static synthetic fun BoxGridItemSpan$default (IIILjava/lang/Object;)J
4138
}
4239

4340
public abstract interface annotation class com/cheonjaeung/compose/grid/ExperimentalGridApi : java/lang/annotation/Annotation {

grid/src/commonMain/kotlin/com/cheonjaeung/compose/grid/BoxGridMeasurePolicy.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private class BoxGridMeasureHelper(
147147
val span = if (spanFunction != null) {
148148
with(spanScope) { spanFunction() }
149149
} else {
150-
BoxGridItemSpan.Default
150+
BoxGridItemSpan()
151151
}
152152
val (rowSpan, columnSpan) = span
153153

grid/src/commonMain/kotlin/com/cheonjaeung/compose/grid/BoxGridSpan.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlin.jvm.JvmInline
1010
/**
1111
* Create a [BoxGridItemSpan] from the given [row] and [column] span size parameter..
1212
*/
13-
fun BoxGridItemSpan(row: Int, column: Int): BoxGridItemSpan {
13+
fun BoxGridItemSpan(row: Int = 1, column: Int = 1): BoxGridItemSpan {
1414
require(row > 0) { "span must be bigger than zero but rowSpan is $row" }
1515
require(column > 0) { "span must be bigger than zero but columnSpan is $column" }
1616
return BoxGridItemSpan(packedValue = packInts(row, column))
@@ -35,11 +35,6 @@ value class BoxGridItemSpan internal constructor(private val packedValue: Long)
3535

3636
@Stable
3737
operator fun component2(): Int = columnSpan
38-
39-
companion object {
40-
@Stable
41-
internal val Default = BoxGridItemSpan(row = 1, column = 1)
42-
}
4338
}
4439

4540
/**

grid/src/test/java/com/cheonjaeung/compose/grid/BoxGridSpanTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class BoxGridSpanTest {
102102
modifier = Modifier
103103
.size(100.dp)
104104
.background(Color.Blue)
105-
.span { BoxGridItemSpan(row = 2, column = 1) }
105+
.span { BoxGridItemSpan(row = 2) }
106106
)
107107
Box(
108108
modifier = Modifier
@@ -118,7 +118,7 @@ class BoxGridSpanTest {
118118
.column(2)
119119
.size(100.dp)
120120
.background(Color.Yellow)
121-
.span { BoxGridItemSpan(row = 1, column = 2) }
121+
.span { BoxGridItemSpan(column = 2) }
122122
)
123123
}
124124
}
@@ -138,7 +138,7 @@ class BoxGridSpanTest {
138138
modifier = Modifier
139139
.size(100.dp)
140140
.background(Color.Blue)
141-
.span { BoxGridItemSpan(row = 2, column = 1) }
141+
.span { BoxGridItemSpan(row = 2) }
142142
)
143143
Box(
144144
modifier = Modifier
@@ -154,7 +154,7 @@ class BoxGridSpanTest {
154154
.column(2)
155155
.size(100.dp)
156156
.background(Color.Yellow)
157-
.span { BoxGridItemSpan(row = 1, column = 2) }
157+
.span { BoxGridItemSpan(column = 2) }
158158
)
159159
}
160160
}
@@ -174,7 +174,7 @@ class BoxGridSpanTest {
174174
modifier = Modifier
175175
.size(100.dp)
176176
.background(Color.Blue)
177-
.span { BoxGridItemSpan(row = maxRowSpan, column = 1) }
177+
.span { BoxGridItemSpan(row = maxRowSpan) }
178178
)
179179
Box(
180180
modifier = Modifier
@@ -215,15 +215,15 @@ class BoxGridSpanTest {
215215
.column(1)
216216
.size(100.dp)
217217
.background(Color.Green)
218-
.span { BoxGridItemSpan(row = maxCurrentRowSpan, column = 1) }
218+
.span { BoxGridItemSpan(row = maxCurrentRowSpan) }
219219
)
220220
Box(
221221
modifier = Modifier
222222
.row(2)
223223
.column(2)
224224
.size(100.dp)
225225
.background(Color.Yellow)
226-
.span { BoxGridItemSpan(row = 1, column = maxCurrentColumnSpan) }
226+
.span { BoxGridItemSpan(column = maxCurrentColumnSpan) }
227227
)
228228
}
229229
}

0 commit comments

Comments
 (0)