Coder Social home page Coder Social logo

jordond / drag-select-compose Goto Github PK

View Code? Open in Web Editor NEW
125.0 2.0 0.0 13.4 MB

⚡ A Compose multiplatform library for adding Google Photos style drag-to-select multi-selection to a LazyGrid

Home Page: https://demo.dragselectcompose.com

License: MIT License

Kotlin 99.56% Shell 0.44%
android compose drag-selection drag-selection-library google-photos kotlin compose-desktop compose-ios compose-multiplatform kotlin-multiplatform

drag-select-compose's People

Contributors

jordond avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

drag-select-compose's Issues

occasionally crashing in iOS simulator

Sometimes crashes the iOS simulator with the following error:

Uncaught Kotlin exception: kotlin.IllegalArgumentException: Failed to open iconv for charset UTF-8 with error code 22
    at 0   DragSelectCompose                   0x100d26dff        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 123 
    at 1   DragSelectCompose                   0x100d1f5d3        kfun:kotlin.Exception#<init>(kotlin.String?){} + 119 
    at 2   DragSelectCompose                   0x100d1f97b        kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 119 
    at 3   DragSelectCompose                   0x100d1fd23        kfun:kotlin.IllegalArgumentException#<init>(kotlin.String?){} + 119 
    at 4   DragSelectCompose                   0x1016bceb3        kfun:io.ktor.utils.io.charsets.checkErrors#internal + 815 
    at 5   DragSelectCompose                   0x1016bc6e3        kfun:io.ktor.utils.io.charsets.CharsetImpl.<init>#internal + 615 
    at 6   DragSelectCompose                   0x1016b95e3        kfun:io.ktor.utils.io.charsets.Charsets#<init>(){} + 191 
    at 7   DragSelectCompose                   0x1016b94ef        kfun:io.ktor.utils.io.charsets.Charsets.$init_global#internal + 151 
    at 8   DragSelectCompose                   0x101b3e9d7        CallInitGlobalPossiblyLock + 511 
    at 9   DragSelectCompose                   0x1016b9967        kfun:io.ktor.utils.io.charsets.Charsets#<get-$instance>#static(){}io.ktor.utils.io.charsets.Charsets + 99 
    at 10  DragSelectCompose                   0x1016ebaef        kfun:io.ktor.http#encodeURLQueryComponent$default__at__kotlin.String(kotlin.Boolean;kotlin.Boolean;io.ktor.utils.io.charsets.Charset?;kotlin.Int){}kotlin.String + 387 
    at 11  DragSelectCompose                   0x101708a5b        kfun:io.ktor.http.URLBuilder#<init>(io.ktor.http.URLProtocol;kotlin.String;kotlin.Int;kotlin.String?;kotlin.String?;kotlin.collections.List<kotlin.String>;io.ktor.http.Parameters;kotlin.String;kotlin.Boolean){} + 871 
    at 12  DragSelectCompose                   0x1017092ef        kfun:io.ktor.http.URLBuilder#<init>(io.ktor.http.URLProtocol?;kotlin.String?;kotlin.Int;kotlin.String?;kotlin.String?;kotlin.collections.List<kotlin.String>?;io.ktor.http.Parameters?;kotlin.String?;kotlin.Boolean;kotlin.Int;kotlin.native.internal.DefaultConstructorMarker?){} + 1111 
    at 13  DragSelectCompose                   0x101712837        kfun:io.ktor.http#URLBuilder(kotlin.String){}io.ktor.http.URLBuilder + 219 
    at 14  DragSelectCompose                   0x101712703        kfun:io.ktor.http#Url(kotlin.String){}io.ktor.http.Url + 151 
    at 15  DragSelectCompose                   0x1017e3bcb        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.<init>$lambda$11$lambda$10$lambda$9#internal + 2831 
    at 16  DragSelectCompose                   0x1017e9f9f        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.$<init>$lambda$11$lambda$10$lambda$9$FUNCTION_REFERENCE$9.invoke#internal + 139 
    at 17  DragSelectCompose                   0x1017ea10b        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.$<init>$lambda$11$lambda$10$lambda$9$FUNCTION_REFERENCE$9.$<bridge-UNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}#internal + 183 
    at 18  DragSelectCompose                   0x10101b33b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 875 
    at 19  DragSelectCompose                   0x10102d72b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 187 
    at 20  DragSelectCompose                   0x10160f077        kfun:androidx.compose.material3.Surface$lambda$3#internal + 6111 
    at 21  DragSelectCompose                   0x10160f887        kfun:androidx.compose.material3.$Surface$lambda$3$FUNCTION_REFERENCE$1.invoke#internal + 179 
    at 22  DragSelectCompose                   0x10160fb6b        kfun:androidx.compose.material3.$Surface$lambda$3$FUNCTION_REFERENCE$1.$<bridge-UNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}#internal + 183 
    at 23  DragSelectCompose                   0x10101b33b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 875 
    at 24  DragSelectCompose                   0x10102d72b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 187 
    at 25  DragSelectCompose                   0x100f3241b        kfun:androidx.compose.runtime#CompositionLocalProvider(kotlin.Array<out|androidx.compose.runtime.ProvidedValue<*>>...;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} + 819 
    at 26  DragSelectCompose                   0x10160c9ff        kfun:androidx.compose.material3#Surface(androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.Shape?;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.unit.Dp;androidx.compose.ui.unit.Dp;androidx.compose.foundation.BorderStroke?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){} + 3479 
    at 27  DragSelectCompose                   0x1017e864b        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.<init>$lambda$11$lambda$10#internal + 1027 
    at 28  DragSelectCompose                   0x1017ea73f        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.$<init>$lambda$11$lambda$10$FUNCTION_REFERENCE$12.invoke#internal + 159 
    at 29  DragSelectCompose                   0x1017ea8db        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.$<init>$lambda$11$lambda$10$FUNCTION_REFERENCE$12.$<bridge-UNNBNB>invoke(kotlin.Boolean;androidx.compose.runtime.Composer;kotlin.Int){}#internal + 231 
    at 30  DragSelectCompose                   0x10101b973        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 927 
    at 31  DragSelectCompose                   0x10102d83f        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNNB>invoke(kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 223 
    at 32  DragSelectCompose                   0x10163e1ab        kfun:com.dragselectcompose.grid.LazyDragSelectGridItemScope#SelectableItem(1:0;androidx.compose.ui.Modifier?;kotlin.String?;androidx.compose.foundation.interaction.MutableInteractionSource?;kotlin.Boolean;kotlin.Function3<androidx.compose.foundation.layout.BoxScope,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Function3<androidx.compose.foundation.layout.BoxScope,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Boolean;com.dragselectcompose.grid.indicator.AnimateSelecti + 21791 
    at 33  DragSelectCompose                   0x1017e90e3        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.<init>$lambda$11#internal + 2463 
    at 34  DragSelectCompose                   0x1017e928b        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.$<init>$lambda$11$FUNCTION_REFERENCE$2.invoke#internal + 175 
    at 35  DragSelectCompose                   0x1017e939f        kfun:com.dragselectcompose.demo.ComposableSingletons$PhotoGridKt.$<init>$lambda$11$FUNCTION_REFERENCE$2.$<bridge-UNNNNNB>invoke(com.dragselectcompose.grid.LazyDragSelectGridItemScope<com.dragselectcompose.demo.PhotoItem>;com.dragselectcompose.demo.PhotoItem;androidx.compose.runtime.Composer;kotlin.Int){}#internal + 255 
    at 36  DragSelectCompose                   0x10101bfe7        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 971 
    at 37  DragSelectCompose                   0x10102d977        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNNNB>invoke(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 259 
    at 38  DragSelectCompose                   0x10164847f        kfun:com.dragselectcompose.grid.DefaultLazyDragSelectGridScope.items$lambda$4#internal + 1811 
    at 39  DragSelectCompose                   0x1016490ff        kfun:com.dragselectcompose.grid.DefaultLazyDragSelectGridScope.$items$lambda$4$FUNCTION_REFERENCE$5.invoke#internal + 191 
    at 40  DragSelectCompose                   0x10164933b        kfun:com.dragselectcompose.grid.DefaultLazyDragSelectGridScope.$items$lambda$4$FUNCTION_REFERENCE$5.$<bridge-UNNNBNB>invoke(androidx.compose.foundation.lazy.grid.LazyGridItemScope;kotlin.Int;androidx.compose.runtime.Composer;kotlin.Int){}#internal + 263 
    at 41  DragSelectCompose                   0x10101bfe7        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 971 
    at 42  DragSelectCompose                   0x10102d977        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNNNB>invoke(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 259 
    at 43  DragSelectCompose                   0x101518b57        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.<init>$lambda$1$lambda$0#internal + 879 
    at 44  DragSelectCompose                   0x101519bcf        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.$<init>$lambda$1$lambda$0$FUNCTION_REFERENCE$6.invoke#internal + 143 
    at 45  DragSelectCompose                   0x101519d57        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.$<init>$lambda$1$lambda$0$FUNCTION_REFERENCE$6.$<bridge-UNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}#internal + 183 
    at 46  DragSelectCompose                   0x10101b33b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 875 
    at 47  DragSelectCompose                   0x10102d72b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 187 
    at 48  DragSelectCompose                   0x100f3241b        kfun:androidx.compose.runtime#CompositionLocalProvider(kotlin.Array<out|androidx.compose.runtime.ProvidedValue<*>>...;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} + 819 
    at 49  DragSelectCompose                   0x101552be7        kfun:androidx.compose.foundation.lazy.layout#LazyLayoutPinnableItem(kotlin.Any?;kotlin.Int;androidx.compose.foundation.lazy.layout.LazyLayoutPinnedItemList;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} + 5463 
    at 50  DragSelectCompose                   0x101519453        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.<init>$lambda$1#internal + 1983 
    at 51  DragSelectCompose                   0x1015196e7        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.$<init>$lambda$1$FUNCTION_REFERENCE$4.invoke#internal + 183 
    at 52  DragSelectCompose                   0x1015198a3        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.$<init>$lambda$1$FUNCTION_REFERENCE$4.$<bridge-UNNNBNB>invoke(androidx.compose.foundation.lazy.layout.IntervalList.Interval<androidx.compose.foundation.lazy.grid.LazyGridIntervalContent>;kotlin.Int;androidx.compose.runtime.Composer;kotlin.Int){}#internal + 263 
    at 53  DragSelectCompose                   0x10101bfe7        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 971 
    at 54  DragSelectCompose                   0x10102d977        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNNNB>invoke(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(kotlin.Any?;kotlin.Any?;androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 259 
    at 55  DragSelectCompose                   0x10154a987        kfun:androidx.compose.foundation.lazy.layout.DefaultLazyLayoutItemsProvider.Item#internal + 1875 
    at 56  DragSelectCompose                   0x101517eb3        kfun:androidx.compose.foundation.lazy.grid.LazyGridItemProviderImpl.Item#internal + 1663 
    at 57  DragSelectCompose                   0x101549083        kfun:androidx.compose.foundation.lazy.layout.DefaultDelegatingLazyLayoutItemProvider.Item#internal + 1763 
    at 58  DragSelectCompose                   0x10151a80f        kfun:androidx.compose.foundation.lazy.grid.object-1.Item#internal + 575 
    at 59  DragSelectCompose                   0x10154638b        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.createContentLambda$lambda$2$lambda$0#internal + 763 
    at 60  DragSelectCompose                   0x1015475d7        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.$createContentLambda$lambda$2$lambda$0$FUNCTION_REFERENCE$3.invoke#internal + 143 
    at 61  DragSelectCompose                   0x10154775f        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.$createContentLambda$lambda$2$lambda$0$FUNCTION_REFERENCE$3.$<bridge-UNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}#internal + 183 
    at 62  DragSelectCompose                   0x10101b33b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 875 
    at 63  DragSelectCompose                   0x10102d72b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 187 
    at 64  DragSelectCompose                   0x100f3241b        kfun:androidx.compose.runtime#CompositionLocalProvider(kotlin.Array<out|androidx.compose.runtime.ProvidedValue<*>>...;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} + 819 
    at 65  DragSelectCompose                   0x10115f05f        kfun:androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider#internal + 3143 
    at 66  DragSelectCompose                   0x10155f82f        kfun:androidx.compose.foundation.lazy.layout.LazySaveableStateHolder.SaveableStateProvider#internal + 2335 
    at 67  DragSelectCompose                   0x101546e0b        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.createContentLambda$lambda$2#internal + 2171 
    at 68  DragSelectCompose                   0x101547367        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.$createContentLambda$lambda$2$FUNCTION_REFERENCE$2.invoke#internal + 143 
    at 69  DragSelectCompose                   0x101547513        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutItemContentFactory.CachedItemContent.$createContentLambda$lambda$2$FUNCTION_REFERENCE$2.$<bridge-UNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}#internal + 183 
    at 70  DragSelectCompose                   0x10101b33b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 875 
    at 71  DragSelectCompose                   0x10102d72b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 187 
    at 72  DragSelectCompose                   0x1012c882f        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose$lambda$0#internal + 1207 
    at 73  DragSelectCompose                   0x1012c979b        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.$subcompose$lambda$0$FUNCTION_REFERENCE$2.invoke#internal + 143 
    at 74  DragSelectCompose                   0x1012c9947        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.$subcompose$lambda$0$FUNCTION_REFERENCE$2.$<bridge-UNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}#internal + 183 
    at 75  DragSelectCompose                   0x10101b33b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any? + 875 
    at 76  DragSelectCompose                   0x10102d72b        kfun:androidx.compose.runtime.internal.ComposableLambdaImpl#$<bridge-NNNNB>invoke(androidx.compose.runtime.Composer;kotlin.Int){}kotlin.Any?(androidx.compose.runtime.Composer;kotlin.Any?){}kotlin.Any? + 187 
    at 77  DragSelectCompose                   0x101019c23        kfun:androidx.compose.runtime#invokeComposable(androidx.compose.runtime.Composer;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>){} + 339 
    at 78  DragSelectCompose                   0x100f0d4f7        kfun:androidx.compose.runtime.ComposerImpl.doCompose$lambda$27#internal + 303 
    at 79  DragSelectCompose                   0x100f1326b        kfun:androidx.compose.runtime.ComposerImpl.$doCompose$lambda$27$FUNCTION_REFERENCE$33.invoke#internal + 103 
    at 80  DragSelectCompose                   0x100f133ff        kfun:androidx.compose.runtime.ComposerImpl.$doCompose$lambda$27$FUNCTION_REFERENCE$33.$<bridge-UNN>invoke(){}#internal + 95 
    at 81  DragSelectCompose                   0x100f35697        kfun:androidx.compose.runtime#observeDerivedStateRecalculations(kotlin.Function1<androidx.compose.runtime.State<*>,kotlin.Unit>;kotlin.Function1<androidx.compose.runtime.State<*>,kotlin.Unit>;kotlin.Function0<0:0>){0§<kotlin.Any?>} + 1015 
    at 82  DragSelectCompose                   0x100f00f63        kfun:androidx.compose.runtime.ComposerImpl.doCompose#internal + 2247 
    at 83  DragSelectCompose                   0x100efff2f        kfun:androidx.compose.runtime.ComposerImpl#composeContent(androidx.compose.runtime.collection.IdentityArrayMap<androidx.compose.runtime.RecomposeScopeImpl,androidx.compose.runtime.collection.IdentityArraySet<kotlin.Any>?>;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>){} + 431 
    at 84  DragSelectCompose                   0x100f226b3        kfun:androidx.compose.runtime.CompositionImpl#composeContent(kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>){} + 535 
    at 85  DragSelectCompose                   0x100f4e3bb        kfun:androidx.compose.runtime.Recomposer#composeInitial(androidx.compose.runtime.ControlledComposition;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>){} + 911 
    at 86  DragSelectCompose                   0x100f06cdb        kfun:androidx.compose.runtime.ComposerImpl.CompositionContextImpl.composeInitial#internal + 243 
    at 87  DragSelectCompose                   0x100f06cdb        kfun:androidx.compose.runtime.ComposerImpl.CompositionContextImpl.composeInitial#internal + 243 
    at 88  DragSelectCompose                   0x100f21bb3        kfun:androidx.compose.runtime.CompositionImpl#setContent(kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>){} + 479 
    at 89  DragSelectCompose                   0x1012c3af3        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto#internal + 595 
    at 90  DragSelectCompose                   0x1012c36eb        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose#internal.192 + 907 
    at 91  DragSelectCompose                   0x1012c32db        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose#internal + 1287 
    at 92  DragSelectCompose                   0x1012c2cef        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState#subcompose(kotlin.Any?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>){}kotlin.collections.List<androidx.compose.ui.layout.Measurable> + 2715 
    at 93  DragSelectCompose                   0x1012c8343        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.Scope.subcompose#internal + 159 
    at 94  DragSelectCompose                   0x10154d5bf        kfun:androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScopeImpl#measure(kotlin.Int;androidx.compose.ui.unit.Constraints){}kotlin.collections.List<androidx.compose.ui.layout.Placeable> + 919 
    at 95  DragSelectCompose                   0x10153bb0b        kfun:androidx.compose.foundation.lazy.grid.LazyMeasuredItemProvider#getAndMeasure(androidx.compose.foundation.lazy.grid.ItemIndex;kotlin.Int;androidx.compose.ui.unit.Constraints){}androidx.compose.foundation.lazy.grid.LazyGridMeasuredItem + 519 
    at 96  DragSelectCompose                   0x10153d00b        kfun:androidx.compose.foundation.lazy.grid.LazyMeasuredLineProvider#getAndMeasure(androidx.compose.foundation.lazy.grid.LineIndex){}androidx.compose.foundation.lazy.grid.LazyGridMeasuredLine + 1251 
    at 97  DragSelectCompose                   0x10151cfab        kfun:androidx.compose.foundation.lazy.grid#measureLazyGrid(kotlin.Int;androidx.compose.foundation.lazy.grid.LazyGridItemProvider;androidx.compose.foundation.lazy.grid.LazyMeasuredLineProvider;androidx.compose.foundation.lazy.grid.LazyMeasuredItemProvider;kotlin.Int;kotlin.Int;kotlin.Int;kotlin.Int;androidx.compose.foundation.lazy.grid.LineIndex;kotlin.Int;kotlin.Float;androidx.compose.ui.unit.Constraints;kotlin.Boolean;androidx.compose.foundation.layout.Arrangement.Vertical?;androidx.compose.foundation.lay + 3507 
    at 98  DragSelectCompose                   0x101503a4b        kfun:androidx.compose.foundation.lazy.grid.rememberLazyGridMeasurePolicy$lambda$6#internal + 7403 
    at 99  DragSelectCompose                   0x1015045bf        kfun:androidx.compose.foundation.lazy.grid.$rememberLazyGridMeasurePolicy$lambda$6$FUNCTION_REFERENCE$2.invoke#internal + 203 
    at 100 DragSelectCompose                   0x10150491b        kfun:androidx.compose.foundation.lazy.grid.$rememberLazyGridMeasurePolicy$lambda$6$FUNCTION_REFERENCE$2.$<bridge-NNNNB>invoke(androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScope;androidx.compose.ui.unit.Constraints){}androidx.compose.foundation.lazy.grid.LazyGridMeasureResult#internal + 187 
    at 101 DragSelectCompose                   0x1015421e3        kfun:androidx.compose.foundation.lazy.layout.LazyLayout$lambda$2$lambda$1#internal + 415 
    at 102 DragSelectCompose                   0x1015445b7        kfun:androidx.compose.foundation.lazy.layout.$LazyLayout$lambda$2$lambda$1$FUNCTION_REFERENCE$3.invoke#internal + 151 
    at 103 DragSelectCompose                   0x101544787        kfun:androidx.compose.foundation.lazy.layout.$LazyLayout$lambda$2$lambda$1$FUNCTION_REFERENCE$3.$<bridge-NNNNB>invoke(androidx.compose.ui.layout.SubcomposeMeasureScope;androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.MeasureResult#internal + 187 
    at 104 DragSelectCompose                   0x1012c8fcb        kfun:androidx.compose.ui.layout.LayoutNodeSubcompositionsState.object-1.measure#internal + 799 
    at 105 DragSelectCompose                   0x1012e7dfb        kfun:androidx.compose.ui.node.InnerNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 959 
    at 106 DragSelectCompose                   0x10124a9ff        kfun:androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure#internal + 307 
    at 107 DragSelectCompose                   0x1012f1b77        kfun:androidx.compose.ui.node.LayoutModifierNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 467 
    at 108 DragSelectCompose                   0x10142952f        kfun:androidx.compose.foundation.layout.PaddingValuesModifier.measure#internal + 2907 
    at 109 DragSelectCompose                   0x1012d9c4b        kfun:androidx.compose.ui.node.BackwardsCompatNode#measure__at__androidx.compose.ui.layout.MeasureScope(androidx.compose.ui.layout.Measurable;androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.MeasureResult + 411 
    at 110 DragSelectCompose                   0x1012f1b77        kfun:androidx.compose.ui.node.LayoutModifierNodeCoordinator#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 467 
    at 111 DragSelectCompose                   0x101321507        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure$lambda$0#internal + 203 
    at 112 DragSelectCompose                   0x1013216d3        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$performMeasure$lambda$0$FUNCTION_REFERENCE$12.invoke#internal + 99 
    at 113 DragSelectCompose                   0x101321803        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.$performMeasure$lambda$0$FUNCTION_REFERENCE$12.$<bridge-UNN>invoke(){}#internal + 95 
    at 114 DragSelectCompose                   0x100fd84a3        kfun:androidx.compose.runtime.snapshots.Snapshot.Companion#observe(kotlin.Function1<kotlin.Any,kotlin.Unit>?;kotlin.Function1<kotlin.Any,kotlin.Unit>?;kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 + 1147 
    at 115 DragSelectCompose                   0x10101727b        kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads$lambda$3#internal + 235 
    at 116 DragSelectCompose                   0x1010178a3        kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver.$observeReads$lambda$3$FUNCTION_REFERENCE$3.invoke#internal + 99 
    at 117 DragSelectCompose                   0x1010179f7        kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver.$observeReads$lambda$3$FUNCTION_REFERENCE$3.$<bridge-UNN>invoke(){}#internal + 95 
    at 118 DragSelectCompose                   0x100f35697        kfun:androidx.compose.runtime#observeDerivedStateRecalculations(kotlin.Function1<androidx.compose.runtime.State<*>,kotlin.Unit>;kotlin.Function1<androidx.compose.runtime.State<*>,kotlin.Unit>;kotlin.Function0<0:0>){0§<kotlin.Any?>} + 1015 
    at 119 DragSelectCompose                   0x1010120ab        kfun:androidx.compose.runtime.snapshots.SnapshotStateObserver#observeReads(0:0;kotlin.Function1<0:0,kotlin.Unit>;kotlin.Function0<kotlin.Unit>){0§<kotlin.Any>} + 1155 
    at 120 DragSelectCompose                   0x101358e03        kfun:androidx.compose.ui.node.OwnerSnapshotObserver#observeReads(0:0;kotlin.Function1<0:0,kotlin.Unit>;kotlin.Function0<kotlin.Unit>){0§<androidx.compose.ui.node.OwnerScope>} + 247 
    at 121 DragSelectCompose                   0x101358be7        kfun:androidx.compose.ui.node.OwnerSnapshotObserver#observeMeasureSnapshotReads(androidx.compose.ui.node.LayoutNode;kotlin.Boolean;kotlin.Function0<kotlin.Unit>){} + 443 
    at 122 DragSelectCompose                   0x1013206e7        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure#internal + 803 
    at 123 DragSelectCompose                   0x101314627        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.MeasurePassDelegate#remeasure(androidx.compose.ui.unit.Constraints){}kotlin.Boolean + 927 
    at 124 DragSelectCompose                   0x10131423f        kfun:androidx.compose.ui.node.LayoutNodeLayoutDelegate.MeasurePassDelegate#measure(androidx.compose.ui.unit.Constraints){}androidx.compose.ui.layout.Placeable + 751 
    at 125 DragSelectCompose                   0x1016056ef        kfun:androidx.compose.material3.ScaffoldLayout$lambda$6$lambda$5#internal + 15435 

Related to this issue

min sdk 21

Why it is need to use min 26 ? Could you set it to 21, please ? 👀

Allow multi-drag multi-selection like Google Photos

Currently if you have items selected, and attempt another drag to select, it doesn't work

I can’t get it to handle dragging unless there are no items selected. After selecting a few I can’t extend the selection, or start a new drag to select a different chunk that’s not contiguous

Item selection does not persist through configuration changes on Android

As described in the title, if the user selects some items and the activity gets recreated (e.g., due screen rotation), the item selection does not persist. This is easily reproducible with the sample app in the repository, you just need to select some items and rotate your device - the selection will be gone.

The original gist uses rememberSaveable to avoid this issue.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

cocoapods
demo/kmm/iosApp/Podfile
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/wrapper-validation-action v3
  • gradle/gradle-build-action v3
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
  • gradle/gradle-build-action v3
.github/workflows/publish.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
  • actions/cache v4
  • gradle/wrapper-validation-action v3
  • EndBug/add-and-commit v9
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/wrapper-validation-action v3
  • gradle/gradle-build-action v3
  • JamesIves/github-pages-deploy-action v4
gradle
gradle.properties
settings.gradle.kts
  • com.gradle.enterprise 3.17.2
build.gradle.kts
core/build.gradle.kts
demo/android/build.gradle.kts
demo/kmm/androidApp/build.gradle.kts
demo/kmm/desktopApp/build.gradle.kts
demo/kmm/shared/build.gradle.kts
dragselect/build.gradle.kts
extensions/build.gradle.kts
gradle/libs.versions.toml
  • androidx.core:core-ktx 1.13.0
  • junit:junit 4.13.2
  • androidx.test.ext:junit 1.1.5
  • androidx.test.espresso:espresso-core 3.5.1
  • androidx.lifecycle:lifecycle-runtime-ktx 2.7.0
  • androidx.activity:activity-compose 1.9.0
  • androidx.compose:compose-bom 2024.04.01
  • androidx.appcompat:appcompat 1.6.1
  • io.coil-kt:coil-compose 2.6.0
  • media.kamel:kamel-image 0.9.4
  • io.ktor:ktor-client-core 2.3.10
  • io.ktor:ktor-client-android 2.3.10
  • io.ktor:ktor-client-darwin 2.3.10
  • io.ktor:ktor-client-java 2.3.10
  • org.jetbrains.kotlin.multiplatform 1.9.23
  • org.jetbrains.compose 1.6.2
  • com.android.application 8.3.2
  • org.jetbrains.kotlin.android 1.9.23
  • com.github.ben-manes.versions 0.51.0
  • org.jetbrains.dokka 1.9.20
  • com.android.library 8.3.2
  • org.jetbrains.kotlinx.binary-compatibility-validator 0.14.0
  • com.vanniktech.maven.publish 0.28.0
  • dev.drewhamilton.poko 0.15.2
grid/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

LazyDragSelectVerticalGrid not available for Android?

My dependencies for the compose module look like this:

        val commonMain by getting {

            dependencies {

                // Shared lib
                api(project(":shared"))

                // Compose Multiplatform
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)

                api("com.dragselectcompose:dragselect:2.1.2")
            }
        }

For JVM it works, but on Android it does not compile:
Unresolved reference: LazyDragSelectVerticalGrid

Allow persisting selection mode after the last item is deselected

In cases where the app exposes a button to enter the multi-selection mode, it might be undesirable for the selection mode to be automatically turned off after the last item is deselected. Consider the following scenario:
The app exposes a "Multi-select" button that enters the selection mode and, in selection mode, exposes a "Cancel" button that exits it.

  1. The user enters selection mode by pressing the multi-select button.
  2. The user selects an item but then quickly deselects it as they want to select a different one.

Desired behavior -> selection mode is still active, and the user can select another item.
Current behavior -> selection mode gets deactivated after the item is deselected, and the user needs to activate it again.

The automated exiting of the selection mode after the last item is deselected might be exposed as a flag so that it can also be turned off when the long-press gesture activates the selection mode. However, that case might be more contentious from the UX perspective.

Dragging past the end should select the end item

When dragging and I get to the bottom row with a single item at the beginning, dragging in the empty space to the right of that item doesn’t select the last row, I have to drag over the thumbnail itself. It feels like dragging past the end should select to the end.

Programmatically enable selection mode

Aside from the selection mode activation on long-press, my app also includes a dedicated button for this purpose, similar to Apple Photos. This design choice is based on the fact that Android users are accustomed to the long press, while iOS users expect a separate button for enabling the selection mode.

To enhance user experience, I would like to propose the addition of a function called dragSelectState.enableSelectionMode() or a similar method. This feature would provide a convenient way for users to activate the selection mode, regardless of their preferred method (long-press or button).

Of course it is essential to maintain the behavior of automatically ending the selection mode when the last photo is deselected.

screenshot_1 screenshot_2

dragSelectState is selecting incorrect items if data source isn't static list

Hello 👋🏽, DragSelectState behaves very weird when item list isn't static.

For an example, I'm fetching data from on-device database(Room) using the following:

val deletedPhotos by localPhotoViewModel.repository.allCameraTrashedPhotos.collectAsState(emptyList())
val dragSelectState = rememberDragSelectState<PhotoEntity>(compareSelector = { it.uid!! })

Now drag-select works fine when data loads for the first time. But when some more rows are added/deleted from database, then sometimes drag-select selects incorrect item, or sometimes can't select/de-select items.

I'm not sure whether I'm doing something wrong, or whether there is an issue in library. Here is how I'm rendering images:

            items(photos.size) { index ->
                val isSelected by remember {
                    derivedStateOf { dragSelectState.isSelected(photos[index]) }
                }

                PhotoItemContent(
                    item = photos[index],
                    inSelectionMode = dragSelectState.inSelectionMode,
                    isSelected = isSelected,
                    modifier = Modifier
                        // Add semantics for accessibility
                        .semantics {
                            if (!dragSelectState.inSelectionMode) {
                                onLongClick("Select") {
                                    dragSelectState.addSelected(photos[index])
                                    true
                                }
                            }
                        }
                        // If we are in selection mode allow the item to be toggleable
                        .then(
                            if (dragSelectState.inSelectionMode) {
                                Modifier.toggleable(
                                    value = isSelected,
                                    interactionSource = remember { MutableInteractionSource() },
                                    indication = null, // do not show a ripple
                                    onValueChange = { toggled ->
                                        if (toggled) dragSelectState.addSelected(photos[index])
                                        else dragSelectState.removeSelected(photos[index])
                                    }
                                )
                            } else {
                                Modifier.clickable {
                                    onClickPhotoItem(navController, photos[index])
                                }
                            },
                        )
                )
            }

Please let me know if you can help here or need more info.

I have also attached a recording of the user experience here:

WhatsApp.Video.2024-01-06.at.23.47.37.mp4

Bug: First selected item is wrong

Using Compose for Desktop v1.4.3 I observed a wrong behavior on selection of the first item that activates the selection mode.

Please see this short demonstration video:
https://github.com/jordond/drag-select-compose/assets/9299303/2fd05370-604d-48d1-a032-9284641ac975

This is the part where I included the library in my code:

    BoxWithConstraints {

        val dragSelectState = rememberDragSelectState<Photo>()

        val tileSizePt: Dp = remember(maxWidth, tileSize) {
            calcTileSizePt(maxWidth, tileSize, state.screenWidth, state.screenHeight)
        }

        val cells: GridCells = remember(tileSize) {
            calcCells(tileSize, state.screenWidth, state.screenHeight)
        }

        val items = state.photosToDisplay

        LaunchedEffect(dragSelectState.inSelectionMode) {

            if (dragSelectState.inSelectionMode != state.photoSelectionMode)
                store.dispatch(AppAction.TogglePhotoSelectionMode)
        }

        LaunchedEffect(state.photoSelectionMode) {

            if (!state.photoSelectionMode)
                dragSelectState.clear()
        }

        LazyDragSelectVerticalGrid(
            columns = cells,
            items = items,
            state = dragSelectState,
        ) {

            items(key = { it.id!! }) { photo ->

                SelectableItem(
                    item = photo
                ) {

                    GalleryPhotoView(
                        // [... snip ... ]
                    )
                }
            }
        }

        VerticalScrollbar(
            modifier = remember { fillWholeMaxHeightModifier.align(Alignment.CenterEnd) },
            theme = state.theme,
            color = getTextColor(state.theme),
            scrollState = dragSelectState.gridState
        )

        // [... Overlays and other stuff ... ]
    }

Photo is a data class and also has an unique id.
I tried without key = { it.id!! } with no difference.

Implement multi-select with holding shift key

At present, on https://photos.google.com/, when you select one picture and then hold the shift key while selecting another, all images between the initially selected one and the clicked one are automatically selected. It would be greatly appreciated if this convenient feature could also be implemented in the desktop version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.