return onError in onPostExecute (which runs on UI thread)

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-08-21 10:46:11 +02:00
parent de38e90acb
commit c50798cd24
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -514,15 +514,9 @@ public final class ThumbnailsCacheManager {
} catch(OutOfMemoryError oome) { } catch(OutOfMemoryError oome) {
Log_OC.e(TAG, "Out of memory"); Log_OC.e(TAG, "Out of memory");
isError = true;
} catch (Throwable t) { } catch (Throwable t) {
// the app should never break due to a problem with thumbnails // the app should never break due to a problem with thumbnails
Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t); Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t);
isError = true;
} finally {
if (isError && mListener != null){
mListener.onError();
}
} }
return thumbnail; return thumbnail;
@ -532,6 +526,7 @@ public final class ThumbnailsCacheManager {
if (bitmap != null && mImageViewReference != null) { if (bitmap != null && mImageViewReference != null) {
final ImageView imageView = mImageViewReference.get(); final ImageView imageView = mImageViewReference.get();
final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView); final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (this == bitmapWorkerTask) { if (this == bitmapWorkerTask) {
String tagId = ""; String tagId = "";
if (mFile instanceof OCFile) { if (mFile instanceof OCFile) {
@ -542,18 +537,22 @@ public final class ThumbnailsCacheManager {
tagId = String.valueOf(((TrashbinFile) mFile).getRemoteId()); tagId = String.valueOf(((TrashbinFile) mFile).getRemoteId());
} }
if (String.valueOf(imageView.getTag()).equals(tagId)) { if (String.valueOf(imageView.getTag()).equals(tagId)) {
if (gridViewEnabled){ if (gridViewEnabled) {
BitmapUtils.setRoundedBitmapForGridMode(bitmap, imageView); BitmapUtils.setRoundedBitmapForGridMode(bitmap, imageView);
} else { } else {
BitmapUtils.setRoundedBitmap(bitmap, imageView); BitmapUtils.setRoundedBitmap(bitmap, imageView);
} }
} }
} }
}
if (mListener !=null){ if (mListener != null) {
mListener.onSuccess(); mListener.onSuccess();
} }
} else {
if (mListener != null) {
mListener.onError();
}
}
if (mAsyncTasks != null) { if (mAsyncTasks != null) {
mAsyncTasks.remove(this); mAsyncTasks.remove(this);