From f9976dee9b8686f5c71193d329256aa09393cfe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Cla=C3=9Fen?= Date: Thu, 2 Jun 2022 13:40:44 +0200 Subject: [PATCH] Updated samples --- .../burnoutcrew/android/ui/reorderlist/ReorderGrid.kt | 10 ++++++---- .../burnoutcrew/android/ui/reorderlist/ReorderList.kt | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderGrid.kt b/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderGrid.kt index 7c0e093..edb7079 100644 --- a/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderGrid.kt +++ b/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderGrid.kt @@ -65,7 +65,9 @@ private fun HorizontalGrid( contentPadding = PaddingValues(horizontal = 8.dp), verticalArrangement = Arrangement.spacedBy(4.dp), horizontalArrangement = Arrangement.spacedBy(4.dp), - modifier = modifier.reorderable(state).height(200.dp) + modifier = modifier + .reorderable(state).height(200.dp) + .detectReorderAfterLongPress(state) ) { items(vm.cats, { it.key }) { item -> ReorderableItem(state, item.key) { isDragging -> @@ -76,7 +78,6 @@ private fun HorizontalGrid( .shadow(elevation.value) .aspectRatio(1f) .background(MaterialTheme.colors.secondary) - .detectReorderAfterLongPress(state) ) { Text(item.title) } @@ -97,7 +98,9 @@ private fun VerticalGrid( contentPadding = PaddingValues(horizontal = 8.dp), verticalArrangement = Arrangement.spacedBy(4.dp), horizontalArrangement = Arrangement.spacedBy(4.dp), - modifier = modifier.reorderable(state) + modifier = modifier + .reorderable(state) + .detectReorderAfterLongPress(state) ) { items(vm.dogs, { it.key }) { item -> ReorderableItem(state, item.key) { isDragging -> @@ -118,7 +121,6 @@ private fun VerticalGrid( .shadow(elevation.value) .aspectRatio(1f) .background(MaterialTheme.colors.primary) - .detectReorderAfterLongPress(state) ) { Text(item.title) } diff --git a/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderList.kt b/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderList.kt index 0f99959..9481ec7 100644 --- a/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderList.kt +++ b/android/src/main/kotlin/org/burnoutcrew/android/ui/reorderlist/ReorderList.kt @@ -66,7 +66,9 @@ private fun NewVerticalReorderList( LazyColumn( state = state.listState, modifier = modifier - .then(Modifier.reorderable(state)) + .then(Modifier + .reorderable(state) + .detectReorderAfterLongPress(state)) ) { items(vm.dogs, { item -> item.key }) { item -> ReorderableItem(state, item.key) { dragging -> @@ -88,7 +90,6 @@ private fun NewVerticalReorderList( .shadow(elevation.value) .fillMaxWidth() .background(MaterialTheme.colors.surface) - .detectReorderAfterLongPress(state) ) { Text( text = item.title, @@ -111,7 +112,9 @@ private fun NewHorizontalReorderList( LazyRow( state = state.listState, horizontalArrangement = Arrangement.spacedBy(8.dp), - modifier = modifier.then(Modifier.reorderable(state)), + modifier = modifier.then(Modifier + .reorderable(state)) + .detectReorderAfterLongPress(state), ) { items(vm.cats, { item -> item.key }) { item -> ReorderableItem(state, item.key) { dragging -> @@ -125,7 +128,6 @@ private fun NewHorizontalReorderList( .shadow(elevation, RoundedCornerShape(24.dp)) .clip(RoundedCornerShape(24.dp)) .background(Color.Red) - .detectReorderAfterLongPress(state) ) { Text(item.title) }