diff --git a/app/build.gradle b/app/build.gradle index bfbaa875e..3df1aeded 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.14.6' + implementation 'com.simplemobiletools:commons:5.14.7' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 461f6f545..96fcb8911 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -14,6 +14,7 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.* import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.commons.models.FileDirItem @@ -323,11 +324,33 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList + if (success) { + getSelectedPaths().filter { !config.isFolderProtected(it) }.forEach { + config.addFolderProtection(it, hash, type) + } + listener?.refreshItems() + finishActMode() + } + } } private fun unlockFolder() { + val paths = getSelectedPaths() + val firstPath = paths.first() + val tabToShow = config.getFolderProtectionType(firstPath) + val hashToCheck = config.getFolderProtectionHash(firstPath) + SecurityDialog(activity, hashToCheck, tabToShow) { hash, type, success -> + if (success) { + paths.filter { config.isFolderProtected(it) && config.getFolderProtectionType(it) == tabToShow && config.getFolderProtectionHash(it) == hashToCheck }.forEach { + config.removeFolderProtection(it) + } + listener?.refreshItems() + finishActMode() + } + } } private fun pinFolders(pin: Boolean) {