From 15440cab4230df994fd521661d57ea841eeedd49 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Jun 2018 18:40:18 +0200 Subject: [PATCH] allow emptying the recycle bin with some menu buttons --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 6 ++++-- .../gallery/adapters/DirectoryAdapter.kt | 17 +++++++++++++++++ app/src/main/res/menu/cab_directories.xml | 8 ++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 137c3a2c4..2ffaa0bb4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index a3ef6ea65..721393926 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 78089c37c..12283589b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -76,6 +76,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList 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