From b4e1762a2f90353f890ca9753a9fb1497aa2f472 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 3 Sep 2023 11:00:42 -0700 Subject: [PATCH] Move select_trkpt into its own function. --- .../java/net/voussoir/trkpt/TrackFragment.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/net/voussoir/trkpt/TrackFragment.kt b/app/src/main/java/net/voussoir/trkpt/TrackFragment.kt index d498870..fa44c2a 100644 --- a/app/src/main/java/net/voussoir/trkpt/TrackFragment.kt +++ b/app/src/main/java/net/voussoir/trkpt/TrackFragment.kt @@ -470,6 +470,22 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener super.onResume() } + fun select_trkpt(trkpt: Trkpt) + { + selected_trkpt = trkpt + selected_trkpt_info.text = "${trkpt.time}\n${iso8601_local(trkpt.time)}\n${trkpt.latitude}\n${trkpt.longitude}\n${trkpt.accuracy}" + selected_trkpt_marker.position = trkpt + if (selected_trkpt_marker !in mapView.overlays) + { + mapView.overlays.add(selected_trkpt_marker) + } + interpolate_points_button.visibility = View.VISIBLE + straighten_points_button.visibility = View.VISIBLE + delete_selected_trkpt_button.visibility = View.VISIBLE + use_trkpt_as_start_button.visibility = View.VISIBLE + use_trkpt_as_end_button.visibility = View.VISIBLE + isolate_trkseg_button.visibility = View.VISIBLE + } fun deselect_trkpt() { if (track_points_overlay != null) @@ -602,19 +618,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener handler.post(requery_and_render) return } - selected_trkpt = trkpt - selected_trkpt_info.text = "${trkpt.time}\n${iso8601_local(trkpt.time)}\n${trkpt.latitude}\n${trkpt.longitude}\n${trkpt.accuracy}" - selected_trkpt_marker.position = trkpt - if (selected_trkpt_marker !in mapView.overlays) - { - mapView.overlays.add(selected_trkpt_marker) - } - interpolate_points_button.visibility = View.VISIBLE - straighten_points_button.visibility = View.VISIBLE - delete_selected_trkpt_button.visibility = View.VISIBLE - use_trkpt_as_start_button.visibility = View.VISIBLE - use_trkpt_as_end_button.visibility = View.VISIBLE - isolate_trkseg_button.visibility = View.VISIBLE + select_trkpt(trkpt) return } })