mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 02:38:58 +03:00
return onError in onPostExecute (which runs on UI thread)
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
de38e90acb
commit
c50798cd24
1 changed files with 10 additions and 11 deletions
|
@ -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,17 +537,21 @@ 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) {
|
||||||
|
|
Loading…
Reference in a new issue