Merge pull request #10329 from osmandapp/master

update test branch
This commit is contained in:
Hardy 2020-12-03 19:21:04 +01:00 committed by GitHub
commit bd45d6f88c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 195 additions and 97 deletions

View file

@ -8,7 +8,8 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="0dp"
android:layout_weight="1">
<ScrollView <ScrollView
android:id="@+id/scroll_view" android:id="@+id/scroll_view"

View file

@ -5,6 +5,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout

View file

@ -3988,4 +3988,6 @@
<string name="select_picture">تحديد صورة</string> <string name="select_picture">تحديد صورة</string>
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string> <string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="lang_de_casual">الألمانية (تقليدية)</string> <string name="lang_de_casual">الألمانية (تقليدية)</string>
<string name="elevation_data">يمكنك استخدام بيانات الارتفاع للنظر في الصعود / الهبوط لرحلتك</string>
<string name="app_mode_light_aircraft">طائرة</string>
</resources> </resources>

View file

@ -3861,4 +3861,6 @@
<string name="select_items_for_import">Vælg emner, der skal importeres.</string> <string name="select_items_for_import">Vælg emner, der skal importeres.</string>
<string name="use_dev_url_descr">Skift til dev.openstreetmap.org i stedet for openstreetmap.org for at teste overførelse af OSM-note / IP / GPX.</string> <string name="use_dev_url_descr">Skift til dev.openstreetmap.org i stedet for openstreetmap.org for at teste overførelse af OSM-note / IP / GPX.</string>
<string name="use_dev_url">Brug dev.openstreetmap.org</string> <string name="use_dev_url">Brug dev.openstreetmap.org</string>
<string name="cannot_upload_image">Kan ikke overføre billedet, prøv igen senere</string>
<string name="select_picture">Vælg billede</string>
</resources> </resources>

View file

@ -4004,4 +4004,6 @@
<string name="cannot_upload_image">Bild kann nicht hochgeladen werden, bitte versuchen Sie es später erneut</string> <string name="cannot_upload_image">Bild kann nicht hochgeladen werden, bitte versuchen Sie es später erneut</string>
<string name="select_picture">Bild auswählen</string> <string name="select_picture">Bild auswählen</string>
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string> <string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="elevation_data">Sie können Höhendaten für die Berücksichtigung von Aufstieg / Abstieg auf Ihrer Strecke verwenden</string>
<string name="app_mode_light_aircraft">Kleinflugzeug</string>
</resources> </resources>

View file

@ -3992,4 +3992,6 @@
<string name="select_picture">Kép kijelölése</string> <string name="select_picture">Kép kijelölése</string>
<string name="lang_de_casual">német (tegeződő)</string> <string name="lang_de_casual">német (tegeződő)</string>
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string> <string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="elevation_data">A magassági adatokat az utazás során előforduló emelkedés/lejtés megfontolásához használhatja</string>
<string name="app_mode_light_aircraft">Könnyű légi jármű</string>
</resources> </resources>

View file

@ -3342,7 +3342,7 @@
<string name="tts_initialization_error">Impossibile avviare il motore dal-testo-alla-voce.</string> <string name="tts_initialization_error">Impossibile avviare il motore dal-testo-alla-voce.</string>
<string name="simulate_your_location_gpx_descr">Simula la mia posizione utilizzando una traccia GPX registrata.</string> <string name="simulate_your_location_gpx_descr">Simula la mia posizione utilizzando una traccia GPX registrata.</string>
<string name="default_speed_dialog_msg">Utilizzata per stimare l\'orario d\'arrivo per le strade di tipo sconosciute e come limite di velocità per tutte le strade (può influenzare il calcolo del percorso)</string> <string name="default_speed_dialog_msg">Utilizzata per stimare l\'orario d\'arrivo per le strade di tipo sconosciute e come limite di velocità per tutte le strade (può influenzare il calcolo del percorso)</string>
<string name="export_profile">Esporta il profilo</string> <string name="export_profile">Esporta profilo</string>
<string name="exported_osmand_profile">Profilo OsmAnd: %1$s</string> <string name="exported_osmand_profile">Profilo OsmAnd: %1$s</string>
<string name="overwrite_profile_q">Il profilo \'%1$s\' c\'è già. Sovrascriverlo\?</string> <string name="overwrite_profile_q">Il profilo \'%1$s\' c\'è già. Sovrascriverlo\?</string>
<string name="export_profile_failed">Esportazione del profilo non riuscita.</string> <string name="export_profile_failed">Esportazione del profilo non riuscita.</string>
@ -3389,7 +3389,7 @@
<string name="select_color">Seleziona il colore</string> <string name="select_color">Seleziona il colore</string>
<string name="edit_profiles_descr">Non puoi cancellare i profili preimpostati di OsmAnd, ma puoi disabilitarli nello schermo precedente o spostarli in basso.</string> <string name="edit_profiles_descr">Non puoi cancellare i profili preimpostati di OsmAnd, ma puoi disabilitarli nello schermo precedente o spostarli in basso.</string>
<string name="edit_profiles">Modifica il profilo</string> <string name="edit_profiles">Modifica il profilo</string>
<string name="select_nav_profile_dialog_message">Il tipo di navigazione influenza le regole di calcolo dei percorsi.</string> <string name="select_nav_profile_dialog_message">Il \'Tipo di navigazione\' determina il modo in cui vengono calcolati i percorsi.</string>
<string name="profile_appearance">Aspetto del profilo</string> <string name="profile_appearance">Aspetto del profilo</string>
<string name="choose_icon_color_name">Scegli l\'icona, il colore e il nome</string> <string name="choose_icon_color_name">Scegli l\'icona, il colore e il nome</string>
<string name="reorder_profiles">Modifica la lista dei profili</string> <string name="reorder_profiles">Modifica la lista dei profili</string>
@ -3633,7 +3633,7 @@
<string name="legend_item_description">La guida ai simboli della mappa.</string> <string name="legend_item_description">La guida ai simboli della mappa.</string>
<string name="navigation_profiles_item">Profili di navigazione</string> <string name="navigation_profiles_item">Profili di navigazione</string>
<string name="unsupported_type_error">Tipo non supportato</string> <string name="unsupported_type_error">Tipo non supportato</string>
<string name="gpx_parse_error">Il GPX OsmAnd non è ben formattato, per favore contatta il supporto per ulteriori informazioni.</string> <string name="gpx_parse_error">OsmAnd GPX non è ben formato, contatta il team di supporto per approfondire.</string>
<string name="shared_string_always">Sempre</string> <string name="shared_string_always">Sempre</string>
<string name="screen_control">Controllo dello schermo</string> <string name="screen_control">Controllo dello schermo</string>
<string name="system_screen_timeout_descr">Spegni lo schermo dopo il tempo di spegnimento di sistema dello schermo.</string> <string name="system_screen_timeout_descr">Spegni lo schermo dopo il tempo di spegnimento di sistema dello schermo.</string>
@ -3977,7 +3977,7 @@
<string name="enter_text_separated">Immetti le etichette separate dalla virgola.</string> <string name="enter_text_separated">Immetti le etichette separate dalla virgola.</string>
<string name="gpx_upload_public_visibility_descr">\"Pubblico\" significa che la traccia è visualizzata pubblicamente nelle tue tracce GPS, nelle liste pubbliche di tracce GPS con le informazioni temporali in forma grezza. I dati forniti attraverso le API non conducono alla tua pagina delle tracce. Le informazioni temporali dei punti traccia non sono disponibili attraverso le API GPS pubbliche, e i punti della traccia non sono ordinati cronologicamente.</string> <string name="gpx_upload_public_visibility_descr">\"Pubblico\" significa che la traccia è visualizzata pubblicamente nelle tue tracce GPS, nelle liste pubbliche di tracce GPS con le informazioni temporali in forma grezza. I dati forniti attraverso le API non conducono alla tua pagina delle tracce. Le informazioni temporali dei punti traccia non sono disponibili attraverso le API GPS pubbliche, e i punti della traccia non sono ordinati cronologicamente.</string>
<string name="gpx_upload_private_visibility_descr">\"Privato\" significa che la traccia non è visualizzabile in alcuna lista pubblica ma i suoi punti, in ordine non cronologico, sono disponibili attraverso le API GPS senza le informazioni temporali.</string> <string name="gpx_upload_private_visibility_descr">\"Privato\" significa che la traccia non è visualizzabile in alcuna lista pubblica ma i suoi punti, in ordine non cronologico, sono disponibili attraverso le API GPS senza le informazioni temporali.</string>
<string name="gpx_upload_identifiable_visibility_descr">\"Identificabile\" significa che la traccia è visualizzabile nelle Mie tracce GPS e nelle liste pubbliche, es. gli altri utenti potranno scaricare la traccia grezza e associarla con il tuo nome utente. I punti della traccia, con le loro informazioni temporali, saranno riconducibili, attraverso le API GPS, alla tua traccia originale.</string> <string name="gpx_upload_identifiable_visibility_descr">\"Identificabile\" significa che la traccia è visualizzabile nelle Mie tracce GPS e nelle liste pubbliche, ad es. gli altri utenti potranno scaricare la traccia grezza e associarla con il tuo nome utente. I punti della traccia, con le loro informazioni temporali, saranno riconducibili, attraverso le API GPS, alla tua traccia originale.</string>
<string name="gpx_upload_trackable_visibility_descr">\"Tracciabile\" significa che la traccia non è visualizzabile in alcuna lista pubblica, ma solo i suoi punti, processati, con le informazioni temporali (che non possono essere direttamente associati a te) attraverso le API GPS pubbliche.</string> <string name="gpx_upload_trackable_visibility_descr">\"Tracciabile\" significa che la traccia non è visualizzabile in alcuna lista pubblica, ma solo i suoi punti, processati, con le informazioni temporali (che non possono essere direttamente associati a te) attraverso le API GPS pubbliche.</string>
<string name="add_to_mapillary">Aggiungi a Mapillary</string> <string name="add_to_mapillary">Aggiungi a Mapillary</string>
<string name="add_to_opr">Aggiungi a OpenPlaceReviews</string> <string name="add_to_opr">Aggiungi a OpenPlaceReviews</string>

View file

@ -3996,4 +3996,6 @@
<string name="select_picture">Selecione a foto</string> <string name="select_picture">Selecione a foto</string>
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string> <string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="lang_de_casual">Alemão (casual)</string> <string name="lang_de_casual">Alemão (casual)</string>
<string name="elevation_data">Você pode usar os dados de elevação para consideração de subida / descida para sua viagem</string>
<string name="app_mode_light_aircraft">Avião leve</string>
</resources> </resources>

View file

@ -4002,4 +4002,7 @@
<string name="select_picture">Selecione a imagem</string> <string name="select_picture">Selecione a imagem</string>
<string name="use_dev_url_descr">Mude para usar dev.openstreetmap.org ao invés de openstreetmap.org para testar enviar uma OSM Nota / POI / GPX.</string> <string name="use_dev_url_descr">Mude para usar dev.openstreetmap.org ao invés de openstreetmap.org para testar enviar uma OSM Nota / POI / GPX.</string>
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string> <string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="lang_de_casual">Alemão (casual)</string>
<string name="elevation_data">Pode usar os dados de elevação para considerar a ascensão / descida na sua viagem</string>
<string name="app_mode_light_aircraft">Aeronaves ligeiras</string>
</resources> </resources>

View file

@ -3954,7 +3954,7 @@
<string name="login_open_street_map_org">Вход в OpenStreetMap.org</string> <string name="login_open_street_map_org">Вход в OpenStreetMap.org</string>
<string name="sign_in_with_open_street_map">Войти через OpenStreetMap</string> <string name="sign_in_with_open_street_map">Войти через OpenStreetMap</string>
<string name="login_account">Аккаунт</string> <string name="login_account">Аккаунт</string>
<string name="user_login">Пользователь</string> <string name="user_login">Авторизоваться</string>
<string name="manage_subscription">Управление подпиской</string> <string name="manage_subscription">Управление подпиской</string>
<string name="subscription_expired_title">Срок действия подписки OsmAnd Live истёк</string> <string name="subscription_expired_title">Срок действия подписки OsmAnd Live истёк</string>
<string name="subscription_paused_title">Подписка OsmAnd Live была приостановлена</string> <string name="subscription_paused_title">Подписка OsmAnd Live была приостановлена</string>

View file

@ -3132,4 +3132,7 @@
<string name="poi_fire_hydrant_style_water_source_pond">Gölet</string> <string name="poi_fire_hydrant_style_water_source_pond">Gölet</string>
<string name="poi_consulate_filter">Konsolosluk</string> <string name="poi_consulate_filter">Konsolosluk</string>
<string name="poi_embassy_filter">Büyük elçilik</string> <string name="poi_embassy_filter">Büyük elçilik</string>
<string name="poi_diplomatic_services_citizen_services_filter">Vatandaş hizmetleri</string>
<string name="poi_diplomatic_services_immigrant_visas_filter">Göçmen vizeleri</string>
<string name="poi_diplomatic_services_non_immigrant_visas_filter">Göçmen olmayan vizeleri</string>
</resources> </resources>

View file

@ -3543,7 +3543,7 @@
<string name="shared_string_circle">Daire</string> <string name="shared_string_circle">Daire</string>
<string name="shared_string_octagon">Sekizgen</string> <string name="shared_string_octagon">Sekizgen</string>
<string name="shared_string_square">Kare</string> <string name="shared_string_square">Kare</string>
<string name="shared_string_min">Min</string> <string name="shared_string_min">Asgari</string>
<string name="replace_point_descr">Başka bir noktayı bununla değiştirin.</string> <string name="replace_point_descr">Başka bir noktayı bununla değiştirin.</string>
<string name="app_mode_ski_touring">Kayak turu</string> <string name="app_mode_ski_touring">Kayak turu</string>
<string name="app_mode_ski_snowmobile">Kar arabası</string> <string name="app_mode_ski_snowmobile">Kar arabası</string>
@ -3903,13 +3903,13 @@
<string name="icon_group_emergency">Acil</string> <string name="icon_group_emergency">Acil</string>
<string name="icon_group_travel">Seyahat</string> <string name="icon_group_travel">Seyahat</string>
<string name="message_you_need_add_two_points_to_show_graphs">En az iki nokta eklemelisiniz</string> <string name="message_you_need_add_two_points_to_show_graphs">En az iki nokta eklemelisiniz</string>
<string name="login_open_street_map">OpenStreetMap için oturum aç</string> <string name="login_open_street_map">OpenStreetMap\'te oturum aç</string>
<string name="login_open_street_map_org">OpenStreetMap.org için oturum aç</string> <string name="login_open_street_map_org">OpenStreetMap.org\'da oturum aç</string>
<string name="open_street_map_login_mode">Yenilikleri veya değişiklikleri karşıya yüklemek için oturum açın, <string name="open_street_map_login_mode">Yenilikleri veya değişiklikleri karşıya yüklemek için oturum açmanız gerekir.
\n \n
\nOAuth ile oturum açabilir veya kullanıcı adı ve parolanızı kullanabilirsiniz.</string> \nGüvenli OAuth yöntemini kullanarak oturum açabilir veya giriş bilgilerinizi ve parolanızı kullanabilirsiniz.</string>
<string name="use_login_password">Kullanıcı adı ve parola ile oturum aç</string> <string name="use_login_password">Giriş bilgisi ve parola kullan</string>
<string name="user_login">Kullanıcı adı</string> <string name="user_login">Giriş bilgisi</string>
<string name="login_account">Hesap</string> <string name="login_account">Hesap</string>
<string name="manage_subscription">Aboneliği yönet</string> <string name="manage_subscription">Aboneliği yönet</string>
<string name="subscription_payment_issue_title">Aboneliğinizle ilgili bir sorun var. Ödeme yönteminizi düzeltmek üzere Google Play abonelik ayarlarına gitmek için düğmeye tıklayın.</string> <string name="subscription_payment_issue_title">Aboneliğinizle ilgili bir sorun var. Ödeme yönteminizi düzeltmek üzere Google Play abonelik ayarlarına gitmek için düğmeye tıklayın.</string>
@ -3926,11 +3926,11 @@
<string name="gpx_upload_trackable_visibility_descr">\"Takip edilebilir\", izlemenin herkese açık herhangi bir listede gösterilmediği, ancak (sizinle doğrudan ilişkilendirilemeyen) zaman damgaları olan işlenen izleme noktalarının herkese açık GPS API\'sinden indirmeler yoluyla göründüğü anlamına gelir.</string> <string name="gpx_upload_trackable_visibility_descr">\"Takip edilebilir\", izlemenin herkese açık herhangi bir listede gösterilmediği, ancak (sizinle doğrudan ilişkilendirilemeyen) zaman damgaları olan işlenen izleme noktalarının herkese açık GPS API\'sinden indirmeler yoluyla göründüğü anlamına gelir.</string>
<string name="osm_edit_close_note">OSM Notunu Kapat</string> <string name="osm_edit_close_note">OSM Notunu Kapat</string>
<string name="osm_edit_comment_note">OSM Notuna Yorum Yap</string> <string name="osm_edit_comment_note">OSM Notuna Yorum Yap</string>
<string name="osm_login_descr">Güvenli OAuth yöntemini kullanarak oturum açın veya kullanıcı adınızı ve parolanızı kullanın.</string> <string name="osm_login_descr">Güvenli OAuth yöntemini kullanarak oturum açabilir veya giriş bilgilerinizi ve parolanızı kullanabilirsiniz.</string>
<string name="shared_string_add_photo">Fotoğraf ekle</string> <string name="shared_string_add_photo">Fotoğraf ekle</string>
<string name="register_on_openplacereviews">OpenPlaceReviews.org\'a <string name="register_on_openplacereviews">OpenPlaceReviews.org\'a
\nkaydolun</string> \nkaydolun</string>
<string name="register_on_openplacereviews_desc">Daha da fazla fotoğraf yüklemek için açık veri projesi web sitesi OpenPlaceReviews.org\'da oturum açın.</string> <string name="register_on_openplacereviews_desc">Fotoğraflar açık veri projesi OpenPlaceReviews.org tarafından sağlanmaktadır. Fotoğraflarınızı yüklemek için web sitesine kaydolmanız gerekir.</string>
<string name="register_opr_create_new_account">Yeni hesap oluştur</string> <string name="register_opr_create_new_account">Yeni hesap oluştur</string>
<string name="register_opr_have_account">Zaten bir hesabım var</string> <string name="register_opr_have_account">Zaten bir hesabım var</string>
<string name="shared_string_search_history">Arama geçmişi</string> <string name="shared_string_search_history">Arama geçmişi</string>
@ -3952,4 +3952,10 @@
<string name="select_items_for_import">İçe aktarılacak ögeleri seçin.</string> <string name="select_items_for_import">İçe aktarılacak ögeleri seçin.</string>
<string name="use_dev_url_descr">OSM Notu/POI/GPX yüklemeyi test etmek için openstreetmap.org yerine dev.openstreetmap.org kullanmaya geçin.</string> <string name="use_dev_url_descr">OSM Notu/POI/GPX yüklemeyi test etmek için openstreetmap.org yerine dev.openstreetmap.org kullanmaya geçin.</string>
<string name="use_dev_url">dev.openstreetmap.org\'u kullan</string> <string name="use_dev_url">dev.openstreetmap.org\'u kullan</string>
<string name="lang_de_casual">Almanca (gündelik)</string>
<string name="cannot_upload_image">Resim yüklenemiyor, lütfen daha sonra tekrar deneyin</string>
<string name="select_picture">Resim seç</string>
<string name="ltr_or_rtl_combine_via_star">%1$s * %2$s</string>
<string name="elevation_data">Yolculuğunuzun Çıkış / İniş değerleri için Yükseklik verilerini kullanabilirsiniz</string>
<string name="app_mode_light_aircraft">Hafif uçak</string>
</resources> </resources>

View file

@ -187,6 +187,17 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
// 8dp is the shadow height // 8dp is the shadow height
boolean showTopShadow = screenHeight - statusBarHeight - mainView.getHeight() >= AndroidUtils.dpToPx(activity, 8); boolean showTopShadow = screenHeight - statusBarHeight - mainView.getHeight() >= AndroidUtils.dpToPx(activity, 8);
drawTopShadow(showTopShadow);
}
});
}
protected void drawTopShadow(boolean showTopShadow) {
final Activity activity = getActivity();
View mainView = getView();
if (activity == null || mainView == null) {
return;
}
if (AndroidUiHelper.isOrientationPortrait(activity)) { if (AndroidUiHelper.isOrientationPortrait(activity)) {
AndroidUtils.setBackground(mainView, showTopShadow ? getPortraitBg(activity) : getColoredBg(activity)); AndroidUtils.setBackground(mainView, showTopShadow ? getPortraitBg(activity) : getColoredBg(activity));
if (!showTopShadow) { if (!showTopShadow) {
@ -196,8 +207,6 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
AndroidUtils.setBackground(mainView, showTopShadow ? getLandscapeTopsidesBg(activity) : getLandscapeSidesBg(activity)); AndroidUtils.setBackground(mainView, showTopShadow ? getLandscapeTopsidesBg(activity) : getLandscapeSidesBg(activity));
} }
} }
});
}
private int getContentHeight(int availableScreenHeight) { private int getContentHeight(int availableScreenHeight) {
int customHeight = getCustomHeight(); int customHeight = getCustomHeight();

View file

@ -281,24 +281,23 @@ public class MeasurementEditingContext {
} }
public boolean isApproximationNeeded() { public boolean isApproximationNeeded() {
boolean hasDefaultPoints = false; boolean hasDefaultPointsOnly = false;
boolean newData = isNewData(); boolean newData = isNewData();
if (!newData) { if (!newData) {
List<WptPt> points = getPoints(); List<WptPt> points = getPoints();
WptPt prevPoint = null; hasDefaultPointsOnly = true;
for (WptPt point : points) { for (WptPt point : points) {
if (!point.hasProfile() && (prevPoint == null || !prevPoint.hasProfile())) { if (point.hasProfile()) {
hasDefaultPoints = true; hasDefaultPointsOnly = false;
break; break;
} }
prevPoint = point;
} }
} }
return !newData && hasDefaultPoints && getPoints().size() > 2; return !newData && hasDefaultPointsOnly && getPoints().size() > 2;
} }
public boolean isSelectionNeedApproximation() { public boolean isSelectionNeedApproximation() {
boolean hasDefaultPoints = false; boolean hasDefaultPointsOnly = false;
boolean newData = isNewData(); boolean newData = isNewData();
if (!newData && selectedPointPosition != -1) { if (!newData && selectedPointPosition != -1) {
WptPt selectedPoint = getPoints().get(selectedPointPosition); WptPt selectedPoint = getPoints().get(selectedPointPosition);
@ -309,18 +308,17 @@ public class MeasurementEditingContext {
points = segment.points; points = segment.points;
} }
} }
WptPt prevPoint = null; if (!Algorithms.isEmpty(points)) {
if (points != null) { hasDefaultPointsOnly = true;
for (WptPt point : points) { for (WptPt point : points) {
if (!point.hasProfile() && (prevPoint == null || !prevPoint.hasProfile())) { if (point.hasProfile()) {
hasDefaultPoints = true; hasDefaultPointsOnly = false;
break; break;
} }
prevPoint = point;
} }
} }
} }
return !newData && hasDefaultPoints && getPoints().size() > 2; return !newData && hasDefaultPointsOnly && getPoints().size() > 2;
} }
public void clearSnappedToRoadPoints() { public void clearSnappedToRoadPoints() {
@ -625,7 +623,7 @@ public class MeasurementEditingContext {
WptPt startPoint = points.get(i); WptPt startPoint = points.get(i);
WptPt endPoint = points.get(i + 1); WptPt endPoint = points.get(i + 1);
Pair<WptPt, WptPt> pair = new Pair<>(startPoint, endPoint); Pair<WptPt, WptPt> pair = new Pair<>(startPoint, endPoint);
if (roadSegmentData.get(pair) == null && startPoint.hasProfile()) { if (roadSegmentData.get(pair) == null && (startPoint.hasProfile() || hasRoute())) {
res.add(pair); res.add(pair);
} }
} }

View file

@ -1,5 +1,6 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import net.osmand.data.LatLon;
import net.osmand.osm.edit.Entity; import net.osmand.osm.edit.Entity;
import net.osmand.osm.edit.OSMSettings.OSMTagKey; import net.osmand.osm.edit.OSMSettings.OSMTagKey;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -97,4 +98,43 @@ public class OpenstreetmapPoint extends OsmPoint {
.append(" (").append(this.getLatitude()).append(", ").append(this.getLongitude()) .append(" (").append(this.getLatitude()).append(", ").append(this.getLongitude())
.append(")]").toString(); .append(")]").toString();
} }
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof OpenstreetmapPoint)) {
return false;
}
OpenstreetmapPoint otherPoint = (OpenstreetmapPoint) other;
boolean res = this.getName() != null && this.getName().equals(otherPoint.getName());
LatLon thisLatLon = new LatLon(this.getLatitude(), this.getLongitude());
LatLon otherLatLon = new LatLon(otherPoint.getLatitude(), otherPoint.getLongitude());
res = res || thisLatLon.equals(otherLatLon);
if (getType() != null)
res = res || getType().equals(otherPoint.getType());
if (getSubtype() != null)
res = res || getSubtype().equals(otherPoint.getSubtype());
if (getTagsString() != null)
res = res || getTagsString().equals(otherPoint.getTagsString());
res = res || getId() == otherPoint.getId();
return res;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 0;
int temp;
temp = (int) Math.floor(getLatitude() * 10000);
result = prime * result + temp;
temp = (int) Math.floor(getLongitude() * 10000);
result = prime * result + temp;
result = prime * result + (getType() != null ? getType().hashCode() : 0);
result = prime * result + (getSubtype() != null ? getSubtype().hashCode() : 0);
result = prime * result + (getTagsString() != null ? getTagsString().hashCode() : 0);
result = prime * result + Long.valueOf(getId()).hashCode();
return result;
}
} }

View file

@ -1,5 +1,7 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import net.osmand.data.LatLon;
public class OsmNotesPoint extends OsmPoint { public class OsmNotesPoint extends OsmPoint {
private static final long serialVersionUID = 729654300829771468L; private static final long serialVersionUID = 729654300829771468L;
@ -68,4 +70,29 @@ public class OsmNotesPoint extends OsmPoint {
.append(" (").append(this.getLatitude()).append(", ").append(this.getLongitude()) .append(" (").append(this.getLatitude()).append(", ").append(this.getLongitude())
.append(")]").toString(); .append(")]").toString();
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof OsmNotesPoint)) return false;
OsmNotesPoint that = (OsmNotesPoint) o;
LatLon thisPos = new LatLon(latitude, longitude);
LatLon thatPos = new LatLon(that.latitude, that.longitude);
boolean res = thisPos.equals(thatPos);
res = res || text != null && text.equals(that.text);
return res;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 0;
int temp;
temp = (int) Math.floor(latitude * 10000);
result = prime * result + temp;
temp = (int) Math.floor(longitude * 10000);
result = prime * result + temp;
result = prime * result + (text != null ? text.hashCode() : 0);
return result;
}
} }

View file

@ -2,12 +2,10 @@ package net.osmand.plus.osmedit.dialogs;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ScrollView; import android.widget.ScrollView;
@ -57,6 +55,9 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
private TextInputEditText tagsField; private TextInputEditText tagsField;
private TextInputEditText messageField; private TextInputEditText messageField;
private int contentHeightPrevious = 0; private int contentHeightPrevious = 0;
private int buttonsHeight;
private int shadowHeight;
private ScrollView scrollView;
public void setGpxInfos(GpxInfo[] gpxInfos) { public void setGpxInfos(GpxInfo[] gpxInfos) {
this.gpxInfos = gpxInfos; this.gpxInfos = gpxInfos;
@ -136,26 +137,18 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
Rect visibleDisplayFrame = new Rect(); Rect visibleDisplayFrame = new Rect();
int buttonsHeight = getResources().getDimensionPixelSize(R.dimen.dialog_button_ex_max_width); buttonsHeight = getResources().getDimensionPixelSize(R.dimen.dialog_button_ex_max_width);
int shadowHeight = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_top_shadow_height); shadowHeight = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_top_shadow_height);
final ScrollView scrollView = getView().findViewById(R.id.scroll_view); scrollView = getView().findViewById(R.id.scroll_view);
scrollView.getWindowVisibleDisplayFrame(visibleDisplayFrame); scrollView.getWindowVisibleDisplayFrame(visibleDisplayFrame);
int height = scrollView.getHeight(); int viewHeight = scrollView.getHeight();
int contentHeight = visibleDisplayFrame.bottom - visibleDisplayFrame.top - buttonsHeight; int contentHeight = visibleDisplayFrame.bottom - visibleDisplayFrame.top - buttonsHeight;
if (contentHeightPrevious != contentHeight || contentHeight < height) { if (contentHeightPrevious != contentHeight) {
if (scrollView.getHeight() + shadowHeight > contentHeight) { boolean showTopShadow;
scrollView.getLayoutParams().height = contentHeight; showTopShadow = viewHeight + shadowHeight < contentHeight;
} else {
scrollView.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
}
scrollView.requestLayout(); scrollView.requestLayout();
int delay = Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP ? 300 : 1000;
scrollView.postDelayed(new Runnable() {
public void run() {
scrollView.scrollTo(0, scrollView.getHeight());
}
}, delay);
contentHeightPrevious = contentHeight; contentHeightPrevious = contentHeight;
drawTopShadow(showTopShadow);
} }
} }
}; };

View file

@ -74,22 +74,25 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem<OpenstreetmapPo
if (!newItems.isEmpty() || !duplicateItems.isEmpty()) { if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
appliedItems = new ArrayList<>(newItems); appliedItems = new ArrayList<>(newItems);
for (OpenstreetmapPoint duplicate : duplicateItems) {
appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
}
}
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
if (osmEditingPlugin != null) { if (osmEditingPlugin != null) {
OpenstreetmapsDbHelper db = osmEditingPlugin.getDBPOI(); OpenstreetmapsDbHelper db = osmEditingPlugin.getDBPOI();
for (OpenstreetmapPoint duplicate : duplicateItems) {
db.deletePOI(duplicate);
db.addOpenstreetmap(duplicate);
}
for (OpenstreetmapPoint point : appliedItems) { for (OpenstreetmapPoint point : appliedItems) {
db.addOpenstreetmap(point); db.addOpenstreetmap(point);
} }
} }
}
} }
@Override @Override
public boolean isDuplicate(@NonNull OpenstreetmapPoint item) { public boolean isDuplicate(@NonNull OpenstreetmapPoint item) {
return false; return existingItems.contains(item);
} }
@NonNull @NonNull
@ -115,6 +118,11 @@ public class OsmEditsSettingsItem extends CollectionSettingsItem<OpenstreetmapPo
return true; return true;
} }
@Override
public boolean shouldShowDuplicates() {
return false;
}
@Override @Override
void readItemsFromJson(@NonNull JSONObject json) throws IllegalArgumentException { void readItemsFromJson(@NonNull JSONObject json) throws IllegalArgumentException {
try { try {

View file

@ -22,7 +22,6 @@ import java.util.List;
public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint> { public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint> {
public static final String ID_KEY = "id";
public static final String TEXT_KEY = "text"; public static final String TEXT_KEY = "text";
public static final String LAT_KEY = "lat"; public static final String LAT_KEY = "lat";
public static final String LON_KEY = "lon"; public static final String LON_KEY = "lon";
@ -63,12 +62,20 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
if (!newItems.isEmpty() || !duplicateItems.isEmpty()) { if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
appliedItems = new ArrayList<>(newItems); appliedItems = new ArrayList<>(newItems);
for (OsmNotesPoint duplicate : duplicateItems) {
appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
}
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
if (osmEditingPlugin != null) { if (osmEditingPlugin != null) {
OsmBugsDbHelper db = osmEditingPlugin.getDBBug(); OsmBugsDbHelper db = osmEditingPlugin.getDBBug();
for (OsmNotesPoint duplicate : duplicateItems) {
int ind = existingItems.indexOf(duplicate);
if (ind != -1 && ind < existingItems.size()) {
OsmNotesPoint original = existingItems.get(ind);
if (original != null) {
db.deleteAllBugModifications(original);
}
db.addOsmbugs(duplicate);
}
}
for (OsmNotesPoint point : appliedItems) { for (OsmNotesPoint point : appliedItems) {
db.addOsmbugs(point); db.addOsmbugs(point);
} }
@ -78,7 +85,7 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
@Override @Override
public boolean isDuplicate(@NonNull OsmNotesPoint item) { public boolean isDuplicate(@NonNull OsmNotesPoint item) {
return false; return existingItems.contains(item);
} }
@NonNull @NonNull
@ -104,16 +111,23 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
return true; return true;
} }
@Override
public boolean shouldShowDuplicates() {
return false;
}
@Override @Override
void readItemsFromJson(@NonNull JSONObject json) throws IllegalArgumentException { void readItemsFromJson(@NonNull JSONObject json) throws IllegalArgumentException {
try { try {
if (!json.has("items")) { if (!json.has("items")) {
return; return;
} }
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
long minId = osmEditingPlugin != null ? osmEditingPlugin.getDBBug().getMinID() - 1 : -2;
int idOffset = 0;
JSONArray jsonArray = json.getJSONArray("items"); JSONArray jsonArray = json.getJSONArray("items");
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i); JSONObject object = jsonArray.getJSONObject(i);
long id = object.getLong(ID_KEY);
String text = object.optString(TEXT_KEY); String text = object.optString(TEXT_KEY);
double lat = object.getDouble(LAT_KEY); double lat = object.getDouble(LAT_KEY);
double lon = object.getDouble(LON_KEY); double lon = object.getDouble(LON_KEY);
@ -121,13 +135,14 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
author = author.isEmpty() ? null : author; author = author.isEmpty() ? null : author;
String action = object.getString(ACTION_KEY); String action = object.getString(ACTION_KEY);
OsmNotesPoint point = new OsmNotesPoint(); OsmNotesPoint point = new OsmNotesPoint();
point.setId(id); point.setId(Math.min(-2, minId - idOffset));
point.setText(text); point.setText(text);
point.setLatitude(lat); point.setLatitude(lat);
point.setLongitude(lon); point.setLongitude(lon);
point.setAuthor(author); point.setAuthor(author);
point.setAction(action); point.setAction(action);
items.add(point); items.add(point);
idOffset++;
} }
} catch (JSONException e) { } catch (JSONException e) {
warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType()))); warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType())));
@ -142,7 +157,6 @@ public class OsmNotesSettingsItem extends CollectionSettingsItem<OsmNotesPoint>
try { try {
for (OsmNotesPoint point : items) { for (OsmNotesPoint point : items) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put(ID_KEY, point.getId());
jsonObject.put(TEXT_KEY, point.getText()); jsonObject.put(TEXT_KEY, point.getText());
jsonObject.put(LAT_KEY, point.getLatitude()); jsonObject.put(LAT_KEY, point.getLatitude());
jsonObject.put(LON_KEY, point.getLongitude()); jsonObject.put(LON_KEY, point.getLongitude());

View file

@ -1,7 +1,6 @@
package net.osmand.plus.settings.bottomsheets; package net.osmand.plus.settings.bottomsheets;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -23,13 +22,11 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter; import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.fragments.ApplyQueryType; import net.osmand.plus.settings.fragments.ApplyQueryType;
@ -52,6 +49,9 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet {
private float currentValue; private float currentValue;
private int contentHeightPrevious = 0; private int contentHeightPrevious = 0;
private EditText text; private EditText text;
private int buttonsHeight;
private int shadowHeight;
private ScrollView scrollView;
@Override @Override
public void createMenuItems(Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
@ -164,13 +164,13 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet {
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
Rect visibleDisplayFrame = new Rect(); Rect visibleDisplayFrame = new Rect();
int buttonsHeight = getResources().getDimensionPixelSize(R.dimen.dialog_button_ex_height); buttonsHeight = getResources().getDimensionPixelSize(R.dimen.dialog_button_ex_height);
int shadowHeight = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_top_shadow_height); shadowHeight = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_top_shadow_height);
final ScrollView scrollView = getView().findViewById(R.id.scroll_view); scrollView = getView().findViewById(R.id.scroll_view);
scrollView.getWindowVisibleDisplayFrame(visibleDisplayFrame); scrollView.getWindowVisibleDisplayFrame(visibleDisplayFrame);
boolean showTopShadow;
int contentHeight = visibleDisplayFrame.bottom - visibleDisplayFrame.top - buttonsHeight; int contentHeight = visibleDisplayFrame.bottom - visibleDisplayFrame.top - buttonsHeight;
if (contentHeightPrevious != contentHeight) { if (contentHeightPrevious != contentHeight) {
boolean showTopShadow;
if (scrollView.getHeight() + shadowHeight > contentHeight) { if (scrollView.getHeight() + shadowHeight > contentHeight) {
scrollView.getLayoutParams().height = contentHeight; scrollView.getLayoutParams().height = contentHeight;
showTopShadow = false; showTopShadow = false;
@ -189,22 +189,6 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet {
drawTopShadow(showTopShadow); drawTopShadow(showTopShadow);
} }
} }
private void drawTopShadow(boolean showTopShadow) {
final Activity activity = getActivity();
View mainView = getView();
if (activity == null || mainView == null) {
return;
}
if (AndroidUiHelper.isOrientationPortrait(activity)) {
AndroidUtils.setBackground(mainView, showTopShadow ? getPortraitBg(activity) : getColoredBg(activity));
if (!showTopShadow) {
mainView.setPadding(0, 0, 0, 0);
}
} else {
AndroidUtils.setBackground(mainView, showTopShadow ? getLandscapeTopsidesBg(activity) : getLandscapeSidesBg(activity));
}
}
}; };
} }