checkpoint
This commit is contained in:
parent
62189f9e61
commit
b0edefcb4b
18 changed files with 65 additions and 105 deletions
|
@ -142,23 +142,61 @@ class TrackerService: Service()
|
|||
|
||||
private fun createLocationListener(): LocationListener
|
||||
{
|
||||
return object : LocationListener {
|
||||
return object : LocationListener
|
||||
{
|
||||
override fun onLocationChanged(location: Location)
|
||||
{
|
||||
Log.i("VOUSSOIR", "Processing point ${location.latitude}, ${location.longitude} ${location.time}.")
|
||||
|
||||
if (! isBetterLocation(location, currentBestLocation))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Not better than previous.")
|
||||
return
|
||||
}
|
||||
|
||||
currentBestLocation = location
|
||||
|
||||
if (trackingState != Keys.STATE_TRACKING_ACTIVE)
|
||||
{
|
||||
return
|
||||
}
|
||||
Log.i("VOUSSOIR", "Processing point ${location.latitude}, ${location.longitude} ${location.time}.")
|
||||
if (should_keep_point((location)))
|
||||
|
||||
displayNotification()
|
||||
|
||||
if(! trackbook.database.ready)
|
||||
{
|
||||
val now: Long = location.time
|
||||
// val now: Date = GregorianCalendar.getInstance().time
|
||||
Log.i("VOUSSOIR", "Omitting due to database not ready.")
|
||||
return
|
||||
}
|
||||
if (location.latitude == 0.0 || location.longitude == 0.0)
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to 0,0 location.")
|
||||
return
|
||||
}
|
||||
if (! isRecentEnough(location))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to not recent enough.")
|
||||
return
|
||||
}
|
||||
if (! isAccurateEnough(location, Keys.DEFAULT_THRESHOLD_LOCATION_ACCURACY))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to not accurate enough.")
|
||||
return
|
||||
}
|
||||
for (homepoint in trackbook.homepoints)
|
||||
{
|
||||
if (homepoint.location.distanceTo(location) < homepoint.radius)
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to homepoint ${homepoint.name}.")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (! (recent_displacement_trkpts.isEmpty() || isDifferentEnough(recent_displacement_trkpts.first().toLocation(), location, omitRests)))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to too close to previous.")
|
||||
return
|
||||
}
|
||||
|
||||
val trkpt = Trkpt(location=location)
|
||||
trackbook.database.insert_trkpt(device_id, trkpt)
|
||||
recent_trkpts.add(trkpt)
|
||||
|
@ -173,14 +211,12 @@ class TrackerService: Service()
|
|||
recent_displacement_trkpts.removeFirst()
|
||||
}
|
||||
|
||||
if (now - lastCommit > Keys.COMMIT_INTERVAL)
|
||||
if (location.time - lastCommit > Keys.COMMIT_INTERVAL)
|
||||
{
|
||||
trackbook.database.commit()
|
||||
lastCommit = now
|
||||
lastCommit = location.time
|
||||
}
|
||||
}
|
||||
displayNotification()
|
||||
}
|
||||
override fun onProviderEnabled(provider: String)
|
||||
{
|
||||
Log.v("VOUSSOIR", "onProviderEnabled $provider")
|
||||
|
@ -414,46 +450,4 @@ class TrackerService: Service()
|
|||
/*
|
||||
* End of inner class
|
||||
*/
|
||||
|
||||
fun should_keep_point(location: Location): Boolean
|
||||
{
|
||||
if(! trackbook.database.ready)
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to database not ready.")
|
||||
return false
|
||||
}
|
||||
if (location.latitude == 0.0 || location.longitude == 0.0)
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to 0,0 location.")
|
||||
return false
|
||||
}
|
||||
if (! isRecentEnough(location))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to not recent enough.")
|
||||
return false
|
||||
}
|
||||
if (! isAccurateEnough(location, Keys.DEFAULT_THRESHOLD_LOCATION_ACCURACY))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to not accurate enough.")
|
||||
return false
|
||||
}
|
||||
for (homepoint in trackbook.homepoints)
|
||||
{
|
||||
if (homepoint.location.distanceTo(location) < homepoint.radius)
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to homepoint ${homepoint.name}.")
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (recent_displacement_trkpts.isEmpty())
|
||||
{
|
||||
return true
|
||||
}
|
||||
if (! isDifferentEnough(recent_displacement_trkpts.first().toLocation(), location, omitRests))
|
||||
{
|
||||
Log.i("VOUSSOIR", "Omitting due to too close to previous.")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
<string name="button_save">Gem</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_share_gpx">Del GPX fil med</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook har ingen rutepunkter endnu.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Fortsæt optagelse</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_elevation_info">Tip: nøjagtigheden af højde målingerne afhænger af din enhed. Op ad og nedadgående højder på hele ruten måles.</string>
|
||||
<string name="toast_message_install_file_helper">Kan ikke gemme. Installer venligst en filhåndteringsprogram først.</string>
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
<string name="button_save">Speichern</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_share_gpx">GPX-Datei teilen mit</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook hat noch keine Wegpunkte aufgenommen.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Aufnahme fortsetzen</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_copied_to_clipboard">In die Zwischenablage kopiert.</string>
|
||||
<string name="toast_message_elevation_info">Hinweis: Die Genauigkeit der Höhenmeter-Werte ist geräteabhängig. Gemessen werden Steigungen und Gefälle der Gesamtstrecke.</string>
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<string name="button_save">Guardar</string>
|
||||
<string name="dialog_generic_button_okay">OK</string>
|
||||
<string name="dialog_generic_details_button">Mostrar detalles</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook no registró ningún punto de referencia hasta el momento.</string>
|
||||
<string name="dialog_rename_track_input_hint">Introduce un nombre nuevo</string>
|
||||
<string name="dialog_share_gpx">Compartir el archivo GPX con</string>
|
||||
<string name="dialog_yes_no_positive_button_default">Si</string>
|
||||
|
@ -38,7 +37,6 @@
|
|||
<string name="dialog_yes_no_message_delete_recording">¿Eliminar esta grabación\?</string>
|
||||
<string name="toast_message_copied_to_clipboard">Copiado al portapapeles.</string>
|
||||
<string name="toast_message_install_file_helper">No se puede guardar. Primero instala un administrador de archivos.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Continuar grabación</string>
|
||||
<string name="toast_message_poi_added">Se agregó un marcador de punto de interés.</string>
|
||||
<string name="toast_message_poi_removed">Se elimino un marcador de punto de interés.</string>
|
||||
<string name="toast_message_save_gpx">Guardando grabacion como GPX.</string>
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
<string name="button_delete">Supprimer</string>
|
||||
<string name="button_save">Sauvegarder</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_error_empty_recording_button_resume">Reprendre l\'enregistrement</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook n\'a enregistré aucun point de parcours jusqu\'à présent.</string>
|
||||
<string name="dialog_share_gpx">Partager le fichier GPX avec</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_elevation_info">Astuce : La précision des données d\'altitude dépend de votre appareil. La dénivellation globale du parcours est mesurée.</string>
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
<string name="toast_message_elevation_info">Savjet: Točnost podataka o visinskoj razlici ovisi o tvom uređaju. Mjeri se visinska razlika cijele rute.</string>
|
||||
<string name="app_name">Trackbook</string>
|
||||
<string name="statistics_sheet_p_distance">Ukupna udaljenost:</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook do sada još nije snimio niti jednu točku rute.</string>
|
||||
<string name="quick_settings_tile_title_start">Počni snimati</string>
|
||||
<string name="abbreviation_seconds">s</string>
|
||||
<string name="dialog_rename_track_button">Preimenuj</string>
|
||||
|
@ -76,7 +75,6 @@
|
|||
<string name="statistics_sheet_p_duration">Ukupno trajanje:</string>
|
||||
<string name="statistics_sheet_p_waypoints">Snimljene točke rute:</string>
|
||||
<string name="layout_onboarding_description_app_icon">Ikona programa Trackbook</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Nastavi snimati</string>
|
||||
<string name="pref_maintenance_title">Održavanje</string>
|
||||
<string name="dialog_yes_no_positive_button_delete_non_starred">Izbriši</string>
|
||||
<string name="track_list_onboarding_h1_part_2">… će se ovdje prikazati.</string>
|
||||
|
|
|
@ -174,8 +174,6 @@
|
|||
<string name="dialog_share_gpx">Bagikan file GPX dengan</string>
|
||||
<string name="dialog_rename_track_input_hint">Masukkan nama baru</string>
|
||||
<string name="dialog_rename_track_button">Ubah nama</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Lanjutkan Perekaman</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook tidak merekam titik arah sejauh ini.</string>
|
||||
<string name="dialog_generic_details_button">Tampilkan detil</string>
|
||||
<string name="dialog_generic_button_okay">Oke</string>
|
||||
<string name="dialog_generic_button_cancel">Batalkan</string>
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
<string name="dialog_generic_button_cancel">Annulla</string>
|
||||
<string name="dialog_generic_button_okay">OK</string>
|
||||
<string name="dialog_generic_details_button">Dettagli</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook non ha registrato nessuna tappa intermedia finora.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Riprendi la registrazione</string>
|
||||
<string name="dialog_rename_track_button">Rinomina</string>
|
||||
<string name="dialog_rename_track_input_hint">Inserisci un nuovo nome</string>
|
||||
<string name="dialog_share_gpx">Condividi il file GPX con</string>
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
<string name="button_save">保存してクリア</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_share_gpx">GPX ファイルを共有...</string>
|
||||
<string name="dialog_error_empty_recording_message">トラックブックはこれまでウェイポイントを記録していません。</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">記録を再開</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_elevation_info">ヒント: 標高データの精度は、お使いのデバイスによって異なります。ルート全体の上り坂と下り坂の標高を測定します。</string>
|
||||
<string name="toast_message_install_file_helper">先にファイルマネージャか GPX トレースビューアーをインストールしてください。</string>
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
<string name="button_save">Lagre og tøm</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_share_gpx">Del GPX-fil med</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook har ikke registrert noen veipunkter så langt.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Gjenoppta opptak</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_elevation_info">Hint: Høydedataens nøyaktighet avhenger av enheten din. Opp og ned-stigningen for hele ruten måles.</string>
|
||||
<string name="toast_message_install_file_helper">Klarte ikke å lagre. Installer en filbehandler først.</string>
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
<string name="button_save">Opslaan</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_share_gpx">GPX-bestand delen met</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook heeft nog geen routepunten vastgelegd.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Opnemen hervatten</string>
|
||||
<!-- toast messages -->
|
||||
<string name="toast_message_elevation_info">Tip: De nauwkeurigheid van de hoogtemeter hangt af van uw toestel. De stijging en daling van de hele afstand wordt gemeten.</string>
|
||||
<string name="toast_message_install_file_helper">Kan niet opslaan. Installeer eerst een bestandsbeheerder.</string>
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
<string name="marker_description_time">Czas</string>
|
||||
<string name="snackbar_message_location_permission_denied">Nie udzielono zezwolenia na lokalizację. Trackbook nie będzie działać.</string>
|
||||
<string name="dialog_rename_track_input_hint">Wpisz nową nazwę</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Zapis życiorysu</string>
|
||||
<string name="toast_message_elevation_info">Wskazówka: Dokładność danych dotyczących wysokości zależy od urządzenia użytkownika. Mierzone jest wzniesienie i zejście całej trasy.</string>
|
||||
<string name="toast_message_install_file_helper">Nie można zapisać. Proszę najpierw zainstalować menedżera plików.</string>
|
||||
<string name="statistics_sheet_p_steps">Podjęte kroki:</string>
|
||||
|
@ -91,6 +90,5 @@
|
|||
<string name="toast_message_copied_to_clipboard">Skopiowane do schowka.</string>
|
||||
<string name="dialog_share_gpx">Udostępnianie pliku GPX</string>
|
||||
<string name="dialog_yes_no_positive_button_default">Tak</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook nie zarejestrował dotychczas żadnych waypointów.</string>
|
||||
<string name="app_name">Trackbook</string>
|
||||
</resources>
|
|
@ -25,8 +25,6 @@
|
|||
<string name="dialog_generic_button_cancel">Cancelar</string>
|
||||
<string name="dialog_generic_button_okay">OK</string>
|
||||
<string name="dialog_generic_details_button">Mostrar detalhes</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook não registrou nenhum ponto de passagem até agora.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Retomar gravação</string>
|
||||
<string name="dialog_rename_track_button">Renomear</string>
|
||||
<string name="dialog_rename_track_input_hint">Insira um novo nome</string>
|
||||
<string name="dialog_share_gpx">Compartilhar arquivo GPX com</string>
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
<string name="dialog_share_gpx">Поделиться файлом GPX через</string>
|
||||
<string name="dialog_rename_track_input_hint">Введите новое имя</string>
|
||||
<string name="dialog_rename_track_button">Переименовать</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Возобновить запись</string>
|
||||
<string name="dialog_error_empty_recording_message">В Trackbook пока что не записаны путевые точки.</string>
|
||||
<string name="dialog_generic_details_button">Показать подробности</string>
|
||||
<string name="dialog_generic_button_okay">ОЕ</string>
|
||||
<string name="dialog_generic_button_cancel">Отмена</string>
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
<string name="button_save">Spara</string>
|
||||
<!-- dialogs -->
|
||||
<string name="dialog_share_gpx">Dela GPX-fil med</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook spelade inte in några vägpunkter så här långt.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Återuppta inspelning</string>
|
||||
<!-- toast messages -->
|
||||
<!--<string name="toast_message_permissions_granted"></string>-->
|
||||
<!--<string name="toast_message_no_external_storage"></string>-->
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
<string name="layout_onboarding_description_app_icon">Trackbook Uygulama Simgesi</string>
|
||||
<string name="quick_settings_tile_title_pause">Kaydı Durdur</string>
|
||||
<string name="quick_settings_tile_title_start">Kaydı Başlat</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Kaydı Devam Ettir</string>
|
||||
<string name="quick_settings_tile_title_default">Kayıt</string>
|
||||
<string name="statistics_sheet_p_velocity">Ortalama hız:</string>
|
||||
<string name="statistics_sheet_p_negative_elevation">Yükseklik (yokuş aşağı):</string>
|
||||
|
@ -74,7 +73,6 @@
|
|||
<string name="dialog_share_gpx">GPX dosyasını paylaş</string>
|
||||
<string name="dialog_rename_track_input_hint">Yeni bir ad girin</string>
|
||||
<string name="dialog_rename_track_button">Yeniden adlandır</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook şu ana kadar herhangi bir ara nokta kaydetmedi.</string>
|
||||
<string name="dialog_generic_details_button">Ayrıntıları göster</string>
|
||||
<string name="dialog_generic_button_okay">Tamam</string>
|
||||
<string name="dialog_generic_button_cancel">İptal</string>
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
<string name="dialog_generic_button_cancel">取消</string>
|
||||
<string name="dialog_generic_button_okay">确定</string>
|
||||
<string name="dialog_generic_details_button">显示详情</string>
|
||||
<string name="dialog_error_empty_recording_message">Trackbook 目前未记录任何航点。</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">恢复记录</string>
|
||||
<string name="dialog_rename_track_button">重命名</string>
|
||||
<string name="dialog_rename_track_input_hint">请输入一个新名称</string>
|
||||
<string name="dialog_share_gpx">分享 GPX 文件到</string>
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
<string name="dialog_generic_button_cancel">Cancel</string>
|
||||
<string name="dialog_generic_button_okay">OK</string>
|
||||
<string name="dialog_generic_details_button">Show details</string>
|
||||
<string name="dialog_error_empty_recording_message">Unable to save. Trackbook did not record any waypoints so far.</string>
|
||||
<string name="dialog_error_empty_recording_button_resume">Resume Recording</string>
|
||||
<string name="dialog_rename_track_button">Rename</string>
|
||||
<string name="dialog_rename_track_input_hint">Enter a new name</string>
|
||||
<string name="dialog_share_gpx">Share GPX file with</string>
|
||||
|
@ -55,13 +53,13 @@
|
|||
<string name="statistics_sheet_p_distance">Total distance:</string>
|
||||
<string name="statistics_sheet_p_steps">Steps taken:</string>
|
||||
<string name="statistics_sheet_p_steps_no_pedometer">pedometer not available</string>
|
||||
<string name="statistics_sheet_p_waypoints">Recorded waypoints:</string>
|
||||
<string name="statistics_sheet_p_waypoints">Recorded trackpoints:</string>
|
||||
<string name="statistics_sheet_p_duration">Total duration:</string>
|
||||
<string name="statistics_sheet_p_recording_paused">Recording paused:</string>
|
||||
<string name="statistics_sheet_p_recording_start">Recording started:</string>
|
||||
<string name="statistics_sheet_p_recording_stop">Recording stopped:</string>
|
||||
<string name="statistics_sheet_p_max_altitude">Highest waypoint:</string>
|
||||
<string name="statistics_sheet_p_min_altitude">Lowest waypoint:</string>
|
||||
<string name="statistics_sheet_p_max_altitude">Highest trackpoint:</string>
|
||||
<string name="statistics_sheet_p_min_altitude">Lowest trackpoint:</string>
|
||||
<string name="statistics_sheet_p_positive_elevation">Elevation (uphill):</string>
|
||||
<string name="statistics_sheet_p_negative_elevation">Elevation (downhill):</string>
|
||||
<string name="statistics_sheet_p_velocity">Average velocity:</string>
|
||||
|
@ -82,7 +80,7 @@
|
|||
<string name="pref_app_version_title">App Version</string>
|
||||
<string name="pref_accuracy_threshold_summary">Discard location fixes with an accuracy larger than (meters):</string>
|
||||
<string name="pref_accuracy_threshold_title">Accuracy Threshold</string>
|
||||
<string name="pref_altitude_smoothing_value_summary" translatable="false">Number of waypoints used to smooth the elevation curve.</string>
|
||||
<string name="pref_altitude_smoothing_value_summary" translatable="false">Number of trackpoints used to smooth the elevation curve.</string>
|
||||
<string name="pref_altitude_smoothing_value_title" translatable="false">Altitude Smoothing</string>
|
||||
<string name="pref_auto_export_interval_summary">Automatically export GPX file after this many hours.</string>
|
||||
<string name="pref_device_id_summary">A unique ID to distinguish tracks recorded across multiple devices:</string>
|
||||
|
@ -104,8 +102,8 @@
|
|||
<string name="pref_imperial_measurement_units_summary_metric">Currently using metric units (Kilometer, Meter).</string>
|
||||
<string name="pref_imperial_measurement_units_summary_imperial">Currently using imperial units (Miles, Feet).</string>
|
||||
<string name="pref_imperial_measurement_units_title">Use Imperial Measurements</string>
|
||||
<string name="pref_omit_rests_on">Waypoints will not be recorded if they are too close to the previous waypoint.</string>
|
||||
<string name="pref_omit_rests_off">All waypoints will be recorded, even while standing still.</string>
|
||||
<string name="pref_omit_rests_on">Trackpoints will not be recorded if they are too close to your recent trackpoints.</string>
|
||||
<string name="pref_omit_rests_off">All trackpoints will be recorded, even while standing still.</string>
|
||||
<string name="pref_omit_rests_title">Omit repeated points</string>
|
||||
<string name="pref_report_issue_summary">Report bugs and suggest improvements on GitHub.</string>
|
||||
<string name="pref_report_issue_title">Report Issue</string>
|
||||
|
|
Loading…
Reference in a new issue