Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/picker/GalleryAdapter.java')
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/picker/GalleryAdapter.java34
1 files changed, 18 insertions, 16 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/picker/GalleryAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/picker/GalleryAdapter.java
index 658eb1ee3..2bd03011f 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/picker/GalleryAdapter.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/picker/GalleryAdapter.java
@@ -69,23 +69,25 @@ public class GalleryAdapter extends AbstractCursorPickerAdapter<RecyclerView.Vie
}
case VIEW_TYPE_ITEM: {
final long id = getItemId(position);
- bindExecutor.execute(() -> {
- try {
- final Bitmap thumbnail;
- if (SDK_INT >= Q) {
- thumbnail = contentResolver.loadThumbnail(ContentUris.withAppendedId(
- EXTERNAL_CONTENT_URI, id), new Size(512, 384), null);
- } else {
- thumbnail = MediaStore.Images.Thumbnails.getThumbnail(
- contentResolver, id,
- MediaStore.Images.Thumbnails.MINI_KIND, null);
+ if (!bindExecutor.isTerminated()) {
+ bindExecutor.execute(() -> {
+ try {
+ final Bitmap thumbnail;
+ if (SDK_INT >= Q) {
+ thumbnail = contentResolver.loadThumbnail(ContentUris.withAppendedId(
+ EXTERNAL_CONTENT_URI, id), new Size(512, 384), null);
+ } else {
+ thumbnail = MediaStore.Images.Thumbnails.getThumbnail(
+ contentResolver, id,
+ MediaStore.Images.Thumbnails.MINI_KIND, null);
+ }
+ new Handler(Looper.getMainLooper()).post(() -> ((GalleryItemViewHolder) holder).bind(ContentUris.withAppendedId(
+ EXTERNAL_CONTENT_URI, id), thumbnail, onSelect));
+ } catch (IOException ignored) {
+ new Handler(Looper.getMainLooper()).post(((GalleryItemViewHolder) holder)::bindError);
}
- new Handler(Looper.getMainLooper()).post(() -> ((GalleryItemViewHolder) holder).bind(ContentUris.withAppendedId(
- EXTERNAL_CONTENT_URI, id), thumbnail, onSelect));
- } catch (IOException ignored) {
- new Handler(Looper.getMainLooper()).post(((GalleryItemViewHolder) holder)::bindError);
- }
- });
+ });
+ }
}
}
}