diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java
index c5f713cdf6..bfe638d394 100644
--- a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java
+++ b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java
@@ -1,12 +1,15 @@
package net.osmand.binary;
import net.osmand.Location;
+import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import net.osmand.util.TransliterationHelper;
+import org.apache.commons.logging.Log;
+
import java.text.MessageFormat;
import java.util.Arrays;
@@ -34,7 +37,7 @@ public class RouteDataObject {
public int[] nameIds;
// mixed array [0, height, cumulative_distance height, cumulative_distance, height, ...] - length is length(points)*2
public float[] heightDistanceArray = null;
-
+ private static final Log LOG = PlatformUtil.getLog(RouteDataObject.class);
public RouteDataObject(RouteRegion region) {
this.region = region;
}
@@ -56,6 +59,7 @@ public class RouteDataObject {
this.pointsY = copy.pointsY;
this.types = copy.types;
this.names = copy.names;
+ this.nameIds = copy.nameIds;
this.restrictions = copy.restrictions;
this.restrictionsVia = copy.restrictionsVia;
this.pointTypes = copy.pointTypes;
@@ -426,12 +430,19 @@ public class RouteDataObject {
int[] opointsX = pointsX;
int[] opointsY = pointsY;
int[][] opointTypes = pointTypes;
+ String[][] opointNames = pointNames;
+ int[][] opointNameTypes = pointNameTypes;
pointsX = new int[pointsX.length + 1];
pointsY = new int[pointsY.length + 1];
boolean insTypes = this.pointTypes != null && this.pointTypes.length > pos;
+ boolean insNames = this.pointNames != null && this.pointNames.length > pos;
if (insTypes) {
pointTypes = new int[opointTypes.length + 1][];
}
+ if (insNames) {
+ pointNames = new String[opointNames.length + 1][];
+ pointNameTypes = new int[opointNameTypes.length +1][];
+ }
int i = 0;
for (; i < pos; i++) {
pointsX[i] = opointsX[i];
@@ -439,18 +450,32 @@ public class RouteDataObject {
if (insTypes) {
pointTypes[i] = opointTypes[i];
}
+ if (insNames) {
+ pointNames[i] = opointNames[i];
+ pointNameTypes[i] = opointNameTypes[i];
+ }
}
pointsX[i] = x31;
pointsY[i] = y31;
if (insTypes) {
pointTypes[i] = null;
}
+ if (insNames) {
+ pointNames[i] = null;
+ pointNameTypes[i] = null;
+ }
for (i = i + 1; i < pointsX.length; i++) {
pointsX[i] = opointsX[i - 1];
pointsY[i] = opointsY[i - 1];
if (insTypes && i < pointTypes.length) {
pointTypes[i] = opointTypes[i - 1];
}
+ if (insNames && i < pointNames.length) {
+ pointNames[i] = opointNames[i - 1];
+ }
+ if (insNames && i < pointNameTypes.length) {
+ pointNameTypes[i] = opointNameTypes[i - 1];
+ }
}
}
diff --git a/OsmAnd/res/values-be/phrases.xml b/OsmAnd/res/values-be/phrases.xml
index 42e8654cab..4e69352251 100644
--- a/OsmAnd/res/values-be/phrases.xml
+++ b/OsmAnd/res/values-be/phrases.xml
@@ -3638,4 +3638,12 @@
На адкрытым паветры
Тып
Статус
+ Даступна для механічнага транспартнага сродку: так
+ Даступна для механічнага транспартнага сродку: не
+ Даступна для механічнага транспартнага сродку: прыватны доступ
+ Стрэлка
+ Вібрацыя
+ Ціск
+ Відэа
+ SMS
\ No newline at end of file
diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml
index dc4aa09a11..10ef38a0f0 100644
--- a/OsmAnd/res/values-be/strings.xml
+++ b/OsmAnd/res/values-be/strings.xml
@@ -9,14 +9,14 @@
Версія:
Пра праграму
Версія, ліцэнзіі, удзельнікі праекта
- Спампаваныя маштабы: %1$s
+ Спампаваныя ўзроўні маштабавання: %1$s
Тэрмін дзеяння (у хвілінах): %1$s
Можна спампаваць: %1$s
Максімальнае павелічэнне: %1$s
Мінімальнае павелічэнне: %1$s
Даныя фрагменту: %1$s
Крыніца фрагментаў мапы «%1$s» захаваная
- Эліптычны меркатар
+ Эліптычная праекцыя меркатара
Максімальнае павелічэнне
Тэрмін дзеяння (у хвілінах)
Мінімальнае павелічэнне
@@ -2071,7 +2071,7 @@
Атрымайце неабмежаваную колькасць спампоўванняў мапаў у дадатак да штотыднёвых, штодзённых і нават штогадзінных абнаўленняў.
Неабмежаваная колькасць спамоўванняў мапаў, абнаўленняў і ўбудова Wikipedia.
Мілі/метры
- Плата за падпіску спаганяецца штомесяц. Скасаваць яе на Google Play можна у любы момант.
+ Плата за падпіску спаганяецца за абраны перыяд. Скасаваць яе на Google Play можна у любы момант.
Ахвяраванне супольнасці OpenStreetMap
Частка вашага ахвяравання накіроўваецца ўдзельнікам праекта OpenStreetMap. Кошт падпіскі застаецца тым жа самым.
Падпіска дазваляе атрымліваць штогадзіныя, штодзённыя, штотыднёвыя абнаўленні і неабмежаваную колькасць спампоўванняў для ўсіх мапаў па ўсім свеце.
@@ -2481,7 +2481,7 @@
\n
Усталяваць
Палепшыць фотапакрыццё Mapillary
- Усталяваць Mapillary, каб дадаць адзін альбо некалькі фотаздымкаў да гэтага месца на мапе.
+ Усталюйце Mapillary, каб дадаць фотаздымкі гэтага месца.
Адкрыць Mapillary
Выява Mapillary
Дыстанцыя выпраўленая
@@ -3093,7 +3093,7 @@
У кожнага профілю свае налады
Вызначце час, цягам якога экран не будзе выключацца.
Выкарыстоўваць датчык адлегласці
- Правядзіце рукой па верхняй частцы экрана, каб уключыць яго падчас навігацыі.
+ Уключаць экран правёўшы па яму рукой.
Зімовая дарога
Ледзяная дарога
Зімовыя і ледзяныя дарогі
@@ -3307,7 +3307,7 @@
Пікап
Паказваць мапу падчас навігацыі на заблакаваным экране.
Налады пабудовы маршруту абранага профілю \"%1$s\".
- Час абуджэння
+ Час працы пасля абуджэння
Адзінкі вымярэння і фарматы
Выгляд
Выгляд мапы
@@ -3327,7 +3327,7 @@
Мапа падчас навігацыі
Мапа падчас навігацыі
Іншае
- Вага, вышыня, хуткасць
+ Вага, вышыня, даўжыня, хуткасць
Параметры аўтамабіля
Галасавыя апавяшчэнні прайграюцца толькі падчас навігацыі.
Навігацыйныя інструкцыі і апавяшчэнні
@@ -3535,7 +3535,7 @@
Аднавіць прадвызначаны парадак элементаў
Вярнуцца да рэдагавання
Паказаць грамадскі транспарт
- Кнопка, каб паказаць ці схаваць грамадскі транспарт на мапе.
+ Кнопка для паказу ці хавання грамадскага транспарту на мапе.
Дадаць профіль
%1$s з %2$s
Схілы
@@ -3564,7 +3564,7 @@
Падзяляльнік
Схавана
Калі схаваць налады, то яны скінуцца да зыходнага стану.
- \"Асноўныя дзеянні\" змяшчаюць толькі 4 кнопкі.
+ Толькі 4 кнопкі.
Асноўныя дзеянні
Убудова для распрацоўшчыкаў
Замяніць іншы пункт на гэты.
@@ -3596,8 +3596,8 @@
Арагонская
Адвольны колер
Пошук тыпаў POI
- Абраныя профілі пераключаюцца націскам на кнопку \"Дзеянне\".
- Профіляў, абраных для гэтага дзеяння, не знойдзена.
+ Пры націсканні на кнопку \"Дзеянні\" пераключаюцца абраныя профілі.
+ Адпаведных профіляў не знойдзена.
Кантонская
Ёруба
Узбекская
@@ -3620,4 +3620,28 @@
Паказаць/схаваць грамадскі транспарт
Пералічыць маршрут у выпадку адхілення
Выдаліць
+ Вызначце шырыню судна, каб пазбягаць вузкіх мастоў
+ Паказаць/схаваць Mapillary
+ Схаваць Mapillary
+ Паказаць Mapillary
+ Пераключальнік для паказу альбо хавання пласта Mapillary.
+ Пазначце даўжыню транспартнага сродку, дазволеную для руху па маршрутах.
+ Ліміт даўжыні
+ Арыентацыя
+ Выдалена: %1$s
+ Перазапуск патрабуецца для поўнага выдалення даных камер кантролю хуткасці.
+ Кіраванне ўзроўнем маштабавання мапы пры дапамозе кнопак рэгулявання гучнасці.
+ Інфармацыя пра славутасці з Вікіпедыі. Гэта ваш кішэнны даведнік - уключыце ўбудову вікіпедыі і чытайце артыкулы пра аб’екты вакол вас.
+ Матацыкл Эндура
+ Мотаролер
+ Выдаліць і перазапусціць
+ На гэтай прыладзе няма камер кантролю хуткасці.
+ Ролікі
+ Выдаліць наступны пункт прызначэння
+ Маштабаванне кнопкамі гучнасці
+ Калі ласка, дайце пункту назву
+ Бягучы пункт прызначэння маршруту будзе выдалены. Калі гэта канцавы пункт прызначэння, то навігацыя спыніцца.
+ Спампаваць мапы Вікіпедыі
+ Інвалідны вазок
+ Закрытая нататка OSM
\ No newline at end of file
diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml
index 47ab66dfe5..4d47baaff2 100644
--- a/OsmAnd/res/values-eo/strings.xml
+++ b/OsmAnd/res/values-eo/strings.xml
@@ -3611,7 +3611,7 @@
Anstataŭigi alian punkton per tiu ĉi.
Aplikis ŝanĝojn al la profilo “%1$s”.
Ne povas legi el “%1$s”.
- Ne povas skribi al “%1%s”.
+ Ne povas skribi al “%1$s”.
Ne povas enporti el “%1$s”.
Elekti dosieron de spuro
Lingvoj
diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml
index afdc93674d..c4e1c15d19 100644
--- a/OsmAnd/res/values-es-rAR/strings.xml
+++ b/OsmAnd/res/values-es-rAR/strings.xml
@@ -3824,4 +3824,5 @@
Silla de ruedas
Go-kart
Nota de OSM cerrada
+ Silla de ruedas (hacia adelante)
\ No newline at end of file
diff --git a/OsmAnd/res/values-hu/phrases.xml b/OsmAnd/res/values-hu/phrases.xml
index 07a5eabded..056b60bcf5 100644
--- a/OsmAnd/res/values-hu/phrases.xml
+++ b/OsmAnd/res/values-hu/phrases.xml
@@ -1116,7 +1116,7 @@
van
Vakvezető burkolat nincs
van
- nincs
+ Hang nincs
Csak amikor zöld
Pihenőhely
Mini körforgalom
@@ -1198,13 +1198,13 @@
Elektromosautó-szerelés
Motorkerékpár-szerelés
igen
- Nem önkiszolgáló
+ Nem
igen
Nem automatizált
Teljes kiszolgálás
igen
Kefés
- Autómosó nincs
+ Nincs
Repülőgépüzemanyag-töltő állomás
Közfürdő
Férfi
@@ -3792,4 +3792,15 @@
Nyíl
Rezgés
Nyomás
+ Akadály
+ Pálya azonosítószám
+ Bowling központ
+ Biztonsági szaküzlet
+ Hegyimentő
+ Igen
+ Igen
+ Rezgés nincs
+ Adomány doboz
+ Kerület
+ Háztömb
\ No newline at end of file
diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml
index e982579f7d..1eb7abb563 100644
--- a/OsmAnd/res/values-it/strings.xml
+++ b/OsmAnd/res/values-it/strings.xml
@@ -3810,15 +3810,16 @@
Questo dispositivo non ha autovelox.
Pattini in linea
Cancella il prossimo punto di destinazione
- Abilita il controllo del zoom della mappa con i pulsanti del volume del dispositivo.
- Pulsanti del volume come zoom
+ Abilita per controllare il livello di zoom della mappa con i pulsanti del volume del dispositivo.
+ Pulsanti volume come zoom
Per favore indica un nome per il punto
- Il punto di destinazione nel percorso attuale verrà cancellato. Se sarà la Destinazione la navigazione si arresterà.
- Scarica mappe Wikimedia
- Ottieni informazioni sui punti di interesse da Wikipedia. È la tua guida tascabile offline - semplicemente abilita il componente aggiuntivo Wikipedia e goditi gli articoli sui punti d\'interesse vicino a te.
- Moto enduro
+ Il punto di destinazione corrente sul percorso verrà eliminato. Se sarà la Destinazione, la navigazione verrà interrotta.
+ Scarica mappe Wikipedia
+ Ottieni informazioni sui punti di interesse da Wikipedia. È la tua guida tascabile offline - basta abilitare il plugin Wikipedia e goderti gli articoli sugli oggetti intorno a te.
+ Moto da enduro
Moto scooter
Sedia a rotelle
Go-kart
Chiudi la nota OSM
+ Sedia a rotelle
\ No newline at end of file
diff --git a/OsmAnd/res/values-uk/phrases.xml b/OsmAnd/res/values-uk/phrases.xml
index 530cedf2c2..3c309cdf27 100644
--- a/OsmAnd/res/values-uk/phrases.xml
+++ b/OsmAnd/res/values-uk/phrases.xml
@@ -3817,4 +3817,7 @@
Вібрація: вимкнено
Стрілка
Вібрація
+ Міський квартал
+ Район
+ Подарункова коробка
\ No newline at end of file
diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml
index 8e1ff5e6fe..41f145794f 100644
--- a/OsmAnd/res/values-uk/strings.xml
+++ b/OsmAnd/res/values-uk/strings.xml
@@ -3810,4 +3810,9 @@
Завантажити мапи Вікіпедії
Отримайте відомості про визначні місця у Вікіпедії. Це ваш кишеньковий посібник без мережі - просто ввімкніть втулок \"Вікіпедія\" і насолоджуйтесь статтями про об\'єкти навколо вас.
Моторолер
+ легкий мотоцикл
+ Інвалідне крісло
+ Інвалідне крісло попереду
+ у мапу
+ Закрита нотатка OSM
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
index 2c232ea8e8..e0cb743a64 100644
--- a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
@@ -22,7 +22,7 @@ import net.osmand.plus.settings.backend.SettingsHelper;
import net.osmand.plus.settings.backend.SettingsHelper.AvoidRoadsSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.MapSourcesSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.PluginSettingsItem;
-import net.osmand.plus.settings.backend.SettingsHelper.PoiUiFilterSettingsItem;
+import net.osmand.plus.settings.backend.SettingsHelper.PoiUiFiltersSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.ProfileSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.QuickActionsSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.SettingsCollectListener;
@@ -305,9 +305,9 @@ public class CustomOsmandPlugin extends OsmandPlugin {
Algorithms.removeAllFiles(dir);
}
}
- } else if (item instanceof PoiUiFilterSettingsItem) {
- PoiUiFilterSettingsItem poiUiFilterSettingsItem = (PoiUiFilterSettingsItem) item;
- List poiUIFilters = poiUiFilterSettingsItem.getItems();
+ } else if (item instanceof PoiUiFiltersSettingsItem) {
+ PoiUiFiltersSettingsItem poiUiFiltersSettingsItem = (PoiUiFiltersSettingsItem) item;
+ List poiUIFilters = poiUiFiltersSettingsItem.getItems();
for (PoiUIFilter filter : poiUIFilters) {
app.getPoiFilters().removePoiFilter(filter);
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/SettingsHelper.java
index 2abbd10e22..41d251ea06 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/SettingsHelper.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/SettingsHelper.java
@@ -126,7 +126,7 @@ public class SettingsHelper {
void onSettingsExportFinished(@NonNull File file, boolean succeed);
}
- public SettingsHelper(OsmandApplication app) {
+ public SettingsHelper(@NonNull OsmandApplication app) {
this.app = app;
}
@@ -149,18 +149,27 @@ public class SettingsHelper {
protected OsmandApplication app;
- private String pluginId;
- private String fileName;
+ protected String pluginId;
+ protected String fileName;
boolean shouldReplace = false;
protected List warnings;
- SettingsItem(OsmandApplication app) {
+ SettingsItem(@NonNull OsmandApplication app) {
this.app = app;
init();
}
+ SettingsItem(@NonNull OsmandApplication app, @Nullable SettingsItem baseItem) {
+ this.app = app;
+ if (baseItem != null) {
+ this.pluginId = baseItem.pluginId;
+ this.fileName = baseItem.fileName;
+ }
+ init();
+ }
+
SettingsItem(OsmandApplication app, @NonNull JSONObject json) throws JSONException {
this.app = app;
init();
@@ -203,10 +212,6 @@ public class SettingsHelper {
return fileName;
}
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
public boolean applyFileName(@NonNull String fileName) {
String n = getFileName();
return n != null && n.endsWith(fileName);
@@ -281,13 +286,13 @@ public class SettingsHelper {
}
@Nullable
- abstract SettingsItemReader getReader();
+ abstract SettingsItemReader extends SettingsItem> getReader();
@Nullable
- abstract SettingsItemWriter getWriter();
+ abstract SettingsItemWriter extends SettingsItem> getWriter();
@NonNull
- SettingsItemReader getJsonReader() {
+ SettingsItemReader extends SettingsItem> getJsonReader() {
return new SettingsItemReader(this) {
@Override
public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException {
@@ -315,7 +320,7 @@ public class SettingsHelper {
}
@NonNull
- SettingsItemWriter getJsonWriter() {
+ SettingsItemWriter extends SettingsItem> getJsonWriter() {
return new SettingsItemWriter(this) {
@Override
public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException {
@@ -445,13 +450,13 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return null;
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -555,13 +560,13 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return null;
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -638,13 +643,13 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return null;
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -664,12 +669,12 @@ public class SettingsHelper {
duplicateItems = new ArrayList<>();
}
- CollectionSettingsItem(OsmandApplication app, @NonNull List items) {
- super(app);
+ CollectionSettingsItem(@NonNull OsmandApplication app, @Nullable CollectionSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem);
this.items = items;
}
- CollectionSettingsItem(OsmandApplication app, @NonNull JSONObject json) throws JSONException {
+ CollectionSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
super(app, json);
}
@@ -747,6 +752,11 @@ public class SettingsHelper {
this.settings = settings;
}
+ protected OsmandSettingsItem(@NonNull OsmandSettings settings, @Nullable OsmandSettingsItem baseItem) {
+ super(settings.getContext(), baseItem);
+ this.settings = settings;
+ }
+
protected OsmandSettingsItem(@NonNull SettingsItemType type, @NonNull OsmandSettings settings, @NonNull JSONObject json) throws JSONException {
super(settings.getContext(), json);
this.settings = settings;
@@ -885,7 +895,7 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return new OsmandSettingsItemReader(this, getSettings()) {
@Override
protected void readPreferenceFromJson(@NonNull OsmandPreference> preference, @NonNull JSONObject json) throws JSONException {
@@ -896,7 +906,7 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return new OsmandSettingsItemWriter(this, getSettings()) {
@Override
protected void writePreferenceToJson(@NonNull OsmandPreference> preference, @NonNull JSONObject json) throws JSONException {
@@ -920,8 +930,8 @@ public class SettingsHelper {
this.appMode = appMode;
}
- public ProfileSettingsItem(@NonNull OsmandApplication app, @NonNull ApplicationModeBean modeBean) {
- super(app.getSettings());
+ public ProfileSettingsItem(@NonNull OsmandApplication app, @Nullable ProfileSettingsItem baseItem, @NonNull ApplicationModeBean modeBean) {
+ super(app.getSettings(), baseItem);
this.modeBean = modeBean;
builder = ApplicationMode.fromModeBean(app, modeBean);
appMode = builder.getApplicationMode();
@@ -1059,7 +1069,7 @@ public class SettingsHelper {
if (additionalPrefsJson != null) {
updatePluginResPrefs();
- SettingsItemReader reader = getReader();
+ SettingsItemReader extends SettingsItem> reader = getReader();
if (reader instanceof OsmandSettingsItemReader) {
((OsmandSettingsItemReader) reader).readPreferencesFromJson(additionalPrefsJson);
}
@@ -1116,7 +1126,7 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return new OsmandSettingsItemReader(this, getSettings()) {
@Override
protected void readPreferenceFromJson(@NonNull OsmandPreference> preference, @NonNull JSONObject json) throws JSONException {
@@ -1129,7 +1139,7 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return new OsmandSettingsItemWriter(this, getSettings()) {
@Override
protected void writePreferenceToJson(@NonNull OsmandPreference> preference, @NonNull JSONObject json) throws JSONException {
@@ -1182,7 +1192,7 @@ public class SettingsHelper {
public StreamSettingsItem(@NonNull OsmandApplication app, @NonNull String name) {
super(app);
this.name = name;
- setFileName(name);
+ this.fileName = name;
}
StreamSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
@@ -1193,7 +1203,7 @@ public class SettingsHelper {
super(app);
this.inputStream = inputStream;
this.name = name;
- setFileName(name);
+ this.fileName = name;
}
@Nullable
@@ -1231,7 +1241,7 @@ public class SettingsHelper {
@Nullable
@Override
- public SettingsItemWriter getWriter() {
+ public SettingsItemWriter extends SettingsItem> getWriter() {
return new StreamSettingsItemWriter(this);
}
}
@@ -1282,7 +1292,7 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return new StreamSettingsItemReader(this) {
@Override
public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException {
@@ -1301,7 +1311,7 @@ public class SettingsHelper {
@Nullable
@Override
- public SettingsItemWriter getWriter() {
+ public SettingsItemWriter extends SettingsItem> getWriter() {
setInputStream(new ByteArrayInputStream(data));
return super.getWriter();
}
@@ -1370,6 +1380,7 @@ public class SettingsHelper {
return UNKNOWN;
}
+ @NonNull
@Override
public String toString() {
return subtypeName;
@@ -1480,7 +1491,7 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return new StreamSettingsItemReader(this) {
@Override
public void readFromStream(@NonNull InputStream inputStream) throws IOException, IllegalArgumentException {
@@ -1509,7 +1520,7 @@ public class SettingsHelper {
@Nullable
@Override
- public SettingsItemWriter getWriter() {
+ public SettingsItemWriter extends SettingsItem> getWriter() {
try {
setInputStream(new FileInputStream(file));
} catch (FileNotFoundException e) {
@@ -1527,7 +1538,7 @@ public class SettingsHelper {
shouldReplace = true;
String fileName = getFileName();
if (!Algorithms.isEmpty(fileName) && !fileName.endsWith(File.separator)) {
- setFileName(fileName + File.separator);
+ this.fileName = fileName + File.separator;
}
}
@@ -1575,7 +1586,7 @@ public class SettingsHelper {
@Nullable
@Override
- public SettingsItemWriter getWriter() {
+ public SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -1585,7 +1596,11 @@ public class SettingsHelper {
private QuickActionRegistry actionRegistry;
public QuickActionsSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
- super(app, items);
+ super(app, null, items);
+ }
+
+ public QuickActionsSettingsItem(@NonNull OsmandApplication app, @Nullable QuickActionsSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem, items);
}
QuickActionsSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
@@ -1725,24 +1740,28 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return getJsonReader();
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
- public static class PoiUiFilterSettingsItem extends CollectionSettingsItem {
+ public static class PoiUiFiltersSettingsItem extends CollectionSettingsItem {
- public PoiUiFilterSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
- super(app, items);
+ public PoiUiFiltersSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
+ super(app, null, items);
}
- PoiUiFilterSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
+ public PoiUiFiltersSettingsItem(@NonNull OsmandApplication app, @Nullable PoiUiFiltersSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem, items);
+ }
+
+ PoiUiFiltersSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
super(app, json);
}
@@ -1873,13 +1892,13 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return getJsonReader();
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -1889,7 +1908,11 @@ public class SettingsHelper {
private List existingItemsNames;
public MapSourcesSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
- super(app, items);
+ super(app, null, items);
+ }
+
+ public MapSourcesSettingsItem(@NonNull OsmandApplication app, @Nullable MapSourcesSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem, items);
}
MapSourcesSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
@@ -2085,13 +2108,13 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return getJsonReader();
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -2102,7 +2125,11 @@ public class SettingsHelper {
private AvoidSpecificRoads specificRoads;
public AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
- super(app, items);
+ super(app, null, items);
+ }
+
+ public AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @Nullable AvoidRoadsSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem, items);
}
AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
@@ -2240,13 +2267,13 @@ public class SettingsHelper {
@Nullable
@Override
- SettingsItemReader getReader() {
+ SettingsItemReader extends SettingsItem> getReader() {
return getJsonReader();
}
@Nullable
@Override
- SettingsItemWriter getWriter() {
+ SettingsItemWriter extends SettingsItem> getWriter() {
return null;
}
}
@@ -2256,7 +2283,7 @@ public class SettingsHelper {
private OsmandApplication app;
private List items = new ArrayList<>();
- SettingsItemsFactory(OsmandApplication app, String jsonStr) throws IllegalArgumentException, JSONException {
+ SettingsItemsFactory(@NonNull OsmandApplication app, String jsonStr) throws IllegalArgumentException, JSONException {
this.app = app;
collectItems(new JSONObject(jsonStr));
}
@@ -2346,7 +2373,7 @@ public class SettingsHelper {
item = new QuickActionsSettingsItem(app, json);
break;
case POI_UI_FILTERS:
- item = new PoiUiFilterSettingsItem(app, json);
+ item = new PoiUiFiltersSettingsItem(app, json);
break;
case MAP_SOURCES:
item = new MapSourcesSettingsItem(app, json);
@@ -2410,7 +2437,7 @@ public class SettingsHelper {
private void writeItemFiles(ZipOutputStream zos) throws IOException {
for (SettingsItem item : items.values()) {
- SettingsItemWriter writer = item.getWriter();
+ SettingsItemWriter extends SettingsItem> writer = item.getWriter();
if (writer != null) {
String fileName = item.getFileName();
if (Algorithms.isEmpty(fileName)) {
@@ -2520,7 +2547,7 @@ public class SettingsHelper {
if (item != null && collecting && item.shouldReadOnCollecting()
|| item != null && !collecting && !item.shouldReadOnCollecting()) {
try {
- SettingsItemReader reader = item.getReader();
+ SettingsItemReader extends SettingsItem> reader = item.getReader();
if (reader != null) {
reader.readFromStream(ois);
}
@@ -2699,8 +2726,8 @@ public class SettingsHelper {
if (item.exists()) {
duplicateItems.add(((ProfileSettingsItem) item).getModeBean());
}
- } else if (item instanceof CollectionSettingsItem) {
- List duplicates = ((CollectionSettingsItem) item).processDuplicateItems();
+ } else if (item instanceof CollectionSettingsItem>) {
+ List> duplicates = ((CollectionSettingsItem>) item).processDuplicateItems();
if (!duplicates.isEmpty()) {
duplicateItems.addAll(duplicates);
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java
index cf2b8d6a11..18e8900203 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java
@@ -49,7 +49,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
private static final Log LOG = PlatformUtil.getLog(ExportImportSettingsAdapter.class.getName());
private OsmandApplication app;
private UiUtilities uiUtilities;
- private List super Object> dataToOperate;
+ private List super Object> data;
private Map> itemsMap;
private List itemsTypes;
private boolean nightMode;
@@ -63,8 +63,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
this.importState = importState;
this.itemsMap = new HashMap<>();
this.itemsTypes = new ArrayList<>();
- this.dataToOperate = new ArrayList<>();
- dataToOperate = new ArrayList<>();
+ this.data = new ArrayList<>();
uiUtilities = app.getUIUtilities();
activeColorRes = nightMode
? R.color.icon_color_active_dark
@@ -102,12 +101,12 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
final List> listItems = itemsMap.get(type);
subTextTv.setText(getSelectedItemsAmount(listItems));
- if (dataToOperate.containsAll(listItems)) {
+ if (data.containsAll(listItems)) {
checkBox.setState(CHECKED);
} else {
boolean contains = false;
for (Object object : listItems) {
- if (dataToOperate.contains(object)) {
+ if (data.contains(object)) {
contains = true;
break;
}
@@ -122,12 +121,12 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
checkBox.performClick();
if (checkBox.getState() == CHECKED) {
for (Object object : listItems) {
- if (!dataToOperate.contains(object)) {
- dataToOperate.add(object);
+ if (!data.contains(object)) {
+ data.add(object);
}
}
} else {
- dataToOperate.removeAll(listItems);
+ data.removeAll(listItems);
}
notifyDataSetChanged();
}
@@ -146,7 +145,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
final Object currentItem = itemsMap.get(itemsTypes.get(groupPosition)).get(childPosition);
boolean isLastGroup = groupPosition == getGroupCount() - 1;
- boolean itemSelected = dataToOperate.contains(currentItem);
+ boolean itemSelected = data.contains(currentItem);
final Type type = itemsTypes.get(groupPosition);
TextView title = child.findViewById(R.id.title_tv);
@@ -166,10 +165,10 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
child.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- if (dataToOperate.contains(currentItem)) {
- dataToOperate.remove(currentItem);
+ if (data.contains(currentItem)) {
+ data.remove(currentItem);
} else {
- dataToOperate.add(currentItem);
+ data.add(currentItem);
}
notifyDataSetChanged();
}
@@ -293,7 +292,7 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
private String getSelectedItemsAmount(List> listItems) {
int amount = 0;
for (Object item : listItems) {
- if (dataToOperate.contains(item)) {
+ if (data.contains(item)) {
amount++;
}
}
@@ -343,17 +342,17 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
}
public void selectAll(boolean selectAll) {
- dataToOperate.clear();
+ data.clear();
if (selectAll) {
for (List> values : itemsMap.values()) {
- dataToOperate.addAll(values);
+ data.addAll(values);
}
}
notifyDataSetChanged();
}
- List super Object> getDataToOperate() {
- return this.dataToOperate;
+ List super Object> getData() {
+ return this.data;
}
public enum Type {
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java
index fc25b7990c..a09a8ba435 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportProfileBottomSheet.java
@@ -26,6 +26,7 @@ import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
+import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
@@ -40,7 +41,12 @@ import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionRegistry;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.SettingsHelper;
+import net.osmand.plus.settings.backend.SettingsHelper.AvoidRoadsSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.FileSettingsItem;
+import net.osmand.plus.settings.backend.SettingsHelper.MapSourcesSettingsItem;
+import net.osmand.plus.settings.backend.SettingsHelper.PoiUiFiltersSettingsItem;
+import net.osmand.plus.settings.backend.SettingsHelper.ProfileSettingsItem;
+import net.osmand.plus.settings.backend.SettingsHelper.QuickActionsSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.SettingsItem;
import net.osmand.plus.settings.bottomsheets.BasePreferenceBottomSheet;
import net.osmand.plus.settings.fragments.ExportImportSettingsAdapter.Type;
@@ -274,7 +280,7 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
private List prepareSettingsItemsForExport() {
List settingsItems = new ArrayList<>();
- settingsItems.add(new SettingsHelper.ProfileSettingsItem(app, profile));
+ settingsItems.add(new ProfileSettingsItem(app, profile));
if (includeAdditionalData) {
settingsItems.addAll(prepareAdditionalSettingsItems());
}
@@ -287,13 +293,12 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
List poiUIFilters = new ArrayList<>();
List tileSourceTemplates = new ArrayList<>();
List avoidRoads = new ArrayList<>();
- for (Object object : adapter.getDataToOperate()) {
+ for (Object object : adapter.getData()) {
if (object instanceof QuickAction) {
quickActions.add((QuickAction) object);
} else if (object instanceof PoiUIFilter) {
poiUIFilters.add((PoiUIFilter) object);
- } else if (object instanceof TileSourceManager.TileSourceTemplate
- || object instanceof SQLiteTileSource) {
+ } else if (object instanceof TileSourceTemplate || object instanceof SQLiteTileSource) {
tileSourceTemplates.add((ITileSource) object);
} else if (object instanceof File) {
try {
@@ -306,16 +311,16 @@ public class ExportProfileBottomSheet extends BasePreferenceBottomSheet {
}
}
if (!quickActions.isEmpty()) {
- settingsItems.add(new SettingsHelper.QuickActionsSettingsItem(app, quickActions));
+ settingsItems.add(new QuickActionsSettingsItem(app, quickActions));
}
if (!poiUIFilters.isEmpty()) {
- settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(app, poiUIFilters));
+ settingsItems.add(new PoiUiFiltersSettingsItem(app, poiUIFilters));
}
if (!tileSourceTemplates.isEmpty()) {
- settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(app, tileSourceTemplates));
+ settingsItems.add(new MapSourcesSettingsItem(app, tileSourceTemplates));
}
if (!avoidRoads.isEmpty()) {
- settingsItems.add(new SettingsHelper.AvoidRoadsSettingsItem(app, avoidRoads));
+ settingsItems.add(new AvoidRoadsSettingsItem(app, avoidRoads));
}
return settingsItems;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
index b7ab4e13ea..a521e8e079 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
@@ -36,7 +36,6 @@ import java.util.List;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
import static net.osmand.plus.settings.fragments.ImportSettingsFragment.IMPORT_SETTINGS_TAG;
-import static net.osmand.plus.settings.fragments.ImportSettingsFragment.getSettingsToOperate;
public class ImportCompleteFragment extends BaseOsmAndFragment {
public static final String TAG = ImportCompleteFragment.class.getSimpleName();
@@ -111,7 +110,7 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
if (settingsItems != null) {
ImportedSettingsItemsAdapter adapter = new ImportedSettingsItemsAdapter(
app,
- getSettingsToOperate(settingsItems, true),
+ ImportSettingsFragment.getSettingsToOperate(settingsItems, true),
nightMode,
new ImportedSettingsItemsAdapter.OnItemClickListener() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
index bf3df71f48..13dc2f94ce 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
@@ -28,12 +28,12 @@ import com.google.android.material.appbar.CollapsingToolbarLayout;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.map.ITileSource;
-import net.osmand.map.TileSourceManager;
+import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.AppInitializer;
-import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
+import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.settings.backend.SettingsHelper;
import net.osmand.plus.settings.backend.SettingsHelper.AvoidRoadsSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.FileSettingsItem;
@@ -41,7 +41,7 @@ import net.osmand.plus.settings.backend.SettingsHelper.FileSettingsItem.FileSubt
import net.osmand.plus.settings.backend.SettingsHelper.ImportAsyncTask;
import net.osmand.plus.settings.backend.SettingsHelper.ImportType;
import net.osmand.plus.settings.backend.SettingsHelper.MapSourcesSettingsItem;
-import net.osmand.plus.settings.backend.SettingsHelper.PoiUiFilterSettingsItem;
+import net.osmand.plus.settings.backend.SettingsHelper.PoiUiFiltersSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.ProfileSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.QuickActionsSettingsItem;
import net.osmand.plus.settings.backend.SettingsHelper.SettingsItem;
@@ -54,6 +54,7 @@ import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.settings.fragments.ExportImportSettingsAdapter.Type;
import net.osmand.plus.widgets.TextViewEx;
+import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@@ -218,7 +219,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
break;
}
case R.id.continue_button: {
- if (adapter.getDataToOperate().isEmpty()) {
+ if (adapter.getData().isEmpty()) {
app.showShortToastMessage(getString(R.string.shared_string_nothing_selected));
} else {
importItems();
@@ -244,7 +245,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
private void importItems() {
updateUi(R.string.shared_string_preparing, R.string.checking_for_duplicate_description);
- List selectedItems = getSettingsItemsFromData(adapter.getDataToOperate());
+ List selectedItems = getSettingsItemsFromData(adapter.getData());
if (file != null && settingsItems != null) {
duplicateStartTime = System.currentTimeMillis();
settingsHelper.checkDuplicates(file, settingsItems, selectedItems, getDuplicatesListener());
@@ -316,22 +317,75 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
this.settingsItems = settingsItems;
}
- private List getSettingsItemsFromData(List