Skip to content

Commit

Permalink
Merge branch 'master' into fix_#19164
Browse files Browse the repository at this point in the history
  • Loading branch information
Chumva committed Sep 24, 2024
2 parents d82e171 + 0fca921 commit c15803d
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 22 deletions.
1 change: 1 addition & 0 deletions OsmAnd-java/src/main/java/net/osmand/gpx/GPXFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Map;
import java.util.Set;

@Deprecated
public class GPXFile extends GPXUtilities.GPXExtensions {

public String author;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Objects;
import java.util.Set;

@Deprecated
public class GPXTrackAnalysis {

public static final Log LOG = PlatformUtil.getLog(GPXTrackAnalysis.class);
Expand Down
1 change: 1 addition & 0 deletions OsmAnd-java/src/main/java/net/osmand/gpx/GPXUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.Stack;
import java.util.TimeZone;

@Deprecated
public class GPXUtilities {

public static final Log log = PlatformUtil.getLog(GPXUtilities.class);
Expand Down
1 change: 1 addition & 0 deletions OsmAnd-java/src/main/java/net/osmand/gpx/GpxParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Arrays;
import java.util.List;

@Deprecated
public enum GpxParameter {

FILE_NAME("fileName", "TEXT", String.class, null, false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.List;

@Deprecated
public class RouteColorize {

public static double MAX_CORRECT_ELEVATION_DISTANCE = 100.0;// in meters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ class GpxTrackAnalysis {
set(value) = setGpxParameter(GpxParameter.TOTAL_DISTANCE, value.toDouble())

fun isTimeSpecified(): Boolean {
return startTime != Long.MAX_VALUE && startTime != 0L
val startTime = startTime
val endTime = endTime
return startTime != Long.MAX_VALUE && startTime != 0L && endTime != Long.MIN_VALUE && endTime != 0L
}

fun isTimeMoving(): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,10 @@ object GpxUtilities {
progress?.progress(1)
}

fun assignExtensionWriter(wptPt: WptPt, pluginsExtensions: Map<String, String>) {
fun assignExtensionWriter(wptPt: WptPt, extensions: Map<String, String>) {
val regularExtensions = HashMap<String, String>()
val gpxtpxExtensions = HashMap<String, String>()
for ((key, value) in pluginsExtensions) {
for ((key, value) in extensions) {
if (key.startsWith(GPXTPX_PREFIX)) {
gpxtpxExtensions[key] = value
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import net.osmand.shared.KAsyncTask
import net.osmand.shared.extensions.currentTimeMillis
import net.osmand.shared.extensions.format
import net.osmand.shared.gpx.GpxDbHelper.GpxDataItemCallback
import net.osmand.shared.gpx.GpxDbHelper.GpxDataItemCallbackEx
import net.osmand.shared.gpx.data.TrackFolder
import net.osmand.shared.io.KFile
import net.osmand.shared.util.LoggerFactory
import net.osmand.shared.util.PlatformUtil

class TrackFolderLoaderTask(
private val folder: TrackFolder,
Expand Down Expand Up @@ -73,6 +70,7 @@ class TrackFolderLoaderTask(
override fun onPostExecute(result: TrackFolder) {
val cachedRootFolder = cachedRootFolder
if (result === cachedRootFolder) folder.update(cachedRootFolder)
resetCachedData(folder)
listener.loadTracksFinished(folder)
SmartFolderHelper.notifyUpdateListeners()
}
Expand Down Expand Up @@ -117,7 +115,7 @@ class TrackFolderLoaderTask(
launch {
log.info("Loading track subfolder = $subfolder")
scanFolder(subfolder, progress, trackItems)
folder.addSubFolder(subfolder)
taskSync.synchronize { folder.addSubFolder(subfolder) }
}
} else if (GpxHelper.isGpxFile(file)) {
val item = TrackItem(file)
Expand All @@ -141,7 +139,7 @@ class TrackFolderLoaderTask(
}
}
}
folder.addTrackItems(batchTrackItems)
taskSync.synchronize { folder.addTrackItems(batchTrackItems) }
}
}
if (isCancelled()) return@coroutineScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class TrackFolder(dirFile: KFile, parentFolder: TrackFolder?) :
TracksGroup, ComparableTracksGroup {
private var dirFile: KFile
private val parentFolder: TrackFolder?
private var trackItems = listOf<TrackItem>()
private var subFolders = listOf<TrackFolder>()
private var trackItems = mutableListOf<TrackItem>()
private var subFolders = mutableListOf<TrackFolder>()
private var flattenedTrackItems: List<TrackItem>? = null
private var flattenedSubFolders: List<TrackFolder>? = null
private var folderAnalysis: TrackFolderAnalysis? = null
Expand All @@ -29,8 +29,8 @@ class TrackFolder(dirFile: KFile, parentFolder: TrackFolder?) :
}

fun update(folder: TrackFolder) {
trackItems = folder.trackItems.toList()
subFolders = folder.subFolders.toList()
trackItems = ArrayList(folder.trackItems)
subFolders = ArrayList(folder.subFolders)
flattenedTrackItems = folder.flattenedTrackItems?.toList()
flattenedSubFolders = folder.flattenedSubFolders?.toList()
folderAnalysis = folder.folderAnalysis
Expand Down Expand Up @@ -76,19 +76,19 @@ class TrackFolder(dirFile: KFile, parentFolder: TrackFolder?) :
}

fun addSubFolder(subFolder: TrackFolder) {
this.subFolders = KCollectionUtils.addToList(this.subFolders, subFolder)
this.subFolders.add(subFolder)
}

fun setTrackItems(trackItems: MutableList<TrackItem>) {
this.trackItems = ArrayList(trackItems)
}

fun addTrackItem(trackItem: TrackItem) {
this.trackItems = KCollectionUtils.addToList(this.trackItems, trackItem)
this.trackItems.add(trackItem)
}

fun addTrackItems(trackItems: List<TrackItem>) {
this.trackItems = KCollectionUtils.addAllToList(this.trackItems, trackItems)
this.trackItems.addAll(trackItems)
}

val isEmpty: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class TrackFolderAnalysis(folder: TracksGroup) {
items.addAll(folder.getTrackItems())
}
var totalDistanceSum = 0.0
var timeSpanSum = 0.0
for (trackItem in items) {
val dataItem = trackItem.dataItem
val analysis = dataItem?.getAnalysis()
Expand All @@ -43,11 +44,12 @@ class TrackFolderAnalysis(folder: TracksGroup) {
fileSize += file.length()
}
if (analysis.isTimeSpecified()) {
timeSpan = (timeSpan + analysis.getDurationInMs() / 1000.0).toInt()
timeSpanSum += analysis.getDurationInMs() / 1000.0
}
}
}
totalDistance = totalDistanceSum.toFloat()
timeSpan = timeSpanSum.toInt()
tracksCount = items.size

log.info(">>>> ${folder.getName()} = (tracks: $tracksCount, totalDistance: ${"%.2f".format(totalDistance)}, " +
Expand Down
55 changes: 54 additions & 1 deletion OsmAnd/res/values-b+sr+Latn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3041,7 +3041,7 @@
<string name="complex_routing_descr">Dvofazno usmeravanje za auto navigaciju.</string>
<string name="use_fast_recalculation_desc">Preračunava samo početni deo puta, korisno za duga putovanja.</string>
<string name="use_native_pt">Razvoj lokalnog javnog prevoza</string>
<string name="use_native_pt_desc">Prebaci se na Java (bezbedno) izrečunavanje rute javnog prevoza</string>
<string name="use_native_pt_desc">Prebaci se na Java (bezbedno) izračunavanje rute javnog prevoza</string>
<string name="perform_oauth_authorization_description">Prijavi se pomoću OAuth -a radi korišćenja mogućnosti uređivanja OpenStritMapa</string>
<string name="perform_oauth_authorization">Prijavi se preko OAuth-a</string>
<string name="clear_osm_token">Obriši OpenStreetMap OAuth token</string>
Expand Down Expand Up @@ -5909,4 +5909,57 @@
<string name="no_photos_available">Nema dostupnih fotografija</string>
<string name="wikimedia">Vikimedia</string>
<string name="unit_volt">V</string>
<string name="obd_fuel_type_not_provided">Nije navedena vrsta goriva</string>
<string name="obd_fuel_type_gasoline">Benzin</string>
<string name="obd_fuel_type_methanol">Metanol</string>
<string name="obd_fuel_type_ethanol">Etanol</string>
<string name="obd_fuel_type_diesel">Dizel</string>
<string name="obd_fuel_type_lpg">TNG</string>
<string name="obd_fuel_type_cng">KPG</string>
<string name="obd_fuel_type_propane">Propan</string>
<string name="obd_fuel_type_electric">Električno</string>
<string name="obd_fuel_type_bifuel_gasoline">Dvogorivno radno Benzin</string>
<string name="obd_fuel_type_bifuel_methanol">Dvogorivno radno Metanol</string>
<string name="obd_fuel_type_bifuel_ethanol">Dvogorivno radno Etanol</string>
<string name="obd_fuel_type_bifuel_lpg">Dvogorivno radno TNG</string>
<string name="obd_fuel_type_bifuel_cng">Dvogorivno radno KPG</string>
<string name="obd_fuel_type_bifuel_propane">Dvogorivno radno Propan</string>
<string name="obd_fuel_type_bifuel_electricity">Dvogorivno radno Električno</string>
<string name="obd_fuel_type_hybrid_gasoline">Hibridno Benzinsko</string>
<string name="obd_fuel_type_bifuel_electric_combustion">Dvogorivno radno Električna i sa US mašina</string>
<string name="obd_fuel_type_hybrid_ethanol">Hibridno Etanol</string>
<string name="obd_fuel_type_hybrid_diesel">Hibridno Dizel</string>
<string name="obd_fuel_type_hybrid_electric_combustion">Hibridno Električna i sa US mašina</string>
<string name="obd_fuel_type_hybrid_regenerative">Hibridno Regenerativno</string>
<string name="obd_fuel_type_bifuel_hydrogen">Dvogorivno radno Vodonik</string>
<string name="obd_fuel_type_hybrid_hydrogen">Hibridno Vodonik</string>
<string name="obd_fuel_type_hydrogen">Vodonik</string>
<string name="obd_fuel_type_unknown">Nepoznati tip goriva</string>
<string name="shared_string_obd">OBD</string>
<string name="obd_fuel_type_hybrid_electric">Hibridno Električno</string>
<string name="obd_widget_group">Metrika vozila</string>
<string name="percent_unit">%</string>
<string name="obd_rpm">RPM</string>
<string name="rpm_unit">rpm</string>
<string name="obd_speed_desc">Prikazuje brzinu vozila preko OBD senzora</string>
<string name="obd_rpm_desc">Prikazuje tahometarski RPM preko OBD senzora</string>
<string name="obd_air_intake_temp_desc">Prikazuje temperaturu usisnog vazduha vozila preko OBD senzora</string>
<string name="obd_ambient_air_temp_desc">Prikazuje temperaturu ambijentalnog vazduha preko OBD senzora</string>
<string name="obd_battery_voltage_desc">Prikazuje napon baterije preko OBD senzora</string>
<string name="obd_fuel_level_desc">Prikazuje nivo goriva u vozilu preko OBD senzora</string>
<string name="obd_fuel_type_desc">Prikazuje vrstu goriva vozila preko OBD senzora</string>
<string name="obd_air_intake_temp">Temperatura ulaznog vazduha</string>
<string name="obd_ambient_air_temp">Temperatura ambijentalnog vazduha</string>
<string name="obd_battery_voltage">Napon baterije</string>
<string name="obd_engine_coolant_temp">Temperatura rashladne tečnosti motora</string>
<string name="obd_fuel_level">Nivo goriva</string>
<string name="obd_fuel_consumption_rate">Stopa potrošnje goriva</string>
<string name="obd_fuel_consumption_rate_desc">Prikazuje stopu potrošnje goriva vozila na osnovu OBD lokacije</string>
<string name="obd_fuel_left_distance">Preostalo gorivo (rastojanje)</string>
<string name="obd_fuel_type">Tip goriva</string>
<string name="obd_plugin_name">Metrika vozila</string>
<string name="obd_support">OBD podrška</string>
<string name="obd_plugin_description">Pristupa informacijama o vašem vozilu preko OBD protokola</string>
<string name="obd_engine_coolant_temp_desc">Prikazuje temperaturu rashladne tečnosti motora preko OBD senzora</string>
<string name="obd_fuel_left_distance_desc">Pokazuje razdaljinu koju vozilo može da pređe sa preostalim gorivom preko OBD senzora</string>
</resources>
42 changes: 42 additions & 0 deletions OsmAnd/res/values-eo/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5909,4 +5909,46 @@
<string name="obd_fuel_type_bifuel_gasoline">plurbrulaĵa, nun benzino</string>
<string name="obd_fuel_type_bifuel_methanol">plurbrulaĵa, nun metanolo</string>
<string name="unit_volt">V</string>
<string name="obd_fuel_type_bifuel_ethanol">plurbrulaĵa, nun etanolo</string>
<string name="obd_fuel_type_bifuel_lpg">plurbrulaĵa, nun LPG</string>
<string name="obd_fuel_type_bifuel_cng">plurbrulaĵa, nun CNG</string>
<string name="obd_fuel_type_bifuel_propane">plurbrulaĵa, nun propano</string>
<string name="obd_fuel_type_bifuel_electricity">plurbrulaĵa, nun elektro</string>
<string name="obd_fuel_type_bifuel_electric_combustion">plurbrulaĵa, nun elektro kaj brulmotoro</string>
<string name="obd_fuel_type_hybrid_gasoline">hibrida, nun benzino</string>
<string name="obd_fuel_type_hybrid_ethanol">hibrida, nun etanolo</string>
<string name="obd_fuel_type_hybrid_diesel">hibrida, nun dizeloleo</string>
<string name="obd_fuel_type_hybrid_electric">hibrida, nun elektro</string>
<string name="obd_fuel_type_hybrid_electric_combustion">hibrida, nun elektro kaj brulmotoro</string>
<string name="obd_fuel_type_hybrid_regenerative">hibrida, nun reutiligo</string>
<string name="obd_fuel_type_bifuel_hydrogen">plurbrulaĵa, nun hidrogeno</string>
<string name="obd_fuel_type_hybrid_hydrogen">hibrida, nun hidrogeno</string>
<string name="obd_fuel_type_unknown">nekonata speco de brulaĵo</string>
<string name="obd_widget_group">Statistikoj pri veturilo</string>
<string name="percent_unit">%</string>
<string name="obd_rpm">Rivolua rapido</string>
<string name="rpm_unit">riv./min</string>
<string name="obd_speed_desc">Montras rapidon de veturilo raportatan de OBD-sentilo</string>
<string name="obd_air_intake_temp_desc">Montras temperaturon de eniga aero raportatan de OBD-sentilo</string>
<string name="obd_fuel_level_desc">Montras nivelon de brulaĵo raportatan de OBD-sentilo</string>
<string name="obd_fuel_left_distance_desc">Montras vetureblan distancon per la nuna brulaĵ-nivelo raportatan de OBD-sentilo</string>
<string name="obd_ambient_air_temp_desc">Montras temperaturon de fona aero raportatan de OBD-sentilo</string>
<string name="obd_battery_voltage_desc">Montras tension de baterio raportatan de OBD-sentilo</string>
<string name="obd_air_intake_temp">Temperaturo de eniga aero</string>
<string name="obd_ambient_air_temp">Temperaturo de fona aero</string>
<string name="obd_battery_voltage">Tensio de baterio</string>
<string name="obd_engine_coolant_temp">Temperaturo de malvarmiga likvaĵo</string>
<string name="obd_fuel_level">Brulaĵ-nivelo</string>
<string name="obd_plugin_name">Statistikoj pri veturilo</string>
<string name="obd_fuel_consumption_rate">Konsum-rapido de brulaĵo</string>
<string name="obd_fuel_consumption_rate_desc">Montras konsum-rapidon de brulaĵo raportatan de OBD-sentilo</string>
<string name="obd_fuel_left_distance">Brulaĵ-nivelo (distanco)</string>
<string name="obd_fuel_type">Speco de brulaĵo</string>
<string name="obd_plugin_description">Liveras informojn pri via veturilo raportatajn per la protokolo OBD.</string>
<string name="obd_support">Subteno por OBD</string>
<string name="obd_fuel_type_hydrogen">hidrogeno</string>
<string name="shared_string_obd">OBD</string>
<string name="obd_rpm_desc">Montras rivoluan rapidon de motoro raportatan de OBD-sentilo</string>
<string name="obd_fuel_type_desc">Montras specon de brulaĵo raportatan de OBD-sentilo</string>
<string name="obd_engine_coolant_temp_desc">Montras temperaturon de malvarmiga likvaĵo raportatan de OBD-sentilo</string>
</resources>
1 change: 1 addition & 0 deletions OsmAnd/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5933,4 +5933,5 @@
<string name="no_photos_available_descr">В это местоположение еще не было добавлено ни одной пользовательской фотографии</string>
<string name="no_photos_available">Нет доступных фотографий</string>
<string name="wikimedia">Викимедиа</string>
<string name="percent_unit">%</string>
</resources>
Loading

0 comments on commit c15803d

Please sign in to comment.