adding some initial folder un/locking related code

This commit is contained in:
tibbi 2019-07-02 17:22:21 +02:00
parent be62c4ed9a
commit 738cbf7d1a
4 changed files with 34 additions and 6 deletions

View File

@ -61,7 +61,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.14.3'
implementation 'com.simplemobiletools:commons:5.14.6'
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'

View File

@ -12,10 +12,7 @@ import com.bumptech.glide.Glide
import com.google.gson.Gson
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.PropertiesDialog
import com.simplemobiletools.commons.dialogs.RenameItemDialog
import com.simplemobiletools.commons.dialogs.RenameItemsDialog
import com.simplemobiletools.commons.dialogs.*
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isOreoPlus
@ -81,6 +78,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
findItem(R.id.cab_rename).isVisible = !selectedPaths.contains(FAVORITES) && !selectedPaths.contains(RECYCLE_BIN)
findItem(R.id.cab_change_cover_image).isVisible = isOneItemSelected
findItem(R.id.cab_lock).isVisible = selectedPaths.any { !config.isFolderProtected(it) }
findItem(R.id.cab_unlock).isVisible = selectedPaths.any { config.isFolderProtected(it) }
findItem(R.id.cab_empty_recycle_bin).isVisible = isOneItemSelected && selectedPaths.first() == RECYCLE_BIN
findItem(R.id.cab_empty_disable_recycle_bin).isVisible = isOneItemSelected && selectedPaths.first() == RECYCLE_BIN
@ -106,6 +106,8 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
R.id.cab_hide -> toggleFoldersVisibility(true)
R.id.cab_unhide -> toggleFoldersVisibility(false)
R.id.cab_exclude -> tryExcludeFolder()
R.id.cab_lock -> tryLockFolder()
R.id.cab_unlock -> unlockFolder()
R.id.cab_copy_to -> copyMoveTo(true)
R.id.cab_move_to -> moveFilesTo()
R.id.cab_select_all -> selectAll()
@ -310,6 +312,24 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
}
}
private fun tryLockFolder() {
if (config.wasFolderLockingNoticeShown) {
lockFolder()
} else {
FolderLockingNoticeDialog(activity) {
lockFolder()
}
}
}
private fun lockFolder() {
}
private fun unlockFolder() {
}
private fun pinFolders(pin: Boolean) {
if (pin) {
config.addPinnedFolders(getSelectedPaths().toHashSet())

View File

@ -380,7 +380,7 @@ class Config(context: Context) : BaseConfig(context) {
}
fun saveLastVideoPosition(path: String, value: Int) {
if (!path.isEmpty()) {
if (path.isNotEmpty()) {
prefs.edit().putInt("$LAST_VIDEO_POSITION_PREFIX${path.toLowerCase()}", value).apply()
}
}

View File

@ -48,6 +48,14 @@
android:id="@+id/cab_exclude"
android:title="@string/exclude"
app:showAsAction="never"/>
<item
android:id="@+id/cab_lock"
android:title="@string/lock_folder"
app:showAsAction="never"/>
<item
android:id="@+id/cab_unlock"
android:title="@string/unlock_folder"
app:showAsAction="never"/>
<item
android:id="@+id/cab_select_all"
android:icon="@drawable/ic_select_all"