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 89d604290..6fc32e489 100644
--- a/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.kt
@@ -27,6 +27,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
+import androidx.annotation.ColorInt
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SortedList
import androidx.recyclerview.widget.SortedListAdapterCallback
@@ -73,7 +74,11 @@ class NodeAdapter (private val context: Context)
private val mDatabase: Database
+ @ColorInt
+ private val contentSelectionColor: Int
+ @ColorInt
private val iconGroupColor: Int
+ @ColorInt
private val iconEntryColor: Int
/**
@@ -97,6 +102,10 @@ class NodeAdapter (private val context: Context)
// Database
this.mDatabase = Database.getInstance()
+ // Color of content selection
+ val taContentSelectionColor = context.theme.obtainStyledAttributes(intArrayOf(R.attr.textColorInverse))
+ this.contentSelectionColor = taContentSelectionColor.getColor(0, Color.WHITE)
+ taContentSelectionColor.recycle()
// Retrieve the color to tint the icon
val taTextColorPrimary = context.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary))
this.iconGroupColor = taTextColorPrimary.getColor(0, Color.BLACK)
@@ -280,11 +289,18 @@ class NodeAdapter (private val context: Context)
override fun onBindViewHolder(holder: NodeViewHolder, position: Int) {
val subNode = nodeSortedList.get(position)
+
+ // Node selection
+ holder.container.isSelected = actionNodesList.contains(subNode)
+
// Assign image
- val iconColor = when (subNode.type) {
+ val iconColor = if (holder.container.isSelected)
+ contentSelectionColor
+ else when (subNode.type) {
Type.GROUP -> iconGroupColor
Type.ENTRY -> iconEntryColor
}
+ holder.imageIdentifier?.setColorFilter(iconColor)
holder.icon.apply {
assignDatabaseIcon(mDatabase.drawFactory, subNode.icon, iconColor)
// Relative size of the icon
@@ -347,8 +363,6 @@ class NodeAdapter (private val context: Context)
holder.container.setOnLongClickListener {
nodeClickCallback?.onNodeLongClick(subNode) ?: false
}
-
- holder.container.isSelected = actionNodesList.contains(subNode)
}
override fun getItemCount(): Int {
@@ -372,6 +386,7 @@ class NodeAdapter (private val context: Context)
class NodeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var container: View = itemView.findViewById(R.id.node_container)
+ var imageIdentifier: ImageView? = itemView.findViewById(R.id.node_image_identifier)
var icon: ImageView = itemView.findViewById(R.id.node_icon)
var text: TextView = itemView.findViewById(R.id.node_text)
var subText: TextView = itemView.findViewById(R.id.node_subtext)
diff --git a/app/src/main/res/color/entry_subtitle_color.xml b/app/src/main/res/color/entry_subtitle_color.xml
new file mode 100644
index 000000000..4bf1f9e4e
--- /dev/null
+++ b/app/src/main/res/color/entry_subtitle_color.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/color/entry_title_color.xml b/app/src/main/res/color/entry_title_color.xml
new file mode 100644
index 000000000..ccc9d8edf
--- /dev/null
+++ b/app/src/main/res/color/entry_title_color.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/color/group_subtitle_color.xml b/app/src/main/res/color/group_subtitle_color.xml
new file mode 100644
index 000000000..4bf1f9e4e
--- /dev/null
+++ b/app/src/main/res/color/group_subtitle_color.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/color/group_title_color.xml b/app/src/main/res/color/group_title_color.xml
new file mode 100644
index 000000000..b32473384
--- /dev/null
+++ b/app/src/main/res/color/group_title_color.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
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 640d5e01e..f0da42052 100644
--- a/app/src/main/res/layout/item_list_nodes_entry.xml
+++ b/app/src/main/res/layout/item_list_nodes_entry.xml
@@ -67,7 +67,7 @@
tools:text="Node Title"
android:lines="1"
android:singleLine="true"
- style="@style/KeepassDXStyle.TextAppearance.Default" />
+ style="@style/KeepassDXStyle.TextAppearance.Entry.Title" />
+ style="@style/KeepassDXStyle.TextAppearance.Entry.SubTitle" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_list_nodes_group.xml b/app/src/main/res/layout/item_list_nodes_group.xml
index 54c3f1950..5f2f411fe 100644
--- a/app/src/main/res/layout/item_list_nodes_group.xml
+++ b/app/src/main/res/layout/item_list_nodes_group.xml
@@ -35,11 +35,10 @@
app:layout_constraintEnd_toEndOf="parent"
android:background="?android:attr/selectableItemBackground" >
+ android:layout_toRightOf="@+id/node_image_identifier"
+ android:layout_toEndOf="@+id/node_image_identifier" />
+ style="@style/KeepassDXStyle.TextAppearance.Group.Title" />
+ style="@style/KeepassDXStyle.TextAppearance.Group.SubTitle" />
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 99b865411..da9736f69 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -271,6 +271,26 @@
- ?attr/colorAccent
+
+
+
+
+
+