mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
add channelUtilization & airUtilTx to UsersFragment
This commit is contained in:
parent
10886a9c98
commit
fbe79dbfa6
2 changed files with 15 additions and 6 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.text.method.LinkMovementMethod
|
||||
|
|
@ -23,7 +22,6 @@ import com.geeksville.util.formatAgo
|
|||
import java.net.URLEncoder
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
|
||||
class UsersFragment : ScreenFragment("Users"), Logging {
|
||||
|
||||
private var _binding: NodelistFragmentBinding? = null
|
||||
|
|
@ -155,6 +153,17 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
holder.signalView.text = text
|
||||
holder.signalView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (n.num == ourNodeInfo?.num) {
|
||||
val info = model.myNodeInfo.value
|
||||
if (info != null) {
|
||||
val channelUtilizationText = String.format("%.1f", info.channelUtilization)
|
||||
val airUtilTxText = String.format("%.1f", info.airUtilTx)
|
||||
val combinedText = "ChUtil $channelUtilizationText% AirUtilTX $airUtilTxText%"
|
||||
holder.signalView.text = combinedText
|
||||
holder.signalView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var nodes = arrayOf<NodeInfo>()
|
||||
|
|
@ -172,9 +181,9 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
) {
|
||||
|
||||
val (image, text) = when (battery) {
|
||||
null -> Pair(R.drawable.ic_battery_full_24, "?")
|
||||
in 1..100 -> Pair(R.drawable.ic_battery_full_24, "$battery%")
|
||||
0 -> Pair(R.drawable.ic_power_plug_24, "")
|
||||
else -> Pair(R.drawable.ic_battery_full_24, "$battery%")
|
||||
else -> Pair(R.drawable.ic_battery_full_24, "?")
|
||||
}
|
||||
|
||||
holder.batteryPctView.text = text
|
||||
|
|
@ -200,7 +209,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
|||
binding.nodeListView.adapter = nodesAdapter
|
||||
binding.nodeListView.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
||||
model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { it ->
|
||||
model.nodeDB.nodes.observe(viewLifecycleOwner, {
|
||||
nodesAdapter.onNodesChanged(it.values)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
|
||||
app:layout_constraintStart_toEndOf="@+id/distance_view"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/nodeNameView"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<ImageView
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue