mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 06:15:48 +00:00
Show parent path on all types
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
@@ -52,7 +52,15 @@ open class PasswordItemRecyclerAdapter :
|
|||||||
val settings =
|
val settings =
|
||||||
PreferenceManager.getDefaultSharedPreferences(itemView.context.applicationContext)
|
PreferenceManager.getDefaultSharedPreferences(itemView.context.applicationContext)
|
||||||
val showHidden = settings.getBoolean(PreferenceKeys.SHOW_HIDDEN_FOLDERS, false)
|
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) {
|
if (item.type == PasswordItem.TYPE_CATEGORY) {
|
||||||
folderIndicator.visibility = View.VISIBLE
|
folderIndicator.visibility = View.VISIBLE
|
||||||
val children = item.file.listFiles { pathname ->
|
val children = item.file.listFiles { pathname ->
|
||||||
@@ -62,15 +70,6 @@ open class PasswordItemRecyclerAdapter :
|
|||||||
childCount.visibility = if (count > 0) View.VISIBLE else View.GONE
|
childCount.visibility = if (count > 0) View.VISIBLE else View.GONE
|
||||||
childCount.text = "$count"
|
childCount.text = "$count"
|
||||||
} else {
|
} 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
|
childCount.visibility = View.GONE
|
||||||
folderIndicator.visibility = View.GONE
|
folderIndicator.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user