From 9520a25f62b87f7c4ca7b25fb7df0b967fdf4d1a Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 22 Jun 2018 20:57:19 +0200 Subject: [PATCH] do not allow clicking or long pressing thumbnail sections --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 4 +++- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 3 ++- .../simplemobiletools/gallery/dialogs/PickMediumDialog.kt | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 8578357b2..c36cc7191 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -320,7 +320,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { initZoomListener() val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller MediaAdapter(this, mMedia, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, mAllowPickingMultiple, media_grid, fastscroller) { - itemClicked((it as Medium).path) + if (it is Medium) { + itemClicked(it.path) + } }.apply { setupZoomListener(mZoomListener) media_grid.adapter = this diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index f20d59461..eddf5d004 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -81,7 +81,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList + val allowLongPress = !allowMultiplePicks && tmbItem is Medium + val view = holder.bindView(tmbItem, allowLongPress) { itemView, adapterPosition -> if (tmbItem is Medium) { setupThumbnail(itemView, tmbItem) } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index dbdd77856..1a45671cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -64,8 +64,10 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c shownMedia = media val adapter = MediaAdapter(activity, shownMedia, null, true, false, view.media_grid, null) { - callback((it as Medium).path) - dialog.dismiss() + if (it is Medium) { + callback(it.path) + dialog.dismiss() + } } val scrollHorizontally = activity.config.scrollHorizontally && isGridViewType