aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-07-20 01:57:11 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-07-26 16:52:30 +0530
commit94f1907e929f19d0e8805d302c9b58ef4ce1a8bd (patch)
tree38857cc05bcb434a80f846d76efa5646a11be272 /app/src/main
parent8c2a9a91ef597d0c09a045500f0190436d7f9680 (diff)
Show parent path on all types
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ui/adapters/PasswordItemRecyclerAdapter.kt19
1 files changed, 9 insertions, 10 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 15e13745..4e153b88 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
@@ -52,7 +52,15 @@ open class PasswordItemRecyclerAdapter :
val settings =
PreferenceManager.getDefaultSharedPreferences(itemView.context.applicationContext)
val showHidden = settings.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, false)
- name.text = item.toString()
+ val parentPath = item.fullPathToParent.replace("(^/)|(/$)".toRegex(), "")
+ val source = if (parentPath.isNotEmpty()) {
+ "$parentPath\n$item"
+ } else {
+ "$item"
+ }
+ val spannable = SpannableString(source)
+ spannable.setSpan(RelativeSizeSpan(0.7f), 0, parentPath.length, 0)
+ name.text = spannable
if (item.type == PasswordItem.TYPE_CATEGORY) {
folderIndicator.visibility = View.VISIBLE
val children = item.file.listFiles { pathname ->
@@ -62,15 +70,6 @@ open class PasswordItemRecyclerAdapter :
childCount.visibility = if (count > 0) View.VISIBLE else View.GONE
childCount.text = "$count"
} else {
- val parentPath = item.fullPathToParent.replace("(^/)|(/$)".toRegex(), "")
- val source = if (parentPath.isNotEmpty()) {
- "$parentPath\n$item"
- } else {
- "$item"
- }
- val spannable = SpannableString(source)
- spannable.setSpan(RelativeSizeSpan(0.7f), 0, parentPath.length, 0)
- name.text = spannable
childCount.visibility = View.GONE
folderIndicator.visibility = View.GONE
}