From a37170662c677b0bfb87ed56af65ca8e6ed23125 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 28 Oct 2018 20:09:20 +0100 Subject: [PATCH] fix #1028, disable the Move operation on items at the recycle bin --- app/build.gradle | 2 +- .../gallery/activities/ViewPagerActivity.kt | 6 ++++++ .../gallery/adapters/MediaAdapter.kt | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a6177dd36..d2a4740fc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,7 +48,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.2.11' + implementation 'com.simplemobiletools:commons:5.2.13' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'androidx.multidex:multidex:2.0.0' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index efd5fe23b..1a50a42a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -25,6 +25,7 @@ import android.view.MenuItem import android.view.View import android.view.WindowManager import android.view.animation.DecelerateInterpolator +import android.widget.Toast import androidx.viewpager.widget.ViewPager import com.bumptech.glide.Glide import com.simplemobiletools.commons.dialogs.PropertiesDialog @@ -524,6 +525,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun copyMoveTo(isCopyOperation: Boolean) { val currPath = getCurrentPath() + if (!isCopyOperation && currPath.startsWith(recycleBinPath)) { + toast(R.string.moving_recycle_bin_items_disabled, Toast.LENGTH_LONG) + return + } + val fileDirItems = arrayListOf(FileDirItem(currPath, currPath.getFilenameFromPath())) tryCopyMoveFilesTo(fileDirItems, isCopyOperation) { config.tempFolderPath = "" 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 acfbac0aa..1e8324fde 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -8,6 +8,7 @@ import android.provider.MediaStore import android.view.Menu import android.view.View import android.view.ViewGroup +import android.widget.Toast import com.bumptech.glide.Glide import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter @@ -277,9 +278,18 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList