Skip to content

Commit

Permalink
Merge branch 'master' into rzr-select-way
Browse files Browse the repository at this point in the history
  • Loading branch information
RZR-UA committed Jan 16, 2025
2 parents 8a7cea9 + 3b1026a commit f7231de
Show file tree
Hide file tree
Showing 22 changed files with 264 additions and 274 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import kotlin.test.assertTrue

class OBDTest {

@Test
// @Test
fun testOBDComputer() = runBlocking {
val widget = OBDDataComputer.registerWidget(OBDDataComputer.OBDTypeWidget.FUEL_CONSUMPTION_RATE_PERCENT_HOUR, 15)
val coef = 0.05
Expand All @@ -21,7 +21,7 @@ class OBDTest {
var time: Long = currentTimeMillis()
for (i in 0 .. 600) {
val map = HashMap<OBDCommand, OBDDataField<Any>>()
map[OBDCommand.OBD_FUEL_LEVEL_COMMAND] = OBDDataField(fuelLevel.toString())
map[OBDCommand.OBD_FUEL_LEVEL_COMMAND] = OBDDataField(fuelLevel)
OBDDataComputer.acceptValue(map)
val now = currentTimeMillis()
fuelLevel = fuelLevelStart - coef / (1000 / delay) * i
Expand Down
4 changes: 2 additions & 2 deletions OsmAnd-telegram/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<string name="shared_string_end">Slut</string>
<string name="shared_string_start">Start</string>
<string name="shared_string_apply">Anvend</string>
<string name="set_time_timeline_descr">Vælg tid at vise</string>
<string name="set_time_timeline_descr">Vælg vist tid</string>
<string name="start_end_date">Start — slutdato</string>
<string name="saved_messages">Gemte beskeder</string>
<string name="time_zone_descr">Vælg tidszone, der skal vises i placeringsbeskeder.</string>
Expand All @@ -259,7 +259,7 @@
<string name="buffer_time">Buffer udløbstid</string>
<string name="unit_of_length_descr">Ændr enhed for afstand.</string>
<string name="shared_string_suggested">Foreslået</string>
<string name="status_widget_title">OsmAnd Tracker-status</string>
<string name="status_widget_title">OsmAnd Tracker status</string>
<string name="back_to_osmand">Tilbage til OsmAnd</string>
<string name="last_update_from_telegram_date">Sidste opdatering fra Telegram: %1$s</string>
<string name="last_response_date">Sidste svar: %1$s</string>
Expand Down
2 changes: 1 addition & 1 deletion OsmAnd/res/values-b+sr+Latn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4840,7 +4840,7 @@
<string name="shared_string_close_the_dialog">Zatvori prozor</string>
<string name="delete_track_folder_dialog_message">Ovo će izbrisati folder \"%1$s\" i sve %2$s sadržane trase.</string>
<string name="delete_folder_question">Da li brišeš folder?</string>
<string name="cloud_sync_progress">Sinhronizacija…%1$s</string>
<string name="cloud_sync_progress">Sinhronizacija… %1$s</string>
<string name="check_for_updates">Proveri osveženja</string>
<string name="download_cloud_version">Preuzmi izdanje iz Cloud-a</string>
<string name="shared_string_do_not_exist">Ne postoji</string>
Expand Down
2 changes: 1 addition & 1 deletion OsmAnd/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3219,7 +3219,7 @@
<string name="select_waypoints_category_description">Добавете всички отправни точки от трасето или изберете отделни категории.</string>
<string name="waypoints_removed_from_map_markers">Премахнати са отправни точки от</string>
<string name="add_group_descr">Внасяне на групи от избрани или отправни точки на GPX.</string>
<string name="cloud_sync_progress">Синхронизиране…%1$s</string>
<string name="cloud_sync_progress">Синхронизиране… %1$s</string>
<string name="external_device_connected">Свързано</string>
<string name="external_device_disconnected">Несвързано</string>
<string name="make_round_trip_descr">Добавя копие на изходната точка в качеството на местоназначение.</string>
Expand Down
6 changes: 6 additions & 0 deletions OsmAnd/res/values-da/phrases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4113,4 +4113,10 @@
<string name="poi_roundtrip_yes">Rundtur: ja</string>
<string name="poi_recycling_glass_bottles_colour">Farvede glasflasker</string>
<string name="poi_roundtrip_no">Rundtur: nej</string>
<string name="poi_vending_machine_fuel_filter">Automatisk brændstof dispenser; Brændstofs automat</string>
<string name="poi_cemt">CEMT</string>
<string name="poi_climbing_grade_filter">Klatregrad</string>
<string name="poi_climbing_bolt">Klatre bolt</string>
<string name="poi_climbing_bolts_filter">Klatre bolte</string>
<string name="poi_climbing_quality">Klatre kvalitet</string>
</resources>
2 changes: 1 addition & 1 deletion OsmAnd/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@
<string name="cloud_all_changes_uploaded_descr">Alle ændringer foretaget på denne enhed er synkroniseret med OsmAnd Cloud.</string>
<string name="cloud_no_conflicts">Der er ingen konflikter.</string>
<string name="download_cloud_version">Download cloud-version</string>
<string name="cloud_sync_progress">Synkroniserer...%1$s</string>
<string name="cloud_sync_progress">Synkroniserer%1$s</string>
<string name="backup_error_failed_to_fetch_remote_items">Fillisten kunne ikke hentes fra serveren.</string>
<string name="import_export">Import/eksport</string>
<string name="modified_file">Ændret fil</string>
Expand Down
2 changes: 2 additions & 0 deletions OsmAnd/res/values-ga/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5462,4 +5462,6 @@
<string name="calculate_size">Ríomh méid</string>
<string name="rendering_attr_showClimbingRoutes_name">Bealaí dreapadóireachta</string>
<string name="rendering_attr_showClimbingRoutes_description">Taispeáin bealaí dreapadóireachta</string>
<string name="display_distance_to_first_intermediate_summary">Taispeánann sé am agus fad don chéad stad eile ar dtús. Múch chun sonraí an chinn scríbe a thaispeáint i gcónaí.</string>
<string name="display_distance_to_first_intermediate">Taispeáin sonraí bealaigh don chéad stad eile</string>
</resources>
4 changes: 3 additions & 1 deletion OsmAnd/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4981,7 +4981,7 @@
<string name="export_to_file">Ekspor ke berkas</string>
<string name="shared_string_modified">Diubah</string>
<string name="choose_what_to_sync">Pilih apa yang disinkron</string>
<string name="cloud_sync_progress">Menyinkronkan…%1$s</string>
<string name="cloud_sync_progress">Menyinkronkan… %1$s</string>
<string name="changes">Perubahan %1$s</string>
<string name="local_changes_will_be_dismissed">Perubahan lokal akan diabaikan</string>
<string name="import_export">Impor/ekspor</string>
Expand Down Expand Up @@ -6060,4 +6060,6 @@
<string name="rendering_attr_showClimbingRoutes_description">Tampilkan rute pendakian</string>
<string name="calculating_indication_message">Menghitung…</string>
<string name="calculate_size">Hitung ukuran</string>
<string name="display_distance_to_first_intermediate_summary">Menampilkan waktu dan jarak untuk perhentian pertama terlebih dahulu. Matikan untuk selalu menampilkan detail tujuan.</string>
<string name="display_distance_to_first_intermediate">Tampilkan detail rute until perhentian berikutnya</string>
</resources>
2 changes: 1 addition & 1 deletion OsmAnd/res/values-sr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4624,7 +4624,7 @@
<string name="si_nm_ft">Наутичке миље/стопе</string>
<string name="av_audio_format_bottom_sheet_descr">Означите облик звучног записа. Врста звучне датотеке је 3ГПП (.3gp).</string>
<string name="choose_what_to_sync">Одредите шта ће се усклађивати</string>
<string name="cloud_sync_progress">Усклади…%1$s</string>
<string name="cloud_sync_progress">Усклади… %1$s</string>
<string name="check_for_updates">Провери освежења</string>
<string name="shared_string_cloud">Облак</string>
<string name="new_file">Нова датотека</string>
Expand Down
2 changes: 1 addition & 1 deletion OsmAnd/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ You need to activate the sensor so OsmAnd can find it.</string>
</string>
<string name="set_up_backup">Set up backup</string>
<string name="choose_what_to_sync">Choose what to sync</string>
<string name="cloud_sync_progress">Sync…%1$s</string>
<string name="cloud_sync_progress">Sync… %1$s</string>
<string name="checking_progress">Checking…</string>
<string name="shared_string_modified">Modified</string>
<string name="res_unknown">Unknown</string>
Expand Down
5 changes: 3 additions & 2 deletions OsmAnd/src/net/osmand/plus/AppVersionUpgradeOnInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ public class AppVersionUpgradeOnInit {
public static final int VERSION_4_8_02 = 4802;
// 4803 - 4.8-03 (Merge asset files versions)
public static final int VERSION_4_8_03 = 4803;
public static final int VERSION_5_0_00 = 5000;

public static final int LAST_APP_VERSION = VERSION_4_8_03;
public static final int LAST_APP_VERSION = VERSION_5_0_00;

private static final String VERSION_INSTALLED = "VERSION_INSTALLED";

Expand Down Expand Up @@ -271,7 +272,7 @@ void upgradeVersion(@NonNull SharedPreferences startPrefs, int lastVersion) {
if (prevAppVersion < VERSION_4_8_02) {
migrateTerrainModeDefaultPreferences(settings);
}
if (prevAppVersion < VERSION_4_8_03) {
if (prevAppVersion < VERSION_5_0_00) {
app.getAppInitializer().addOnFinishListener(
init -> MergeAssetFilesVersionAlgorithm.execute(app)
);
Expand Down
69 changes: 37 additions & 32 deletions OsmAnd/src/net/osmand/plus/backup/BackupUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,48 @@ public static Map<RemoteFile, SettingsItem> getItemsMapForRestore(@Nullable Back

@NonNull
public static Map<RemoteFile, SettingsItem> getRemoteFilesSettingsItems(@NonNull List<SettingsItem> items,
@NonNull List<RemoteFile> remoteFiles,
boolean infoFiles) {
@NonNull List<RemoteFile> remoteFiles, boolean infoFiles) {
Map<RemoteFile, SettingsItem> res = new HashMap<>();
List<RemoteFile> files = new ArrayList<>(remoteFiles);
Map<String, SettingsItem> settingsItemMap = new HashMap<>();
List<FileSettingsItem> subtypeFolders = new ArrayList<>();
String DELIMETER = "___";
for (SettingsItem item : items) {
List<RemoteFile> processedFiles = new ArrayList<>();
for (RemoteFile file : files) {
String type = file.getType();
String name = file.getName();
if (infoFiles && name.endsWith(BackupHelper.INFO_EXT)) {
name = name.substring(0, name.length() - BackupHelper.INFO_EXT.length());
String itemFileName = getItemFileName(item);
settingsItemMap.put(item.getType().name() + DELIMETER + itemFileName, item);
// Commits FileSettingsItem introduced likely are related to TTS / Voice configuration (folders)
// https://github.com/osmandapp/OsmAnd/commit/ba750f9df87057da268b36e0d32b8c1996f4023a
// https://github.com/osmandapp/OsmAnd/commit/bf93162bd13ef7ab16622bb662c953e931c34a21
if (item instanceof FileSettingsItem fileItem) {
String subtypeFolder = fileItem.getSubtype().getSubtypeFolder();
if (subtypeFolder != null && fileItem.getFile().isDirectory()) {
subtypeFolders.add(fileItem);
}
if (applyItem(item, type, name)) {
res.put(file, item);
processedFiles.add(file);
}
}
for (RemoteFile file : remoteFiles) {
String type = file.getType();
String name = file.getName();
if (infoFiles && name.endsWith(BackupHelper.INFO_EXT)) {
name = name.substring(0, name.length() - BackupHelper.INFO_EXT.length());
}
SettingsItem item = settingsItemMap.get(type + DELIMETER + name);
if (item != null) {
res.put(file, item);
} else {
for (FileSettingsItem fileItem : subtypeFolders) {
String itemFileName = getItemFileName(fileItem);
boolean found = false;
if (!itemFileName.endsWith("/")) {
found = name.startsWith(itemFileName + "/");
} else {
found = name.startsWith(itemFileName);
}
if (found) {
res.put(file, fileItem);
break;
}
}
}
files.removeAll(processedFiles);
}
return res;
}
Expand All @@ -121,25 +145,6 @@ public static CommonPreference<Boolean> getVersionHistoryTypePref(@NonNull Osman
return app.getSettings().registerBooleanPreference(VERSION_HISTORY_PREFIX + exportType.name(), true).makeGlobal().makeShared();
}

public static boolean applyItem(@NonNull SettingsItem item, @NonNull String type, @NonNull String name) {
String itemFileName = getItemFileName(item);
if (item.getType().name().equals(type)) {
if (name.equals(itemFileName)) {
return true;
} else if (item instanceof FileSettingsItem fileItem) {
String subtypeFolder = fileItem.getSubtype().getSubtypeFolder();
if (subtypeFolder != null && name.startsWith(subtypeFolder)) {
if (fileItem.getFile().isDirectory() && !itemFileName.endsWith("/")) {
return name.startsWith(itemFileName + "/");
} else {
return name.startsWith(itemFileName);
}
}
}
}
return false;
}

@NonNull
public static String getItemFileName(@NonNull SettingsItem item) {
String fileName;
Expand Down
2 changes: 1 addition & 1 deletion OsmAnd/src/net/osmand/plus/backup/ImportBackupTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static int calculateMaxProgress(@NonNull OsmandApplication app) {
BackupHelper backupHelper = app.getBackupHelper();
BackupInfo info = backupHelper.getBackup().getBackupInfo();
if (info != null) {
for (RemoteFile file : info.filesToDownload) {
for (RemoteFile file : info.filteredFilesToDownload) {
maxProgress += backupHelper.calculateFileSize(file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,27 @@ protected void setupCards(@NonNull View view) {
FragmentActivity activity = requireActivity();
ViewGroup container = view.findViewById(R.id.cards_container);

MultiStateCard arrowsCard = new MultiStateCard(activity, controller.getArrowsCardController());
MultiStateCard arrowsCard = new MultiStateCard(activity, controller.getArrowsCardController(), false);
container.addView(arrowsCard.build());

inflate(R.layout.list_item_divider_with_padding_basic, container, true);

MultiStateCard iconsCard = new MultiStateCard(activity, controller.getIconsCardController());
MultiStateCard iconsCard = new MultiStateCard(activity, controller.getIconsCardController(), false);
container.addView(iconsCard.build());

inflate(R.layout.list_item_divider, container, true);

MultiStateCard colorsCard = new MultiStateCard(activity, controller.getColorCardController());
MultiStateCard colorsCard = new MultiStateCard(activity, controller.getColorCardController(), false);
container.addView(colorsCard.build());

inflate(R.layout.list_item_divider, container, true);

MultiStateCard widthCard = new MultiStateCard(activity, controller.getWidthCardController());
MultiStateCard widthCard = new MultiStateCard(activity, controller.getWidthCardController(), false);
container.addView(widthCard.build());

inflate(R.layout.list_item_divider, container, true);

MultiStateCard splitCard = new MultiStateCard(activity, controller.getSplitCardController());
MultiStateCard splitCard = new MultiStateCard(activity, controller.getSplitCardController(), false);
container.addView(splitCard.build());

setupOnNeedScrollListener();
Expand Down
Loading

0 comments on commit f7231de

Please sign in to comment.