Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enchance imageviewer: Downloadprogressbar, error placeholder + retry, large images subsampling, SVG support #1111

Merged
merged 12 commits into from
Aug 3, 2023

Conversation

MV-GH
Copy link
Collaborator

@MV-GH MV-GH commented Jul 29, 2023

Before we were recreating a bunch of imageloaders which were creating a bunch of HttpClients. This pr aims to solve this.

  • Make imageloader a singleton that gets reused
  • Make HTTPclient a singleton that gets resused
  • Add SVG support
  • Moved application to a seperate file
  • Added a loadingbar to the imageviewer that tracks the download progress of the image
  • increase the ability to zoom in
  • Opened: Zooming in on large images, makes the image blurry likely due to downsampling, support "resampling" coil-kt/coil#1833
  • Used a ZoomableAsyncImage instead now, which supports subsampling larges images
  • Added error placeholder (I drew that myself found no SVG CC error placeholder images)
  • Added foundation to track upload/download progress
  • Removed useless repository section in build :Jerboa, it gets overwritten from settings.gradle anyway, wasted some time on that

OkHttp performs best when you create a single OkHttpClient instance and reuse it for all of your HTTP calls. This is because each client holds its own connection pool and thread pools. Reusing connections and threads reduces latency and saves memory. Conversely, creating a client for each request wastes resources on idle pools.

Loading bar example

studio64_kcQHmGd8PN.mp4

error failure

studio64_RvFLc7Fpxh.mp4

Large image subsampling

studio64_mpNOL3St41.mp4

ZoomableAsyncImage does have some slight issues. I can revert back to AsymcImage untill they are fixed.

see https://github.com/saket/telephoto/issues

@MV-GH MV-GH marked this pull request as draft July 31, 2023 07:21
@MV-GH MV-GH changed the title Make imageLoader a singleton, add loadingbar in imageviewer, add SVG support Enchance imageviewer: Downloadprogressbar, error placeholder + retry, large images subsampling Aug 2, 2023
@MV-GH MV-GH changed the title Enchance imageviewer: Downloadprogressbar, error placeholder + retry, large images subsampling Enchance imageviewer: Downloadprogressbar, error placeholder + retry, large images subsampling, SVG support Aug 2, 2023
MV-GH added 2 commits August 2, 2023 03:19
# Conflicts:
#	app/src/main/res/values/strings.xml
@MV-GH MV-GH marked this pull request as ready for review August 2, 2023 01:26
MV-GH and others added 5 commits August 2, 2023 09:16
# Conflicts:
#	app/src/main/java/com/jerboa/Utils.kt
#	app/src/main/java/com/jerboa/api/Http.kt
#	app/src/main/res/values/strings.xml
# Conflicts:
#	app/build.gradle.kts
Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

Works well, thx!

@@ -0,0 +1,19 @@
package com.jerboa.util.downloadprogress
Copy link
Member

Choose a reason for hiding this comment

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

Wish these things were already built in to the http clients. oh well.

@dessalines dessalines enabled auto-merge (squash) August 3, 2023 13:29
@dessalines dessalines disabled auto-merge August 3, 2023 14:12
@dessalines dessalines merged commit 18d9a51 into LemmyNet:main Aug 3, 2023
@MV-GH MV-GH deleted the feat/imageLoader_singleton branch August 3, 2023 16:08
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