From 94f1907e929f19d0e8805d302c9b58ef4ce1a8bd Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 20 Jul 2020 01:57:11 +0530 Subject: Show parent path on all types Signed-off-by: Harsh Shandilya --- .../ui/adapters/PasswordItemRecyclerAdapter.kt | 19 +++++++++---------- 1 file 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 } -- cgit v1.2.3