adding more menu visibility changes

This commit is contained in:
tibbi 2022-02-12 18:12:16 +01:00
parent cfbeb85b0d
commit 144409b7a9
3 changed files with 37 additions and 34 deletions

View file

@ -5,6 +5,7 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.internalStoragePath
import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID
import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
@ -42,7 +43,6 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_add_folder, menu) menuInflater.inflate(R.menu.menu_add_folder, menu)
menu.findItem(R.id.add_folder).isVisible = !isRPlus()
updateMenuItemColors(menu) updateMenuItemColors(menu)
return true return true
} }
@ -60,7 +60,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun addFolder() { private fun addFolder() {
FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true, true) { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden, false, true, true) {
config.lastFilepickerPath = it config.lastFilepickerPath = it
config.addExcludedFolder(it) config.addExcludedFolder(it)
updateFolders() updateFolders()

View file

@ -287,6 +287,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
findItem(R.id.hide_the_recycle_bin).isVisible = useBin && config.showRecycleBinAtFolders findItem(R.id.hide_the_recycle_bin).isVisible = useBin && config.showRecycleBinAtFolders
findItem(R.id.show_the_recycle_bin).isVisible = useBin && !config.showRecycleBinAtFolders findItem(R.id.show_the_recycle_bin).isVisible = useBin && !config.showRecycleBinAtFolders
findItem(R.id.set_as_default_folder).isVisible = !config.defaultFolder.isEmpty() findItem(R.id.set_as_default_folder).isVisible = !config.defaultFolder.isEmpty()
findItem(R.id.create_new_folder).isVisible = !isRPlus()
setupSearch(this) setupSearch(this)
} }
} }

View file

@ -8,8 +8,10 @@ import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.R
import kotlinx.android.synthetic.main.dialog_save_as.view.* import kotlinx.android.synthetic.main.dialog_save_as.view.*
class SaveAsDialog(val activity: BaseSimpleActivity, val path: String, val appendFilename: Boolean, val cancelCallback: (() -> Unit)? = null, class SaveAsDialog(
val callback: (savePath: String) -> Unit) { val activity: BaseSimpleActivity, val path: String, val appendFilename: Boolean, val cancelCallback: (() -> Unit)? = null,
val callback: (savePath: String) -> Unit
) {
init { init {
var realPath = path.getParentPath() var realPath = path.getParentPath()