mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Long press node in map jumps to node in node list (#955)
* Fix scrolling to node and blinking * Show node in list, instead of opening DM
This commit is contained in:
parent
80e9bbbe56
commit
e887336da3
3 changed files with 87 additions and 49 deletions
|
|
@ -105,21 +105,12 @@ class MapFragment : ScreenFragment("Map Fragment"), Logging {
|
|||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent {
|
||||
AppCompatTheme {
|
||||
MapView(model, ::openDirectMessage)
|
||||
MapView(model)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun openDirectMessage(node: NodeInfo) {
|
||||
val user = node.user ?: return
|
||||
model.setContactKey("${node.channel}${user.id}")
|
||||
parentFragmentManager.beginTransaction()
|
||||
.replace(R.id.mainActivityLayout, MessagesFragment())
|
||||
.addToBackStack(null)
|
||||
.commit()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -135,7 +126,6 @@ private fun MapView.UpdateMarkers(
|
|||
@Composable
|
||||
fun MapView(
|
||||
model: UIViewModel = viewModel(),
|
||||
openDirectMessage: (NodeInfo) -> Unit = { },
|
||||
) {
|
||||
|
||||
// UI Elements
|
||||
|
|
@ -236,7 +226,8 @@ fun MapView(
|
|||
icon = markerIcon
|
||||
|
||||
setOnLongClickListener {
|
||||
openDirectMessage(node)
|
||||
performHapticFeedback()
|
||||
model.focusUserNode(node)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue