Merge pull request #10117 from osmandapp/master

update test bramch
This commit is contained in:
Hardy 2020-10-30 19:22:10 +01:00 committed by GitHub
commit e13bb59dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 1052 additions and 94 deletions

View file

@ -14,6 +14,10 @@
package com.jwetherell.openmap.common;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MGRSPoint extends ZonedUTMPoint {
/**
@ -104,6 +108,15 @@ public class MGRSPoint extends ZonedUTMPoint {
* an UPPERCASE coordinate string is expected.
*/
protected void decode(String mgrsString) throws NumberFormatException {
if (mgrsString.contains(" ")) {
String[] parts = mgrsString.split(" ");
StringBuilder s = new StringBuilder();
for (String i : parts) {
s.append(i);
}
mgrsString = s.toString();
}
if (mgrsString == null || mgrsString.length() == 0) {
throw new NumberFormatException("MGRSPoint coverting from nothing");
}
@ -633,6 +646,97 @@ public class MGRSPoint extends ZonedUTMPoint {
return twoLetter;
}
public String toFlavoredString() {
try {
List<String> all = new ArrayList<>();
for (int i = 0; i <= mgrs.length(); i++) {
if (Character.isAlphabetic(mgrs.charAt(i))){
all.add(mgrs.substring(0,i+1));
all.add(mgrs.substring(i+1,i+3));
String remains = mgrs.substring(i+3);
all.add(remains.substring(0,remains.length()/2));
all.add(remains.substring(remains.length()/2));
break;
}
}
StringBuilder os = new StringBuilder();
for(String part: all){
if (os.length() > 0) os.append(" ");
os.append(part);
}
return os.toString();
}catch (Exception e){
return mgrs;
}
}
public String toFlavoredString(int accuracy) {
try {
List<String> all = new ArrayList<>();
for (int i = 0; i <= mgrs.length(); i++) {
if (Character.isAlphabetic(mgrs.charAt(i))){
all.add(mgrs.substring(0,i+1));
all.add(mgrs.substring(i+1,i+3));
String remains = mgrs.substring(i+3);
int easting = Integer.parseInt(remains.substring(0,remains.length()/2));
int northing = Integer.parseInt(remains.substring(remains.length()/2));
double resolution = Math.pow(10, getAccuracy() - accuracy);
long roundedEasting = Math.round(easting/resolution);
long roundedNorthing = Math.round(northing/resolution);
int eastShift = 0;
int northShift = 0;
if (roundedEasting == resolution*10){
roundedEasting = 0L;
eastShift = 1;
}
if (roundedNorthing == resolution*10){
roundedNorthing = 0L;
northShift = 1;
}
if (eastShift != 0 || northShift != 0){
all.set(1, shiftChar(all.get(1), eastShift, northShift));
String zero = "";
}
all.add(String.format("%0" + accuracy + "d", roundedEasting));
all.add(String.format("%0" + accuracy + "d", roundedNorthing));
break;
}
}
StringBuilder os = new StringBuilder();
for(String part: all){
if (os.length() > 0) os.append(" ");
os.append(part);
}
return os.toString();
}catch (Exception e){
return toFlavoredString();
}
}
private static String shiftChar(String chars, int east, int north){
ArrayList<Character> keys = new ArrayList<Character>(
Arrays.asList('A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z'));
StringBuilder s = new StringBuilder();
if (east != 0){
int idx = keys.indexOf(chars.charAt(0));
idx += east;
if (idx >= keys.size()) idx -= keys.size();
if (idx < 0) idx += keys.size();
s.append(keys.get(idx));
}else s.append(chars.charAt(0));
if (north != 0){
int idx = keys.indexOf(chars.charAt(1));
idx += north;
if (idx >= keys.size()) idx -= keys.size();
if (idx < 0) idx += keys.size();
s.append(keys.get(idx));
}else s.append(chars.charAt(1));
return s.toString();
}
/**
* {@inheritDoc}
*/

View file

@ -15,6 +15,7 @@ public class LocationConvert {
public static final int FORMAT_SECONDS = 2;
public static final int UTM_FORMAT = 3;
public static final int OLC_FORMAT = 4;
public static final int MGRS_FORMAT = 5;
private static final char DELIM = ':';
private static final char DELIMITER_DEGREES = '°';
private static final char DELIMITER_MINUTES = '';

View file

@ -3,6 +3,7 @@ package net.osmand.util;
import com.google.openlocationcode.OpenLocationCode;
import com.google.openlocationcode.OpenLocationCode.CodeArea;
import com.jwetherell.openmap.common.LatLonPoint;
import com.jwetherell.openmap.common.MGRSPoint;
import com.jwetherell.openmap.common.UTMPoint;
import net.osmand.data.LatLon;
@ -111,7 +112,7 @@ public class LocationParser {
return null;
}
// detect UTM
if (all.size() == 4 && d.size() == 3 && all.get(1) instanceof String) {
if (all.size() == 4 && d.size() == 3 && all.get(1) instanceof String && ((String) all.get(1)).length() == 1) {
char ch = all.get(1).toString().charAt(0);
if (Character.isLetter(ch)) {
UTMPoint upoint = new UTMPoint(d.get(2), d.get(1), d.get(0).intValue(), ch);
@ -120,7 +121,7 @@ public class LocationParser {
}
}
if (all.size() == 3 && d.size() == 2 && all.get(1) instanceof String) {
if (all.size() == 3 && d.size() == 2 && all.get(1) instanceof String && ((String) all.get(1)).length() == 1) {
char ch = all.get(1).toString().charAt(0);
String combined = strings.get(2);
if (Character.isLetter(ch)) {
@ -135,6 +136,17 @@ public class LocationParser {
}
}
}
//detect MGRS
if (all.size() >= 3 && (d.size() == 2 || d.size() == 3) && all.get(1) instanceof String) {
try {
MGRSPoint mgrsPoint = new MGRSPoint(locPhrase);
LatLonPoint ll = mgrsPoint.toLatLonPoint();
return validateAndCreateLatLon(ll.getLatitude(), ll.getLongitude());
} catch (NumberFormatException e) {
//do nothing
}
}
// try to find split lat/lon position
int jointNumbers = 0;
int lastJoin = 0;

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>

View file

@ -265,4 +265,5 @@
<string name="last_response_date">Ultima risposta: %1$s</string>
<string name="last_update_from_telegram_date">Ultimo aggiornamento da Telegram: %1$s</string>
<string name="shared_string_error_short">ERR</string>
<string name="logcat_buffer_descr">Controlla e condividi i log dettagliati dell\'applicazione</string>
</resources>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M4,6C4,4.8954 4.8954,4 6,4H18C19.1046,4 20,4.8954 20,6H6V18H20C20,19.1046 19.1046,20 18,20H6C4.8954,20 4,19.1046 4,18V6Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M10,13H16.5858L14.2929,15.2928L15.7071,16.7071L20.4142,12.0001L15.7071,7.2929L14.2929,8.707L16.5858,11H10V13Z"
android:fillColor="#ffffff"/>
</vector>

View file

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M16.2979,22.0153L11.5335,21.0624L6.769,22.0153L2.0046,21.0624L2.9575,16.2979L2.0046,11.5335L2.9575,6.769L2.0046,2.0046L6.769,2.9575L11.5335,2.0046L16.2979,2.9575L21.0624,2.0046L22.0153,6.769L21.0624,11.5335L22.0153,16.2979L21.0624,21.0624L16.2979,22.0153Z"
android:fillColor="#9DD184"
android:fillType="evenOdd"/>
<path
android:pathData="M18.9999,10.5C18.9999,13.5376 16.5375,16 13.4999,16C12.3424,16 11.2684,15.6424 10.3824,15.0317L6.707,18.7071C6.3165,19.0976 5.6833,19.0976 5.2928,18.7071C4.9022,18.3166 4.9022,17.6834 5.2928,17.2929L8.9682,13.6175C8.3574,12.7315 7.9999,11.6575 7.9999,10.5C7.9999,7.4624 10.4623,5 13.4999,5C16.5375,5 18.9999,7.4624 18.9999,10.5ZM16.9999,10.5C16.9999,12.433 15.4329,14 13.4999,14C11.5669,14 9.9999,12.433 9.9999,10.5C9.9999,8.567 11.5669,7 13.4999,7C15.4329,7 16.9999,8.567 16.9999,10.5Z"
android:fillColor="#3A6425"
android:fillType="evenOdd"/>
</vector>

View file

@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M23,12C23,18.0751 18.0751,23 12,23C5.9249,23 1,18.0751 1,12C1,5.9249 5.9249,1 12,1C18.0751,1 23,5.9249 23,12Z"
android:strokeAlpha="0.2"
android:fillColor="#ffffff"
android:fillAlpha="0.2"/>
<path
android:pathData="M6.1848,17.4939C6.5378,16.3774 7.3745,15.4502 8.5,15C10.735,14.0421 13.265,14.0421 15.5,15C16.6256,15.4502 17.4622,16.3775 17.8153,17.494C16.3569,19.0371 14.2909,20 12.0001,20C9.7092,20 7.6432,19.0371 6.1848,17.4939Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M15,9C15,10.6569 13.6569,12 12,12C10.3432,12 9,10.6569 9,9C9,7.3432 10.3432,6 12,6C13.6569,6 15,7.3432 15,9Z"
android:fillColor="#ffffff"/>
</vector>

View file

@ -324,6 +324,52 @@
</LinearLayout>
<LinearLayout
android:id="@+id/mgrsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:visibility="gone">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="54dp"
android:layout_marginRight="16dp"
android:layout_marginStart="54dp"
android:layout_marginEnd="16dp">
<EditText
android:id="@+id/mgrsEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/navigate_point_mgrs"
android:imeOptions="actionDone"
android:inputType="textCapCharacters|textNoSuggestions"
tools:text="22.12345"/>
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/mgrsClearButton"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="end"
android:layout_marginRight="4dp"
android:contentDescription="@string/shared_string_clear"
app:srcCompat="@drawable/ic_action_remove_dark"
android:layout_marginEnd="4dp" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/olcLayout"
android:layout_width="match_parent"

View file

@ -139,6 +139,26 @@
android:layout_marginEnd="5dp"></EditText>
</TableRow>
<TableRow android:layout_width="fill_parent" android:id="@+id/mgrs_row">
<TextView
android:textSize="@dimen/default_list_text_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="@string/navigate_point_mgrs"
android:layout_marginStart="5dp"></TextView>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/MGRSEdit"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"></EditText>
</TableRow>
<TableRow android:layout_width="fill_parent" >
<TextView

View file

@ -3922,4 +3922,13 @@
<string name="shared_string_graph">رسم بياني</string>
<string name="ltr_or_rtl_combine_via_dash">%2$s — %1$s</string>
<string name="app_mode_gap">فجوة</string>
<string name="shared_string_local_maps">الخرائط المحلية</string>
<string name="icon_group_amenity">راحة</string>
<string name="icon_group_special">خاص</string>
<string name="icon_group_transport">نقل</string>
<string name="icon_group_service">خدمة</string>
<string name="icon_group_symbols">الرموز</string>
<string name="icon_group_sport">رياضة</string>
<string name="icon_group_emergency">الطوارئ</string>
<string name="icon_group_travel">سفر</string>
</resources>

View file

@ -2170,4 +2170,20 @@
<string name="restore_all_profile_settings">Възстановяване на всички настройки на профила\?</string>
<string name="clear_recorded_data_warning">Наистина ли искате да изчистите записаните данни\?</string>
<string name="recalculate_route_in_deviation">Преизчисляване на маршрута в случай на отклонение</string>
<string name="osm_edit_logout_success">Успешно излязохте</string>
<string name="file_already_imported">Файлът вече е импортиран в OsmAnd</string>
<string name="use_two_phase_routing">Използване на 2-стъпков A* рутиращ алгоритъм</string>
<string name="message_graph_will_be_available_after_recalculation">Изчакайте преизчисляването на маршрута.
\nГрафиката ще бъде достъпна след преизчисляване.</string>
<string name="shared_string_local_maps">Местни карти</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="app_mode_gap">Пропуск</string>
<string name="icon_group_amenity">Удобства</string>
<string name="icon_group_special">Специални</string>
<string name="icon_group_transport">Транспорт</string>
<string name="icon_group_service">Услуги</string>
<string name="icon_group_symbols">Символи</string>
<string name="icon_group_sport">Спорт</string>
<string name="icon_group_emergency">Аварийни служби</string>
<string name="icon_group_travel">Пътуване</string>
</resources>

View file

@ -3224,8 +3224,10 @@
<string name="get_discount_first_few_part">%1$s für die ersten %2$s</string>
<string name="configure_profile_info">Einstellungen für Profil:</string>
<string name="utm_format_descr">OsmAnd verwendet den UTM-Standard, der ähnlich, aber nicht identisch zum UTM-NATO-Format ist.</string>
<string name="mgrs_format_descr">OsmAnd verwendet MGRS, das identisch zum UTM-NATO-Format ist.</string>
<string name="shared_string_example">Beispiel</string>
<string name="navigate_point_format_utm">UTM-Standard</string>
<string name="navigate_point_format_mgrs">MGRS</string>
<string name="coordinates_format_info">Das gewählte Format wird in der gesamten App angewandt.</string>
<string name="pref_selected_by_default_for_profiles">Für Profile wird als Vorgabe diese Einstellung gewählt: %s</string>
<string name="change_default_settings">Einstellung ändern</string>

View file

@ -3786,4 +3786,13 @@
<string name="use_live_public_transport">OsmAnd andmed reaalajas</string>
<string name="snowmobile_render_descr">Mootorsaanide sõitmine eraldi määratud teedel ja radadel.</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="icon_group_special">Eriteenused</string>
<string name="icon_group_amenity">Mugavus</string>
<string name="shared_string_local_maps">Kohalikud kaardid</string>
<string name="icon_group_travel">Reisimine</string>
<string name="icon_group_emergency">Hädaabi</string>
<string name="icon_group_sport">Sport</string>
<string name="icon_group_symbols">Sümbolid</string>
<string name="icon_group_service">Teenused</string>
<string name="icon_group_transport">Transport</string>
</resources>

View file

@ -3914,4 +3914,13 @@
<string name="shared_string_graph">Graphique</string>
<string name="app_mode_gap">Écart</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s - %2$s</string>
<string name="shared_string_local_maps">Cartes locales</string>
<string name="icon_group_amenity">Loisir</string>
<string name="icon_group_special">Spécial</string>
<string name="icon_group_transport">Transport</string>
<string name="icon_group_service">Service</string>
<string name="icon_group_symbols">Symboles</string>
<string name="icon_group_sport">Sport</string>
<string name="icon_group_emergency">Urgence</string>
<string name="icon_group_travel">Voyage</string>
</resources>

View file

@ -3834,7 +3834,7 @@
<string name="simplified_track">Egyszerűsített nyomvonal</string>
<string name="shared_string_done">Kész</string>
<string name="shared_string_is_saved">elmentve</string>
<string name="route_between_points_desc">Jelölje ki, hogyan legyenek összekötve a pontok: egyenes vonallal vagy az alábbiak szerint kiszámított útvonallal.</string>
<string name="route_between_points_desc">Válassza ki, hogyan legyenek összekötve a pontok: egyenes vonallal vagy az alábbiak szerint kiszámított útvonallal.</string>
<string name="whole_track">Teljes nyomvonal</string>
<string name="monitoring_min_accuracy_descr_remark">Megjegyzés: Ha a GPS közvetlenül a felvétel előtt ki volt kapcsolva, akkor rosszabb lehet az első mért pont pontossága. A kódban ezért szeretnénk majd talán várni egy-két másodpercet egy pont rögzítése előtt (vagy a 3 egymást követő pont közül a legjobbat rögzíteni vagy valami hasonló), de ezt még nem programoztuk le.</string>
<string name="delete_address">Cím törlése</string>
@ -3926,4 +3926,13 @@
<string name="message_need_calculate_route_before_show_graph">%1$s adatok csak az utakról állnak rendelkezésre. Használja az „Útvonal tervezése pontok között” funkciót.</string>
<string name="message_graph_will_be_available_after_recalculation">Várja meg az útvonal újraszámítását.
\nAz ábra az újraszámítás után lesz látható.</string>
<string name="shared_string_local_maps">Helyi térképek</string>
<string name="icon_group_amenity">Hasznos és fontos létesítmény</string>
<string name="icon_group_special">Különleges</string>
<string name="icon_group_transport">Közlekedés</string>
<string name="icon_group_service">Szolgáltatás</string>
<string name="icon_group_symbols">Jelképek</string>
<string name="icon_group_sport">Sport</string>
<string name="icon_group_emergency">Vészhelyzet</string>
<string name="icon_group_travel">Utazás</string>
</resources>

View file

@ -3945,4 +3945,13 @@
\n Þú getur stýrt og aflýst áskriftunum þínum með því að fara í AppGallery stillingarnar þínar.</string>
<string name="shared_string_graph">Graf</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="shared_string_local_maps">Staðkort</string>
<string name="icon_group_amenity">Aðstaða</string>
<string name="icon_group_special">Sértákn</string>
<string name="icon_group_transport">Samgöngur</string>
<string name="icon_group_service">Þjónusta</string>
<string name="icon_group_symbols">Tákn</string>
<string name="icon_group_sport">Íþróttir</string>
<string name="icon_group_emergency">Neyðartilfelli</string>
<string name="icon_group_travel">Ferðalög</string>
</resources>

View file

@ -3837,7 +3837,7 @@
<string name="route_between_points_add_track_desc">נא לבחור קובץ מסלול שבו יתווסף המקטע החדש.</string>
<string name="route_between_points_whole_track_button_desc">כל המסלול יחושב מחדש באמצעות הפרופיל הנבחר.</string>
<string name="route_between_points_next_segment_button_desc">רק המקטע הבא יחושב מחודש באמצעות הפרופיל הנבחר.</string>
<string name="route_between_points_desc">נא לבחור כיצד לחבר נקודות, בקו ישר, או לחבר מסלול ביניהן כפי שצוין להלן.</string>
<string name="route_between_points_desc">נא לבחור כיצד לחבר את הנקודות, בקו ישר, או לחבר מסלול ביניהן כפי שצוין להלן.</string>
<string name="route_between_points_warning_desc">בשלב הבא עליך להצמיד את הדרך המורשית הקרובה ביותר לאחד מפרופילי הניווט שלך כדי להשתמש באפשרות הזו.</string>
<string name="street_level_imagery">תמונות ברמת רחוב</string>
<string name="plan_route_exit_dialog_descr">להתעלם מהשינויים במסלול המתוכנן על ידי סגירתו\?</string>
@ -3939,4 +3939,13 @@
<string name="message_graph_will_be_available_after_recalculation">נא להמתין לחישוב המסלול מחדש.
\nהתרשים יהיה זמין לאחר החישוב מחדש.</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s ‏— %2$s</string>
<string name="shared_string_local_maps">מפות מקומיות</string>
<string name="icon_group_amenity">שירות לציבור</string>
<string name="icon_group_special">מיוחד</string>
<string name="icon_group_transport">תחבורה</string>
<string name="icon_group_service">שירות</string>
<string name="icon_group_symbols">סמלים</string>
<string name="icon_group_sport">ספורט</string>
<string name="icon_group_emergency">חירום</string>
<string name="icon_group_travel">טיול</string>
</resources>

View file

@ -990,7 +990,7 @@
<string name="poi_wiki_lang_vi">ベトナム語 wiki</string>
<string name="poi_wiki_lang_vo">ボラピュク語 wiki</string>
<string name="poi_wiki_lang_zh">中国語 wiki</string>
<string name="poi_bollard">係船柱</string>
<string name="poi_bollard"></string>
<string name="poi_cycle_barrier">自転車用車止め</string>
<string name="poi_motorcycle_barrier">オートバイ用車止め</string>
<string name="poi_block">ブロック</string>
@ -1260,8 +1260,8 @@
<string name="poi_amenity_vacuum_cleaner">掃除機</string>
<string name="poi_fuel_adblue">ディーゼル排気用液(AdBlue・尿素水)</string>
<string name="poi_drive_through">ドライブスルー</string>
<string name="poi_drive_through_yes">有り</string>
<string name="poi_drive_through_no">無し</string>
<string name="poi_drive_through_yes"></string>
<string name="poi_drive_through_no">ドライブスルー: 不可</string>
<string name="poi_fuel_91ul">91UL 無鉛航空燃料</string>
<string name="poi_fuel_100ll">100LL 有鉛航空燃料</string>
<string name="poi_fuel_jeta1">JET A-1ジェット燃料</string>
@ -1577,7 +1577,7 @@
<string name="poi_free_flying_characteristic">スカイスポーツの対応要素</string>
<string name="poi_seasonal">季節営業</string>
<string name="poi_drive_in">ドライブイン</string>
<string name="poi_drive_in_no">無し</string>
<string name="poi_drive_in_no">ドライブイン: 不可</string>
<string name="poi_power_supply_yes">有り</string>
<string name="poi_scout_camp">ボーイスカウト用キャンプ</string>
<string name="poi_scout_yes">肯定</string>
@ -1710,7 +1710,7 @@
<string name="poi_medical_system_sidda_yes">南インドのタミル伝統医学</string>
<string name="poi_medical_system_unani_yes">ユナニ医学・南アジアの伝統医学</string>
<string name="poi_health_facility_type_office">医療事務</string>
<string name="poi_drive_in_yes">有り</string>
<string name="poi_drive_in_yes"></string>
<string name="poi_healthcare_alternative_types">代替医療の専門種</string>
<string name="poi_home_visit">往診</string>
<string name="poi_home_visit_no">無し</string>
@ -3835,4 +3835,8 @@
<string name="poi_give_box">ギブボックス(提供品置場)</string>
<string name="poi_fire_hydrant_type_pipe">簡易給水栓</string>
<string name="poi_fuel_lng">液化天然ガス</string>
<string name="poi_gpx_point">GPXポイント</string>
<string name="poi_parking_layby">待避所</string>
<string name="poi_parking_sheds">車庫</string>
<string name="poi_parking_rooftop">屋上</string>
</resources>

View file

@ -2754,7 +2754,7 @@ POIの更新は利用できません</string>
<string name="osm_edits_export_desc">OSMメモ、POI、またはその両方用にエクスポートします。</string>
<string name="all_data">全てのデータ</string>
<string name="osm_notes">OSMメモ</string>
<string name="will_open_tomorrow_at">明日開く</string>
<string name="will_open_tomorrow_at">明日以降の次の時間に営業</string>
<string name="shared_string_without_name">名無し</string>
<string name="release_3_2_pre">• 一部の機種で起動時にクラッシュしていた問題を修正
\n
@ -2775,11 +2775,11 @@ POIの更新は利用できません</string>
<string name="pick_up_till">駐車上限時刻</string>
<string name="without_time_limit">時間制限なし</string>
<string name="context_menu_read_full_article">記事の全文を読む</string>
<string name="open_from">以下の場所から開く</string>
<string name="open_till">以下の所まで開く</string>
<string name="will_close_at">閉店時間</string>
<string name="will_open_at">開店予定時間</string>
<string name="will_open_on">営業予定時刻</string>
<string name="open_from">次の時間から営業</string>
<string name="open_till">次の時間まで営業</string>
<string name="will_close_at">営業終了時間</string>
<string name="will_open_at">営業開始時間</string>
<string name="will_open_on">営業開始時間</string>
<string name="empty_state_markers_active">マップマーカーを作成しよう!</string>
<string name="empty_state_markers_history_desc">通過した地点のマーカーと通過予定地点のマーカーがこの画面に表示されます。</string>
<string name="shared_string_right"></string>

View file

@ -769,9 +769,7 @@
\n - Beperkt aantal kaartdownloads
\n - Geen toegang tot offline Wikipedia POI\'s
\n
\nOsmAnd wordt actief ontwikkeld en ons project en de verdere vooruitgang ervan is afhankelijk van
\nfinanciële bijdragen om de ontwikkeling en testen van nieuwe functionaliteit te kunnen bekostigen.
\nWij verzoeken je om OsmAnd+ te kopen, of om een donatie over te maken via https://osmand.net.</string>
\n OsmAnd wordt actief ontwikkeld en ons project en de verdere vooruitgang ervan is afhankelijk van financiële bijdragen om de ontwikkeling en testen van nieuwe functionaliteit te kunnen bekostigen. Wij verzoeken je om OsmAnd+ te kopen, of om een donatie over te maken via https://osmand.net.</string>
<string name="osmand_plus_long_description_1000_chars">OsmAnd+ (OSM Automated Navigation Directions)
\n
\nOsmAnd+ is een open-source app voor navigatie die gebruikmaakt van de wereldwijde verzameling van OSM-gegevens. Alle kaartmateriaal (vector- en rasterkaarten) kunnen worden opgeslagen in het telefoongeheugen voor offline gebruik. De app biedt ook offline- en online-navigatie, met stembegeleiding.
@ -1283,7 +1281,7 @@
<string name="map_widget_left">Widgets Linker Kolom</string>
<string name="configure_map">Kaart instellen</string>
<string name="search_radius_proximity">Binnen</string>
<string name="anonymous_user_hint">Anonieme gebruikers kunnen geen
<string name="anonymous_user_hint">Anonieme gebruikers kunnen geen:
\n- groepen aanmaken;
\n- groepen en apparaten synchroniseren met de server;
\n- groepen en apparaten beheren in een eigen omgeving op de website.</string>
@ -1532,7 +1530,7 @@
<string name="routing_attr_height_name">Hoogte van het voertuig</string>
<string name="routing_attr_height_description">Geef de hoogte die minimaal toegestaan moet zijn op de route.</string>
<string name="use_fast_recalculation">Slim opnieuw berekenen van routes</string>
<string name="use_fast_recalculation_desc">Herbereken alleen het begin van de route voor lange trajecten.</string>
<string name="use_fast_recalculation_desc">Herbereken alleen het begin van de route. Kan gebruikt worden voor lange trajecten.</string>
<string name="osm_edit_context_menu_delete">Verwijder OSM-wijziging</string>
<string name="rendering_value_disabled_name">Uitgeschakeld</string>
<string name="rendering_value_walkingRoutesScopeOSMC_name">Kleuren naar Wandelroute-netwerk</string>
@ -3336,7 +3334,7 @@
<string name="edit_profiles_descr">U kunt geen standaard OsmAnd profielen verwijderen, maar u kunt ze deactiveren (in het vorige scherm), of naar onderen verplaatsen.</string>
<string name="edit_profiles">Wijzig profielen</string>
<string name="select_nav_profile_dialog_message">\'Navigatietype\' bepaalt hoe routes berekend worden.</string>
<string name="profile_appearance">Profiel aanzicht</string>
<string name="profile_appearance">Profiel weergave</string>
<string name="choose_icon_color_name">Icoon, kleur en naam</string>
<string name="reorder_profiles">Wijzig lijst met profielen</string>
<string name="selected_profile">Geselecteerd profiel</string>
@ -3779,4 +3777,121 @@
<string name="import_track_descr">Kies een trackbestand om te volgen of importeer het, vanaf uw apparaat.</string>
<string name="app_mode_gap">Kloof</string>
<string name="shared_string_custom">Op maat</string>
<string name="perform_oauth_authorization_description">Voer een OAuth-login uit om osm edit functies te gebruiken</string>
<string name="release_3_5">"• Bijgewerkte app- en profielinstellingen: instellingen zijn nu gerangschikt op type. Elk profiel kan afzonderlijk worden aangepast.
\n
\n • Nieuw dialoogvenster voor het downloaden van kaarten waarin wordt voorgesteld een kaart te downloaden tijdens het browsen
\n
\n • Donkere thema-fixes
\n
\n • Verschillende routeringsproblemen over de hele wereld opgelost
\n
\n • Bijgewerkte basiskaart met meer gedetailleerd wegennet
\n
\n • Vaste overstroomde gebieden over de hele wereld
\n
\n • Skirouting: hoogteprofiel en routecomplexiteit toegevoegd aan de routedetails
\n
\n • Andere bugs opgelost
\n
\n"</string>
<string name="release_3_6">"• Profielen: nu kunt u de volgorde wijzigen, het pictogram voor de kaart instellen, alle instellingen voor basisprofielen wijzigen en ze terugzetten naar de standaardinstellingen
\n
\n • Exitnummer toegevoegd in de navigatie
\n
\n • Herwerkte plug-in instellingen
\n
\n • Herwerkt instellingenscherm voor snelle toegang tot alle profielen
\n
\n • Optie toegevoegd om instellingen van een ander profiel te kopiëren
\n
\n • Mogelijkheid toegevoegd om een volgorde te wijzigen of POI-categorieën in Zoeken te verbergen
\n
\n • Correct uitgelijnde POI-pictogrammen op de kaart
\n
\n • Zonsondergang / zonsopganggegevens toegevoegd om de kaart te configureren
\n
\n • Thuis/werk-pictogrammen toegevoegd op de kaart
\n
\n • Ondersteuning toegevoegd voor meerdere regels beschrijving bij Instellingen
\n
\n • Correcte transliteratie toegevoegd aan de kaart van Japan
\n
\n • Antarctica-kaart toegevoegd
\n
\n"</string>
<string name="what_is_new">Wat is er nieuw</string>
<string name="snowmobile_render_descr">Voor sneeuwscooter, rijden met speciale wegen en tracks.</string>
<string name="set_working_days_to_continue">Stel aantal werkdagen in om door te gaan</string>
<string name="gpx_split_interval_descr">Selecteer het interval waarmee markeringen met afstand of tijd op de track worden weergegeven.</string>
<string name="gpx_split_interval_none_descr">Selecteer de gewenste splitsingsoptie: op tijd of op afstand.</string>
<string name="track_coloring_solid">Vaste</string>
<string name="overwrite_track">Overschrijf track</string>
<string name="threshold_distance">Drempelafstand</string>
<string name="navigation_profile">Navigatieprofiel</string>
<string name="in_case_of_reverse_direction">In geval van een omgekeerde richting</string>
<string name="shared_string_gpx_files">Routes</string>
<string name="layer_gpx_layer">Routes</string>
<string name="show_gpx">Routes</string>
<string name="save_track_to_gpx_globally">Log track naar GPX-bestand</string>
<string name="shared_string_gpx_route">Volg route</string>
<string name="empty_state_my_tracks">Voeg trackbestanden toe</string>
<string name="context_menu_item_add_waypoint">Voeg een trackwaypoint toe</string>
<string name="follow_track">Volg de track</string>
<string name="follow_track_descr">Kies een trackbestand om te volgen</string>
<string name="select_another_track">Selecteer een andere track</string>
<string name="navigate_to_track_descr">Navigeer vanaf mijn positie naar de track</string>
<string name="start_of_the_track">Track starten</string>
<string name="nearest_point">Dichtstbijzijnde punt</string>
<string name="attach_to_the_roads">Aan wegen koppelen</string>
<string name="delete_address">Adres verwijderen</string>
<string name="add_address">Adres ingeven</string>
<string name="access_hint_enter_address">Adres ingeven</string>
<string name="shared_string_file_name">Bestandsnaam</string>
<string name="number_of_gpx_files_selected_pattern">%s trackbestanden geselecteerd</string>
<string name="disable_recording_once_app_killed_descrp">Zal trackregistratie onderbreken wanneer de app wordt uitgeschakeld (via recente apps). (OsmAnd-achtergrondindicatie verdwijnt uit de Android-berichtenbalk.)</string>
<string name="previous_segment">Vorig segment</string>
<string name="all_previous_segments">Alle voorgaande segmenten</string>
<string name="only_selected_segment_recalc">Alleen het geselecteerde segment wordt opnieuw berekend met het geselecteerde profiel.</string>
<string name="all_previous_segments_will_be_recalc">Alle voorgaande segmenten worden opnieuw berekend met het geselecteerde profiel.</string>
<string name="open_saved_track">Open opgeslagen track</string>
<string name="shared_string_is_saved">wordt opgeslagen</string>
<string name="one_point_error">Voeg ten minste twee punten toe.</string>
<string name="shared_string_redo">Opnieuw doen</string>
<string name="sort_last_modified">Laatst gewijzigd</string>
<string name="sort_name_descending">Naam: A Z</string>
<string name="sort_name_ascending">Naam: A Z</string>
<string name="start_finish_icons">Start/stop iconen</string>
<string name="contour_lines_thanks">Bedankt voor het kopen van \'Contourlijnen\'</string>
<string name="osm_live_payment_desc_hw">Abonnement berekend per geselecteerde periode. Annuleer het op elk moment op AppGallery.</string>
<string name="osm_live_payment_subscription_management_hw">De betaling wordt bij de bevestiging van de aankoop in rekening gebracht op uw AppGallery-account.
\n
\nHet abonnement wordt automatisch verlengd, tenzij het vóór de verlengingsdatum wordt opgezegd. Uw account wordt alleen op de verlengingsdatum in rekening gebracht voor de verlengingsperiode (maand / drie maanden / jaar).
\n
\nU kunt uw abonnementen beheren en annuleren door naar uw AppGallery-instellingen te gaan.</string>
<string name="routing_attr_avoid_footways_description">Vermijd voetpaden</string>
<string name="routing_attr_avoid_footways_name">Vermijd voetpaden</string>
<string name="development">Ontwikkeling</string>
<string name="use_live_public_transport">OsmAnd Live gegevens</string>
<string name="use_live_routing">OsmAnd Live gegevens</string>
<string name="complex_routing_descr">Twee stappen routeberekening voor autonavigatie.</string>
<string name="use_native_pt">Eigen ontwikkeling van het openbaar vervoer</string>
<string name="use_native_pt_desc">Schakel over naar Java (veilige) routeberekening voor het openbaar vervoer</string>
<string name="perform_oauth_authorization">Inloggen via OAuth</string>
<string name="clear_osm_token">Wis OpenStreetMap OAuth-token</string>
<string name="osm_edit_logout_success">Uitloggen gelukt</string>
<string name="file_already_imported">Het bestand is al geïmporteerd in OsmAnd</string>
<string name="shared_string_local_maps">Lokale kaarten</string>
<string name="icon_group_amenity">Aangenaam</string>
<string name="icon_group_special">Speciaal</string>
<string name="icon_group_transport">Transport</string>
<string name="icon_group_service">Onderhoud</string>
<string name="icon_group_symbols">Symbolen</string>
<string name="icon_group_sport">Sport</string>
<string name="icon_group_emergency">Noodtoestand</string>
<string name="icon_group_travel">Reizen</string>
<string name="empty_state_my_tracks_desc">Trackbestanden importeren of opnemen</string>
<string name="quick_action_add_gpx">Track waypoint toevoegen</string>
<string name="marker_save_as_track">Opslaan als trackbestand</string>
<string name="monitoring_control_start">Rec</string>
</resources>

View file

@ -3929,4 +3929,13 @@
<string name="message_graph_will_be_available_after_recalculation">Aguarde o recálculo da rota.
\nO gráfico estará disponível após o recálculo.</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="shared_string_local_maps">Mapas locais</string>
<string name="icon_group_amenity">Amenidade</string>
<string name="icon_group_special">Especial</string>
<string name="icon_group_transport">Transporte</string>
<string name="icon_group_service">Serviço</string>
<string name="icon_group_symbols">Símbolos</string>
<string name="icon_group_sport">Esporte</string>
<string name="icon_group_emergency">Emergência</string>
<string name="icon_group_travel">Viagem</string>
</resources>

View file

@ -3762,7 +3762,7 @@
<string name="poi_monastery_type_monastics">Тип монастыря: монашество</string>
<string name="poi_shop_security">Магазин защиты и безопасности</string>
<string name="poi_mountain_rescue">Горноспасательная станция</string>
<string name="poi_internet_access_fee_customers">Сигнал для поиска полюса</string>
<string name="poi_internet_access_fee_customers">Доступ в Интернет: клиенты</string>
<string name="poi_climbing_multipitch_no">Многоуровневые маршруты: нет</string>
<string name="poi_climbing_multipitch_yes">Многоуровневые маршруты: есть</string>
<string name="poi_nuclear_explosion_salvo_second_or_later_detonation">Взрывной залп: вторая или более поздняя детонация залпового теста</string>
@ -3833,4 +3833,6 @@
<string name="poi_nuts">Магазин орехов</string>
<string name="poi_beehive">Улей</string>
<string name="poi_fuel_lng">СПГ</string>
<string name="poi_parking_sheds">Навесы</string>
<string name="poi_gpx_point">Точка GPX</string>
</resources>

View file

@ -3924,4 +3924,17 @@
<string name="file_already_imported">Файл уже импортирован</string>
<string name="message_graph_will_be_available_after_recalculation">Дождитесь пересчёта маршрута.
\nГрафик будет доступен после пересчёта.</string>
<string name="app_mode_gap">Разрыв</string>
<string name="icon_group_service">Сервис</string>
<string name="icon_group_special">Специальные</string>
<string name="snowmobile_render_descr">Для езды на снегоходах по выделенным дорогам и трассам.</string>
<string name="development">Разработка</string>
<string name="shared_string_local_maps">Местная карта</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="icon_group_amenity">Удобства</string>
<string name="icon_group_transport">Транспорт</string>
<string name="icon_group_symbols">Символы</string>
<string name="icon_group_sport">Спорт</string>
<string name="icon_group_emergency">Экстренные службы</string>
<string name="icon_group_travel">Путешествие</string>
</resources>

View file

@ -3935,4 +3935,13 @@
\nGraf bude dostupný po prepočte.</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="app_mode_gap">Medzera</string>
<string name="shared_string_local_maps">Lokálne mapy</string>
<string name="icon_group_amenity">Občianska vybavenosť</string>
<string name="icon_group_special">Špeciálne</string>
<string name="icon_group_transport">Doprava</string>
<string name="icon_group_service">Služby</string>
<string name="icon_group_symbols">Symboly</string>
<string name="icon_group_sport">Šport</string>
<string name="icon_group_emergency">Núdzová situácia/Záchrana</string>
<string name="icon_group_travel">Cestovanie</string>
</resources>

View file

@ -3931,4 +3931,13 @@
\nГрафік буде доступний після переобчислення.</string>
<string name="app_mode_gap">Розрив</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="shared_string_local_maps">Місцеві мапи</string>
<string name="icon_group_amenity">Зручності</string>
<string name="icon_group_special">Спеціальні</string>
<string name="icon_group_transport">Транспорт</string>
<string name="icon_group_service">Послуги</string>
<string name="icon_group_symbols">Знаки</string>
<string name="icon_group_sport">Спорт</string>
<string name="icon_group_emergency">Аварійні служби</string>
<string name="icon_group_travel">Мандрівка</string>
</resources>

View file

@ -3930,4 +3930,13 @@
\n重新計算後即可使用圖表。</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="app_mode_gap">分隔</string>
<string name="shared_string_local_maps">本機地圖</string>
<string name="icon_group_amenity">便利設施</string>
<string name="icon_group_special">特殊</string>
<string name="icon_group_transport">運輸</string>
<string name="icon_group_service">服務</string>
<string name="icon_group_symbols">符號</string>
<string name="icon_group_sport">運動</string>
<string name="icon_group_emergency">警急</string>
<string name="icon_group_travel">旅行</string>
</resources>

View file

@ -628,8 +628,10 @@
<string name="configure_profile">Configure profile</string>
<string name="configure_profile_info">Settings for profile:</string>
<string name="utm_format_descr">OsmAnd uses the UTM Standard, which is similar but not identical to the UTM NATO format.</string>
<string name="mgrs_format_descr">OsmAnd uses MGRS, which is similar to the UTM NATO format.</string>
<string name="shared_string_example">Example</string>
<string name="navigate_point_format_utm">UTM Standard</string>
<string name="navigate_point_format_mgrs">MGRS</string>
<string name="navigate_point_format_olc">Open Location Code</string>
<string name="coordinates_format_info">The selected format will be applied throughout the app.</string>
<string name="pref_selected_by_default_for_profiles">This setting is selected by default for profiles: %s</string>
@ -2209,6 +2211,7 @@
<string name="map_locale">Map language</string>
<string name="rendering_attr_transportStops_name">Transport stops</string>
<string name="navigate_point_zone">Zone</string>
<string name="navigate_point_mgrs">MGRS</string>
<!-- (OLC) is a geocode system -->
<string name="navigate_point_olc">Open Location Code</string>
<string name="navigate_point_olc_info_invalid">Invalid OLC\n</string>

View file

@ -27,6 +27,12 @@
android:persistent="false"
android:title="@string/navigate_point_format_utm" />
<CheckBoxPreference
android:key="mgrs_format"
android:layout="@layout/preference_radio_button"
android:persistent="false"
android:title="@string/navigate_point_format_mgrs" />
<CheckBoxPreference
android:key="olc_format"
android:layout="@layout/preference_radio_button"

View file

@ -171,6 +171,7 @@ public class PointDescription {
String utm = OsmAndFormatter.getFormattedCoordinates(lat, lon, OsmAndFormatter.UTM_FORMAT);
String olc = OsmAndFormatter.getFormattedCoordinates(lat, lon, OsmAndFormatter.OLC_FORMAT);
String mgrs = OsmAndFormatter.getFormattedCoordinates(lat, lon, OsmAndFormatter.MGRS_FORMAT);
try {
latLonString = OsmAndFormatter.getFormattedCoordinates(lat, lon, OsmAndFormatter.FORMAT_DEGREES_SHORT);
@ -190,6 +191,7 @@ public class PointDescription {
results.put(OsmAndFormatter.FORMAT_SECONDS, latLonSec);
results.put(OsmAndFormatter.UTM_FORMAT, utm);
results.put(OsmAndFormatter.OLC_FORMAT, olc);
results.put(OsmAndFormatter.MGRS_FORMAT, mgrs);
int zoom = 17;
if (ctx.getMapView() != null) {
@ -204,6 +206,8 @@ public class PointDescription {
results.put(LOCATION_LIST_HEADER, utm);
} else if (f == PointDescription.OLC_FORMAT) {
results.put(LOCATION_LIST_HEADER, olc);
} else if (f == PointDescription.MGRS_FORMAT) {
results.put(LOCATION_LIST_HEADER, mgrs);
} else if (f == PointDescription.FORMAT_DEGREES) {
results.put(LOCATION_LIST_HEADER, latLonDeg);
} else if (f == PointDescription.FORMAT_MINUTES) {
@ -396,6 +400,7 @@ public class PointDescription {
public static final int FORMAT_SECONDS = LocationConvert.FORMAT_SECONDS;
public static final int UTM_FORMAT = LocationConvert.UTM_FORMAT;
public static final int OLC_FORMAT = LocationConvert.OLC_FORMAT;
public static final int MGRS_FORMAT = LocationConvert.MGRS_FORMAT;
public static String formatToHumanString(Context ctx, int format) {
switch (format) {
@ -409,6 +414,8 @@ public class PointDescription {
return "UTM";
case LocationConvert.OLC_FORMAT:
return "OLC";
case LocationConvert.MGRS_FORMAT:
return "MGRS";
default:
return "Unknown format";
}

View file

@ -76,6 +76,22 @@ public class FavouritesDbHelper {
private int color;
private List<FavouritePoint> points = new ArrayList<>();
public FavoriteGroup() {
}
public FavoriteGroup(String name, boolean visible, int color) {
this.name = name;
this.visible = visible;
this.color = color;
}
public FavoriteGroup(String name, List<FavouritePoint> points, int color, boolean visible) {
this.name = name;
this.color = color;
this.points = points;
this.visible = visible;
}
public boolean isPersonal() {
return isPersonal(name);
}
@ -640,7 +656,7 @@ public class FavouritesDbHelper {
return asGpxFile(cachedFavoritePoints);
}
private GPXFile asGpxFile(List<FavouritePoint> favoritePoints) {
public GPXFile asGpxFile(List<FavouritePoint> favoritePoints) {
GPXFile gpx = new GPXFile(Version.getFullVersion(context));
for (FavouritePoint p : favoritePoints) {
context.getSelectedGpxHelper().addPoint(p.toWpt(context), gpx);

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.text.format.DateUtils;
import com.jwetherell.openmap.common.LatLonPoint;
import com.jwetherell.openmap.common.MGRSPoint;
import com.jwetherell.openmap.common.UTMPoint;
import net.osmand.LocationConvert;
@ -53,6 +54,7 @@ public class OsmAndFormatter {
public static final int FORMAT_SECONDS = LocationConvert.FORMAT_SECONDS;
public static final int UTM_FORMAT = LocationConvert.UTM_FORMAT;
public static final int OLC_FORMAT = LocationConvert.OLC_FORMAT;
public static final int MGRS_FORMAT = LocationConvert.MGRS_FORMAT;
private static final char DELIMITER_DEGREES = '°';
private static final char DELIMITER_MINUTES = '';
private static final char DELIMITER_SECONDS = '″';
@ -518,6 +520,9 @@ public class OsmAndFormatter {
r = "0, 0";
}
result.append(r);
} else if (outputFormat == MGRS_FORMAT) {
MGRSPoint pnt = new MGRSPoint(new LatLonPoint(lat, lon));
result.append(pnt.toFlavoredString(5));
}
return result.toString();
}

View file

@ -21,6 +21,7 @@ import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.jwetherell.openmap.common.LatLonPoint;
import com.jwetherell.openmap.common.MGRSPoint;
import com.jwetherell.openmap.common.UTMPoint;
import net.osmand.LocationConvert;
@ -71,7 +72,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
currentFormat = app.getSettings().COORDINATES_FORMAT.get();
initUI(location.getLatitude(), location.getLongitude());
if(savedInstanceState != null && savedInstanceState.containsKey(SEARCH_LAT) && savedInstanceState.containsKey(SEARCH_LON) &&
currentFormat != PointDescription.UTM_FORMAT) {
currentFormat != PointDescription.UTM_FORMAT && currentFormat != PointDescription.MGRS_FORMAT) {
String lat = savedInstanceState.getString(SEARCH_LAT);
String lon = savedInstanceState.getString(SEARCH_LON);
if(lat != null && lon != null && lat.length() > 0 && lon.length() > 0) {
@ -152,13 +153,15 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
protected void showCurrentFormat(LatLon l) {
final EditText latEdit = ((EditText)view.findViewById(R.id.LatitudeEdit));
final EditText lonEdit = ((EditText)view.findViewById(R.id.LongitudeEdit));
boolean utm = currentFormat == PointDescription.UTM_FORMAT;
view.findViewById(R.id.easting_row).setVisibility(utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.northing_row).setVisibility(utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.zone_row).setVisibility(utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.lat_row).setVisibility(!utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.lon_row).setVisibility(!utm ? View.VISIBLE : View.GONE);
if(currentFormat == PointDescription.UTM_FORMAT) {
switch (currentFormat){
case PointDescription.UTM_FORMAT: {
view.findViewById(R.id.easting_row).setVisibility(View.VISIBLE);
view.findViewById(R.id.northing_row).setVisibility(View.VISIBLE);
view.findViewById(R.id.zone_row).setVisibility(View.VISIBLE);
view.findViewById(R.id.lat_row).setVisibility(View.GONE);
view.findViewById(R.id.lon_row).setVisibility(View.GONE);
view.findViewById(R.id.mgrs_row).setVisibility(View.GONE);
final EditText northingEdit = ((EditText) view.findViewById(R.id.NorthingEdit));
final EditText eastingEdit = ((EditText) view.findViewById(R.id.EastingEdit));
final EditText zoneEdit = ((EditText) view.findViewById(R.id.ZoneEdit));
@ -166,10 +169,37 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
zoneEdit.setText(pnt.zone_number + "" + pnt.zone_letter);
northingEdit.setText(((long) pnt.northing) + "");
eastingEdit.setText(((long) pnt.easting) + "");
} else {
break;
}
case PointDescription.MGRS_FORMAT: {
view.findViewById(R.id.easting_row).setVisibility(View.GONE);
view.findViewById(R.id.northing_row).setVisibility(View.GONE);
view.findViewById(R.id.zone_row).setVisibility(View.GONE);
view.findViewById(R.id.lat_row).setVisibility(View.GONE);
view.findViewById(R.id.lon_row).setVisibility(View.GONE);
view.findViewById(R.id.mgrs_row).setVisibility(View.VISIBLE);
final EditText mgrsEdit = ((EditText) view.findViewById(R.id.MGRSEdit));
MGRSPoint pnt = new MGRSPoint(new LatLonPoint(l.getLatitude(), l.getLongitude()));
mgrsEdit.setText(pnt.toFlavoredString(5));
break;
}
default: {
view.findViewById(R.id.easting_row).setVisibility(View.GONE);
view.findViewById(R.id.northing_row).setVisibility(View.GONE);
view.findViewById(R.id.zone_row).setVisibility(View.GONE);
view.findViewById(R.id.lat_row).setVisibility(View.VISIBLE);
view.findViewById(R.id.lon_row).setVisibility(View.VISIBLE);
view.findViewById(R.id.mgrs_row).setVisibility(View.GONE);
latEdit.setText(LocationConvert.convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat));
lonEdit.setText(LocationConvert.convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat));
}
}
}
protected LatLon parseLocation() {
@ -199,6 +229,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_MINUTES),
PointDescription.formatToHumanString(this.getContext(), PointDescription.FORMAT_SECONDS),
PointDescription.formatToHumanString(this.getContext(), PointDescription.UTM_FORMAT),
PointDescription.formatToHumanString(this.getContext(), PointDescription.MGRS_FORMAT),
});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
format.setAdapter(adapter);
@ -217,6 +248,8 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
newFormat = PointDescription.FORMAT_SECONDS;
} else if (PointDescription.formatToHumanString(NavigatePointFragment.this.getContext(), PointDescription.UTM_FORMAT).equals(itm)) {
newFormat = PointDescription.UTM_FORMAT;
} else if (PointDescription.formatToHumanString(NavigatePointFragment.this.getContext(), PointDescription.MGRS_FORMAT).equals(itm)) {
newFormat = PointDescription.MGRS_FORMAT;
}
try {
LatLon loc = parseLocation();

View file

@ -650,8 +650,8 @@ public class ImportHelper {
}
}
protected static List<FavouritePoint> asFavourites(OsmandApplication app, List<WptPt> wptPts, String fileName, boolean forceImportFavourites) {
final List<FavouritePoint> favourites = new ArrayList<>();
public static List<FavouritePoint> asFavourites(OsmandApplication app, List<WptPt> wptPts, String fileName, boolean forceImportFavourites) {
List<FavouritePoint> favourites = new ArrayList<>();
for (WptPt p : wptPts) {
if (p.name != null) {
final String fpCat;
@ -664,18 +664,18 @@ public class ImportHelper {
} else {
fpCat = p.category;
}
final FavouritePoint fp = new FavouritePoint(p.lat, p.lon, p.name, fpCat);
FavouritePoint point = new FavouritePoint(p.lat, p.lon, p.name, fpCat);
if (p.desc != null) {
fp.setDescription(p.desc);
point.setDescription(p.desc);
}
fp.setAddress(p.getExtensionsToRead().get("address"));
fp.setColor(p.getColor(0));
point.setAddress(p.getExtensionsToRead().get("address"));
point.setColor(p.getColor(0));
String iconName = p.getIconName();
if (iconName != null) {
fp.setIconIdFromName(app, iconName);
point.setIconIdFromName(app, iconName);
}
fp.setBackgroundType(BackgroundType.getByTypeName(p.getBackgroundType(), DEFAULT_BACKGROUND_TYPE));
favourites.add(fp);
point.setBackgroundType(BackgroundType.getByTypeName(p.getBackgroundType(), DEFAULT_BACKGROUND_TYPE));
favourites.add(point);
}
}
return favourites;

View file

@ -676,9 +676,15 @@ public class MenuBuilder {
LinearLayout llv = buildCollapsableContentView(mapActivity, true, true);
for (final Map.Entry<Integer, String> line : locationData.entrySet()) {
final TextViewEx button = buildButtonInCollapsableView(mapActivity, false, false);
if (line.getKey() == OsmAndFormatter.UTM_FORMAT || line.getKey() == OsmAndFormatter.OLC_FORMAT) {
if (line.getKey() == OsmAndFormatter.UTM_FORMAT || line.getKey() == OsmAndFormatter.OLC_FORMAT || line.getKey() == OsmAndFormatter.MGRS_FORMAT) {
SpannableStringBuilder ssb = new SpannableStringBuilder();
ssb.append(line.getKey() == OsmAndFormatter.UTM_FORMAT ? "UTM: " : "OLC: ");
if (line.getKey() == OsmAndFormatter.UTM_FORMAT) {
ssb.append("UTM: ");
} else if (line.getKey() == OsmAndFormatter.MGRS_FORMAT) {
ssb.append("MGRS: ");
} else if (line.getKey() == OsmAndFormatter.OLC_FORMAT){
ssb.append("OLC: ");
}
ssb.setSpan(new ForegroundColorSpan(app.getResources().getColor(R.color.text_color_secondary_light)), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
ssb.append(line.getValue());
button.setText(ssb);

View file

@ -323,9 +323,9 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabActivity.TabItem> mTabs, Intent intent) {
mTabs.add(favoritesActivity.getTabIndicator(R.string.osm_edits, OsmEditsFragment.class));
mTabs.add(favoritesActivity.getTabIndicator(OSM_EDIT_TAB, OsmEditsFragment.class));
if (intent != null && "OSM".equals(intent.getStringExtra("TAB"))) {
app.getSettings().FAVORITES_TAB.set(R.string.osm_edits);
app.getSettings().FAVORITES_TAB.set(OSM_EDIT_TAB);
}
}

View file

@ -29,6 +29,7 @@ import androidx.fragment.app.DialogFragment;
import com.google.openlocationcode.OpenLocationCode;
import com.jwetherell.openmap.common.LatLonPoint;
import com.jwetherell.openmap.common.MGRSPoint;
import com.jwetherell.openmap.common.UTMPoint;
import net.osmand.AndroidUtils;
@ -73,6 +74,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
private static final String QUICK_SEARCH_COORDS_NORTH_KEY = "quick_search_coords_north_key";
private static final String QUICK_SEARCH_COORDS_EAST_KEY = "quick_search_coords_east_key";
private static final String QUICK_SEARCH_COORDS_ZONE_KEY = "quick_search_coords_zone_key";
private static final String QUICK_SEARCH_COORDS_MGRS_KEY = "quick_search_coords_mgrs_key";
private static final String QUICK_SEARCH_COORDS_OLC_KEY = "quick_search_coords_olc_key";
private static final String QUICK_SEARCH_COORDS_OLC_INFO_KEY = "quick_search_coords_olc_info_key";
private static final String QUICK_SEARCH_COORDS_FORMAT_KEY = "quick_search_coords_format_key";
@ -89,6 +91,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
private EditText northingEdit;
private EditText eastingEdit;
private EditText zoneEdit;
private EditText mgrsEdit;
private EditText olcEdit;
private TextView olcInfo;
private EditText formatEdit;
@ -153,6 +156,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
northingEdit = ((EditText) view.findViewById(R.id.northingEditText));
eastingEdit = ((EditText) view.findViewById(R.id.eastingEditText));
zoneEdit = ((EditText) view.findViewById(R.id.zoneEditText));
mgrsEdit = ((EditText) view.findViewById(R.id.mgrsEditText));
olcEdit = ((EditText) view.findViewById(R.id.olcEditText));
olcInfo = ((TextView) view.findViewById(R.id.olcInfoTextView));
formatEdit = ((EditText) view.findViewById(R.id.formatEditText));
@ -160,6 +164,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
String defaultLat = "";
String defaultZone = "";
String defaultMgrs = "";
String defaultOlc = "";
boolean coordinatesApplied = false;
if (getArguments() != null) {
@ -167,6 +172,8 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
if (!Algorithms.isEmpty(text)) {
if (currentFormat == PointDescription.UTM_FORMAT) {
defaultZone = text.trim();
} else if (currentFormat == PointDescription.MGRS_FORMAT) {
defaultMgrs = text.trim();
} else if (currentFormat == PointDescription.OLC_FORMAT) {
defaultOlc = text.trim();
} else {
@ -188,6 +195,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
String northingStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_NORTH_KEY, "");
String eastingStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_EAST_KEY, "");
String zoneStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_ZONE_KEY, defaultZone);
String mgrsStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_MGRS_KEY, defaultMgrs);
String olcStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_OLC_KEY, defaultOlc);
String olcInfoStr = getStringValue(savedInstanceState, QUICK_SEARCH_COORDS_OLC_INFO_KEY, defaultOlc);
@ -209,6 +217,8 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
eastingEdit.setSelection(eastingStr.length());
zoneEdit.setText(zoneStr);
zoneEdit.setSelection(zoneStr.length());
mgrsEdit.setText(mgrsStr);
mgrsEdit.setSelection(mgrsStr.length());
olcEdit.setText(olcStr);
olcEdit.setSelection(olcStr.length());
olcInfo.setText(olcInfoStr);
@ -242,6 +252,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
northingEdit.addTextChangedListener(textWatcher);
eastingEdit.addTextChangedListener(textWatcher);
zoneEdit.addTextChangedListener(textWatcher);
mgrsEdit.addTextChangedListener(textWatcher);
olcEdit.addTextChangedListener(textWatcher);
OnEditorActionListener doneListener = new OnEditorActionListener() {
@ -258,6 +269,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
lonEdit.setOnEditorActionListener(doneListener);
zoneEdit.setOnEditorActionListener(doneListener);
mgrsEdit.setOnEditorActionListener(doneListener);
olcEdit.setOnEditorActionListener(doneListener);
UiUtilities ic = app.getUIUtilities();
@ -318,6 +330,15 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
olcEdit.setText("");
}
});
ImageButton mgrsClearButton = (ImageButton) view.findViewById(R.id.mgrsClearButton);
mgrsClearButton.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_remove_dark));
mgrsClearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mgrsEdit.setText("");
}
});
ImageButton formatSelectButton = (ImageButton) view.findViewById(R.id.formatSelectButton);
formatSelectButton.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_drop_down));
formatSelectButton.setOnClickListener(new View.OnClickListener() {
@ -364,6 +385,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
final TextView northEdit = ((TextView) view.findViewById(R.id.northingEditText));
final TextView eastEdit = ((TextView) view.findViewById(R.id.eastingEditText));
final TextView zoneEdit = ((TextView) view.findViewById(R.id.zoneEditText));
final TextView mgrsEdit = ((TextView) view.findViewById(R.id.mgrsEditText));
final TextView olcEdit = ((TextView) view.findViewById(R.id.olcEditText));
final TextView olcInfo = ((TextView) view.findViewById(R.id.olcInfoTextView));
outState.putString(QUICK_SEARCH_COORDS_LAT_KEY, latEdit.getText().toString());
@ -371,6 +393,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
outState.putString(QUICK_SEARCH_COORDS_NORTH_KEY, northEdit.getText().toString());
outState.putString(QUICK_SEARCH_COORDS_EAST_KEY, eastEdit.getText().toString());
outState.putString(QUICK_SEARCH_COORDS_ZONE_KEY, zoneEdit.getText().toString());
outState.putString(QUICK_SEARCH_COORDS_MGRS_KEY, mgrsEdit.getText().toString());
outState.putString(QUICK_SEARCH_COORDS_OLC_KEY, olcEdit.getText().toString());
outState.putString(QUICK_SEARCH_COORDS_OLC_INFO_KEY, olcInfo.getText().toString());
}
@ -470,7 +493,9 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
}
private void updateControlsVisibility() {
if (currentFormat == PointDescription.OLC_FORMAT) {
switch (currentFormat){
case PointDescription.OLC_FORMAT: {
view.findViewById(R.id.eastingLayout).setVisibility(View.GONE);
view.findViewById(R.id.northingLayout).setVisibility(View.GONE);
view.findViewById(R.id.zoneLayout).setVisibility(View.GONE);
@ -478,15 +503,42 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
view.findViewById(R.id.olcInfoLayout).setVisibility(View.VISIBLE);
view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE);
view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE);
} else {
boolean utm = currentFormat == PointDescription.UTM_FORMAT;
view.findViewById(R.id.eastingLayout).setVisibility(utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.northingLayout).setVisibility(utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.zoneLayout).setVisibility(utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.mgrsLayout).setVisibility(View.GONE);
break;
}
case PointDescription.UTM_FORMAT: {
view.findViewById(R.id.eastingLayout).setVisibility(View.VISIBLE);
view.findViewById(R.id.northingLayout).setVisibility(View.VISIBLE);
view.findViewById(R.id.zoneLayout).setVisibility(View.VISIBLE);
view.findViewById(R.id.olcLayout).setVisibility(View.GONE);
view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE);
view.findViewById(R.id.latitudeLayout).setVisibility(!utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.longitudeLayout).setVisibility(!utm ? View.VISIBLE : View.GONE);
view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE);
view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE);
view.findViewById(R.id.mgrsLayout).setVisibility(View.GONE);
break;
}
case PointDescription.MGRS_FORMAT: {
view.findViewById(R.id.eastingLayout).setVisibility(View.GONE);
view.findViewById(R.id.northingLayout).setVisibility(View.GONE);
view.findViewById(R.id.zoneLayout).setVisibility(View.GONE);
view.findViewById(R.id.olcLayout).setVisibility(View.GONE);
view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE);
view.findViewById(R.id.latitudeLayout).setVisibility(View.GONE);
view.findViewById(R.id.longitudeLayout).setVisibility(View.GONE);
view.findViewById(R.id.mgrsLayout).setVisibility(View.VISIBLE);
break;
}
default: {
view.findViewById(R.id.eastingLayout).setVisibility(View.GONE);
view.findViewById(R.id.northingLayout).setVisibility(View.GONE);
view.findViewById(R.id.zoneLayout).setVisibility(View.GONE);
view.findViewById(R.id.olcLayout).setVisibility(View.GONE);
view.findViewById(R.id.olcInfoLayout).setVisibility(View.GONE);
view.findViewById(R.id.latitudeLayout).setVisibility(View.VISIBLE);
view.findViewById(R.id.longitudeLayout).setVisibility(View.VISIBLE);
view.findViewById(R.id.mgrsLayout).setVisibility(View.GONE);
break;
}
}
}
@ -544,11 +596,28 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
zoneEdit.setText(olcEdit.getText());
northingEdit.setText("");
eastingEdit.setText("");
} else if (prevFormat == PointDescription.MGRS_FORMAT) {
zoneEdit.setText(mgrsEdit.getText());
northingEdit.setText("");
eastingEdit.setText("");
} else {
zoneEdit.setText(latEdit.getText());
northingEdit.setText("");
eastingEdit.setText("");
}
} else if (currentFormat == PointDescription.MGRS_FORMAT) {
final EditText mgrsEdit = ((EditText) view.findViewById(R.id.mgrsEditText));
if (latLon != null) {
MGRSPoint pnt = new MGRSPoint(new LatLonPoint(latLon.getLatitude(), latLon.getLongitude()));
mgrsEdit.setText(pnt.toFlavoredString(5));
} else if (prevFormat == PointDescription.UTM_FORMAT) {
mgrsEdit.setText(zoneEdit.getText());
} else if (prevFormat == PointDescription.OLC_FORMAT) {
mgrsEdit.setText(olcEdit.getText());
} else {
mgrsEdit.setText(latEdit.getText());
}
} else if (currentFormat == PointDescription.OLC_FORMAT) {
if (latLon != null) {
String olc = OpenLocationCode.encode(latLon.getLatitude(), latLon.getLongitude());
@ -557,6 +626,9 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
} else if (prevFormat == PointDescription.UTM_FORMAT) {
olcEdit.setText(zoneEdit.getText());
olcInfo.setText(provideOlcInfo(olcEdit.getText().toString()));
} else if (prevFormat == PointDescription.MGRS_FORMAT) {
olcEdit.setText(mgrsEdit.getText());
olcInfo.setText(provideOlcInfo(olcEdit.getText().toString()));
} else {
olcEdit.setText(latEdit.getText());
olcInfo.setText(provideOlcInfo(olcEdit.getText().toString()));
@ -568,6 +640,9 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
} else if (prevFormat == PointDescription.UTM_FORMAT) {
latEdit.setText(zoneEdit.getText());
lonEdit.setText("");
} else if (prevFormat == PointDescription.MGRS_FORMAT) {
latEdit.setText(mgrsEdit.getText());
lonEdit.setText("");
} else if (prevFormat == PointDescription.OLC_FORMAT) {
latEdit.setText(olcEdit.getText());
lonEdit.setText("");
@ -591,6 +666,11 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
UTMPoint upoint = new UTMPoint(northing, easting, z, c);
LatLonPoint ll = upoint.toLatLonPoint();
loc = new LatLon(ll.getLatitude(), ll.getLongitude());
} else if (currentFormat == LocationConvert.MGRS_FORMAT) {
String mgrs = (mgrsEdit.getText().toString());
MGRSPoint upoint = new MGRSPoint(mgrs);
LatLonPoint ll = upoint.toLatLonPoint();
loc = new LatLon(ll.getLatitude(), ll.getLongitude());
} else if (currentFormat == LocationConvert.OLC_FORMAT) {
String olcText = olcEdit.getText().toString();
olcInfo.setText(provideOlcInfo(olcText));
@ -851,12 +931,13 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final QuickSearchCoordinatesFragment parent = (QuickSearchCoordinatesFragment) getParentFragment();
String[] entries = new String[5];
String[] entries = new String[6];
entries[0] = PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES);
entries[1] = PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES);
entries[2] = PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS);
entries[3] = PointDescription.formatToHumanString(getContext(), PointDescription.UTM_FORMAT);
entries[4] = PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT);
entries[5] = PointDescription.formatToHumanString(getContext(), PointDescription.MGRS_FORMAT);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.coords_format)

