Skip to content

Complete Swipe-to-Dismiss list demo (delete + archive + undo) - #210

Open
dipenpradhan wants to merge 12 commits into
Gurupreet:masterfrom
dipenpradhan:issue-188-swipe-dismiss
Open

Complete Swipe-to-Dismiss list demo (delete + archive + undo)#210
dipenpradhan wants to merge 12 commits into
Gurupreet:masterfrom
dipenpradhan:issue-188-swipe-dismiss

Conversation

@dipenpradhan

Copy link
Copy Markdown

Summary

Completes the Swipe-to-Dismiss / Swipe Actions list demo, as proposed in #188.

The "Swipeable Lists" tab under Advance Lists already rendered SwipeToDismissBox items, but swipes never removed anything (onItemSwiped was a no-op), there was no undo, and only one direction was enabled. This PR makes it a full Material3 swipe-actions showcase:

  • Swipe left (end → start): red Delete background with icon, item removed from the LazyColumn
  • Swipe right (start → end): Archive reveal background with icon, item removed
  • Undo Snackbar after either action restores the item at its original position (the M3-recommended interaction pattern)
  • Directional threshold configured via positionalThreshold (half the item width)
  • Items are keyed (key = { it.id }) so dismiss state is correctly scoped per item, including after undo
  • Dark mode supported via the existing errorContainer/secondaryContainer theme colors
  • README "Coming Soon" no longer lists Swipe lists

Acceptance criteria from #188

  • SwipeToDismissBox demo with directional thresholds configured
  • Background shown during swipe (red Delete background with icon)
  • Item removed from the list on full swipe
  • Undo Snackbar after deletion
  • Dark mode support
  • Reachable from Home → Advance Lists → Swipeable Lists (existing wiring)
  • README updated

Closes #188

Verification

  • ./gradlew ktfmtCheck assembleDebug testDebugUnitTest passes locally (JDK 17, SDK 35)
  • CI ./gradlew build on this PR

Merge order

PR 10 of the stacked series. Depends on #195 → … → #209 — its diff includes their commits until they merge.

🤖 Generated with Claude Code

cc @Gurupreet for review

- Bump kotlin-gradle-plugin 1.9.22 -> 2.1.20 (root + buildSrc)
- Adopt the new Compose Compiler Gradle plugin
  (org.jetbrains.kotlin.plugin.compose) in app and convention plugins
- Drop composeCompiler version constant and composeOptions blocks
- Replace removed -Xopt-in flag with -opt-in
- Bump KSP to 2.1.20-1.0.31 to match Kotlin

Fixes Gurupreet#182
ktfmt-gradle 0.12.0 fails with 'Generic error during file processing'
once Kotlin 2.x is on the buildscript classpath. 0.22.0 supports
Kotlin 2.x and also formats *.kts build scripts, hence the repo-wide
reformat (no functional changes).
@dipenpradhan
dipenpradhan force-pushed the issue-188-swipe-dismiss branch from 368f005 to 486aea6 Compare September 8, 2026 06:37
- AGP 8.2.2 -> 8.7.3 (compileSdk 35 supported from AGP 8.6)
- Gradle wrapper 8.5 -> 8.9 (required by AGP 8.7.x)
- PinLockView: removeLast() -> removeAt(lastIndex); at compileSdk 35 the
  call binds to java.util.List#removeLast (API 35) instead of the Kotlin
  stdlib extension, failing lint NewApi against minSdk 25

Fixes Gurupreet#185
- Replace compose/material3 version constants with composeBom
- Strip explicit versions from BOM-managed artifacts
- Import the BOM platform on every configuration that receives
  Compose artifacts (implementation, debugImplementation,
  androidTestImplementation, :data)
- Migrate API removals that come with Compose 1.7 / Material3 1.3:
  SmallTopAppBar -> TopAppBar, rememberRipple -> material3 ripple
- Update the outdated README Compose badge to the BOM version

Fixes Gurupreet#186
All lifecycle artifacts (viewmodel-compose, viewmodel-ktx,
livedata-ktx, runtime-ktx, viewmodel-savedstate) move together
via the shared androidLifecycleGrouped version.

Fixes Gurupreet#192
- navCompose 2.7.7 -> 2.8.9; add kotlinx-serialization-json 1.8.0
- Apply the Kotlin serialization plugin in gmail and tiktok demos
- Gmail: string routes -> @serializable route objects
- TikTok: TikTokScreen becomes a serializable sealed interface;
  the profile route carries a typed userId argument read via
  toRoute(), bottom bar selection uses NavDestination.hasRoute

Fixes Gurupreet#193
- Replace com.google.android.exoplayer:exoplayer with
  androidx.media3:media3-exoplayer and media3-ui
- Rewrite TikTokPlayer against the Media3 API (SimpleExoPlayer was
  removed; default media source factory handles asset URIs)
- Removes the last Jetifier warning produced by ExoPlayer 2.x

Fixes Gurupreet#183
- Move to the io.coil-kt.coil3 artifact group
- Add coil-network-okhttp (network fetching is a separate artifact
  in Coil 3, self-registered via ServiceLoader)
- Migrate call sites: rememberImagePainter(data=) ->
  rememberAsyncImagePainter(model=), coil.* -> coil3.* imports

Fixes Gurupreet#191
PullRefreshList was a fully commented-out stub (TODO revisit pull
refresh). It now demonstrates the first-party PullToRefreshBox with
a simulated 1.5s reload that prepends an item to the list.

Fixes Gurupreet#187
Covers the new composables added here so the feature ships with its own
verification rather than relying on a later change in the stack.
…undo

The Swipeable Lists tab rendered SwipeToDismissBox items but swipes
never removed anything. Now:
- swipe left deletes (red background), swipe right archives
- items are actually removed from the keyed LazyColumn
- an Undo snackbar restores the item at its original position
- positionalThreshold set to half the item width

Fixes Gurupreet#188
Adds UI tests for the composables introduced here so the feature ships with
its own verification.

The undo test surfaced a real defect: tapping Undo re-added the album to the
backing list, but LazyColumn keeps the first visible item anchored, so a row
re-inserted above it silently landed off-screen and the user saw nothing
happen. The list now holds a LazyListState and scrolls the restored row back
into view.
@dipenpradhan
dipenpradhan force-pushed the issue-188-swipe-dismiss branch from 486aea6 to 8e29a2b Compare September 8, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add Swipe-to-Dismiss / Swipe Actions list demo

1 participant