diff --git a/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt
index 2328e7d26..a56dbd4a2 100644
--- a/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt
+++ b/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt
@@ -35,6 +35,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
// Provide a direct reference to each of the views within a data item
// Used to cache the views within the item layout for fast access
class ViewHolder(itemView: AdapterNodeLayoutBinding) : RecyclerView.ViewHolder(itemView.root) {
+ val chipNode = itemView.chipNode
val nodeNameView = itemView.nodeNameView
val distanceView = itemView.distanceView
val coordsView = itemView.coordsView
@@ -110,7 +111,9 @@ class UsersFragment : ScreenFragment("Users"), Logging {
*/
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val n = nodes[position]
- val name = n.user?.longName ?: n.user?.id ?: "Unknown node"
+ val user = n.user
+ holder.chipNode.text = user?.shortName ?: "UNK"
+ val name = user?.longName ?: "Unknown node"
holder.nodeNameView.text = name
val pos = n.validPosition
@@ -165,19 +168,21 @@ class UsersFragment : ScreenFragment("Users"), Logging {
holder.signalView.visibility = View.INVISIBLE
}
}
- holder.itemView.setOnLongClickListener {
- val node = n.user
- if (position > 0 && node != null) {
- debug("calling MessagesFragment filter:${node.id}")
+ holder.chipNode.setOnClickListener {
+ if (position > 0 && user != null) {
+ debug("calling MessagesFragment filter:${user.id}")
setFragmentResult(
"requestKey",
- bundleOf("contactKey" to "0${node.id}", "contactName" to name)
+ bundleOf("contactKey" to "0${user.id}", "contactName" to name)
)
parentFragmentManager.beginTransaction()
.replace(R.id.mainActivityLayout, MessagesFragment())
.addToBackStack(null)
.commit()
}
+ }
+ holder.itemView.setOnLongClickListener {
+ // do something else
true
}
}
@@ -210,10 +215,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
holder.batteryPctView.text = text
holder.powerIcon.setImageDrawable(context?.let {
- ContextCompat.getDrawable(
- it,
- image
- )
+ ContextCompat.getDrawable(it, image)
})
}
diff --git a/app/src/main/res/drawable/ic_twotone_person_24.xml b/app/src/main/res/drawable/ic_twotone_person_24.xml
deleted file mode 100644
index 5306b665e..000000000
--- a/app/src/main/res/drawable/ic_twotone_person_24.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
diff --git a/app/src/main/res/layout/adapter_node_layout.xml b/app/src/main/res/layout/adapter_node_layout.xml
index 51e139a8a..37f902985 100644
--- a/app/src/main/res/layout/adapter_node_layout.xml
+++ b/app/src/main/res/layout/adapter_node_layout.xml
@@ -15,19 +15,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
+ android:layout_margin="8dp"
+ android:text="@string/some_username"
+ android:textAlignment="center"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintStart_toEndOf="@+id/chip_node"
+ app:layout_constraintTop_toTopOf="@+id/chip_node" />
+ app:layout_constraintEnd_toEndOf="@+id/chip_node"
+ app:layout_constraintStart_toStartOf="@+id/chip_node"
+ app:layout_constraintTop_toBottomOf="@+id/chip_node" />
@@ -68,10 +59,10 @@
android:id="@+id/batteryIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:layout_marginEnd="8dp"
+ android:layout_margin="8dp"
+ app:layout_constraintBottom_toBottomOf="@+id/batteryPercentageView"
app:layout_constraintEnd_toStartOf="@+id/batteryPercentageView"
- app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintTop_toTopOf="@+id/batteryPercentageView"
app:srcCompat="@drawable/ic_battery_full_24" />
+ app:layout_constraintTop_toTopOf="@+id/nodeNameView" />
+ app:layout_constraintTop_toTopOf="@+id/coords_view" />
+ app:layout_constraintTop_toBottomOf="@id/lastConnectionView" />