View file

@ -13,5 +13,6 @@ public enum ExportSettingsType {
GLOBAL,
OSM_NOTES,
OSM_EDITS,
OFFLINE_MAPS
OFFLINE_MAPS,
FAVORITES
}

View file

@ -174,6 +174,6 @@ public class AvoidRoadsSettingsItem extends CollectionSettingsItem<AvoidSpecific
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -97,6 +97,6 @@ public class DownloadsItem extends SettingsItem {
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -0,0 +1,197 @@
package net.osmand.plus.settings.backend.backup;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.data.FavouritePoint;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static net.osmand.IndexConstants.GPX_FILE_EXT;
import static net.osmand.plus.importfiles.ImportHelper.asFavourites;
public class FavoritesSettingsItem extends CollectionSettingsItem<FavoriteGroup> {
private FavouritesDbHelper favoritesHelper;
public FavoritesSettingsItem(@NonNull OsmandApplication app, @NonNull List<FavoriteGroup> items) {
super(app, null, items);
}
public FavoritesSettingsItem(@NonNull OsmandApplication app, @Nullable FavoritesSettingsItem baseItem, @NonNull List<FavoriteGroup> items) {
super(app, baseItem, items);
}
FavoritesSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
super(app, json);
}
@Override
protected void init() {
super.init();
favoritesHelper = app.getFavorites();
existingItems = new ArrayList<>(favoritesHelper.getFavoriteGroups());
}
@NonNull
@Override
public SettingsItemType getType() {
return SettingsItemType.FAVOURITES;
}
@NonNull
@Override
public String getName() {
return "favourites";
}
@NonNull
@Override
public String getPublicName(@NonNull Context ctx) {
return ctx.getString(R.string.shared_string_favorites);
}
@NonNull
public String getDefaultFileName() {
return getName() + getDefaultFileExtension();
}
@NonNull
public String getDefaultFileExtension() {
return GPX_FILE_EXT;
}
@Override
public void apply() {
List<FavoriteGroup> newItems = getNewItems();
if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
appliedItems = new ArrayList<>(newItems);
for (FavoriteGroup duplicate : duplicateItems) {
if (shouldReplace) {
FavoriteGroup existingGroup = favoritesHelper.getGroup(duplicate.getName());
if (existingGroup != null) {
List<FavouritePoint> favouritePoints = new ArrayList<>(existingGroup.getPoints());
for (FavouritePoint favouritePoint : favouritePoints) {
favoritesHelper.deleteFavourite(favouritePoint, false);
}
}
}
appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
}
List<FavouritePoint> favourites = getPointsFromGroups(appliedItems);
for (FavouritePoint favourite : favourites) {
favoritesHelper.addFavourite(favourite, false);
}
favoritesHelper.sortAll();
favoritesHelper.saveCurrentPointsIntoFile();
}
}
@Override
public boolean isDuplicate(@NonNull FavoriteGroup favoriteGroup) {
String name = favoriteGroup.getName();
for (FavoriteGroup group : existingItems) {
if (group.getName().equals(name)) {
return true;
}
}
return false;
}
@Override
public boolean shouldReadOnCollecting() {
return true;
}
@NonNull
@Override
public FavoriteGroup renameItem(@NonNull FavoriteGroup item) {
int number = 0;
while (true) {
number++;
String name = item.getName() + " (" + number + ")";
FavoriteGroup renamedItem = new FavoriteGroup(name, item.getPoints(), item.getColor(), item.isVisible());
if (!isDuplicate(renamedItem)) {
for (FavouritePoint point : renamedItem.getPoints()) {
point.setCategory(renamedItem.getName());
}
return renamedItem;
}
}
}
@Nullable
@Override
SettingsItemReader<FavoritesSettingsItem> getReader() {
return new SettingsItemReader<FavoritesSettingsItem>(this) {
@Override
public void readFromStream(@NonNull InputStream inputStream) throws IllegalArgumentException {
GPXFile gpxFile = GPXUtilities.loadGPXFile(inputStream);
if (gpxFile.error != null) {
warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType())));
SettingsHelper.LOG.error("Failed read gpx file", gpxFile.error);
} else {
Map<String, FavoriteGroup> flatGroups = new LinkedHashMap<>();
List<FavouritePoint> favourites = asFavourites(app, gpxFile.getPoints(), fileName, false);
for (FavouritePoint point : favourites) {
FavoriteGroup group = flatGroups.get(point.getCategory());
if (group == null) {
group = new FavoriteGroup(point.getCategory(), point.isVisible(), point.getColor());
flatGroups.put(group.getName(), group);
items.add(group);
}
group.getPoints().add(point);
}
}
}
};
}
private List<FavouritePoint> getPointsFromGroups(List<FavoriteGroup> groups) {
List<FavouritePoint> favouritePoints = new ArrayList<>();
for (FavoriteGroup group : groups) {
favouritePoints.addAll(group.getPoints());
}
return favouritePoints;
}
@Nullable
@Override
SettingsItemWriter<FavoritesSettingsItem> getWriter() {
return new SettingsItemWriter<FavoritesSettingsItem>(this) {
@Override
public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException {
List<FavouritePoint> favourites = getPointsFromGroups(items);
GPXFile gpxFile = favoritesHelper.asGpxFile(favourites);
Exception error = GPXUtilities.writeGpx(new OutputStreamWriter(outputStream, "UTF-8"), gpxFile);
if (error != null) {
warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType())));
SettingsHelper.LOG.error("Failed write to gpx file", error);
return false;
}
return true;
}
};
}
}

View file

@ -19,6 +19,10 @@ public class GlobalSettingsItem extends OsmandSettingsItem {
super(settings);
}
public GlobalSettingsItem(@NonNull OsmandSettings settings, @NonNull JSONObject json) throws JSONException {
super(SettingsItemType.GLOBAL, settings, json);
}
@NonNull
@Override
public SettingsItemType getType() {

View file

@ -236,6 +236,6 @@ public class MapSourcesSettingsItem extends CollectionSettingsItem<ITileSource>
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -194,6 +194,6 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem<OpenstreetmapPo
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -167,6 +167,6 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -173,6 +173,6 @@ public class PoiUiFiltersSettingsItem extends CollectionSettingsItem<PoiUIFilter
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -178,6 +178,6 @@ public class QuickActionsSettingsItem extends CollectionSettingsItem<QuickAction
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -13,6 +13,7 @@ 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.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.SQLiteTileSource;
@ -47,7 +48,7 @@ import java.util.Map;
import java.util.Set;
import static net.osmand.IndexConstants.OSMAND_SETTINGS_FILE_EXT;
import static net.osmand.plus.activities.LocalIndexHelper.*;
import static net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
/*
Usage:
@ -535,6 +536,10 @@ public class SettingsHelper {
if (!files.isEmpty()) {
dataList.put(ExportSettingsType.OFFLINE_MAPS, files);
}
List<FavoriteGroup> favoriteGroups = app.getFavorites().getFavoriteGroups();
if (!favoriteGroups.isEmpty()) {
dataList.put(ExportSettingsType.FAVORITES, favoriteGroups);
}
return dataList;
}
@ -562,6 +567,7 @@ public class SettingsHelper {
List<ITileSource> tileSourceTemplates = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<ApplicationModeBean> appModeBeans = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
List<OsmNotesPoint> osmNotesPointList = new ArrayList<>();
List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>();
@ -586,6 +592,8 @@ public class SettingsHelper {
osmNotesPointList.add((OsmNotesPoint) object);
} else if (object instanceof OpenstreetmapPoint) {
osmEditsPointList.add((OpenstreetmapPoint) object);
} else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object);
}
}
if (!quickActions.isEmpty()) {
@ -614,6 +622,9 @@ public class SettingsHelper {
if (!osmEditsPointList.isEmpty()) {
settingsItems.add(new OsmEditsSettingsItem(app, osmEditsPointList));
}
if (!favoriteGroups.isEmpty()) {
settingsItems.add(new FavoritesSettingsItem(app, favoriteGroups));
}
return settingsItems;
}
@ -632,6 +643,8 @@ public class SettingsHelper {
List<GlobalSettingsItem> globalSettingsItems = new ArrayList<>();
List<OsmNotesPoint> notesPointList = new ArrayList<>();
List<OpenstreetmapPoint> editsPointList = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
for (SettingsItem item : settingsItems) {
switch (item.getType()) {
case PROFILE:
@ -705,6 +718,10 @@ public class SettingsHelper {
editsPointList.addAll(osmEditsSettingsItem.getItems());
}
break;
case FAVOURITES:
FavoritesSettingsItem favoritesSettingsItem = (FavoritesSettingsItem) item;
favoriteGroups.addAll(favoritesSettingsItem.getItems());
break;
default:
break;
}
@ -749,6 +766,9 @@ public class SettingsHelper {
if (!mapFilesList.isEmpty()) {
settingsToOperate.put(ExportSettingsType.OFFLINE_MAPS, mapFilesList);
}
if (!favoriteGroups.isEmpty()) {
settingsToOperate.put(ExportSettingsType.FAVORITES, favoriteGroups);
}
return settingsToOperate;
}
}

View file

@ -142,7 +142,6 @@ public abstract class SettingsItem {
}
json.put("file", fileName);
}
writeItemsToJson(json);
}
String toJson() throws JSONException {

View file

@ -15,4 +15,5 @@ public enum SettingsItemType {
DOWNLOADS,
OSM_NOTES,
OSM_EDITS,
FAVOURITES
}

View file

@ -90,7 +90,7 @@ class SettingsItemsFactory {
OsmandSettings settings = app.getSettings();
switch (type) {
case GLOBAL:
item = new GlobalSettingsItem(settings);
item = new GlobalSettingsItem(settings, json);
break;
case PROFILE:
item = new ProfileSettingsItem(app, json);
@ -131,6 +131,9 @@ class SettingsItemsFactory {
case OSM_EDITS:
item = new OsmEditsSettingsItem(app, json);
break;
case FAVOURITES:
item = new FavoritesSettingsItem(app, json);
break;
}
return item;
}

View file

@ -123,6 +123,6 @@ public class SuggestedDownloadsItem extends SettingsItem {
@Nullable
@Override
SettingsItemWriter<? extends SettingsItem> getWriter() {
return null;
return getJsonWriter();
}
}

View file

@ -31,11 +31,13 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
public static final String TAG = CoordinatesFormatFragment.class.getSimpleName();
private static final String UTM_FORMAT_WIKI_LINK = "https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system";
private static final String MGRS_FORMAT_WIKI_LINK = "https://en.wikipedia.org/wiki/Military_Grid_Reference_System";
private static final String FORMAT_DEGREES = "format_degrees";
private static final String FORMAT_MINUTES = "format_minutes";
private static final String FORMAT_SECONDS = "format_seconds";
private static final String UTM_FORMAT = "utm_format";
private static final String MGRS_FORMAT = "mgrs_format";
private static final String OLC_FORMAT = "olc_format";
@Override
@ -44,6 +46,7 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
CheckBoxPreference minutesPref = (CheckBoxPreference) findPreference(FORMAT_MINUTES);
CheckBoxPreference secondsPref = (CheckBoxPreference) findPreference(FORMAT_SECONDS);
CheckBoxPreference utmPref = (CheckBoxPreference) findPreference(UTM_FORMAT);
CheckBoxPreference mgrsPref = (CheckBoxPreference) findPreference(MGRS_FORMAT);
CheckBoxPreference olcPref = (CheckBoxPreference) findPreference(OLC_FORMAT);
Location loc = app.getLocationProvider().getLastKnownLocation();
@ -52,6 +55,7 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
minutesPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_MINUTES));
secondsPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_SECONDS));
utmPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.UTM_FORMAT));
mgrsPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.MGRS_FORMAT));
olcPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.OLC_FORMAT));
int currentFormat = settings.COORDINATES_FORMAT.getModeValue(getSelectedAppMode());
@ -69,6 +73,12 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
summaryView.setOnTouchListener(new ClickableSpanTouchListener());
}
}
if (MGRS_FORMAT.equals(preference.getKey())) {
TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
if (summaryView != null) {
summaryView.setOnTouchListener(new ClickableSpanTouchListener());
}
}
}
private CharSequence getCoordinatesFormatSummary(Location loc, int format) {
@ -106,6 +116,36 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
return spannableBuilder;
}
if (format == PointDescription.MGRS_FORMAT) {
SpannableStringBuilder spannableBuilder = new SpannableStringBuilder();
String combined = getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_example), formattedCoordinates);
spannableBuilder.append(combined);
spannableBuilder.append("\n");
spannableBuilder.append(getString(R.string.mgrs_format_descr));
int start = spannableBuilder.length();
spannableBuilder.append(" ");
spannableBuilder.append(getString(R.string.shared_string_read_more));
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(@NonNull View widget) {
Context ctx = getContext();
if (ctx != null) {
WikipediaDialogFragment.showFullArticle(ctx, Uri.parse(MGRS_FORMAT_WIKI_LINK), isNightMode());
}
}
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
};
spannableBuilder.setSpan(clickableSpan, start, spannableBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannableBuilder;
}
return getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_example), formattedCoordinates);
}
@ -159,6 +199,8 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
return PointDescription.FORMAT_SECONDS;
case UTM_FORMAT:
return PointDescription.UTM_FORMAT;
case MGRS_FORMAT:
return PointDescription.MGRS_FORMAT;
case OLC_FORMAT:
return PointDescription.OLC_FORMAT;
default:
@ -176,6 +218,8 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
return FORMAT_SECONDS;
case PointDescription.UTM_FORMAT:
return UTM_FORMAT;
case PointDescription.MGRS_FORMAT:
return MGRS_FORMAT;
case PointDescription.OLC_FORMAT:
return OLC_FORMAT;
default:

View file

@ -13,6 +13,7 @@ import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.map.ITileSource;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.settings.backend.ApplicationMode;
@ -148,6 +149,10 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter<RecyclerView
itemHolder.title.setText(((AvoidRoadInfo) currentItem).name);
itemHolder.icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_alert, activeColorRes));
itemHolder.subTitle.setVisibility(View.GONE);
} else if (currentItem instanceof FavoriteGroup) {
itemHolder.title.setText(((FavoriteGroup) currentItem).getDisplayName(app));
itemHolder.icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_favorite, activeColorRes));
itemHolder.subTitle.setVisibility(View.GONE);
}
itemHolder.divider.setVisibility(shouldShowDivider(position) ? View.VISIBLE : View.GONE);
}

View file

@ -16,6 +16,7 @@ import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.map.ITileSource;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@ -35,8 +36,8 @@ import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
import net.osmand.plus.settings.backend.backup.FileSettingsItem;
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
import net.osmand.util.Algorithms;
import net.osmand.view.ThreeStateCheckbox;
@ -49,8 +50,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static net.osmand.plus.settings.backend.ExportSettingsType.*;
import static net.osmand.plus.settings.backend.backup.FileSettingsItem.*;
import static net.osmand.plus.settings.backend.ExportSettingsType.OFFLINE_MAPS;
import static net.osmand.plus.settings.backend.backup.FileSettingsItem.FileSubtype;
import static net.osmand.view.ThreeStateCheckbox.State.CHECKED;
import static net.osmand.view.ThreeStateCheckbox.State.MISC;
import static net.osmand.view.ThreeStateCheckbox.State.UNCHECKED;
@ -303,6 +304,11 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
subText.setText(AndroidUtils.formatSize(app, size));
subText.setVisibility(View.VISIBLE);
break;
case FAVORITES:
FavoriteGroup favoriteGroup = (FavoriteGroup) currentItem;
title.setText(favoriteGroup.getDisplayName(app));
setupIcon(icon, R.drawable.ic_action_favorite, itemSelected);
break;
default:
return child;
}
@ -393,6 +399,8 @@ class ExportImportSettingsAdapter extends OsmandBaseExpandableListAdapter {
return R.string.osm_edit_modified_poi;
case OFFLINE_MAPS:
return R.string.shared_string_local_maps;
case FAVORITES:
return R.string.shared_string_favorites;
default:
return R.string.access_empty_list;
}

View file

@ -28,6 +28,8 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dialogs.SelectMapStyleBottomSheetDialogFragment;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.quickaction.QuickActionListFragment;
import net.osmand.plus.routepreparationmenu.AvoidRoadsBottomSheetDialogFragment;
import net.osmand.plus.search.QuickSearchDialogFragment;
@ -194,9 +196,15 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
OsmAndAppCustomization appCustomization = app.getAppCustomization();
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
app.getSettings().FAVORITES_TAB.set(R.string.osm_edits);
app.getSettings().FAVORITES_TAB.set(OsmEditingPlugin.OSM_EDIT_TAB);
startActivity(favorites);
break;
case FAVORITES:
Intent favoritesActivity = new Intent(activity, app.getAppCustomization().getFavoritesActivity());
favoritesActivity.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
app.getSettings().FAVORITES_TAB.set(FavoritesActivity.FAV_TAB);
startActivity(favoritesActivity);
break;
default:
break;
}

View file

@ -26,6 +26,7 @@ import com.google.android.material.appbar.CollapsingToolbarLayout;
import net.osmand.AndroidUtils;
import net.osmand.map.ITileSource;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@ -178,6 +179,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
List<File> multimediaFilesList = new ArrayList<>();
List<File> trackFilesList = new ArrayList<>();
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
for (Object object : duplicatesList) {
if (object instanceof ApplicationMode.ApplicationModeBean) {
@ -201,6 +203,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
}
} else if (object instanceof AvoidRoadInfo) {
avoidRoads.add((AvoidRoadInfo) object);
} else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object);
}
}
if (!profiles.isEmpty()) {
@ -239,6 +243,10 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
duplicates.add(getString(R.string.avoid_road));
duplicates.addAll(avoidRoads);
}
if (!favoriteGroups.isEmpty()) {
duplicates.add(getString(R.string.shared_string_favorites));
duplicates.addAll(favoriteGroups);
}
return duplicates;
}

View file

@ -33,6 +33,7 @@ import net.osmand.PlatformUtil;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
@ -46,6 +47,8 @@ import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.backend.backup.FavoritesSettingsItem;
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
import net.osmand.plus.settings.backend.backup.OsmEditsSettingsItem;
import net.osmand.plus.settings.backend.backup.OsmNotesSettingsItem;
import net.osmand.plus.settings.backend.backup.SettingsHelper;
@ -437,6 +440,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
List<AvoidRoadInfo> avoidRoads = new ArrayList<>();
List<OsmNotesPoint> osmNotesPointList = new ArrayList<>();
List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>();
for (Object object : data) {
if (object instanceof ApplicationModeBean) {
appModeBeans.add((ApplicationModeBean) object);
@ -456,6 +460,10 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
osmNotesPointList.add((OsmNotesPoint) object);
} else if (object instanceof OpenstreetmapPoint) {
osmEditsPointList.add((OpenstreetmapPoint) object);
} else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object);
} else if (object instanceof GlobalSettingsItem) {
settingsItems.add((GlobalSettingsItem) object);
}
}
if (!appModeBeans.isEmpty()) {
@ -483,6 +491,10 @@ public class ImportSettingsFragment extends BaseOsmAndFragment
OsmEditsSettingsItem baseItem = getBaseItem(SettingsItemType.OSM_EDITS, OsmEditsSettingsItem.class);
settingsItems.add(new OsmEditsSettingsItem(app, baseItem, osmEditsPointList));
}
if (!favoriteGroups.isEmpty()) {
FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class);
settingsItems.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups));
}
return settingsItems;
}

View file

@ -122,6 +122,18 @@ public class ImportedSettingsItemsAdapter extends
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_info_dark, activeColorRes));
holder.title.setText(R.string.osm_edit_modified_poi);
break;
case FAVORITES:
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_favorite, activeColorRes));
holder.title.setText(R.string.shared_string_favorites);
break;
case OFFLINE_MAPS:
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_map, activeColorRes));
holder.title.setText(R.string.shared_string_local_maps);
break;
case GLOBAL:
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_settings, activeColorRes));
holder.title.setText(R.string.general_settings_2);
break;
}
}

View file

@ -33,6 +33,7 @@ import androidx.core.graphics.drawable.DrawableCompat;
import com.google.android.material.snackbar.Snackbar;
import com.jwetherell.openmap.common.LatLonPoint;
import com.jwetherell.openmap.common.MGRSPoint;
import com.jwetherell.openmap.common.UTMPoint;
import net.osmand.AndroidUtils;
@ -1251,6 +1252,13 @@ public class MapInfoWidgetsFactory {
UTMPoint pnt = new UTMPoint(new LatLonPoint(lat, lon));
String utmLocation = pnt.zone_number + "" + pnt.zone_letter + " " + ((long) pnt.easting) + " " + ((long) pnt.northing);
latitudeText.setText(utmLocation);
} else if (f == PointDescription.MGRS_FORMAT) {
AndroidUiHelper.updateVisibility(lonCoordinatesContainer, false);
AndroidUiHelper.updateVisibility(coordinatesDivider, false);
AndroidUiHelper.updateVisibility(latitudeIcon, true);
latitudeIcon.setImageDrawable(iconsCache.getIcon(nightMode ? R.drawable.widget_coordinates_utm_night : R.drawable.widget_coordinates_utm_day));
MGRSPoint pnt = new MGRSPoint(new LatLonPoint(lat, lon));
latitudeText.setText(pnt.toFlavoredString(5));
} else if (f == PointDescription.OLC_FORMAT) {
AndroidUiHelper.updateVisibility(lonCoordinatesContainer, false);
AndroidUiHelper.updateVisibility(coordinatesDivider, false);