mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
fix #335, properly show hidden files if open through a file manager
This commit is contained in:
parent
7046fc9ed4
commit
60ed21702f
2 changed files with 23 additions and 2 deletions
|
@ -72,7 +72,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
mIsGetAnyContentIntent || mIsSetWallpaperIntent
|
||||
|
||||
directories_refresh_layout.setOnRefreshListener({ getDirectories() })
|
||||
mDirs = ArrayList<Directory>()
|
||||
mDirs = ArrayList()
|
||||
mStoredAnimateGifs = config.animateGifs
|
||||
mStoredCropThumbnails = config.cropThumbnails
|
||||
mStoredScrollHorizontally = config.scrollHorizontally
|
||||
|
|
|
@ -98,7 +98,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
return
|
||||
}
|
||||
|
||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && File(mPath).isHidden) {
|
||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && isShowHiddenFlagNeeded()) {
|
||||
if (!config.isPasswordProtectionOn) {
|
||||
config.temporarilyShowHidden = true
|
||||
}
|
||||
|
@ -443,6 +443,27 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
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 showProperties() {
|
||||
|
|
Loading…
Reference in a new issue