fix #335, properly show hidden files if open through a file manager
This commit is contained in:
parent
7046fc9ed4
commit
60ed21702f
|
@ -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 New Issue