nextcloud / nextcloud/android

Refactor: Create a ThumbImageView

Open
#77 13 comments 0 reactions 0 assignees View on GitHub
♻️ refactor feature: previews and thumbnails technical debt
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

Thumbnails of images are currently shown in 3 different places. The uploadlist, the local file browser and the normal folder view of an nextcloud folder.

The code to generate a thumbnail / kickof the thumbnail generation is present in all of there places.

To unify this, i would like to propose a ThumbImageView class which subclases ImageView. This Class should handle all concern regarding File or OCFile -> Thumbnail, by calling ThumbManager and so on.

The ImageView objects are reused in the list views, all code accesing these Views has to check whether the reference they use, still refer to a View with the initial File, this could be solved by having a Reference to OCFile or File on the ThumbImageView aswell as the unique thumbnail CacheKey!

So we have some new methods like
void setFile(File file);
void setOCFile(OCFile file);
int getCacheKey(); (maybe override .hashCode(), but this could be problematic with OCFiles not existing)

Another possibility would be to introduce two additional classes
FileThumbImageView and OCFileThumbImageView.. As far as i understand it, the Upload Queue and local filebrowser lists use File and the nextcloud folder browser uses OCFile..

This should only a refactor not any addition of new functionality.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.