mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
fix #335, properly show hidden files if open through a file manager
This commit is contained in:
@@ -72,7 +72,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||||||
mIsGetAnyContentIntent || mIsSetWallpaperIntent
|
mIsGetAnyContentIntent || mIsSetWallpaperIntent
|
||||||
|
|
||||||
directories_refresh_layout.setOnRefreshListener({ getDirectories() })
|
directories_refresh_layout.setOnRefreshListener({ getDirectories() })
|
||||||
mDirs = ArrayList<Directory>()
|
mDirs = ArrayList()
|
||||||
mStoredAnimateGifs = config.animateGifs
|
mStoredAnimateGifs = config.animateGifs
|
||||||
mStoredCropThumbnails = config.cropThumbnails
|
mStoredCropThumbnails = config.cropThumbnails
|
||||||
mStoredScrollHorizontally = config.scrollHorizontally
|
mStoredScrollHorizontally = config.scrollHorizontally
|
||||||
|
@@ -98,7 +98,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && File(mPath).isHidden) {
|
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && isShowHiddenFlagNeeded()) {
|
||||||
if (!config.isPasswordProtectionOn) {
|
if (!config.isPasswordProtectionOn) {
|
||||||
config.temporarilyShowHidden = true
|
config.temporarilyShowHidden = true
|
||||||
}
|
}
|
||||||
@@ -443,6 +443,27 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||||||
out.close()
|
out.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun isShowHiddenFlagNeeded(): Boolean {
|
||||||
|
val file = File(mPath)
|
||||||
|
if (file.isHidden)
|
||||||
|
return true
|
||||||
|
|
||||||
|
var parent = file.parentFile
|
||||||
|
while (true) {
|
||||||
|
if (parent.isHidden || parent.listFiles()?.contains(File(NOMEDIA)) == true) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent.absolutePath == "/") {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
parent = parent.parentFile
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem)
|
private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem)
|
||||||
|
|
||||||
private fun showProperties() {
|
private fun showProperties() {
|
||||||
|
Reference in New Issue
Block a user