mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
always show the hidden item visibility toggles
This commit is contained in:
parent
ca5b977b2e
commit
2eafcbd22e
5 changed files with 42 additions and 32 deletions
|
@ -78,7 +78,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:ffead928f7'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:f5f3f94be6'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.simplemobiletools.gallery.pro.databases.GalleryDatabase
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeSortingDialog
|
import com.simplemobiletools.gallery.pro.dialogs.ChangeSortingDialog
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeViewTypeDialog
|
import com.simplemobiletools.gallery.pro.dialogs.ChangeViewTypeDialog
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.FilterMediaDialog
|
import com.simplemobiletools.gallery.pro.dialogs.FilterMediaDialog
|
||||||
|
import com.simplemobiletools.gallery.pro.dialogs.GrantAllFilesDialog
|
||||||
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.DirectoryOperationsListener
|
import com.simplemobiletools.gallery.pro.interfaces.DirectoryOperationsListener
|
||||||
|
@ -317,7 +318,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
directories_toolbar.menu.apply {
|
directories_toolbar.menu.apply {
|
||||||
findItem(R.id.temporarily_show_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && !config.shouldShowHidden
|
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
|
||||||
findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
|
findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
|
||||||
|
|
||||||
findItem(R.id.temporarily_show_excluded).isVisible = !config.temporarilyShowExcluded
|
findItem(R.id.temporarily_show_excluded).isVisible = !config.temporarilyShowExcluded
|
||||||
|
@ -585,12 +586,16 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
private fun tryToggleTemporarilyShowHidden() {
|
private fun tryToggleTemporarilyShowHidden() {
|
||||||
if (config.temporarilyShowHidden) {
|
if (config.temporarilyShowHidden) {
|
||||||
toggleTemporarilyShowHidden(false)
|
toggleTemporarilyShowHidden(false)
|
||||||
|
} else {
|
||||||
|
if (isRPlus() && !isExternalStorageManager()) {
|
||||||
|
GrantAllFilesDialog(this)
|
||||||
} else {
|
} else {
|
||||||
handleHiddenFolderPasswordProtection {
|
handleHiddenFolderPasswordProtection {
|
||||||
toggleTemporarilyShowHidden(true)
|
toggleTemporarilyShowHidden(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun toggleTemporarilyShowHidden(show: Boolean) {
|
private fun toggleTemporarilyShowHidden(show: Boolean) {
|
||||||
mLoadedInitialPhotos = false
|
mLoadedInitialPhotos = false
|
||||||
|
|
|
@ -31,10 +31,7 @@ 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.ChangeGroupingDialog
|
import com.simplemobiletools.gallery.pro.dialogs.*
|
||||||
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
|
||||||
|
@ -256,7 +253,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
findItem(R.id.about).isVisible = mShowAll
|
findItem(R.id.about).isVisible = mShowAll
|
||||||
findItem(R.id.create_new_folder).isVisible = !mShowAll && mPath != RECYCLE_BIN && mPath != FAVORITES
|
findItem(R.id.create_new_folder).isVisible = !mShowAll && mPath != RECYCLE_BIN && mPath != FAVORITES
|
||||||
|
|
||||||
findItem(R.id.temporarily_show_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && !config.shouldShowHidden
|
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
|
||||||
findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
|
findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
|
||||||
|
|
||||||
findItem(R.id.set_as_default_folder).isVisible = !isDefaultFolder
|
findItem(R.id.set_as_default_folder).isVisible = !isDefaultFolder
|
||||||
|
@ -654,12 +651,16 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
private fun tryToggleTemporarilyShowHidden() {
|
private fun tryToggleTemporarilyShowHidden() {
|
||||||
if (config.temporarilyShowHidden) {
|
if (config.temporarilyShowHidden) {
|
||||||
toggleTemporarilyShowHidden(false)
|
toggleTemporarilyShowHidden(false)
|
||||||
|
} else {
|
||||||
|
if (isRPlus() && !isExternalStorageManager()) {
|
||||||
|
GrantAllFilesDialog(this)
|
||||||
} else {
|
} else {
|
||||||
handleHiddenFolderPasswordProtection {
|
handleHiddenFolderPasswordProtection {
|
||||||
toggleTemporarilyShowHidden(true)
|
toggleTemporarilyShowHidden(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun toggleTemporarilyShowHidden(show: Boolean) {
|
private fun toggleTemporarilyShowHidden(show: Boolean) {
|
||||||
mLoadedInitialPhotos = false
|
mLoadedInitialPhotos = false
|
||||||
|
|
|
@ -11,10 +11,7 @@ import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeFileThumbnailStyleDialog
|
import com.simplemobiletools.gallery.pro.dialogs.*
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeFolderThumbnailStyleDialog
|
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ManageBottomActionsDialog
|
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ManageExtendedDetailsDialog
|
|
||||||
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.models.AlbumCover
|
import com.simplemobiletools.gallery.pro.models.AlbumCover
|
||||||
|
@ -223,13 +220,16 @@ class SettingsActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupShowHiddenItems() {
|
private fun setupShowHiddenItems() {
|
||||||
if (isRPlus() && !isExternalStorageManager()) {
|
if (isRPlus() && !isExternalStorageManager()) {
|
||||||
settings_show_hidden_items_holder.beGone()
|
settings_show_hidden_items.text = "${getString(R.string.show_hidden_items)} (${getString(R.string.no_permission)})"
|
||||||
settings_manage_excluded_folders_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
|
} else {
|
||||||
|
settings_show_hidden_items.setText(R.string.show_hidden_items)
|
||||||
}
|
}
|
||||||
|
|
||||||
settings_show_hidden_items.isChecked = config.showHiddenMedia
|
settings_show_hidden_items.isChecked = config.showHiddenMedia
|
||||||
settings_show_hidden_items_holder.setOnClickListener {
|
settings_show_hidden_items_holder.setOnClickListener {
|
||||||
if (config.showHiddenMedia) {
|
if (isRPlus() && !isExternalStorageManager()) {
|
||||||
|
GrantAllFilesDialog(this)
|
||||||
|
} else if (config.showHiddenMedia) {
|
||||||
toggleHiddenItems()
|
toggleHiddenItems()
|
||||||
} else {
|
} else {
|
||||||
handleHiddenFolderPasswordProtection {
|
handleHiddenFolderPasswordProtection {
|
||||||
|
|
|
@ -143,6 +143,22 @@ fun BaseSimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) {
|
||||||
|
|
||||||
AllFilesPermissionDialog(this, messagePrompt, callback = { success ->
|
AllFilesPermissionDialog(this, messagePrompt, callback = { success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
|
launchGrantAllFilesIntent()
|
||||||
|
}
|
||||||
|
}, neutralPressed = {
|
||||||
|
if (isSPlus()) {
|
||||||
|
launchMediaManagementIntent(callback)
|
||||||
|
} else {
|
||||||
|
config.avoidShowingAllFilesPrompt = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun BaseSimpleActivity.launchGrantAllFilesIntent() {
|
||||||
try {
|
try {
|
||||||
val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
|
val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
|
||||||
intent.addCategory("android.intent.category.DEFAULT")
|
intent.addCategory("android.intent.category.DEFAULT")
|
||||||
|
@ -157,18 +173,6 @@ fun BaseSimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, neutralPressed = {
|
|
||||||
if (isSPlus()) {
|
|
||||||
launchMediaManagementIntent(callback)
|
|
||||||
} else {
|
|
||||||
config.avoidShowingAllFilesPrompt = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) {
|
fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) {
|
||||||
|
|
Loading…
Reference in a new issue