implementing folder un/locking
This commit is contained in:
parent
738cbf7d1a
commit
8497e2fdec
2 changed files with 24 additions and 1 deletions
|
@ -61,7 +61,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.dialogs.*
|
import com.simplemobiletools.commons.dialogs.*
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
|
import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.helpers.isOreoPlus
|
import com.simplemobiletools.commons.helpers.isOreoPlus
|
||||||
import com.simplemobiletools.commons.models.FileDirItem
|
import com.simplemobiletools.commons.models.FileDirItem
|
||||||
|
@ -323,11 +324,33 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun lockFolder() {
|
private fun lockFolder() {
|
||||||
|
SecurityDialog(activity, "", SHOW_ALL_TABS) { hash, type, success ->
|
||||||
|
if (success) {
|
||||||
|
getSelectedPaths().filter { !config.isFolderProtected(it) }.forEach {
|
||||||
|
config.addFolderProtection(it, hash, type)
|
||||||
|
}
|
||||||
|
|
||||||
|
listener?.refreshItems()
|
||||||
|
finishActMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun unlockFolder() {
|
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) {
|
private fun pinFolders(pin: Boolean) {
|
||||||
|
|
Loading…
Reference in a new issue