allow emptying the recycle bin with some menu buttons

This commit is contained in:
tibbi 2018-06-27 18:40:18 +02:00
parent 8397ebac66
commit 15440cab42
4 changed files with 30 additions and 3 deletions

View File

@ -47,7 +47,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:4.3.5'
implementation 'com.simplemobiletools:commons:4.3.6'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1'

View File

@ -218,8 +218,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
menuInflater.inflate(R.menu.menu_main_intent, menu)
} else {
menuInflater.inflate(R.menu.menu_main, menu)
menu.findItem(R.id.increase_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt < MAX_COLUMN_COUNT
menu.findItem(R.id.reduce_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt > 1
menu.apply {
findItem(R.id.increase_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt < MAX_COLUMN_COUNT
findItem(R.id.reduce_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt > 1
}
}
menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
menu.findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden

View File

@ -76,6 +76,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
findItem(R.id.cab_rename).isVisible = isOneItemSelected() && !selectedPaths.contains(FAVORITES) && !selectedPaths.contains(RECYCLE_BIN)
findItem(R.id.cab_change_cover_image).isVisible = isOneItemSelected()
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
checkHideBtnVisibility(this)
checkPinBtnVisibility(this)
}
@ -92,6 +95,8 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
R.id.cab_pin -> pinFolders(true)
R.id.cab_unpin -> pinFolders(false)
R.id.cab_hide -> toggleFoldersVisibility(true)
R.id.cab_empty_recycle_bin -> emptyRecycleBin()
R.id.cab_empty_disable_recycle_bin -> emptyAndDisableRecycleBin()
R.id.cab_unhide -> toggleFoldersVisibility(false)
R.id.cab_exclude -> tryExcludeFolder()
R.id.cab_copy_to -> copyMoveTo(true)
@ -208,6 +213,18 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
}
}
private fun emptyRecycleBin() {
activity.emptyTheRecycleBin {
listener?.refreshItems()
}
}
private fun emptyAndDisableRecycleBin() {
activity.emptyAndDisableTheRecycleBin {
listener?.refreshItems()
}
}
private fun updateFolderNames() {
val includedFolders = activity.config.includedFolders
val hidden = activity.getString(R.string.hidden)

View File

@ -36,6 +36,14 @@
android:icon="@drawable/ic_unhide"
android:title="@string/unhide_folder"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/cab_empty_recycle_bin"
android:title="@string/empty_recycle_bin"
app:showAsAction="never"/>
<item
android:id="@+id/cab_empty_disable_recycle_bin"
android:title="@string/empty_and_disable_recycle_bin"
app:showAsAction="never"/>
<item
android:id="@+id/cab_exclude"
android:title="@string/exclude"