checkpoint
This commit is contained in:
parent
bbd23d8fb1
commit
4a47d267a5
4 changed files with 17 additions and 10 deletions
|
@ -41,7 +41,7 @@ data class Track (
|
|||
{
|
||||
fun delete()
|
||||
{
|
||||
Log.i("VOUSSOIR", "Track.delete.")
|
||||
Log.i("VOUSSOIR", "Track.delete ${device_id} ${start_time} -- ${end_time}.")
|
||||
}
|
||||
|
||||
fun export_gpx(context: Context, fileuri: Uri): Uri?
|
||||
|
@ -120,6 +120,7 @@ data class Track (
|
|||
|
||||
fun statistics(): TrackStatistics
|
||||
{
|
||||
Log.i("VOUSSOIR", "Track.statistics")
|
||||
var first: Trkpt? = null
|
||||
var last: Trkpt? = null
|
||||
var previous: Trkpt? = null
|
||||
|
@ -170,7 +171,7 @@ data class Track (
|
|||
"SELECT lat, lon, time, ele, accuracy, sat FROM trkpt WHERE device_id = ? AND time > ? AND time < ? ORDER BY time ASC",
|
||||
arrayOf(device_id, start_time.time.toString(), end_time.time.toString())
|
||||
)
|
||||
Log.i("VOUSSOIR", "Querying points between ${start_time} -- ${end_time}")
|
||||
Log.i("VOUSSOIR", "Track.trkpt_generator: Querying points between ${start_time} -- ${end_time}")
|
||||
val COLUMN_LAT = cursor.getColumnIndex("lat")
|
||||
val COLUMN_LON = cursor.getColumnIndex("lon")
|
||||
val COLUMN_ELE = cursor.getColumnIndex("ele")
|
||||
|
|
|
@ -98,8 +98,8 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
val RERENDER_DELAY: Long = 1000
|
||||
|
||||
/* Overrides onCreateView from Fragment */
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
// initialize layout
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View
|
||||
{
|
||||
val database: Database = (requireActivity().applicationContext as Trackbook).database
|
||||
track = Track(
|
||||
database=database,
|
||||
|
@ -108,6 +108,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
start_time= iso8601_format.parse(this.requireArguments().getString(Keys.ARG_TRACK_START_TIME)!!),
|
||||
end_time=iso8601_format.parse(this.requireArguments().getString(Keys.ARG_TRACK_STOP_TIME)!!),
|
||||
)
|
||||
track.load_trkpts()
|
||||
rootView = inflater.inflate(R.layout.fragment_track, container, false)
|
||||
mapView = rootView.findViewById(R.id.map)
|
||||
save_track_button = rootView.findViewById(R.id.save_button)
|
||||
|
@ -147,7 +148,6 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
mapView.overlayManager.tilesOverlay.setColorFilter(TilesOverlay.INVERT_COLORS)
|
||||
}
|
||||
|
||||
track.load_trkpts()
|
||||
val actual_start_time: Date = if (track.trkpts.isEmpty()) track.start_time else Date(track.trkpts.first().time)
|
||||
val actual_end_time: Date = if (track.trkpts.isEmpty()) track.end_time else Date(track.trkpts.last().time)
|
||||
|
||||
|
@ -226,7 +226,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
}
|
||||
|
||||
deleteButton.setOnClickListener {
|
||||
val dialogMessage = "${getString(R.string.dialog_yes_no_message_delete_recording)}\n\n${trackNameView.text}"
|
||||
val dialogMessage = "${getString(R.string.dialog_yes_no_message_delete_recording)}\n\n${track.trkpts.size} trackpoints"
|
||||
YesNoDialog(this@TrackFragment as YesNoDialog.YesNoDialogListener).show(
|
||||
context = activity as Context,
|
||||
type = Keys.DIALOG_DELETE_TRACK,
|
||||
|
@ -251,6 +251,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
|
||||
fun render_track()
|
||||
{
|
||||
Log.i("VOUSSOIR", "TrackFragment.render_track")
|
||||
if (special_points_overlay != null)
|
||||
{
|
||||
mapView.overlays.remove(special_points_overlay)
|
||||
|
@ -312,7 +313,7 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
Toast.makeText(context, R.string.toast_message_elevation_info, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
// make track name on statistics sheet clickable
|
||||
|
||||
trackNameView.setOnClickListener {
|
||||
toggleStatisticsSheetVisibility()
|
||||
}
|
||||
|
@ -341,11 +342,11 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
private val requery_and_render: Runnable = object : Runnable {
|
||||
override fun run()
|
||||
{
|
||||
Log.i("VOUSSOIR", "requery_and_render")
|
||||
Log.i("VOUSSOIR", "TrackFragment.requery_and_render")
|
||||
track.start_time = get_datetime(track_query_start_date, track_query_start_time, seconds=0)
|
||||
track.end_time = get_datetime(track_query_end_date, track_query_end_time, seconds=59)
|
||||
track.load_trkpts()
|
||||
Log.i("VOUSSOIR", "Reloaded ${track.trkpts.size} trkpts.")
|
||||
Log.i("VOUSSOIR", "TrackFragment.requery_and_render: Reloaded ${track.trkpts.size} trkpts.")
|
||||
render_track()
|
||||
mapView.invalidate()
|
||||
}
|
||||
|
@ -384,6 +385,9 @@ class TrackFragment : Fragment(), MapListener, YesNoDialog.YesNoDialogListener
|
|||
{
|
||||
// user tapped remove track
|
||||
true -> {
|
||||
track.delete()
|
||||
handler.removeCallbacks(requery_and_render)
|
||||
handler.postDelayed(requery_and_render, RERENDER_DELAY)
|
||||
// switch to TracklistFragment and remove track there
|
||||
// val bundle: Bundle = bundleOf(Keys.ARG_TRACK_ID to layout.track.id)
|
||||
// findNavController().navigate(R.id.tracklist_fragment, bundle)
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.*
|
|||
|
||||
fun createTrackOverlay(context: Context, map_view: MapView, trkpts: Collection<Trkpt>, trackingState: Int): SimpleFastPointOverlay
|
||||
{
|
||||
Log.i("VOUSSOIR", "MapOverlayHelper.createTrackOverlay")
|
||||
val trackpoints: MutableList<IGeoPoint> = mutableListOf()
|
||||
for (trkpt in trkpts)
|
||||
{
|
||||
|
@ -83,6 +84,7 @@ fun createTrackOverlay(context: Context, map_view: MapView, trkpts: Collection<T
|
|||
|
||||
fun create_start_end_markers(context: Context, map_view: MapView, trkpts: Collection<Trkpt>): ItemizedIconOverlay<OverlayItem>?
|
||||
{
|
||||
Log.i("VOUSSOIR", "MapOverlayHelper.create_start_end_markers")
|
||||
if (trkpts.size == 0)
|
||||
{
|
||||
return null
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<string name="dialog_yes_no_positive_button_delete_recording">Delete</string>
|
||||
<string name="dialog_yes_no_positive_button_delete_non_starred">Delete</string>
|
||||
<string name="dialog_yes_no_message_delete_non_starred">Delete all non-starred recordings? This action cannot be undone.</string>
|
||||
<string name="dialog_yes_no_message_delete_recording">Delete this recording?</string>
|
||||
<string name="dialog_yes_no_message_delete_recording">Delete these trackpoints?</string>
|
||||
<!-- Toast Messages -->
|
||||
<string name="toast_message_copied_to_clipboard">Copied to clipboard.</string>
|
||||
<string name="toast_message_elevation_info">Hint: The accuracy of elevation data depends on your device. The uphill and downhill elevation of the whole route is measured.</string>
|
||||
|
|
Loading…
Reference in a new issue