removing un/hide and exclude menu items from folder screen
This commit is contained in:
parent
9cd55a1ce4
commit
ca46970023
2 changed files with 4 additions and 59 deletions
|
@ -22,7 +22,6 @@ import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import com.bumptech.glide.request.target.SimpleTarget
|
import com.bumptech.glide.request.target.SimpleTarget
|
||||||
import com.bumptech.glide.request.transition.Transition
|
import com.bumptech.glide.request.transition.Transition
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
|
||||||
import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog
|
import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||||
|
@ -36,7 +35,10 @@ import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.adapters.MediaAdapter
|
import com.simplemobiletools.gallery.pro.adapters.MediaAdapter
|
||||||
import com.simplemobiletools.gallery.pro.asynctasks.GetMediaAsynctask
|
import com.simplemobiletools.gallery.pro.asynctasks.GetMediaAsynctask
|
||||||
import com.simplemobiletools.gallery.pro.databases.GalleryDatabase
|
import com.simplemobiletools.gallery.pro.databases.GalleryDatabase
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.*
|
import com.simplemobiletools.gallery.pro.dialogs.ChangeGroupingDialog
|
||||||
|
import com.simplemobiletools.gallery.pro.dialogs.ChangeSortingDialog
|
||||||
|
import com.simplemobiletools.gallery.pro.dialogs.ChangeViewTypeDialog
|
||||||
|
import com.simplemobiletools.gallery.pro.dialogs.FilterMediaDialog
|
||||||
import com.simplemobiletools.gallery.pro.extensions.*
|
import com.simplemobiletools.gallery.pro.extensions.*
|
||||||
import com.simplemobiletools.gallery.pro.helpers.*
|
import com.simplemobiletools.gallery.pro.helpers.*
|
||||||
import com.simplemobiletools.gallery.pro.interfaces.MediaOperationsListener
|
import com.simplemobiletools.gallery.pro.interfaces.MediaOperationsListener
|
||||||
|
@ -221,14 +223,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu_media, menu)
|
menuInflater.inflate(R.menu.menu_media, menu)
|
||||||
|
|
||||||
val isFolderHidden = mPath.containsNoMedia(this)
|
|
||||||
menu.apply {
|
menu.apply {
|
||||||
findItem(R.id.group).isVisible = !config.scrollHorizontally
|
findItem(R.id.group).isVisible = !config.scrollHorizontally
|
||||||
|
|
||||||
findItem(R.id.hide_folder).isVisible = !isFolderHidden && !mShowAll && mPath != FAVORITES && mPath != RECYCLE_BIN
|
|
||||||
findItem(R.id.unhide_folder).isVisible = isFolderHidden && !mShowAll && mPath != FAVORITES && mPath != RECYCLE_BIN
|
|
||||||
findItem(R.id.exclude_folder).isVisible = !mShowAll && mPath != FAVORITES && mPath != RECYCLE_BIN
|
|
||||||
|
|
||||||
findItem(R.id.empty_recycle_bin).isVisible = mPath == RECYCLE_BIN
|
findItem(R.id.empty_recycle_bin).isVisible = mPath == RECYCLE_BIN
|
||||||
findItem(R.id.empty_disable_recycle_bin).isVisible = mPath == RECYCLE_BIN
|
findItem(R.id.empty_disable_recycle_bin).isVisible = mPath == RECYCLE_BIN
|
||||||
findItem(R.id.restore_all_files).isVisible = mPath == RECYCLE_BIN
|
findItem(R.id.restore_all_files).isVisible = mPath == RECYCLE_BIN
|
||||||
|
@ -264,9 +261,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
R.id.folder_view -> switchToFolderView()
|
R.id.folder_view -> switchToFolderView()
|
||||||
R.id.change_view_type -> changeViewType()
|
R.id.change_view_type -> changeViewType()
|
||||||
R.id.group -> showGroupByDialog()
|
R.id.group -> showGroupByDialog()
|
||||||
R.id.hide_folder -> tryHideFolder()
|
|
||||||
R.id.unhide_folder -> unhideFolder()
|
|
||||||
R.id.exclude_folder -> tryExcludeFolder()
|
|
||||||
R.id.create_new_folder -> createNewFolder()
|
R.id.create_new_folder -> createNewFolder()
|
||||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||||
|
@ -545,43 +539,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryHideFolder() {
|
|
||||||
if (config.wasHideFolderTooltipShown) {
|
|
||||||
hideFolder()
|
|
||||||
} else {
|
|
||||||
ConfirmationDialog(this, getString(R.string.hide_folder_description)) {
|
|
||||||
config.wasHideFolderTooltipShown = true
|
|
||||||
hideFolder()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun hideFolder() {
|
|
||||||
addNoMedia(mPath) {
|
|
||||||
runOnUiThread {
|
|
||||||
if (!config.shouldShowHidden) {
|
|
||||||
finish()
|
|
||||||
} else {
|
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun unhideFolder() {
|
|
||||||
removeNoMedia(mPath) {
|
|
||||||
runOnUiThread {
|
|
||||||
invalidateOptionsMenu()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun tryExcludeFolder() {
|
|
||||||
ExcludeFolderDialog(this, arrayListOf(mPath)) {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun deleteDirectoryIfEmpty() {
|
private fun deleteDirectoryIfEmpty() {
|
||||||
val fileDirItem = FileDirItem(mPath, mPath.getFilenameFromPath(), true)
|
val fileDirItem = FileDirItem(mPath, mPath.getFilenameFromPath(), true)
|
||||||
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory && fileDirItem.getProperFileCount(this, true) == 0) {
|
if (config.deleteEmptyFolders && !fileDirItem.isDownloadsFolder() && fileDirItem.isDirectory && fileDirItem.getProperFileCount(this, true) == 0) {
|
||||||
|
|
|
@ -59,18 +59,6 @@
|
||||||
android:id="@+id/group"
|
android:id="@+id/group"
|
||||||
android:title="@string/group_by"
|
android:title="@string/group_by"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
<item
|
|
||||||
android:id="@+id/hide_folder"
|
|
||||||
android:title="@string/hide_folder"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/unhide_folder"
|
|
||||||
android:title="@string/unhide_folder"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/exclude_folder"
|
|
||||||
android:title="@string/exclude"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/create_new_folder"
|
android:id="@+id/create_new_folder"
|
||||||
android:title="@string/create_new_folder"
|
android:title="@string/create_new_folder"
|
||||||
|
|
Loading…
Reference in a new issue