diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt index e7b1164be..70ec88e2a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt @@ -79,6 +79,7 @@ class NodeAdapter (private val context: Context, private var mShowOTP: Boolean = false private var mShowUUID: Boolean = false private var mEntryFilters = arrayOf() + private var mVirtualGroup = false private var mActionNodesList = LinkedList() private var mNodeClickCallback: NodeClickCallback? = null @@ -145,6 +146,7 @@ class NodeAdapter (private val context: Context, * Rebuild the list by clear and build children from the group */ fun rebuildList(group: Group) { + mVirtualGroup = group.isVirtual assignPreferences() mNodeSortedList.replaceAll(group.getFilteredChildren(mEntryFilters)) } @@ -356,6 +358,15 @@ class NodeAdapter (private val context: Context, visibility = View.GONE } } + // Add path to virtual group + if (mVirtualGroup) { + holder.path?.apply { + text = subNode.getPathString() + visibility = View.VISIBLE + } + } else { + holder.path?.visibility = View.GONE + } // Specific elements for entry if (subNode.type == Type.ENTRY) { @@ -497,6 +508,7 @@ class NodeAdapter (private val context: Context, var text: TextView = itemView.findViewById(R.id.node_text) var subText: TextView? = itemView.findViewById(R.id.node_subtext) var meta: TextView = itemView.findViewById(R.id.node_meta) + var path: TextView? = itemView.findViewById(R.id.node_path) var otpContainer: ViewGroup? = itemView.findViewById(R.id.node_otp_container) var otpProgress: ProgressBar? = itemView.findViewById(R.id.node_otp_progress) var otpToken: TextView? = itemView.findViewById(R.id.node_otp_token) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt index 036ab5580..f43db7eb0 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/node/Node.kt @@ -32,6 +32,19 @@ interface Node: NodeVersionedInterface { fun removeParent() { parent = null } + + fun getPathString(): String { + val pathNodes = mutableListOf() + var currentNode = this + pathNodes.add(0, currentNode) + while (currentNode.containsParent()) { + currentNode.parent?.let { parent -> + currentNode = parent + pathNodes.add(0, currentNode) + } + } + return pathNodes.joinToString("/") { it.title } + } } /** diff --git a/app/src/main/res/layout/item_list_nodes_entry.xml b/app/src/main/res/layout/item_list_nodes_entry.xml index cac133ba5..4d250ab6b 100644 --- a/app/src/main/res/layout/item_list_nodes_entry.xml +++ b/app/src/main/res/layout/item_list_nodes_entry.xml @@ -101,6 +101,15 @@ android:lines="1" android:singleLine="true" tools:text="7543A7EAB2EA7CFD1394F1615EBEB08C" /> + +