Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2021-01-13 14:30:20 +01:00
commit 46aeac9f2e
15 changed files with 107 additions and 31 deletions

View file

@ -54,34 +54,6 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
private var agpsDataLastTimeDownloaded: Long = 0
private val useMagneticFieldSensorCompass = false
// note, passive provider is from API_LEVEL 8 but it is a constant, we can check for it.
// constant should not be changed in future
// LocationManager.PASSIVE_PROVIDER
// put passive provider to first place
// find location
val firstTimeRunDefaultLocation: net.osmand.Location?
@SuppressLint("MissingPermission")
get() {
if (!AndroidUtils.isLocationPermissionAvailable(app)) {
return null
}
val service = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val ps = service.getProviders(true) ?: return null
val providers = ArrayList(ps)
val passiveFirst = providers.indexOf("passive")
if (passiveFirst > -1) {
providers.add(0, providers.removeAt(passiveFirst))
}
for (provider in providers) {
val location = convertLocation(service.getLastKnownLocation(provider))
if (location != null) {
return location
}
}
return null
}
private val gpsListener = object : LocationListener {
override fun onLocationChanged(location: Location?) {
if (location != null) {
@ -115,6 +87,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
@SuppressLint("MissingPermission")
fun resumeAllUpdates() {
/*
val service = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
if (app.isInternetConnectionAvailable) {
if (System.currentTimeMillis() - agpsDataLastTimeDownloaded > AGPS_TO_REDOWNLOAD) {
@ -162,11 +135,12 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
}
}
*/
registerOrUnregisterCompassListener(true)
}
private fun redownloadAGPS() {
/*
try {
val service = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
service.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", null)
@ -178,7 +152,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
agpsDataLastTimeDownloaded = 0L
e.printStackTrace()
}
*/
}
private fun getGpsStatusListener(service: LocationManager): GpsStatus.Listener {
@ -245,6 +219,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
@Synchronized
fun registerOrUnregisterCompassListener(register: Boolean) {
/*
if (sensorRegistered && !register) {
Log.d(PlatformUtil.TAG, "Disable sensor") //$NON-NLS-1$
(app.getSystemService(Context.SENSOR_SERVICE) as SensorManager).unregisterListener(this)
@ -285,6 +260,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
}
sensorRegistered = true
}
*/
}
override fun onAccuracyChanged(sensor: Sensor, accuracy: Int) {}
@ -418,12 +394,14 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
}
private fun stopLocationRequests() {
/*
val service = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
service.removeGpsStatusListener(gpsStatusListener)
service.removeUpdates(gpsListener)
while (!networkListeners.isEmpty()) {
service.removeUpdates(networkListeners.poll())
}
*/
}
fun pauseAllUpdates() {

View file

@ -505,6 +505,8 @@ class TelegramSettings(private val app: TelegramApplication) {
val currentTimeMillis = System.currentTimeMillis()
val currentTime = currentTimeMillis / 1000
statusChangeTime = currentTimeMillis
val gpsEnabled = false
/*
val lm = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val gpsEnabled = try {
if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
@ -518,6 +520,7 @@ class TelegramSettings(private val app: TelegramApplication) {
} catch (ex: Exception) {
false
}
*/
var initializing = false
var sendChatsErrors = false

View file

@ -4039,4 +4039,8 @@
<string name="copy_address">Kopírovat adresu</string>
<string name="online_routing_engine">Online navigační služba</string>
<string name="online_routing_engines">Online navigační služby</string>
<string name="shared_string_folders">Složky</string>
<string name="select_folder">Zvolte složku</string>
<string name="select_folder_descr">Zvolte složku nebo vytvořte novou</string>
<string name="shared_string_empty">Prázdné</string>
</resources>

View file

@ -4050,4 +4050,8 @@
<string name="routing_engine_vehicle_type_driving">Fahren</string>
<string name="online_routing_engine">Online Navigationssystem</string>
<string name="online_routing_engines">Online Navigationssysteme</string>
<string name="shared_string_folders">Ordner</string>
<string name="select_folder">Ordner auswählen</string>
<string name="select_folder_descr">Ordner auswählen oder neuen hinzufügen</string>
<string name="shared_string_empty">Leer</string>
</resources>

View file

@ -4046,4 +4046,8 @@
<string name="copy_address">Kopii adreson</string>
<string name="online_routing_engine">Enreta navigilo</string>
<string name="online_routing_engines">Enretaj navigiloj</string>
<string name="shared_string_folders">Dosierujoj</string>
<string name="select_folder">Elekti dosierujon</string>
<string name="select_folder_descr">Elekti dosierujon aŭ krei novan</string>
<string name="shared_string_empty">Malplena</string>
</resources>

View file

@ -4025,4 +4025,8 @@
<string name="copy_address">Copier l\'adresse</string>
<string name="online_routing_engine">Moteur de routage en ligne</string>
<string name="online_routing_engines">Moteurs de routage en ligne</string>
<string name="shared_string_folders">Dossiers</string>
<string name="select_folder">Sélectionnez le dossier</string>
<string name="select_folder_descr">Sélectionnez un dossier ou créez-en un nouveau</string>
<string name="shared_string_empty">Vide</string>
</resources>

View file

@ -3958,7 +3958,7 @@ Lon %2$s</string>
<string name="navigate_point_mgrs">MGRS</string>
<string name="navigate_point_format_mgrs">MGRS</string>
<string name="mgrs_format_descr">O OsmAnd emprega MGRS, que é semellante ó formato UTM NATO.</string>
<string name="message_need_calculate_route_before_show_graph">%1$s datos dispoñíbeis só nas estrada, necesitas calcular unha ruta empregando \"Ruta entre puntos\" para obtela.</string>
<string name="message_need_calculate_route_before_show_graph">Os datos de %1$s só dispoñíbeis nas estradas, calcula unha ruta empregando \"Ruta entre puntos\" para ver gráficas.</string>
<string name="message_graph_will_be_available_after_recalculation">O gráfico estará dispoñíbel após o recálculo da ruta.</string>
<string name="shared_string_local_maps">Mapas locais</string>
<string name="app_mode_gap">Salto</string>
@ -4066,4 +4066,11 @@ Lon %2$s</string>
<string name="routing_engine_vehicle_type_car">Coche</string>
<string name="message_error_recheck_parameters">Erro, verifica novamente os parámetros</string>
<string name="copy_address">Copiar enderezo</string>
<string name="voice_prompts_timetable">Horarios dos avisos por voz</string>
<string name="online_routing_engine">Motor de navegación en liña</string>
<string name="online_routing_engines">Motores de navegación en liña</string>
<string name="shared_string_folders">Cartafoles</string>
<string name="select_folder_descr">Selecionar cartafol ou engadir un novo</string>
<string name="select_folder">Seleccionar cartafol</string>
<string name="shared_string_empty">Baleiro</string>
</resources>

View file

@ -4038,4 +4038,8 @@
<string name="copy_address">Cím másolása</string>
<string name="online_routing_engine">Online útvonaltervező</string>
<string name="online_routing_engines">Online útvonaltervezők</string>
<string name="shared_string_folders">Mappák</string>
<string name="select_folder">Mappa kijelölése</string>
<string name="select_folder_descr">Mappa kijelölése vagy új hozzáadása</string>
<string name="shared_string_empty">Üres</string>
</resources>

View file

@ -4050,4 +4050,8 @@
<string name="copy_address">העתקת כתובת</string>
<string name="online_routing_engine">מנוע ניווט מקוון</string>
<string name="online_routing_engines">מנועי ניווט מקוונים</string>
<string name="shared_string_folders">תיקיות</string>
<string name="select_folder">בחירת תקינה</string>
<string name="select_folder_descr">נא לבחור תיקייה או להוסיף אחת חדשה</string>
<string name="shared_string_empty">ריק</string>
</resources>

View file

@ -3940,4 +3940,30 @@
<string name="routing_attr_allow_streams_description">Beken en sloten gebruiken</string>
<string name="routing_attr_allow_streams_name">Beken en sloten gebruiken</string>
<string name="routing_attr_allow_intermittent_description">Waterwegen die periodiek water voeren gebruiken</string>
<string name="select_folder">Selecteer een map</string>
<string name="select_folder_descr">Selecteer een map of maak een nieuwe</string>
<string name="shared_string_empty">Leeg</string>
<string name="select_groups_for_import">Selecteer de groepen om deze te importeren.</string>
<string name="select_items_for_import">Selecteer de items om deze te importeren.</string>
<string name="add_to_mapillary">Voeg toe aan Mapillary</string>
<string name="add_to_opr">Voeg toe aan OpenPlaceReviews</string>
<string name="use_dev_url">Gebruik dev.openstreetmap.org</string>
<string name="profile_by_default_description">Selecteer het profiel dat zal worden gebruikt bij het starten van de applicatie.</string>
<string name="add_online_routing_engine">Online routeplanner toevoegen</string>
<string name="edit_online_routing_engine">Bewerk online routeplanner</string>
<string name="shared_string_subtype">Subtype</string>
<string name="shared_string_vehicle">Voertuig</string>
<string name="shared_string_api_key">API-sleutel</string>
<string name="shared_string_server_url">Server-URL</string>
<string name="online_routing_example_hint">De URL met alle parameters ziet er als volgt uit:</string>
<string name="test_route_calculation">Test routeberekening</string>
<string name="routing_engine_vehicle_type_driving">Rijden</string>
<string name="routing_engine_vehicle_type_foot">Te voet</string>
<string name="routing_engine_vehicle_type_bike">Fiets</string>
<string name="routing_engine_vehicle_type_car">Auto</string>
<string name="message_error_recheck_parameters">Fout, controleer parameters opnieuw</string>
<string name="copy_address">Kopieer adres</string>
<string name="online_routing_engine">Online routeplanningssysteem</string>
<string name="online_routing_engines">Online routeplanningssystemen</string>
<string name="shared_string_folders">Mappen</string>
</resources>

View file

@ -4041,4 +4041,8 @@
<string name="copy_address">Copiar endereço</string>
<string name="online_routing_engine">Motor de encaminhamento online</string>
<string name="online_routing_engines">Mecanismos de roteamento online</string>
<string name="shared_string_folders">Pastas</string>
<string name="select_folder">Selecione a pasta</string>
<string name="select_folder_descr">Selecione a pasta ou adicione uma nova</string>
<string name="shared_string_empty">Vazio</string>
</resources>

View file

@ -4025,4 +4025,26 @@
<string name="routing_attr_allow_intermittent_description">Permite caminos de abba intermitentes</string>
<string name="routing_attr_allow_intermittent_name">Permite caminos de abba intermitentes</string>
<string name="voice_prompts_timetable">Nùmeru de annùntzios vocales</string>
<string name="add_online_routing_engine">Annanghe unu motore de càrculu de s\'àndala in lìnia</string>
<string name="edit_online_routing_engine">Modìfica su motore de càrculu de s\'àndala in lìnia</string>
<string name="shared_string_subtype">Suta-casta</string>
<string name="shared_string_vehicle">Veìculu</string>
<string name="shared_string_api_key">Crae de s\'API</string>
<string name="shared_string_server_url">URL de su serbidore</string>
<string name="shared_string_enter_param">Inserta su paràmetru</string>
<string name="keep_it_empty_if_not">Si nono, mantene·lu bòidu</string>
<string name="online_routing_example_hint">S\'URL cun totu sos paràmetros at a apàrrere gasi:</string>
<string name="test_route_calculation">Proa a carculare un\'àndala</string>
<string name="routing_engine_vehicle_type_driving">In vetura</string>
<string name="routing_engine_vehicle_type_foot">A pee</string>
<string name="routing_engine_vehicle_type_bike">Bitzicleta</string>
<string name="routing_engine_vehicle_type_car">Màchina</string>
<string name="message_error_recheck_parameters">Errore, torra a verificare sos paràmetros</string>
<string name="copy_address">Còpia s\'indiritzu</string>
<string name="online_routing_engine">Motore de càrculu in lìnia</string>
<string name="online_routing_engines">Motores de càrculu in lìnia</string>
<string name="shared_string_folders">Cartellas</string>
<string name="select_folder">Ischerta sa cartella</string>
<string name="select_folder_descr">Ischerta una cartella o crea·nde una noa</string>
<string name="shared_string_empty">Bòidu</string>
</resources>

View file

@ -4001,4 +4001,8 @@
<string name="copy_address">Adresi kopyala</string>
<string name="online_routing_engine">Çevrim içi yönlendirme motoru</string>
<string name="online_routing_engines">Çevrim içi yönlendirme motorları</string>
<string name="shared_string_folders">Klasörler</string>
<string name="select_folder">Klasör seç</string>
<string name="select_folder_descr">Klasör seçin veya yeni bir tane ekleyin</string>
<string name="shared_string_empty">Boş</string>
</resources>

View file

@ -4042,4 +4042,8 @@
<string name="copy_address">Копіювати адресу</string>
<string name="online_routing_engine">Мережний рушій маршрутизації</string>
<string name="online_routing_engines">Мережні рушії маршрутизації</string>
<string name="shared_string_folders">Теки</string>
<string name="select_folder">Вибрати теку</string>
<string name="select_folder_descr">Виберіть теку або додайте нову</string>
<string name="shared_string_empty">Порожньо</string>
</resources>

View file

@ -4041,4 +4041,8 @@
<string name="copy_address">複製地址</string>
<string name="online_routing_engine">線上路線計算引擎</string>
<string name="online_routing_engines">線上路線計算引擎</string>
<string name="shared_string_folders">資料夾</string>
<string name="select_folder">選取資料夾</string>
<string name="select_folder_descr">選取資料夾或新增</string>
<string name="shared_string_empty"></string>
</resources>