Skip to content

Tapping on an image opens pinch-to-zoom view#1491

Open
amarek wants to merge 2 commits into
wallabag:masterfrom
amarek:image-zoom
Open

Tapping on an image opens pinch-to-zoom view#1491
amarek wants to merge 2 commits into
wallabag:masterfrom
amarek:image-zoom

Conversation

@amarek
Copy link
Copy Markdown

@amarek amarek commented Apr 17, 2026

Some images embedded in articles become too small to see the details when viewed on a mobile/e-reader device. This change adds the capbility to open a zoomable view of an image by tapping on it. Tapping again closes the view.

Details:

  • Adds an image-zoom handler (JS) that sends image URLs from the article WebView back to the app.
  • New ImageViewActivity (PhotoView-based) opens a full-screen pinch-to-zoom viewer, loading from cache, file://, or network with downsample-to-4096px to avoid Canvas size crashes.
  • Wires the JS interface and activity into ReadArticleActivity and the manifest.

@Strubbl
Copy link
Copy Markdown
Contributor

Strubbl commented Apr 27, 2026

Thank you, this would have fixed #616. But i do not want to add a dependency to an unmaintained lib (https://github.com/Baseflow/PhotoView). Last commit was 6 years ago, last tag/release ~8 years ago.

Copy link
Copy Markdown
Contributor

@Strubbl Strubbl left a comment

Choose a reason for hiding this comment

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

as stated above, if we introduce a new dependency it should at least be maintained

@amarek
Copy link
Copy Markdown
Author

amarek commented May 18, 2026

Replaced PhotoView with https://github.com/panpf/zoomimage which seems to be maintained.

Copy link
Copy Markdown
Contributor

@Strubbl Strubbl left a comment

Choose a reason for hiding this comment

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

Thank you for the update of the dependency. What do you think about my review comments?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I hope this file did not serve any purpose.

// Fall back to loading from network
try {
URL url = new URL(imageUrl);
try (InputStream is = url.openStream()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you change this to use the OkhttpClient here? WallabagConnection.createClient() could be reused (automatically reusing the app's global network settings).

return null;
}

// Canvas hardware-accelerated draw limit is ~100MB; cap at 4096px (64MB @ ARGB_8888).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

64 MB is a lot, maybe we need to catch any OOM errors when we use this high resolution? This might be an issue esp. with low-end devices.

android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity
android:name="fr.gaulupeau.apps.Poche.ui.ImageViewActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should add the android:configChanges="keyboardHidden|orientation|screenSize" here, analog to the other activities, so that this image view acitvity does not get recreated when we rotate the phone while viewing the image.

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.

3 participants