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
|
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() {
|
||||||
|
|
Loading…
Reference in a new issue