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 {
|
||||
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 'it.sephiroth.android.exif:library:1.0.1'
|
||||
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.ChangeViewTypeDialog
|
||||
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.helpers.*
|
||||
import com.simplemobiletools.gallery.pro.interfaces.DirectoryOperationsListener
|
||||
|
@ -317,7 +318,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
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.temporarily_show_excluded).isVisible = !config.temporarilyShowExcluded
|
||||
|
@ -586,8 +587,12 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
if (config.temporarilyShowHidden) {
|
||||
toggleTemporarilyShowHidden(false)
|
||||
} else {
|
||||
handleHiddenFolderPasswordProtection {
|
||||
toggleTemporarilyShowHidden(true)
|
||||
if (isRPlus() && !isExternalStorageManager()) {
|
||||
GrantAllFilesDialog(this)
|
||||
} else {
|
||||
handleHiddenFolderPasswordProtection {
|
||||
toggleTemporarilyShowHidden(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,7 @@ import com.simplemobiletools.gallery.pro.R
|
|||
import com.simplemobiletools.gallery.pro.adapters.MediaAdapter
|
||||
import com.simplemobiletools.gallery.pro.asynctasks.GetMediaAsynctask
|
||||
import com.simplemobiletools.gallery.pro.databases.GalleryDatabase
|
||||
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.dialogs.*
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.helpers.*
|
||||
import com.simplemobiletools.gallery.pro.interfaces.MediaOperationsListener
|
||||
|
@ -256,7 +253,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
findItem(R.id.about).isVisible = mShowAll
|
||||
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.set_as_default_folder).isVisible = !isDefaultFolder
|
||||
|
@ -655,8 +652,12 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
if (config.temporarilyShowHidden) {
|
||||
toggleTemporarilyShowHidden(false)
|
||||
} else {
|
||||
handleHiddenFolderPasswordProtection {
|
||||
toggleTemporarilyShowHidden(true)
|
||||
if (isRPlus() && !isExternalStorageManager()) {
|
||||
GrantAllFilesDialog(this)
|
||||
} else {
|
||||
handleHiddenFolderPasswordProtection {
|
||||
toggleTemporarilyShowHidden(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,7 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeFileThumbnailStyleDialog
|
||||
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.dialogs.*
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.helpers.*
|
||||
import com.simplemobiletools.gallery.pro.models.AlbumCover
|
||||
|
@ -223,13 +220,16 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
private fun setupShowHiddenItems() {
|
||||
if (isRPlus() && !isExternalStorageManager()) {
|
||||
settings_show_hidden_items_holder.beGone()
|
||||
settings_manage_excluded_folders_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
|
||||
settings_show_hidden_items.text = "${getString(R.string.show_hidden_items)} (${getString(R.string.no_permission)})"
|
||||
} else {
|
||||
settings_show_hidden_items.setText(R.string.show_hidden_items)
|
||||
}
|
||||
|
||||
settings_show_hidden_items.isChecked = config.showHiddenMedia
|
||||
settings_show_hidden_items_holder.setOnClickListener {
|
||||
if (config.showHiddenMedia) {
|
||||
if (isRPlus() && !isExternalStorageManager()) {
|
||||
GrantAllFilesDialog(this)
|
||||
} else if (config.showHiddenMedia) {
|
||||
toggleHiddenItems()
|
||||
} else {
|
||||
handleHiddenFolderPasswordProtection {
|
||||
|
|
|
@ -143,20 +143,7 @@ fun BaseSimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) {
|
|||
|
||||
AllFilesPermissionDialog(this, messagePrompt, callback = { success ->
|
||||
if (success) {
|
||||
try {
|
||||
val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
|
||||
intent.addCategory("android.intent.category.DEFAULT")
|
||||
intent.data = Uri.parse("package:$packageName")
|
||||
startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
val intent = Intent()
|
||||
intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
|
||||
try {
|
||||
startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
}
|
||||
launchGrantAllFilesIntent()
|
||||
}
|
||||
}, neutralPressed = {
|
||||
if (isSPlus()) {
|
||||
|
@ -171,6 +158,23 @@ fun BaseSimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) {
|
|||
}
|
||||
}
|
||||
|
||||
fun BaseSimpleActivity.launchGrantAllFilesIntent() {
|
||||
try {
|
||||
val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
|
||||
intent.addCategory("android.intent.category.DEFAULT")
|
||||
intent.data = Uri.parse("package:$packageName")
|
||||
startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
val intent = Intent()
|
||||
intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
|
||||
try {
|
||||
startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) {
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||
|
|
Loading…
Reference in a new issue