Skip to content

Improve Jetchat adaptive UI, video player transitions, and tests - #1738

Open
bsagmoe wants to merge 3 commits into
adaptivefrom
bsagmoe/jetchat-adaptive-video
Open

bsagmoe wants to merge 3 commits into
adaptivefrom
bsagmoe/jetchat-adaptive-video

Conversation

@bsagmoe

@bsagmoe bsagmoe commented Oct 27, 2026

Copy link
Copy Markdown
Contributor
  • Add shared element transitions, frame snapshot handoff, and retained playback state for fullscreen video player
  • Handle captionBar and statusBarsIgnoringVisibility window insets in drawer, profile, and video player controls
  • Cache per-channel conversation states, generate unique message IDs and formatted timestamps
  • Add RoomDatabase keep rule for R8 Full Mode (since so we can use the release build when installing on demo devices) and update instrumentation tests

@bsagmoe
bsagmoe requested a review from raystatic October 27, 2026 22:46
@bsagmoe
bsagmoe added this pull request to stack #1739 October 27, 2026 22:46
@bsagmoe
bsagmoe requested a review from a team as a code owner October 27, 2026 22:46
@compose-devrel-github-bot

Copy link
Copy Markdown
Contributor

⚡ Jetpack Compose Performance Review

No Jetpack Compose performance issues were found in the changed code.

Verified Best Practices in Changed Code

The newly introduced and modified code in .gemini/pr_diff.patch adheres strictly to Jetpack Compose performance guidelines across all audited categories:

  1. Phase Deferral to Draw & Layout:

    • VideoThumbnail wraps animated alpha evaluations (hideUntilSnapshotReady and animatedPlayOverlayAlpha.value) inside Modifier.graphicsLayer { ... } rather than reading state during Composition.
    • rememberAnimatedVideoShape reads fractionState.value inside Shape.createOutline, deferring corner radius animation to the Draw/Layout pass and avoiding recompositions per frame.
    • fitVideoBounds uses Modifier.layout to compute fitted video constraints in the Layout phase rather than relying on subcomposition (SubcomposeLayout or BoxWithConstraints).
  2. Elimination of Backwards Writes & Coordinate Observation:

    • FullScreenVideoPlayer replaces onGloballyPositioned and Compose MutableState with Modifier.onLayoutRectChanged(throttleMillis = 0, debounceMillis = 0) and a plain Ref<IntRect>, preventing recomposition loops, multi-pass layout churn, and 1-frame lags.
  3. Deferred Shared Transitions in Lazy Lists:

    • VideoThumbnail gates Modifier.videoSharedBounds behind Modifier.onVisibilityChanged(minFractionVisible = 0.001f), preventing Lookahead passes and transition scopes from instantiating on pre-fetched or off-screen items during fast scrolling.
  4. Optimized State Derivation & Non-Allocating Collections:

    • Messages uses remember(scrollState) { derivedStateOf { ... } } along with visibleItems.fastSumBy { it.size } from androidx.compose.ui.util to eliminate iterator allocations and avoid unnecessary recompositions while scrolling.
    • JetchatApp derives displayBackStack cleanly via remember(isMultiPane) { derivedStateOf { ... } }.
  5. Lifecycle Retention & Main-Thread Offloading:

    • FullScreenVideoPlayer preserves ExoPlayer across configuration changes and shared-element transitions using retain(resolvedUri).
    • Video thumbnail extraction (extractInitialVideoFrame) is offloaded to Dispatchers.IO using MediaMetadataRetriever, and bitmaps are downscaled to 720px (downscaleBitmapIfNeeded) to minimize GPU memory pressure.

- Add shared element transitions, frame snapshot handoff, and retained playback state for fullscreen video player
- Handle captionBar and statusBarsIgnoringVisibility window insets in drawer, profile, and video player controls
- Cache per-channel conversation states, generate unique message IDs and formatted timestamps
- Add RoomDatabase keep rule for R8 Full Mode and update instrumentation tests
@bsagmoe
bsagmoe force-pushed the bsagmoe/jetchat-adaptive-video branch from 85259bf to a8ae7e9 Compare October 28, 2026 03:06
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.

2 participants