adding some initial folder un/locking related code
This commit is contained in:
parent
be62c4ed9a
commit
738cbf7d1a
|
@ -61,7 +61,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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 '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'
|
||||||
|
|
|
@ -12,10 +12,7 @@ import com.bumptech.glide.Glide
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
import com.simplemobiletools.commons.dialogs.*
|
||||||
import com.simplemobiletools.commons.dialogs.PropertiesDialog
|
|
||||||
import com.simplemobiletools.commons.dialogs.RenameItemDialog
|
|
||||||
import com.simplemobiletools.commons.dialogs.RenameItemsDialog
|
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.helpers.isOreoPlus
|
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_rename).isVisible = !selectedPaths.contains(FAVORITES) && !selectedPaths.contains(RECYCLE_BIN)
|
||||||
findItem(R.id.cab_change_cover_image).isVisible = isOneItemSelected
|
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_recycle_bin).isVisible = isOneItemSelected && selectedPaths.first() == RECYCLE_BIN
|
||||||
findItem(R.id.cab_empty_disable_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_hide -> toggleFoldersVisibility(true)
|
||||||
R.id.cab_unhide -> toggleFoldersVisibility(false)
|
R.id.cab_unhide -> toggleFoldersVisibility(false)
|
||||||
R.id.cab_exclude -> tryExcludeFolder()
|
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_copy_to -> copyMoveTo(true)
|
||||||
R.id.cab_move_to -> moveFilesTo()
|
R.id.cab_move_to -> moveFilesTo()
|
||||||
R.id.cab_select_all -> selectAll()
|
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) {
|
private fun pinFolders(pin: Boolean) {
|
||||||
if (pin) {
|
if (pin) {
|
||||||
config.addPinnedFolders(getSelectedPaths().toHashSet())
|
config.addPinnedFolders(getSelectedPaths().toHashSet())
|
||||||
|
|
|
@ -380,7 +380,7 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveLastVideoPosition(path: String, value: Int) {
|
fun saveLastVideoPosition(path: String, value: Int) {
|
||||||
if (!path.isEmpty()) {
|
if (path.isNotEmpty()) {
|
||||||
prefs.edit().putInt("$LAST_VIDEO_POSITION_PREFIX${path.toLowerCase()}", value).apply()
|
prefs.edit().putInt("$LAST_VIDEO_POSITION_PREFIX${path.toLowerCase()}", value).apply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,14 @@
|
||||||
android:id="@+id/cab_exclude"
|
android:id="@+id/cab_exclude"
|
||||||
android:title="@string/exclude"
|
android:title="@string/exclude"
|
||||||
app:showAsAction="never"/>
|
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
|
<item
|
||||||
android:id="@+id/cab_select_all"
|
android:id="@+id/cab_select_all"
|
||||||
android:icon="@drawable/ic_select_all"
|
android:icon="@drawable/ic_select_all"
|
||||||
|
|
Loading…
Reference in New Issue