Set datetime spinners during isolate trkseg and spatial query.
This commit is contained in:
parent
71d1bcc675
commit
fd206249f5
1 changed files with 23 additions and 0 deletions
|
@ -85,6 +85,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
||||||
lateinit var track_query_end_time: TimePicker
|
lateinit var track_query_end_time: TimePicker
|
||||||
private lateinit var datepicker_changed_listener: DatePicker.OnDateChangedListener
|
private lateinit var datepicker_changed_listener: DatePicker.OnDateChangedListener
|
||||||
private lateinit var timepicker_changed_listener: TimePicker.OnTimeChangedListener
|
private lateinit var timepicker_changed_listener: TimePicker.OnTimeChangedListener
|
||||||
|
private var datetime_change_listener_enabled: Boolean = true
|
||||||
lateinit var delete_selected_trkpt_button: ImageButton
|
lateinit var delete_selected_trkpt_button: ImageButton
|
||||||
lateinit var isolate_trkseg_button: ImageButton
|
lateinit var isolate_trkseg_button: ImageButton
|
||||||
lateinit var when_was_i_here_button: ImageButton
|
lateinit var when_was_i_here_button: ImageButton
|
||||||
|
@ -123,6 +124,10 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
||||||
datepicker_changed_listener = object: DatePicker.OnDateChangedListener {
|
datepicker_changed_listener = object: DatePicker.OnDateChangedListener {
|
||||||
override fun onDateChanged(p0: DatePicker?, p1: Int, p2: Int, p3: Int)
|
override fun onDateChanged(p0: DatePicker?, p1: Int, p2: Int, p3: Int)
|
||||||
{
|
{
|
||||||
|
if (! datetime_change_listener_enabled)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
handler.removeCallbacks(requery_and_render)
|
handler.removeCallbacks(requery_and_render)
|
||||||
handler.postDelayed(requery_and_render, RERENDER_DELAY)
|
handler.postDelayed(requery_and_render, RERENDER_DELAY)
|
||||||
}
|
}
|
||||||
|
@ -130,6 +135,10 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
||||||
timepicker_changed_listener = object : TimePicker.OnTimeChangedListener{
|
timepicker_changed_listener = object : TimePicker.OnTimeChangedListener{
|
||||||
override fun onTimeChanged(p0: TimePicker?, p1: Int, p2: Int)
|
override fun onTimeChanged(p0: TimePicker?, p1: Int, p2: Int)
|
||||||
{
|
{
|
||||||
|
if (! datetime_change_listener_enabled)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
handler.removeCallbacks(requery_and_render)
|
handler.removeCallbacks(requery_and_render)
|
||||||
val newminute = (p1 * 60) + p2
|
val newminute = (p1 * 60) + p2
|
||||||
Log.i("VOUSSOIR", "End time changed $newminute")
|
Log.i("VOUSSOIR", "End time changed $newminute")
|
||||||
|
@ -258,6 +267,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
||||||
(polyline.actualPoints.first() as Trkpt).time,
|
(polyline.actualPoints.first() as Trkpt).time,
|
||||||
(polyline.actualPoints.last() as Trkpt).time,
|
(polyline.actualPoints.last() as Trkpt).time,
|
||||||
))
|
))
|
||||||
|
set_datetimes_from_track()
|
||||||
render_track()
|
render_track()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,6 +283,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
||||||
east=mapView.boundingBox.lonEast,
|
east=mapView.boundingBox.lonEast,
|
||||||
west=mapView.boundingBox.lonWest,
|
west=mapView.boundingBox.lonWest,
|
||||||
))
|
))
|
||||||
|
set_datetimes_from_track()
|
||||||
render_track()
|
render_track()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,6 +444,18 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun set_datetimes_from_track()
|
||||||
|
{
|
||||||
|
if (track.trkpts.size == 0)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
datetime_change_listener_enabled = false
|
||||||
|
set_datetime(track_query_start_date, track_query_start_time, Date(track.trkpts.first().time), _ending=false)
|
||||||
|
set_datetime(track_query_end_date, track_query_end_time, Date(track.trkpts.last().time), _ending=true)
|
||||||
|
datetime_change_listener_enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
fun get_datetime(datepicker: DatePicker, timepicker: TimePicker, seconds: Int): Date
|
fun get_datetime(datepicker: DatePicker, timepicker: TimePicker, seconds: Int): Date
|
||||||
{
|
{
|
||||||
val cal = GregorianCalendar.getInstance()
|
val cal = GregorianCalendar.getInstance()
|
||||||
|
|
Loading…
Reference in a new issue