Skip to content

Compress images and videos before upload + new upload/preview dialog + use system camera - #6429

Open
mahibi wants to merge 4 commits into
masterfrom
feature/5190/imageCompression
Open

Compress images and videos before upload + new upload/preview dialog + use system camera#6429
mahibi wants to merge 4 commits into
masterfrom
feature/5190/imageCompression

Conversation

@mahibi

@mahibi mahibi commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator
  • resolve Use compression for images and files selected via gallery #5190

  • resolve replace photo camera code with intent to open system camera #2461

    Adds automatic compression of images and videos before upload in chat, replaces the old attachment picker/preview dialog with a new Compose-based
    one, and removes the app's built-in camera capture screen in favor of the system camera.

  • Compress images and videos before upload

    • New ImageCompressor/VideoCompressor utilities: images are downscaled and re-encoded as JPEG; videos are downscaled to 540p (short side) and
      transcoded via Media3 Transformer on a dedicated HandlerThread, keeping the main thread unblocked.
    • BitmapShrinker modernized to use ImageDecoder on API 28+ (single-pass decode+scale with automatic EXIF rotation for JPEG/HEIC), falling back to
      the previous BitmapFactory path on API 26/27.
    • UploadAndShareFilesWorker shows live "Compressing… X%" progress (via Transformer.getProgress()) before switching to the upload progress notification.
      --> this is just a temporary solution until in chat upload previews are implemented.
    • Fixes MIME-type resolution for file:// URIs (e.g. camera-captured photos/videos), which previously broke dialog/thumbnail detection since
      ContentResolver.getType() only handles content:// URIs.
  • New attachment preview/upload dialog

    • FileAttachmentPreviewFragment/FileAttachmentPreviewDialogCompose rewritten in Jetpack Compose, with thumbnails and per-file dimensions/size shown
      before sending.
  • Media quality setting

    • The compression toggle is now a "Sent media quality" setting under Settings, presented as a dialog with Original quality / Reduced quality
      options (previously a simple switch), persisted via AppPreferences.
  • Removed built-in camera

    • Deleted TakePhotoActivity, TakePictureViewModel, and the associated layout/drawables. Photo/video capture now goes through the system camera;
      PickImage, ConversationCreationActivity, ConversationInfoEditActivity, and ProfileActivity updated accordingly.

Assisted-by: Claude Code 2.1.199:claude-sonnet-5

🖼️ Screenshots

before

grafik

after

work in progress....

🚧 TODO

  • ...

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@mahibi mahibi self-assigned this Jul 28, 2026
@mahibi
mahibi requested a review from rapterjet2004 July 28, 2026 18:36
@mahibi mahibi added the 3. to review Waiting for reviews label Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/30387637532/artifacts/8699821637
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@mahibi
mahibi force-pushed the feature/5190/imageCompression branch from cd7df8f to c950080 Compare July 28, 2026 18:44
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/30388822788/artifacts/8700239068
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@jancborchardt jancborchardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to formulate and design it a bit less technical. Signal e.g. specifically calls it "Sent media quality" with an easy to understand "Low" and "High" setting.

I'd say we could have a single-select segmented button in the send flow with:

  • Original quality
  • Reduced quality

And last selected setting remembered. What do you think @nimishavijay

@mahibi

mahibi commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

For reference: thats how signal does it in the send flow (in the left pic it is the (crossed) HD button):

grafik grafik

@mahibi
mahibi force-pushed the feature/5190/imageCompression branch from c950080 to fc85f80 Compare July 29, 2026 17:38
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/30476294926/artifacts/8734032240
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@nimishavijay

Copy link
Copy Markdown
Member

If we are able to have a fullscreen preview of the image before sending like in whatsapp,telegram, signal, etc, the HD/SD icon-only button is pretty standard. if that is not possible then the radio-style buttons in the current UI make sense :)

@mahibi mahibi added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jul 30, 2026
@mahibi mahibi changed the title Compress images and videos before upload Compress images and videos before upload + new upload dialog + use system camera Jul 31, 2026
Adds an optional compression step to the chat attachment upload flow,
covering both gallery-picked and camera-captured photos/videos.

  - Add ImageCompressor/VideoCompressor utilities: images are downscaled
    and re-encoded as JPEG; videos are downscaled to 540p short side and
    transcoded via Media3 Transformer on a dedicated HandlerThread so the
    main thread is never blocked.
  - Migrate the file attachment preview dialog to Jetpack Compose, adding
    thumbnails, per-file dimensions/size preview, and a "Compress images
    and videos" checkbox that updates the preview live.
  - Persist the compression choice as a user preference (default on),
    with a toggle in Settings.
  - Extend the existing upload notification to also show live progress
    ("Compressing… X%") while a video is being transcoded, by polling
    Transformer.getProgress(), before it turns into the upload progress
    notification.
  - Modernize BitmapShrinker to use ImageDecoder on API 28+ (single-pass
    decode+scale, automatic EXIF rotation for JPEG/HEIC), falling back to
    the previous BitmapFactory-based path on API 26/27.
  - Fix MIME-type resolution for file:// URIs (e.g. camera-captured
    photos/videos), which previously failed dialog/thumbnail detection
    since ContentResolver.getType() only handles content:// URIs.

Assisted-by: Claude Code 2.1.199:claude-sonnet-5

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi
mahibi force-pushed the feature/5190/imageCompression branch from fc85f80 to b50fd6b Compare July 31, 2026 15:07
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/30641574479/artifacts/8797835298
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

@mahibi mahibi changed the title Compress images and videos before upload + new upload dialog + use system camera Compress images and videos before upload + new upload/preview dialog + use system camera Jul 31, 2026
mahibi added 2 commits July 31, 2026 17:48
Assisted-by: Claude Code 2.1.199:claude-sonnet-5

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Assisted-by: Claude Code 2.1.199:claude-sonnet-5

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi
mahibi force-pushed the feature/5190/imageCompression branch from b50fd6b to 19383a8 Compare July 31, 2026 15:49
Assisted-by: Claude Code 2.1.199:claude-sonnet-5

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi
mahibi force-pushed the feature/5190/imageCompression branch from 19383a8 to 9267408 Compare July 31, 2026 18:44
@github-actions

Copy link
Copy Markdown
Contributor

APK file: https://github.com/nextcloud/talk-android/actions/runs/30656399981/artifacts/8803577048
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
qrcode (please click on link to get QR code displayed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use compression for images and files selected via gallery replace photo camera code with intent to open system camera

4 participants