mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-02-14 10:50:43 +01:00
fix: "shouldShowHidden" does not reflect changes on "showHidden || temporarilyShowHidden" due to its variable like definition on a singleton object
This commit is contained in:
parent
8e67656719
commit
f6332b09c2
@ -65,7 +65,7 @@ class FavoritesActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addFavorite() {
|
private fun addFavorite() {
|
||||||
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden, canAddShowHiddenButton = true) {
|
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden(), canAddShowHiddenButton = true) {
|
||||||
config.addFavorite(it)
|
config.addFavorite(it)
|
||||||
updateFavorites()
|
updateFavorites()
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
findItem(R.id.go_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder
|
findItem(R.id.go_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder
|
||||||
findItem(R.id.set_as_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder
|
findItem(R.id.set_as_home).isVisible = currentFragment is ItemsFragment && currentFragment.currentPath != config.homeFolder
|
||||||
|
|
||||||
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden && currentFragment !is StorageFragment
|
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden() && currentFragment !is StorageFragment
|
||||||
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden && currentFragment !is StorageFragment
|
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden && currentFragment !is StorageFragment
|
||||||
|
|
||||||
findItem(R.id.column_count).isVisible = currentViewType == VIEW_TYPE_GRID && currentFragment !is StorageFragment
|
findItem(R.id.column_count).isVisible = currentViewType == VIEW_TYPE_GRID && currentFragment !is StorageFragment
|
||||||
|
@ -29,7 +29,7 @@ import com.simplemobiletools.filemanager.pro.helpers.*
|
|||||||
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
|
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
|
||||||
import com.simplemobiletools.filemanager.pro.models.ListItem
|
import com.simplemobiletools.filemanager.pro.models.ListItem
|
||||||
import kotlinx.android.synthetic.main.activity_mimetypes.*
|
import kotlinx.android.synthetic.main.activity_mimetypes.*
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
|
||||||
class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||||
private var isSearchOpen = false
|
private var isSearchOpen = false
|
||||||
@ -86,7 +86,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
|||||||
mimetypes_toolbar.menu.apply {
|
mimetypes_toolbar.menu.apply {
|
||||||
findItem(R.id.toggle_filename).isVisible = currentViewType == VIEW_TYPE_GRID
|
findItem(R.id.toggle_filename).isVisible = currentViewType == VIEW_TYPE_GRID
|
||||||
|
|
||||||
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
|
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden()
|
||||||
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
|
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
|
||||||
|
|
||||||
findItem(R.id.column_count).isVisible = currentViewType == VIEW_TYPE_GRID
|
findItem(R.id.column_count).isVisible = currentViewType == VIEW_TYPE_GRID
|
||||||
@ -255,7 +255,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
|||||||
|
|
||||||
private fun getProperFileDirItems(callback: (ArrayList<FileDirItem>) -> Unit) {
|
private fun getProperFileDirItems(callback: (ArrayList<FileDirItem>) -> Unit) {
|
||||||
val fileDirItems = ArrayList<FileDirItem>()
|
val fileDirItems = ArrayList<FileDirItem>()
|
||||||
val showHidden = config.shouldShowHidden
|
val showHidden = config.shouldShowHidden()
|
||||||
val uri = MediaStore.Files.getContentUri("external")
|
val uri = MediaStore.Files.getContentUri("external")
|
||||||
val projection = arrayOf(
|
val projection = arrayOf(
|
||||||
MediaStore.Files.FileColumns.MIME_TYPE,
|
MediaStore.Files.FileColumns.MIME_TYPE,
|
||||||
|
@ -9,7 +9,7 @@ import com.simplemobiletools.commons.helpers.NavigationIcon
|
|||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.filemanager.pro.R
|
import com.simplemobiletools.filemanager.pro.R
|
||||||
import com.simplemobiletools.filemanager.pro.extensions.config
|
import com.simplemobiletools.filemanager.pro.extensions.config
|
||||||
import kotlinx.android.synthetic.main.activity_save_as.*
|
import kotlinx.android.synthetic.main.activity_save_as.activity_save_as_toolbar
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class SaveAsActivity : SimpleActivity() {
|
class SaveAsActivity : SimpleActivity() {
|
||||||
@ -18,7 +18,7 @@ class SaveAsActivity : SimpleActivity() {
|
|||||||
setContentView(R.layout.activity_save_as)
|
setContentView(R.layout.activity_save_as)
|
||||||
|
|
||||||
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) {
|
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) {
|
||||||
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden, showFAB = true, showFavoritesButton = true) {
|
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden(), showFAB = true, showFavoritesButton = true) {
|
||||||
val destination = it
|
val destination = it
|
||||||
handleSAFDialog(destination) {
|
handleSAFDialog(destination) {
|
||||||
toast(R.string.saving)
|
toast(R.string.saving)
|
||||||
|
@ -249,10 +249,10 @@ class ItemsAdapter(
|
|||||||
|
|
||||||
private fun showProperties() {
|
private fun showProperties() {
|
||||||
if (selectedKeys.size <= 1) {
|
if (selectedKeys.size <= 1) {
|
||||||
PropertiesDialog(activity, getFirstSelectedItemPath(), config.shouldShowHidden)
|
PropertiesDialog(activity, getFirstSelectedItemPath(), config.shouldShowHidden())
|
||||||
} else {
|
} else {
|
||||||
val paths = getSelectedFileDirItems().map { it.path }
|
val paths = getSelectedFileDirItems().map { it.path }
|
||||||
PropertiesDialog(activity, paths, config.shouldShowHidden)
|
PropertiesDialog(activity, paths, config.shouldShowHidden())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ class ItemsAdapter(
|
|||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private fun addFileUris(path: String, paths: ArrayList<String>) {
|
private fun addFileUris(path: String, paths: ArrayList<String>) {
|
||||||
if (activity.getIsPathDirectory(path)) {
|
if (activity.getIsPathDirectory(path)) {
|
||||||
val shouldShowHidden = config.shouldShowHidden
|
val shouldShowHidden = config.shouldShowHidden()
|
||||||
when {
|
when {
|
||||||
activity.isRestrictedSAFOnlyRoot(path) -> {
|
activity.isRestrictedSAFOnlyRoot(path) -> {
|
||||||
activity.getAndroidSAFFileItems(path, shouldShowHidden, false) { files ->
|
activity.getAndroidSAFFileItems(path, shouldShowHidden, false) { files ->
|
||||||
@ -407,9 +407,9 @@ class ItemsAdapter(
|
|||||||
val source = firstFile.getParentPath()
|
val source = firstFile.getParentPath()
|
||||||
FilePickerDialog(
|
FilePickerDialog(
|
||||||
activity,
|
activity,
|
||||||
activity.getDefaultCopyDestinationPath(config.shouldShowHidden, source),
|
activity.getDefaultCopyDestinationPath(config.shouldShowHidden(), source),
|
||||||
false,
|
false,
|
||||||
config.shouldShowHidden,
|
config.shouldShowHidden(),
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
showFavoritesButton = true
|
showFavoritesButton = true
|
||||||
@ -418,7 +418,7 @@ class ItemsAdapter(
|
|||||||
if (activity.isPathOnRoot(it) || activity.isPathOnRoot(firstFile.path)) {
|
if (activity.isPathOnRoot(it) || activity.isPathOnRoot(firstFile.path)) {
|
||||||
copyMoveRootItems(files, it, isCopyOperation)
|
copyMoveRootItems(files, it, isCopyOperation)
|
||||||
} else {
|
} else {
|
||||||
activity.copyMoveFilesTo(files, source, it, isCopyOperation, false, config.shouldShowHidden) {
|
activity.copyMoveFilesTo(files, source, it, isCopyOperation, false, config.shouldShowHidden()) {
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
files.forEach { sourceFileDir ->
|
files.forEach { sourceFileDir ->
|
||||||
val sourcePath = sourceFileDir.path
|
val sourcePath = sourceFileDir.path
|
||||||
|
@ -7,7 +7,8 @@ import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
|||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.filemanager.pro.R
|
import com.simplemobiletools.filemanager.pro.R
|
||||||
import com.simplemobiletools.filemanager.pro.extensions.config
|
import com.simplemobiletools.filemanager.pro.extensions.config
|
||||||
import kotlinx.android.synthetic.main.dialog_compress_as.view.*
|
import kotlinx.android.synthetic.main.dialog_compress_as.view.filename_value
|
||||||
|
import kotlinx.android.synthetic.main.dialog_compress_as.view.folder
|
||||||
|
|
||||||
class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val callback: (destination: String) -> Unit) {
|
class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val callback: (destination: String) -> Unit) {
|
||||||
private val view = activity.layoutInflater.inflate(R.layout.dialog_compress_as, null)
|
private val view = activity.layoutInflater.inflate(R.layout.dialog_compress_as, null)
|
||||||
@ -23,7 +24,7 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c
|
|||||||
|
|
||||||
folder.setText(activity.humanizePath(realPath))
|
folder.setText(activity.humanizePath(realPath))
|
||||||
folder.setOnClickListener {
|
folder.setOnClickListener {
|
||||||
FilePickerDialog(activity, realPath, false, activity.config.shouldShowHidden, true, true, showFavoritesButton = true) {
|
FilePickerDialog(activity, realPath, false, activity.config.shouldShowHidden(), true, true, showFavoritesButton = true) {
|
||||||
folder.setText(activity.humanizePath(it))
|
folder.setText(activity.humanizePath(it))
|
||||||
realPath = it
|
realPath = it
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||||||
|
|
||||||
scrollStates[currentPath] = getScrollState()!!
|
scrollStates[currentPath] = getScrollState()!!
|
||||||
currentPath = realPath
|
currentPath = realPath
|
||||||
showHidden = context!!.config.shouldShowHidden
|
showHidden = context!!.config.shouldShowHidden()
|
||||||
showProgressBar()
|
showProgressBar()
|
||||||
getItems(currentPath) { originalPath, listItems ->
|
getItems(currentPath) { originalPath, listItems ->
|
||||||
if (currentPath != originalPath) {
|
if (currentPath != originalPath) {
|
||||||
@ -180,13 +180,13 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||||||
return@handleAndroidSAFDialog
|
return@handleAndroidSAFDialog
|
||||||
}
|
}
|
||||||
val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST
|
val getProperChildCount = context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_LIST
|
||||||
context.getAndroidSAFFileItems(path, context.config.shouldShowHidden, getProperChildCount) { fileItems ->
|
context.getAndroidSAFFileItems(path, context.config.shouldShowHidden(), getProperChildCount) { fileItems ->
|
||||||
callback(path, getListItemsFromFileDirItems(fileItems))
|
callback(path, getListItemsFromFileDirItems(fileItems))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) {
|
} else if (context!!.isPathOnOTG(path) && config.OTGTreeUri.isNotEmpty()) {
|
||||||
val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
|
val getProperFileSize = context!!.config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
|
||||||
context!!.getOTGItems(path, config.shouldShowHidden, getProperFileSize) {
|
context!!.getOTGItems(path, config.shouldShowHidden(), getProperFileSize) {
|
||||||
callback(path, getListItemsFromFileDirItems(it))
|
callback(path, getListItemsFromFileDirItems(it))
|
||||||
}
|
}
|
||||||
} else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) {
|
} else if (!config.enableRootAccess || !context!!.isPathOnRoot(path)) {
|
||||||
|
@ -21,7 +21,9 @@ import com.simplemobiletools.filemanager.pro.extensions.config
|
|||||||
import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT
|
import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT
|
||||||
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
|
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
|
||||||
import com.simplemobiletools.filemanager.pro.models.ListItem
|
import com.simplemobiletools.filemanager.pro.models.ListItem
|
||||||
import kotlinx.android.synthetic.main.recents_fragment.view.*
|
import kotlinx.android.synthetic.main.recents_fragment.view.recents_list
|
||||||
|
import kotlinx.android.synthetic.main.recents_fragment.view.recents_placeholder
|
||||||
|
import kotlinx.android.synthetic.main.recents_fragment.view.recents_swipe_refresh
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener {
|
class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener {
|
||||||
@ -134,7 +136,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getRecents(callback: (recents: ArrayList<ListItem>) -> Unit) {
|
private fun getRecents(callback: (recents: ArrayList<ListItem>) -> Unit) {
|
||||||
val showHidden = context?.config?.shouldShowHidden ?: return
|
val showHidden = context?.config?.shouldShowHidden() ?: return
|
||||||
val listItems = arrayListOf<ListItem>()
|
val listItems = arrayListOf<ListItem>()
|
||||||
|
|
||||||
val uri = Files.getContentUri("external")
|
val uri = Files.getContentUri("external")
|
||||||
|
@ -318,7 +318,7 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||||||
|
|
||||||
private fun getAllFiles(): ArrayList<FileDirItem> {
|
private fun getAllFiles(): ArrayList<FileDirItem> {
|
||||||
val fileDirItems = ArrayList<FileDirItem>()
|
val fileDirItems = ArrayList<FileDirItem>()
|
||||||
val showHidden = context?.config?.shouldShowHidden ?: return fileDirItems
|
val showHidden = context?.config?.shouldShowHidden() ?: return fileDirItems
|
||||||
val uri = MediaStore.Files.getContentUri("external")
|
val uri = MediaStore.Files.getContentUri("external")
|
||||||
val projection = arrayOf(
|
val projection = arrayOf(
|
||||||
MediaStore.Files.FileColumns.DATA,
|
MediaStore.Files.FileColumns.DATA,
|
||||||
|
@ -20,7 +20,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
||||||
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
||||||
|
|
||||||
var shouldShowHidden = showHidden || temporarilyShowHidden
|
fun shouldShowHidden() = showHidden || temporarilyShowHidden
|
||||||
|
|
||||||
var pressBackTwice: Boolean
|
var pressBackTwice: Boolean
|
||||||
get() = prefs.getBoolean(PRESS_BACK_TWICE, true)
|
get() = prefs.getBoolean(PRESS_BACK_TWICE, true)
|
||||||
|
@ -36,7 +36,7 @@ class RootHelpers(val activity: Activity) {
|
|||||||
val fullLines = it
|
val fullLines = it
|
||||||
|
|
||||||
val files = ArrayList<ListItem>()
|
val files = ArrayList<ListItem>()
|
||||||
val hiddenArgument = if (activity.config.shouldShowHidden) "-A " else ""
|
val hiddenArgument = if (activity.config.shouldShowHidden()) "-A " else ""
|
||||||
val cmd = "ls $hiddenArgument$path"
|
val cmd = "ls $hiddenArgument$path"
|
||||||
|
|
||||||
val command = object : Command(0, cmd) {
|
val command = object : Command(0, cmd) {
|
||||||
@ -66,7 +66,7 @@ class RootHelpers(val activity: Activity) {
|
|||||||
|
|
||||||
private fun getFullLines(path: String, callback: (ArrayList<String>) -> Unit) {
|
private fun getFullLines(path: String, callback: (ArrayList<String>) -> Unit) {
|
||||||
val fullLines = ArrayList<String>()
|
val fullLines = ArrayList<String>()
|
||||||
val hiddenArgument = if (activity.config.shouldShowHidden) "-Al " else "-l "
|
val hiddenArgument = if (activity.config.shouldShowHidden()) "-Al " else "-l "
|
||||||
val cmd = "ls $hiddenArgument$path"
|
val cmd = "ls $hiddenArgument$path"
|
||||||
|
|
||||||
val command = object : Command(0, cmd) {
|
val command = object : Command(0, cmd) {
|
||||||
@ -85,7 +85,7 @@ class RootHelpers(val activity: Activity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getChildrenCount(files: ArrayList<ListItem>, path: String, callback: (originalPath: String, listItems: ArrayList<ListItem>) -> Unit) {
|
private fun getChildrenCount(files: ArrayList<ListItem>, path: String, callback: (originalPath: String, listItems: ArrayList<ListItem>) -> Unit) {
|
||||||
val hiddenArgument = if (activity.config.shouldShowHidden) "-A " else ""
|
val hiddenArgument = if (activity.config.shouldShowHidden()) "-A " else ""
|
||||||
var cmd = ""
|
var cmd = ""
|
||||||
files.filter { it.isDirectory }.forEach {
|
files.filter { it.isDirectory }.forEach {
|
||||||
cmd += "ls $hiddenArgument${it.path} |wc -l;"
|
cmd += "ls $hiddenArgument${it.path} |wc -l;"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user