aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/ui
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-08-27 14:27:55 +0530
committerGitHub <noreply@github.com>2020-08-27 14:27:55 +0530
commit1ce3ef4ea3c55d4a6c4a79f8a6cca58387b240df (patch)
tree6e9fbf27c8528637857d358fa9f4b21e96132ef3 /app/src/main/java/com/zeapo/pwdstore/ui
parent8ec3320df793b58d20f632038b0b2a37f37103e3 (diff)
downloadHardenedPass-1ce3ef4ea3c55d4a6c4a79f8a6cca58387b240df.tar.gz
HardenedPass-1ce3ef4ea3c55d4a6c4a79f8a6cca58387b240df.zip
Expand show hidden folders to also cover files (#1059)
* PasswordItem: only strip .gpg suffixes Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Add preference key and migration for showing all hidden contents Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Allow showing both hidden files and directories Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Add tests for hidden folder setting migration Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Add changelog entry Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Slightly improve migration logic Skip migration if old key is not found and always delete the previous key even if its set to false. Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Tweak wording Suggested-by: Fabian Henneke <fabian@henneke.me> Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Assert previous key's removal in tests Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/ui')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ui/adapters/PasswordItemRecyclerAdapter.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/ui/adapters/PasswordItemRecyclerAdapter.kt b/app/src/main/java/com/zeapo/pwdstore/ui/adapters/PasswordItemRecyclerAdapter.kt
index dc9d0ebd..2915efb4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/ui/adapters/PasswordItemRecyclerAdapter.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/ui/adapters/PasswordItemRecyclerAdapter.kt
@@ -50,7 +50,7 @@ open class PasswordItemRecyclerAdapter :
fun bind(item: PasswordItem) {
val settings = itemView.context.sharedPrefs
- val showHidden = settings.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, false)
+ val showHidden = settings.getBoolean(PreferenceKeys.SHOW_HIDDEN_CONTENTS, false)
val parentPath = item.fullPathToParent.replace("(^/)|(/$)".toRegex(), "")
val source = if (parentPath.isNotEmpty()) {
"$parentPath\n$item"
@@ -62,8 +62,8 @@ open class PasswordItemRecyclerAdapter :
name.text = spannable
if (item.type == PasswordItem.TYPE_CATEGORY) {
folderIndicator.visibility = View.VISIBLE
- val children = item.file.listFiles { pathname ->
- !(!showHidden && (pathname.isDirectory && pathname.isHidden))
+ val children = with(item.file) {
+ if (showHidden) listFiles() else listFiles { pathname -> pathname.isDirectory && !pathname.isHidden }
} ?: emptyArray<File>()
val count = children.size
childCount.visibility = if (count > 0) View.VISIBLE else View.GONE