@@ -5,7 +5,7 @@ import android.content.ClipboardManager
5
5
import android.content.Context
6
6
import android.widget.Toast
7
7
import androidx.compose.animation.AnimatedVisibility
8
- import androidx.compose.foundation.clickable
8
+ import androidx.compose.foundation.combinedClickable
9
9
import androidx.compose.foundation.layout.Arrangement
10
10
import androidx.compose.foundation.layout.Box
11
11
import androidx.compose.foundation.layout.Column
@@ -215,6 +215,13 @@ fun Content(viewModel: AccountViewModel) {
215
215
},
216
216
onShortcutClick = {
217
217
showShortcutDialog = it
218
+ },
219
+ onItemLongClick = {
220
+ val clipboard =
221
+ context.getSystemService(Context .CLIPBOARD_SERVICE ) as ClipboardManager
222
+ val clip = ClipData .newPlainText(" Link copied" , it.link)
223
+ clipboard.setPrimaryClip(clip)
224
+ Toast .makeText(context, " Link copied" , Toast .LENGTH_SHORT ).show()
218
225
}
219
226
)
220
227
@@ -296,7 +303,8 @@ fun DeeprList(
296
303
accounts : List <Deepr >,
297
304
onItemClick : (Deepr ) -> Unit ,
298
305
onRemoveClick : (Deepr ) -> Unit ,
299
- onShortcutClick : (Deepr ) -> Unit
306
+ onShortcutClick : (Deepr ) -> Unit ,
307
+ onItemLongClick : (Deepr ) -> Unit
300
308
) {
301
309
LazyColumn (modifier = modifier, contentPadding = PaddingValues (vertical = 8 .dp)) {
302
310
if (accounts.isEmpty()) {
@@ -309,20 +317,23 @@ fun DeeprList(
309
317
account = account,
310
318
onItemClick = onItemClick,
311
319
onRemoveClick = onRemoveClick,
312
- onShortcutClick = onShortcutClick
320
+ onShortcutClick = onShortcutClick,
321
+ onItemLongClick = onItemLongClick
313
322
)
314
323
}
315
324
}
316
325
}
317
326
}
318
327
328
+ @OptIn(androidx.compose.foundation.ExperimentalFoundationApi ::class )
319
329
@Composable
320
330
fun DeeprItem (
321
331
modifier : Modifier = Modifier ,
322
332
account : Deepr ,
323
333
onItemClick : (Deepr ) -> Unit ,
324
334
onRemoveClick : (Deepr ) -> Unit ,
325
- onShortcutClick : (Deepr ) -> Unit
335
+ onShortcutClick : (Deepr ) -> Unit ,
336
+ onItemLongClick : (Deepr ) -> Unit
326
337
) {
327
338
var expanded by remember { mutableStateOf(false ) }
328
339
val context = LocalContext .current
@@ -331,7 +342,9 @@ fun DeeprItem(
331
342
modifier = modifier
332
343
.fillMaxWidth()
333
344
.padding(vertical = 4 .dp)
334
- .clickable { onItemClick(account) }
345
+ .combinedClickable(onClick = { onItemClick(account) }, onLongClick = {
346
+ onItemLongClick(account)
347
+ })
335
348
) {
336
349
Row (
337
350
modifier = Modifier
0 commit comments