@@ -68,30 +68,23 @@ class FileThumbnailGenerator @Inject constructor(
6868 )
6969
7070 private val tasks = Collections .synchronizedList(mutableListOf<ThumbnailGenerationTask >())
71- private var arguments = ThumbnailArguments .none
72-
73- fun setThumbnail (
74- file : OCFile ,
75- view : ImageView ,
76- arguments : ThumbnailArguments ,
77- ) {
78- this .arguments = arguments
7971
72+ fun setThumbnail (file : OCFile , view : ImageView , arguments : ThumbnailArguments ) {
8073 if (file.remoteId == null ) {
81- setLocalThumbnail(file, view)
74+ setLocalThumbnail(file, view, arguments )
8275 return
8376 }
8477
8578 if (! file.isPreviewAvailable) {
86- generate(file, view)
79+ generate(file, view, arguments )
8780 return
8881 }
8982
9083 val cached = file.getSmallThumbnail()
9184 if (cached == null || file.isUpdateThumbnailNeeded) {
92- generate(file, view)
85+ generate(file, view, arguments )
9386 } else {
94- show(cached, file, view)
87+ show(cached, file, view, arguments )
9588 }
9689
9790 applyPngBackground(file, view)
@@ -125,7 +118,7 @@ class FileThumbnailGenerator @Inject constructor(
125118 }
126119 }
127120
128- private fun show (bitmap : Bitmap , file : OCFile , view : ImageView ) {
121+ private fun show (bitmap : Bitmap , file : OCFile , view : ImageView , arguments : ThumbnailArguments ) {
129122 view.stopShimmer(arguments.shimmer)
130123
131124 if (MimeTypeUtil .isVideo(file)) {
@@ -135,7 +128,7 @@ class FileThumbnailGenerator @Inject constructor(
135128 }
136129 }
137130
138- private fun setLocalThumbnail (file : OCFile , view : ImageView ) {
131+ private fun setLocalThumbnail (file : OCFile , view : ImageView , arguments : ThumbnailArguments ) {
139132 val localFile = file.storagePath.toFile()
140133
141134 if (localFile == null || ! MimeTypeUtil .isImageOrVideo(file)) {
@@ -145,14 +138,15 @@ class FileThumbnailGenerator @Inject constructor(
145138 startTask(
146139 file,
147140 view,
141+ arguments,
148142 ThumbnailGenerationTaskObject (localFile, null ),
149143 localFile.hashCode()
150144 )
151145 }
152146 }
153147
154148 @Suppress(" DEPRECATION" )
155- private fun generate (file : OCFile , view : ImageView ) {
149+ private fun generate (file : OCFile , view : ImageView , arguments : ThumbnailArguments ) {
156150 if (! ThumbnailsCacheManager .cancelPotentialThumbnailWork(file, view)) {
157151 return
158152 }
@@ -173,6 +167,7 @@ class FileThumbnailGenerator @Inject constructor(
173167 startTask(
174168 file,
175169 view,
170+ arguments,
176171 ThumbnailGenerationTaskObject (file, file.remoteId),
177172 file.fileId
178173 )
@@ -183,6 +178,7 @@ class FileThumbnailGenerator @Inject constructor(
183178 private fun startTask (
184179 file : OCFile ,
185180 view : ImageView ,
181+ arguments : ThumbnailArguments ,
186182 target : ThumbnailGenerationTaskObject ,
187183 tag : Any
188184 ) {
0 commit comments