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

Commit 5fe2616

Browse files
oscar-adjafu888
authored andcommitted
[Compose] Fix warnings in MotionLayout.kt
For - Modifier should be first optional parameter (may be a breaking change) - explicit type - unused
1 parent 3a2a318 commit 5fe2616

File tree

1 file changed

+14
-12
lines changed
  • constraintlayout/compose/src/main/java/androidx/constraintlayout/compose

1 file changed

+14
-12
lines changed

constraintlayout/compose/src/main/java/androidx/constraintlayout/compose/MotionLayout.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ import kotlinx.coroutines.launch
5656
inline fun MotionLayout(
5757
start: ConstraintSet,
5858
end: ConstraintSet,
59+
modifier: Modifier = Modifier,
5960
transition: Transition? = null,
6061
progress: Float,
6162
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
62-
modifier: Modifier = Modifier,
6363
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
6464
crossinline content: @Composable MotionLayoutScope.() -> Unit
6565
) {
@@ -87,8 +87,8 @@ inline fun MotionLayout(
8787
inline fun MotionLayout(
8888
motionScene: MotionScene,
8989
progress: Float,
90-
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
9190
modifier: Modifier = Modifier,
91+
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
9292
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
9393
crossinline content: @Composable (MotionLayoutScope.() -> Unit),
9494
) {
@@ -118,10 +118,10 @@ inline fun MotionLayout(
118118
@Composable
119119
inline fun MotionLayout(
120120
motionScene: MotionScene,
121+
modifier: Modifier = Modifier,
121122
constraintSetName: String? = null,
122-
animationSpec: AnimationSpec<Float> = tween<Float>(),
123+
animationSpec: AnimationSpec<Float> = tween(),
123124
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
124-
modifier: Modifier = Modifier,
125125
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
126126
noinline finishedAnimationListener: (() -> Unit)? = null,
127127
crossinline content: @Composable (MotionLayoutScope.() -> Unit)
@@ -144,11 +144,11 @@ inline fun MotionLayout(
144144
inline fun MotionLayout(
145145
start: ConstraintSet,
146146
end: ConstraintSet,
147+
modifier: Modifier = Modifier,
147148
transition: Transition? = null,
148149
progress: Float,
149150
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
150151
informationReceiver: LayoutInformationReceiver? = null,
151-
modifier: Modifier = Modifier,
152152
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
153153
crossinline content: @Composable (MotionLayoutScope.() -> Unit)
154154
) {
@@ -166,15 +166,15 @@ inline fun MotionLayout(
166166
)
167167
}
168168

169-
@OptIn(ExperimentalMotionApi::class)
169+
@ExperimentalMotionApi
170170
@PublishedApi
171171
@Composable
172172
internal inline fun MotionLayoutCore(
173173
motionScene: MotionScene,
174+
modifier: Modifier = Modifier,
174175
constraintSetName: String? = null,
175-
animationSpec: AnimationSpec<Float> = tween<Float>(),
176+
animationSpec: AnimationSpec<Float> = tween(),
176177
debugFlag: MotionLayoutDebugFlags = MotionLayoutDebugFlags.NONE,
177-
modifier: Modifier = Modifier,
178178
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
179179
noinline finishedAnimationListener: (() -> Unit)? = null,
180180
crossinline content: @Composable (MotionLayoutScope.() -> Unit)
@@ -211,7 +211,8 @@ internal inline fun MotionLayoutCore(
211211
}
212212

213213
val targetConstraintSet = remember(motionScene, constraintSetName) {
214-
val targetEndContent = constraintSetName?.let { motionScene.getConstraintSet(constraintSetName) }
214+
val targetEndContent =
215+
constraintSetName?.let { motionScene.getConstraintSet(constraintSetName) }
215216
targetEndContent?.let { ConstraintSet(targetEndContent) }
216217
}
217218

@@ -270,8 +271,8 @@ internal inline fun MotionLayoutCore(
270271
internal inline fun MotionLayoutCore(
271272
motionScene: MotionScene,
272273
progress: Float,
273-
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
274274
modifier: Modifier = Modifier,
275+
debug: EnumSet<MotionLayoutDebugFlags> = EnumSet.of(MotionLayoutDebugFlags.NONE),
275276
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
276277
crossinline content: @Composable (MotionLayoutScope.() -> Unit),
277278
) {
@@ -316,11 +317,11 @@ internal inline fun MotionLayoutCore(
316317
internal inline fun MotionLayoutCore(
317318
start: ConstraintSet,
318319
end: ConstraintSet,
320+
modifier: Modifier = Modifier,
319321
transition: TransitionImpl? = null,
320322
motionProgress: MotionProgress,
321323
debugFlag: MotionLayoutDebugFlags = MotionLayoutDebugFlags.NONE,
322324
informationReceiver: LayoutInformationReceiver? = null,
323-
modifier: Modifier = Modifier,
324325
optimizationLevel: Int = Optimizer.OPTIMIZATION_STANDARD,
325326
crossinline content: @Composable MotionLayoutScope.() -> Unit
326327
) {
@@ -448,6 +449,7 @@ internal inline fun MotionLayoutCore(
448449
)
449450
}
450451

452+
@Suppress("unused")
451453
@LayoutScopeMarker
452454
class MotionLayoutScope @PublishedApi internal constructor(
453455
measurer: MotionMeasurer,
@@ -611,7 +613,7 @@ internal fun UpdateWithForcedIfNoUserChange(
611613
val forcedProgress = informationReceiver.getForcedProgress()
612614

613615
// Save the initial progress
614-
val lastUserProgress = remember { Ref<Float>().apply { value = currentUserProgress} }
616+
val lastUserProgress = remember { Ref<Float>().apply { value = currentUserProgress } }
615617

616618
if (!forcedProgress.isNaN() && lastUserProgress.value == currentUserProgress) {
617619
// Use the forced progress if the user progress hasn't changed

0 commit comments

Comments
 (0)