Skip to content

feat(android): add gallery app integration (#1695) - #1696

Draft
tobikrs wants to merge 10 commits into
pulsejet:masterfrom
tobikrs:1695-add-support-for-image-review-chooser
Draft

feat(android): add gallery app integration (#1695)#1696
tobikrs wants to merge 10 commits into
pulsejet:masterfrom
tobikrs:1695-add-support-for-image-review-chooser

Conversation

@tobikrs

@tobikrs tobikrs commented Jul 5, 2026

Copy link
Copy Markdown

Fixes #1695

Memories did not appear in the Android system gallery chooser when tapping a camera
thumbnail, using "Open with" from a file manager, or selecting media in app pickers.

Approach

A new ViewerActivity is registered as the entry point for all incoming media intents.
On launch it resolves the incoming content:// URI against MediaStore and the local
Room DB, then routes to one of three modes:

  • Mode A (user is logged in + file is synced): redirects to MainActivity with a
    #v/{dayId}/{localId} hash, opening the photo directly in the Memories WebView viewer.
    ViewerActivity finishes immediately and is never visible.
  • Mode B (file not synced / offline): full-screen native viewer with ViewPager2 swipe
    navigation, pinch-zoom images (PhotoView), video playback (ExoPlayer), share, and delete.
    An "Open in Memories" FAB triggers the Mode A redirect when the user later logs in.
  • Mode C (picker intent): same native viewer as Mode B, but the toolbar shows a
    "Use this" action instead of share/delete, and returns the URI to the calling app via
    setResult.

Intent filters added to ViewerActivity

Action Use case
com.android.camera.action.REVIEW Camera thumbnail tap (legacy camera apps)
android.provider.action.REVIEW Camera thumbnail tap (Android 10+ / Google Camera)
ACTION_VIEW image/* + video/* "Open with" from file manager or share sheet
ACTION_PICK Media picker (e.g. attach photo in messaging apps)
ACTION_GET_CONTENT Media picker (alternative intent)

MainActivity is changed to singleTask so that a Mode A redirect brings the existing
instance to the foreground rather than creating a second one.

Other changes

  • MediaResolverService: resolves a content:// URI to structured media metadata
    (MediaStore _ID, auid, dayId, MIME type) by querying MediaStore then Room DB.
  • PlayerController: ExoPlayer logic extracted from MainActivity into a reusable
    class (local URIs, remote HTTP/HLS, error fall-through). Both MainActivity and
    ViewerActivity use it.
  • MainActivity: gains a pendingPhotoHash field consumed in onNewIntent(),
    loadDefaultUrl(), and onPageFinished() to handle the Mode A deep-link reliably
    regardless of whether the WebView has already finished loading.
  • PhotoView (com.github.chrisbanes:PhotoView:2.3.0) added as dependency for pinch-zoom.

Reviewer notes

  • Mode A uses the URL hash as the deep-link mechanism because it is the only way to open
    a specific photo in the Memories frontend (Vue Router watches #v/{dayId}/{fileid}).
  • In Mode B, swipe navigation loads all photos for the same day from Room DB and positions
    the pager at the current photo. When the file is not in the DB, a single-item pager is
    shown with swiping disabled.
  • Delete uses MediaStore.createTrashRequest() on API 30+ and direct deletion on older
    versions. On success the item is removed from the pager; if no items remain, the activity
    finishes.

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.

Add support for viewing images from camera app's photo review chooser

1 participant