fix a glitch with the inability to display hidden files anymore

This commit is contained in:
tibbi 2022-02-13 11:02:51 +01:00
parent 0605e8944e
commit 3e3fb0c580
2 changed files with 26 additions and 15 deletions

View file

@ -14,6 +14,7 @@ import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.gallery.pro.BuildConfig
import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.extensions.*
@ -101,6 +102,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
if (intent.extras?.containsKey(REAL_FILE_PATH) == true) {
val realPath = intent.extras!!.getString(REAL_FILE_PATH)
if (realPath != null && getDoesFilePathExist(realPath)) {
val avoidShowingHiddenFiles = isRPlus() && File(realPath).isHidden
if (!avoidShowingHiddenFiles) {
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
if (isFileTypeVisible(realPath)) {
bottom_actions.beGone()
@ -113,6 +116,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
}
}
}
}
if (mUri!!.scheme == "file") {
if (filename.contains('.')) {
@ -124,6 +128,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
return
} else {
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
val avoidShowingHiddenFiles = isRPlus() && File(path).isHidden
if (!avoidShowingHiddenFiles) {
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.') && getDoesFilePathExist(path)) {
if (isFileTypeVisible(path)) {
bottom_actions.beGone()
@ -134,6 +140,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
}
}
}
}
checkNotchSupport()
showSystemUI(true)

View file

@ -41,6 +41,7 @@ import com.github.penfeizhou.animation.webp.WebPDrawable
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity
import com.simplemobiletools.gallery.pro.activities.PhotoActivity
@ -165,6 +166,9 @@ class PhotoFragment : ViewPagerFragment() {
if (mMedium.path.startsWith("content://") && !mMedium.path.startsWith("content://mms/")) {
mMedium.path = context!!.getRealPathFromURI(Uri.parse(mOriginalPath)) ?: mMedium.path
if (isRPlus() && mMedium.path.startsWith("/storage/") && mMedium.isHidden()) {
mMedium.path = mOriginalPath
}
if (mMedium.path.isEmpty()) {
var out: FileOutputStream? = null