Skip to content

feat: enhance thumbnail generation - #4946

Open
alexknop wants to merge 2 commits into
owncloud:masterfrom
alexknop:feature/enhancethumbnails
Open

feat: enhance thumbnail generation#4946
alexknop wants to merge 2 commits into
owncloud:masterfrom
alexknop:feature/enhancethumbnails

Conversation

@alexknop

Copy link
Copy Markdown
Contributor

Related Issues

  • No logged issue, but I keep my photo albums in Owncloud and noticed that many thumbnails stop showing on large albums and performance is very slow. Usually a thumbnail is loading one at a time and can take 2 seconds per thumbnail

Solution:

  • Increase thumbnail cache disk from 10 MB to 250 MB
  • Migrated thumbnail loading from AsyncTask to Coil
  • Caching ImageLoader instead of creating a new one on every request

App:

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (if required)

QA

@alexknop
alexknop requested a review from a team as a code owner July 31, 2026 18:52
@jesmrec

jesmrec commented Aug 3, 2026

Copy link
Copy Markdown
Member

hi @alexknop!! thanks for your contribution. We'll check it as soon as posible.

Some inputs about, in order to put the code in shape:

  • Review the commit naming, it does not pass the conventional commits validation CI check

  • The static code analyzer CI check is also red. This is the message: ThumbnailsRequester.kt:118:1: Line detected, which is longer than the defined maximum line length in the code style. [MaxLineLength] . Please wrap the line.

  • Calens file lacks of endline and description. A quick review will be appreciated ;)

@jesmrec jesmrec changed the title Enhance thumbnail generation feat: enhance thumbnail generation Aug 3, 2026
@alexknop
alexknop force-pushed the feature/enhancethumbnails branch from 2a628ad to c50529c Compare August 3, 2026 16:40
@alexknop

alexknop commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@jesmrec This is done. I was a bit confused on the two AccountUtils files but believe I referenced the correct one in the ThumbnailRequester file.

@jesmrec

jesmrec commented Aug 4, 2026

Copy link
Copy Markdown
Member

Cool @alexknop!! as in #4943, i'd suggest to compact the calens file. Again, my suggestion:

Enhancement: Thumbnail caching

Thumbnail caching system has been improved for a better experience and performance.

<link>

Calens file is intended to be a quick entry, not a complete description of the work. For that aim, the issue/PR is the best option. Changelog should be read at a glance.

Thanks again for your engagement!

@alexknop
alexknop force-pushed the feature/enhancethumbnails branch from 60d5592 to 842234a Compare August 5, 2026 03:16
@alexknop

alexknop commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@jesmrec done, thank you for your feedback. I'll get the hang of these things eventually...

@alexknop
alexknop force-pushed the feature/enhancethumbnails branch from 842234a to 7e195c2 Compare August 6, 2026 21:48
@joragua joragua closed this Aug 7, 2026
@joragua joragua reopened this Aug 7, 2026
@joragua

joragua commented Aug 7, 2026

Copy link
Copy Markdown
Member

The same note as on the other PR: all commits must be GPG/PGP signed and include a Signed-off-by line. Use the command: git commit -s -S -m "..." for that. Once it's done, I will start with the CR. Thanks @alexknop ! 🍻

@joragua

joragua commented Aug 7, 2026

Copy link
Copy Markdown
Member

Related issue: #4443

@alexknop
alexknop force-pushed the feature/enhancethumbnails branch from 7e195c2 to a484d2a Compare August 7, 2026 14:33
@alexknop

alexknop commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@joragua done!

Signed-off-by: alex <knopalex@msu.edu>
Signed-off-by: alex <knopalex@msu.edu>
@alexknop
alexknop force-pushed the feature/enhancethumbnails branch from a484d2a to 690cf68 Compare August 11, 2026 01:50
@alexknop

Copy link
Copy Markdown
Contributor Author

@joragua fixed signed commits.

@joragua joragua 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.

Hi @alexknop! Thanks for this contribution! Some comments about the first CR round. Let us know if you have any doubts and we will be happy to help you! 💯

NOTE: Please don't forget that there should be only one commit for calens file in the PR. In case yo need to make any changes, you will need to rebase the commits and create a new one.

Comment thread changelog/unreleased/4946
@@ -0,0 +1,5 @@
Enhancement: Thumbnail caching

Thumbnail caching system has been improved for a better experience and performance.

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.

I'd write the calens body like this:

Suggested change
Thumbnail caching system has been improved for a better experience and performance.
Thumbnail caching system has been improved for a better experience and performance. Thumbnails are now loaded from the cache whenever possible instead of being regenerated each time, reducing loading times.

Comment thread changelog/unreleased/4946

Thumbnail caching system has been improved for a better experience and performance.

https://github.com/owncloud/android/pull/4946

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.

The issue id is missing here:

Suggested change
https://github.com/owncloud/android/pull/4946
https://github.com/owncloud/android/issues/4443
https://github.com/owncloud/android/pull/4946

private static boolean mThumbnailCacheStarting = true;

private static final int DISK_CACHE_SIZE = 1024 * 1024 * 10; // 10MB
private static final int DISK_CACHE_SIZE = 1024 * 1024 * 250; // 250MB

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.

Why did you choose 250 MB? Is there any specific reason for this value? 🤔

}
task.execute(file)
fileIcon.load(
ThumbnailsRequester.getPreviewUriForFile(fileWithSyncInfo, account!!),

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.

Be careful with account!! clause. What could happen if the value of this variable is null?

marginVertical = 0,
height = context.resources.getDimensionPixelSize(R.dimen.item_file_grid_height),
width = context.resources.getDimensionPixelSize(R.dimen.item_file_grid_width),
)

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.

I'm not sure if this logic is valid at this point, since before these changes there were two different configurations (margin, height, and width) depending on the thumbnail. Now, there's only one configuration, and with Coil, thumbnails are generated asynchronously.

Could it be a risk for grid mode? 🤔 Maybe, it will need an extra check...

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Some images previews are visible on web interface and not on Android app

3 participants