fix a glitch with the inability to display hidden files anymore
This commit is contained in:
parent
0605e8944e
commit
3e3fb0c580
2 changed files with 26 additions and 15 deletions
|
@ -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,15 +102,18 @@ 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)) {
|
||||
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
|
||||
if (isFileTypeVisible(realPath)) {
|
||||
bottom_actions.beGone()
|
||||
sendViewPagerIntent(realPath)
|
||||
finish()
|
||||
return
|
||||
val avoidShowingHiddenFiles = isRPlus() && File(realPath).isHidden
|
||||
if (!avoidShowingHiddenFiles) {
|
||||
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
|
||||
if (isFileTypeVisible(realPath)) {
|
||||
bottom_actions.beGone()
|
||||
sendViewPagerIntent(realPath)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
filename = realPath.getFilenameFromPath()
|
||||
}
|
||||
} else {
|
||||
filename = realPath.getFilenameFromPath()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,13 +128,16 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
return
|
||||
} else {
|
||||
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
||||
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.') && getDoesFilePathExist(path)) {
|
||||
if (isFileTypeVisible(path)) {
|
||||
bottom_actions.beGone()
|
||||
rescanPaths(arrayListOf(mUri!!.path!!))
|
||||
sendViewPagerIntent(path)
|
||||
finish()
|
||||
return
|
||||
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()
|
||||
rescanPaths(arrayListOf(mUri!!.path!!))
|
||||
sendViewPagerIntent(path)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue