Merge pull request #10818 from osmandapp/master

update test branch
This commit is contained in:
Hardy 2021-02-10 00:25:40 +01:00 committed by GitHub
commit c2a2c6dcd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 732 additions and 300 deletions

View file

@ -25,6 +25,24 @@ public class ALocation extends AidlParams {
private ALocation() {
}
public ALocation(double latitude, double longitude, long time, boolean hasAltitude, double altitude,
boolean hasSpeed, float speed, boolean hasBearing, float bearing,
boolean hasAccuracy, float accuracy, boolean hasVerticalAccuracy, float verticalAccuracy) {
this.latitude = latitude;
this.longitude = longitude;
this.time = time;
this.hasAltitude = hasAltitude;
this.altitude = altitude;
this.hasSpeed = hasSpeed;
this.speed = speed;
this.hasBearing = hasBearing;
this.bearing = bearing;
this.hasAccuracy = hasAccuracy;
this.accuracy = accuracy;
this.hasVerticalAccuracy = hasVerticalAccuracy;
this.verticalAccuracy = verticalAccuracy;
}
public ALocation(Parcel in) {
readFromParcel(in);
}

View file

@ -1255,6 +1255,10 @@ public class GPXUtilities {
return g;
}
public boolean containsRoutePoint(WptPt point) {
return getRoutePoints().contains(point);
}
public List<WptPt> getRoutePoints() {
List<WptPt> points = new ArrayList<>();
for (int i = 0; i < routes.size(); i++) {

View file

@ -1,17 +1,32 @@
package net.osmand.osm;
public enum RouteActivityType {
WATER("Water", "yellow"), WINTER("Winter", "yellow"), SNOWMOBILE("Snowmobile", "yellow"), RIDING("Riding", "yellow"), RACING("Racing", "yellow"),
MOUNTAINBIKE("Mountainbike", "blue"), CYCLING("Cycling", "blue"),
HIKING("Hiking", "orange"), RUNNING("Running", "orange"), WALKING("Walking", "orange"),
OFFROAD("Off-road", "yellow"),
MOTORBIKE("Motorbike", "green"), CAR("Car", "green");
// less specific bottom order
import java.util.ArrayList;
import java.util.List;
public class RouteActivityType {
private static final List<RouteActivityType> values = new ArrayList<>();
public static final String DEFAULT_ICON = "special_marker";
public static final String DEFAULT_COLOR = "orange";
public static final RouteActivityType WATER = createType("water", "yellow").icon("special_kayak").reg();
public static final RouteActivityType WINTER = createType("winter", "yellow").icon("special_skiing").reg();
public static final RouteActivityType SNOWMOBILE = createType("snowmobile", "yellow").icon("special_snowmobile").reg();
public static final RouteActivityType RIDING = createType("riding", "yellow").icon("special_horse").reg();
public static final RouteActivityType RACING = createType("racing", "yellow").icon("raceway").reg();
public static final RouteActivityType MOUNTAINBIKE = createType("mountainbike", "blue").icon("sport_cycling").reg();
public static final RouteActivityType CYCLING = createType("cycling", "blue").icon("special_bicycle").reg();
public static final RouteActivityType HIKING = createType("hiking", "orange").icon("special_trekking").reg();
public static final RouteActivityType RUNNING = createType("running", "orange").icon("running").reg();
public static final RouteActivityType WALKING = createType("walking", "orange").icon("special_walking").reg();
public static final RouteActivityType OFFROAD = createType("offroad", "yellow").icon("special_offroad").reg();
public static final RouteActivityType MOTORBIKE = createType("motorbike", "green").icon("special_motorcycle").reg();
public static final RouteActivityType CAR = createType("car", "green").icon("shop_car").reg();
// less specific bottom order
String name;
String color;
String icon;
private RouteActivityType(String nm, String clr) {
RouteActivityType(String nm, String clr) {
this.name = nm;
this.color = clr;
}
@ -24,12 +39,31 @@ public enum RouteActivityType {
return color;
}
public String getIcon() {
return icon;
}
public static RouteActivityType getOrCreateTypeFromName(String name) {
for (RouteActivityType rat : values) {
if (rat.name.equalsIgnoreCase(name)) {
return rat;
}
}
return createType(name.toLowerCase(), DEFAULT_COLOR).icon(DEFAULT_ICON).reg();
}
private static RouteActivityTypeBuilder createType(String name, String color) {
RouteActivityTypeBuilder builder = new RouteActivityTypeBuilder();
builder.routeActivityType = new RouteActivityType(name, color);
return builder;
}
public static RouteActivityType getTypeFromTags(String[] tags) {
RouteActivityType activityType = null;
for (String tg : tags) {
RouteActivityType rat = RouteActivityType.convertFromOsmGPXTag(tg);
if (rat != null) {
if (activityType == null || activityType.ordinal() > rat.ordinal()) {
if (activityType == null || values.indexOf(activityType) > values.indexOf(rat)) {
activityType = rat;
}
}
@ -215,4 +249,18 @@ public enum RouteActivityType {
return null;
}
public static class RouteActivityTypeBuilder {
private RouteActivityType routeActivityType;
public RouteActivityTypeBuilder icon(String icon) {
routeActivityType.icon = icon;
return this;
}
private RouteActivityType reg() {
values.add(routeActivityType);
return routeActivityType;
}
}
}

View file

@ -202,8 +202,6 @@ public class EntityParser {
return amenitiesList;
}
private static boolean checkAmenitiesToAdd(Amenity a, List<Amenity> amenitiesList){
// check amenity for duplication
for(Amenity b : amenitiesList){

View file

@ -36,7 +36,7 @@
<string name="shared_string_close">Κλείσιμο</string>
<string name="shared_string_off">Ανενεργό</string>
<string name="shared_string_install">Εγκατάσταση</string>
<string name="shared_string_share">Διαμοιρασμός</string>
<string name="shared_string_share">Κοινοποίηση</string>
<string name="shared_string_back">Προηγούμενο</string>
<string name="shared_string_continue">Συνέχεια</string>
<string name="shared_string_cancel">Ακύρωση</string>

2
OsmAnd/.gitignore vendored
View file

@ -39,8 +39,6 @@ mx_*
valgrind/
bin/
dist/
res/values/no_translate.xml
res/values/skip_translate.xml
assets/specialphrases/*
assets/voice/*
assets/fonts/*

View file

@ -4,7 +4,7 @@
<application
android:icon="@mipmap/icon_free"
android:label="@string/app_name_free"
android:label="OsmAnd — Offline Maps &amp; GPS Navigation"
tools:replace="android:icon, android:label">
<meta-data

View file

@ -40,9 +40,6 @@
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="com.sec.feature.spen_usp" android:required="false"/>
<uses-sdk android:targetSdkVersion="26"
tools:overrideLibrary="com.getkeepsafe.taptargetview, studio.carbonylgroup.textfieldboxes, android.support.customtabs"/>
<supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"
android:xlargeScreens="true" android:anyDensity="true" />

View file

@ -5,9 +5,6 @@
<application
android:icon="@mipmap/icon_nightly"
tools:replace="android:icon">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="fb792288460976727"/>
<activity
android:name="net.osmand.plus.activities.MapActivity"
android:theme="@style/FirstSplashScreenNightlyFree"

View file

@ -106,15 +106,6 @@ android {
}
}
task updateNoTranslate(type: Copy) {
from('.') {
include 'no_translate.xml'
filter {
line -> replaceNoTranslate(line);
}
}
into 'res/values/'
}
task validateTranslate {
println "Validating translations"
@ -147,10 +138,6 @@ task collectVoiceAssets(type: Sync) {
include "**/*.js"
}
task cleanNoTranslate(type: Delete) {
delete('res/values/no_translate.xml')
}
task collectFonts(type: Copy) {
from "../../resources/fonts"
from "../../resources/rendering_styles/fonts"
@ -262,7 +249,6 @@ task collectExternalResources {
copyMapShaderIcons,
copyMapPOIIcons,
copyLargePOIIcons,
updateNoTranslate,
validateTranslate,
copyWidgetIcons,
copyWidgetIconsHdpi,

View file

@ -28,10 +28,6 @@ android {
}
}
def replaceNoTranslate(line) {
return line;
}
afterEvaluate {
android.libraryVariants.all { variant ->
variant.javaCompiler.dependsOn(collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore)

View file

@ -36,9 +36,9 @@ android {
defaultConfig {
minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 15
versionCode 390
versionCode 400
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
versionName "3.9.0"
versionName "4.0.0"
versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName
}
@ -105,31 +105,45 @@ android {
nightlyFree {
dimension "version"
applicationId "net.osmand.dev"
resValue "string", "app_name", "OsmAnd Nightly"
resValue "string", "app_edition", System.getenv("APP_EDITION") ? System.getenv("APP_EDITION") : ""
// resConfig "en"
}
androidFull {
dimension "version"
applicationId "net.osmand.plus"
resValue "string", "app_name", "OsmAnd~"
resValue "string", "app_edition", System.getenv("APP_EDITION") ? System.getenv("APP_EDITION") : ""
}
gplayFree {
dimension "version"
applicationId "net.osmand"
resValue "string", "app_name", "OsmAnd"
resValue "string", "app_edition", System.getenv("APP_EDITION") ? System.getenv("APP_EDITION") : ""
}
gplayFull {
dimension "version"
applicationId "net.osmand.plus"
resValue "string", "app_name", "OsmAnd+"
resValue "string", "app_edition", System.getenv("APP_EDITION") ? System.getenv("APP_EDITION") : ""
}
amazonFree {
dimension "version"
applicationId "net.osmand"
resValue "string", "app_name", "OsmAnd"
resValue "string", "app_edition", ""
}
amazonFull {
dimension "version"
applicationId "net.osmand.plus"
resValue "string", "app_name", "OsmAnd+"
resValue "string", "app_edition", ""
}
huawei {
dimension "version"
applicationId "net.osmand.huawei"
resValue "string", "app_name", "OsmAnd"
resValue "string", "app_edition", ""
}
// Build that includes 3D OpenGL release
@ -156,19 +170,6 @@ android {
}
def replaceNoTranslate(line) {
if (line.contains("\"app_name\"") && System.getenv("TARGET_APP_NAME")) {
return line.replaceAll(">[^<]*<", ">" + System.getenv("TARGET_APP_NAME") + "<")
}
if (line.contains("\"app_name_free\"") && System.getenv("TARGET_APP_NAME")) {
return line.replaceAll(">[^<]*<", ">" + System.getenv("TARGET_APP_NAME") + "<")
}
if (line.contains("\"app_edition\"") && System.getenv("APP_EDITION")) {
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_EDITION") + "<")
}
return line;
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompiler.dependsOn(collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore)

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/wikivoyage_card_bg_dark" android:state_selected="false" />
<item android:drawable="@drawable/navigation_item_active_bg_dark" android:state_selected="true" />
</selector>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/wikivoyage_card_bg_light" android:state_selected="false" />
<item android:drawable="@drawable/navigation_item_active_bg_light" android:state_selected="true" />
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/active_color_primary_dark" />
</shape>
</item>
<item android:top="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/wikivoyage_card_bg_dark" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/active_color_primary_light" />
</shape>
</item>
<item android:top="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/wikivoyage_card_bg_light" />
</shape>
</item>
</layer-list>

View file

@ -6,6 +6,22 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:ellipsize="end"
android:letterSpacing="@dimen/description_letter_spacing"
android:maxLines="2"
android:minHeight="@dimen/default_desc_line_height"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:lineHeight="@dimen/default_desc_line_height"
osmand:typeface="@string/font_roboto_regular"
tools:text="Amsterdam is the Netherlands' capital and financial, cultural and creative centre with more" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_overview"
android:layout_width="match_parent"

View file

@ -125,6 +125,49 @@
</LinearLayout>
<LinearLayout
android:id="@+id/back_button_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:background="?attr/flow_toolbar_bg"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/setting_list_item_small_height"
android:orientation="horizontal"
android:paddingStart="@dimen/content_padding_half"
android:paddingLeft="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_small"
android:paddingRight="@dimen/content_padding_small">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/back_button_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:tint="?attr/active_color_basic"
osmand:srcCompat="@drawable/ic_arrow_back" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/back_button_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?attr/active_color_basic"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/shared_string_tracks" />
</LinearLayout>
</LinearLayout>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/context_menu_toolbar_container"
android:layout_width="match_parent"
@ -206,7 +249,7 @@
android:layout_height="@dimen/context_menu_action_buttons_height"
android:layout_gravity="bottom"
android:background="?attr/wikivoyage_card_bg_color"
osmand:itemBackground="?attr/wikivoyage_card_bg_color"
osmand:itemBackground="?attr/bottom_navigation_item_background"
osmand:itemIconTint="@color/bottom_navigation_color_selector_light"
osmand:itemTextColor="@color/bottom_navigation_color_selector_light"
osmand:labelVisibilityMode="labeled"

View file

@ -139,31 +139,83 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_small">
<LinearLayout
android:id="@+id/user_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/btn_border_bg"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginStart="@dimen/content_padding_half">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/user_icon"
android:layout_width="@dimen/poi_icon_size"
android:layout_height="@dimen/poi_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding_small_half"
android:layout_marginStart="@dimen/content_padding_small_half"
android:contentDescription="@string/shared_string_icon"
tools:src="@drawable/ic_action_user_account_16" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_border_bg_light"
android:gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="@dimen/subHeaderPadding"
android:paddingBottom="@dimen/subHeaderPadding"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingLeft="@dimen/content_padding_small_half"
android:paddingRight="@dimen/content_padding_small_half"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
android:drawablePadding="@dimen/content_padding_small_half"
android:drawableStart="@drawable/ic_action_user_account_16"
android:drawableLeft="@drawable/ic_action_user_account_16"
tools:drawableTint="?attr/wikivoyage_active_color"
tools:text="Lorem Ipsum" />
tools:text="@string/mapillary_menu_title_username" />
</LinearLayout>
<LinearLayout
android:id="@+id/activity_type_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/btn_border_bg"
android:visibility="gone"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginStart="@dimen/content_padding_half">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/activity_type_icon"
android:layout_width="@dimen/poi_icon_size"
android:layout_height="@dimen/poi_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding_small_half"
android:layout_marginStart="@dimen/content_padding_small_half"
android:contentDescription="@string/shared_string_icon"
tools:src="@drawable/ic_action_bicycle_dark" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/activity_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="@dimen/subHeaderPadding"
android:paddingBottom="@dimen/subHeaderPadding"
android:paddingLeft="@dimen/content_padding_small_half"
android:paddingRight="@dimen/content_padding_small_half"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:drawableTint="?attr/wikivoyage_active_color"
tools:text="@string/shared_string_profiles" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
@ -172,7 +224,6 @@
<View
android:layout_width="match_parent"
android:visibility="invisible"
android:layout_height="1dp"
android:background="?attr/wikivoyage_card_divider_color" />

View file

@ -3355,8 +3355,8 @@
<string name="sett_generic_ext_input">لوحة المفاتيح</string>
<string name="sett_wunderlinq_ext_input">وندرلينك</string>
<string name="sett_parrot_ext_input">ببغاء</string>
<string name="new_route_calculated_dist_dbg">"المسار: المسافة%1$s، الوقت %2$s.
\nالحساب: %3$.1f ث، %4$d طريق، %5$d تجانب"</string>
<string name="new_route_calculated_dist_dbg">المسار: المسافة%1$s، الوقت %2$s.
\nالحساب: %3$.1f ث، %4$d طريق، %5$d تجانب</string>
<string name="lang_oc">الأوكيتانية</string>
<string name="get_discount_second_part">ثم %1$s</string>
<string name="apply_to_current_profile">تطبيق فقط على \"%1$s\"</string>
@ -3800,7 +3800,7 @@
<string name="plan_route_last_edited">التعديل الأخير</string>
<string name="plan_route_import_track">استيراد المسار</string>
<string name="plan_route_open_existing_track">فتح مسار موجود</string>
<string name="plan_route_create_new_route">إنشاء مسار جديد</string>
<string name="plan_route_create_new_route">إنشاء طريق جديد</string>
<string name="plan_route_select_track_file_for_open">حدد المسار للفتح.</string>
<string name="shared_string_done">تم</string>
<string name="overwrite_track">الكتابة فوق المسار</string>
@ -3833,15 +3833,15 @@
<string name="quick_action_add_gpx">أضف إحداثية مسار</string>
<string name="map_widget_monitoring">تسجيل الرحلة</string>
<string name="marker_save_as_track">حفظ كمسار</string>
<string name="follow_track">تتبع المسار</string>
<string name="follow_track">اتبع المسار</string>
<string name="follow_track_descr">اختر مسار للمتابعة</string>
<string name="import_track_descr">اختر ملف المسار للمتابعة أو قم باستيراده من الجهاز.</string>
<string name="select_another_track">حدد مسارا آخر</string>
<string name="select_another_track">حدد مساراً آخر</string>
<string name="navigate_to_track_descr">انتقل من موقعي إلى المسار</string>
<string name="pass_whole_track_descr">نقطة المسار للتنقل</string>
<string name="start_of_the_track">بداية المسار</string>
<string name="nearest_point">أقرب نقطة</string>
<string name="attach_to_the_roads">إرفاق الطرق</string>
<string name="attach_to_the_roads">إرفاق بالطرق</string>
<string name="delete_address">حذف عنوان</string>
<string name="add_address">إضافة عنوان</string>
<string name="access_hint_enter_address">أدخل العنوان</string>
@ -3864,7 +3864,7 @@
<string name="open_saved_track">فتح المسار المحفوظ</string>
<string name="shared_string_is_saved">محفوظ</string>
<string name="simplified_track">مسار مبسط</string>
<string name="simplified_track_description">سيتم حفظ خط التوجيه فقط، وسيتم حذف نقاط الطريق.</string>
<string name="simplified_track_description">سيتم حفظ خط الطريق فقط، وسيتم حذف نقاط المسار.</string>
<string name="shared_string_file_name">اسم الملف</string>
<string name="one_point_error">الرجاء إضافة نقطتين على الأقل.</string>
<string name="shared_string_redo">إعادة</string>
@ -3997,8 +3997,8 @@
\n • دعم ألوان مخصصة للمفضلة ونقاط لمسار الطريق
\n
\n</string>
<string name="profile_type_osmand_string">وضع أساسي</string>
<string name="profile_type_user_string">وضع المستخدم</string>
<string name="profile_type_osmand_string">وضع التطبيق</string>
<string name="profile_type_user_string">حساب المستخدم</string>
<string name="reverse_all_points">عكس جميع النقاط</string>
<string name="profile_by_default_description">حدد الوضع الذي سيتم استخدامه في بدء التطبيق.</string>
<string name="shared_string_last_used">آخر استخدام</string>
@ -4030,7 +4030,7 @@
<string name="select_folder">تحديد مجلد</string>
<string name="select_folder_descr">تحديد مجلد أو إضافة واحد جديد</string>
<string name="shared_string_empty">فارغ</string>
<string name="analyze_by_intervals">التحليل حسب الفواصل الزمنية (الفاصل الزمني)</string>
<string name="analyze_by_intervals">تحليل حسب الفاصل الزمني</string>
<string name="upload_to_openstreetmap">رفع إلى خريطة الشارع المفتوح</string>
<string name="edit_track">تحرير المسار</string>
<string name="rename_track">تسمية المسار</string>

View file

@ -1212,7 +1212,7 @@
<string name="poi_description">Περιγραφή</string>
<string name="poi_phone">Τηλέφωνο</string>
<string name="poi_website">Ιστότοπος</string>
<string name="poi_email">Ηλ. διεύθυνση</string>
<string name="poi_email">Ηλεκτρονικό ταχυδρομείο</string>
<string name="poi_fax">Τηλεομοιότυπο (φαξ)</string>
<string name="facebook">Facebook</string>
<string name="twitter">Twitter</string>

View file

@ -267,7 +267,7 @@
<string name="offline_edition">Επεξεργασία χωρίς διαδίκτυο</string>
<string name="offline_edition_descr">Χρήση πάντα της επεξεργασίας χωρίς διαδίκτυο.</string>
<string name="update_poi_does_not_change_indexes">Οι αλλαγές στα ΣΕ μέσω της εφαρμογής δεν επηρεάζουν τα ληφθέντα αρχεία χάρτη, οι αλλαγές αποθηκεύονται ως αρχείο στη συσκευή σας.</string>
<string name="local_openstreetmap_uploading">Αποστολή </string>
<string name="local_openstreetmap_uploading">Αποστολή…</string>
<string name="local_openstreetmap_were_uploaded">{0} ΣΕ/Οι σημειώσεις απεστάλησαν</string>
<string name="local_openstreetmap_uploadall">Αποστολή όλων</string>
<string name="local_openstreetmap_upload">Αποστολή επεξεργασίας στο OSM</string>
@ -813,7 +813,7 @@
<string name="edit_filter_delete_dialog_title">Διαγραφή αυτού του φίλτρου;</string>
<string name="edit_filter_delete_message">Το φίλτρο \'%1$s\' διαγράφηκε</string>
<string name="edit_filter_create_message">Το φίλτρο \'%1$s\' δημιουργήθηκε</string>
<string name="email">ηλ. διεύθυνση</string>
<string name="email">ηλεκτρονικό ταχυδρομείο</string>
<string name="intermediate_point_too_far">Ο ενδιάμεσος προορισμός %1$s είναι πολύ μακριά από τον πλησιέστερο δρόμο.</string>
<string name="arrived_at_intermediate_point">Φτάσατε στον ενδιάμεσο προορισμό σας</string>
<string name="context_menu_item_intermediate_point">Προσθήκη ως ενδιάμεσου προορισμού</string>
@ -1175,7 +1175,7 @@
<string name="keep_informing_never">Μόνο χειροκίνητα (πατήστε το βέλος)</string>
<string name="keep_informing">Επανάληψη οδηγιών πλοήγησης</string>
<string name="import_file_favourites">Αποθήκευση δεδομένων ως αρχείο GPX ή εισαγωγή σημείων διαδρομής στα \'Αγαπημένα\';</string>
<string name="shared_string_share">Διαμοιρασμός</string>
<string name="shared_string_share">Κοινοποίηση</string>
<string name="navigation_intent_invalid">Μη έγκυρη μορφή: %s</string>
<string name="stop_navigation_service">Διακοπή</string>
<string name="sleep_mode_stop_dialog">Διακοπή λειτουργίας παρασκηνίου του GPS;</string>
@ -3385,7 +3385,7 @@
<string name="monitoring_min_accuracy_descr_recommendation">Σύσταση: Είναι δύσκολο να προβλεφθεί τι θα εγγραφεί και τι όχι, ίσως είναι καλύτερο να απενεργοποιήσετε αυτό το φίλτρο.</string>
<string name="monitoring_min_accuracy_descr_remark">Παρατήρηση: Εάν το GPS είχε απενεργοποιηθεί αμέσως πριν μια εγγραφή, το πρώτο μετρούμενο σημείο μπορεί να έχει μειωμένη ακρίβεια, έτσι μπορεί να θέλουμε να περιμένουμε λιγάκι πριν την καταγραφή σημείου (ή να εγγράψουμε τα καλύτερα 3 διαδοχικά σημεία, κλπ.), αλλά αυτό δεν έχει ακόμα υλοποιηθεί.</string>
<string name="monitoring_min_distance_descr">Αυτό το φίλτρο αποφεύγει διπλά σημεία να εγγραφούν όταν έχει συμβεί πολύ λίγη ενεργή κίνηση, καθιστώντας καλύτερη τη χωροταξική εμφάνιση των ιχνών που δεν επεξεργάζονται αργότερα.</string>
<string name="button_rate">Τιμή</string>
<string name="button_rate">Βαθμολόγηση</string>
<string name="monitoring_min_distance_descr_side_effect">Παράπλευρα αποτελέσματα: Περίοδοι σε ακινησία δεν καταγράφονται καθόλου ή μόνο με ένα σημείο καθεμιά. Μικρές (πραγματικός κόσμος) κινήσεις (π.χ. πλάγιες, για να σημειώσουν έξοδο στο ταξίδι σας) μπορεί να φιλτραριστούν. Το αρχείο σας περιέχει λιγότερες πληροφορίες για μετεπεξεργασία και έχει χειρότερα στατιστικά φιλτράροντας προφανώς περιττά σημεία κατά τον χρόνο εγγραφής, ενώ δυνητικά διατηρεί παράσιτα που προκαλούνται από κακή λήψη ή επιπτώσεις κυκλωμάτων GPS.</string>
<string name="monitoring_min_distance_descr_recommendation">Σύσταση: Ρύθμιση 5 μέτρων μπορεί να λειτουργήσει καλά για σας, εάν δεν χρειάζεστε να πιάσετε λεπτομέρειες πιο ακριβείς από αυτό και δεν θέλετε να πάρετε δεδομένα σε ακινησία.</string>
<string name="live_monitoring_time_buffer">Ενδιάμεσος χρόνος</string>

View file

@ -3925,4 +3925,37 @@
\n"</string>
<string name="plan_route_join_segments">Unisci segmenti</string>
<string name="plan_route_split_before">Spezza</string>
<string name="announcement_time_arrive">Arrivo a destinazione</string>
<string name="shared_string_turn">Svolta</string>
<string name="start_recording">Avvia registrazione</string>
<string name="show_track_on_map">Mostra il percorso sulla mappa</string>
<string name="routing_engine_vehicle_type_wheelchair">Sedia a rotelle</string>
<string name="routing_engine_vehicle_type_hiking">Escursionismo</string>
<string name="routing_engine_vehicle_type_walking">A piedi</string>
<string name="routing_engine_vehicle_type_hgv">Mezzi pesanti</string>
<string name="routing_engine_vehicle_type_truck">Camion</string>
<string name="routing_engine_vehicle_type_scooter">Scooter</string>
<string name="routing_engine_vehicle_type_racingbike">Bici da corsa</string>
<string name="routing_engine_vehicle_type_mtb">MTB</string>
<string name="message_server_error">Errore del server: %1$s</string>
<string name="message_name_is_already_exists">Il nome esiste già</string>
<string name="delete_online_routing_engine">Eliminare questo motore di routing online\?</string>
<string name="context_menu_edit_descr">Modifica descrizione</string>
<string name="delete_waypoints">Elimina i waypoint</string>
<string name="copy_to_map_markers">Aggiungi ai marcatori</string>
<string name="copy_to_map_favorites">Copia nei preferiti</string>
<string name="upload_photo">Caricamento</string>
<string name="upload_photo_completed">Caricamento completato</string>
<string name="uploading_count">Carico %1$d di %2$d</string>
<string name="uploaded_count">Caricati %1$d di %2$d</string>
<string name="toast_select_edits_for_upload">Seleziona le modifiche per il caricamento</string>
<string name="hillshade_slope_contour_lines">Hillshade / Pendenza / Linee di contorno</string>
<string name="open_place_reviews_plugin_description">OpenPlaceReviews è un progetto community-driven su luoghi pubblici come ristoranti, hotel, musei, waypoint. Raccoglie tutte le informazioni pubbliche su di essi come foto, recensioni, link ad altri sistemi che collegano OpenStreetMap, Wikipedia.
\n
\nTutti i dati di OpenPlaceReview sono aperti e disponibili a tutti: http://openplacereviews.org/data.
\n
\nPer maggiori informazioni: http://openplacereviews.org</string>
<string name="open_place_reviews">OpenPlaceReviews</string>
<string name="opr_use_dev_url">Usa test.openplacereviews.org</string>
<string name="login_open_place_reviews">Accedi a OpenPlaceReviews</string>
</resources>

View file

@ -3881,4 +3881,14 @@
<string name="poi_wildlife_crossing_bat_tunnel">Túnel para morcego</string>
<string name="poi_wildlife_crossing_bat_bridge">Ponte para morcego</string>
<string name="poi_wildlife_crossing">Travessia de vida selvagem</string>
<string name="poi_mobile_library">Posição de parada da biblioteca móvel</string>
<string name="poi_summit_register_no">Registro de conferência: não</string>
<string name="poi_summit_register_yes">Registro de conferência: sim</string>
<string name="poi_piste_status_closed">Status da pista: fechada</string>
<string name="poi_piste_status_open">Status da pista: aberta</string>
<string name="poi_patrolled_no">Patrulhado: não</string>
<string name="poi_patrolled_yes">Patrulhado: sim</string>
<string name="poi_gladed_yes">Satisfeito: sim</string>
<string name="poi_piste_name">Nome da pista</string>
<string name="poi_piste_ski_jump">Salto de esqui</string>
</resources>

View file

@ -3881,4 +3881,10 @@
<string name="poi_wildlife_crossing_bat_tunnel">Тунель кажанів</string>
<string name="poi_wildlife_crossing_bat_bridge">Міст кажанів</string>
<string name="poi_wildlife_crossing">Переправа диких тварин</string>
<string name="poi_piste_status_closed">Стан траси: зачинена</string>
<string name="poi_piste_status_open">Стан траси: відчинена</string>
<string name="poi_patrolled_no">Патрулюється: ні</string>
<string name="poi_patrolled_yes">Патрулюється: так</string>
<string name="poi_piste_name">Назва траси</string>
<string name="poi_piste_ski_jump">рибки на лижах</string>
</resources>

View file

@ -3881,4 +3881,14 @@
<string name="poi_wildlife_crossing_bat_tunnel">蝙蝠隧道</string>
<string name="poi_wildlife_crossing_bat_bridge">蝙蝠橋</string>
<string name="poi_wildlife_crossing">野生動物穿越</string>
<string name="poi_mobile_library">行動圖書館停放位置</string>
<string name="poi_summit_register_no">峰頂紀錄:否</string>
<string name="poi_summit_register_yes">峰頂紀錄:是</string>
<string name="poi_piste_status_closed">滑雪道狀態:關閉</string>
<string name="poi_piste_status_open">滑雪道狀態:開放</string>
<string name="poi_patrolled_no">巡邏:否</string>
<string name="poi_patrolled_yes">巡邏:是</string>
<string name="poi_gladed_yes">林間空地:是</string>
<string name="poi_piste_name">滑雪道名稱</string>
<string name="poi_piste_ski_jump">跳台滑雪</string>
</resources>

View file

@ -142,6 +142,7 @@
<attr name="text_input_background" format="reference"/>
<attr name="image_help_announcement_time" format="reference"/>
<attr name="switch_button_active" format="reference" />
<attr name="bottom_navigation_item_background" format="reference" />
</declare-styleable>
<declare-styleable name="PagerSlidingTabStrip">

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="app_name">OsmAnd~</string>
<string name="app_name_free">OsmAnd Nightly</string>
<!-- Part of build.gradle -->
<!-- <string name="app_name">OsmAnd~</string> -->
<!-- <string name="app_edition"></string> -->
<!-- string name="app_version_suffix"></string -->
<!-- Not translatable -->
@ -9,11 +10,7 @@
<string name="srtm_plugin_price">€2,99</string>
<string name="sea_depth_maps_price">€1,39</string>
<string name="osm_live">OsmAnd Live</string>
<string name="ga_api_key">UA-28342846-2</string>
<string name="ga_dispatchPeriod">10</string>
<string name="ga_debug">true</string>
<string name="openstreetmap_copyright"><a href="https://www.openstreetmap.org/copyright">&#169; OpenStreetMap</a></string>
<string name="app_edition"></string>
<string name="support_email">support@osmand.net</string>
<string name="preferred_locale_no_translate">Display language</string>
<string name="system_locale_no_translate">Device language</string>

View file

@ -12,6 +12,19 @@
-->
<string name="activity_type_car_name">Car</string>
<string name="activity_type_motorbike_name">Motorbike</string>
<string name="activity_type_offroad_name">Off-road</string>
<string name="activity_type_walking_name">Walking</string>
<string name="activity_type_running_name">Running</string>
<string name="activity_type_hiking_name">Hiking</string>
<string name="activity_type_cycling_name">Cycling</string>
<string name="activity_type_mountainbike_name">Mountainbike</string>
<string name="activity_type_racing_name">Racing</string>
<string name="activity_type_riding_name">Riding</string>
<string name="activity_type_snowmobile_name">Snowmobile</string>
<string name="activity_type_winter_name">Winter</string>
<string name="activity_type_water_name">Water</string>
<string name="login_open_place_reviews">Login to OpenPlaceReviews</string>
<string name="opr_use_dev_url">Use test.openplacereviews.org</string>
<string name="open_place_reviews">OpenPlaceReviews</string>

View file

@ -249,6 +249,7 @@
<item name="text_input_background">@color/text_input_background_light</item>
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_day</item>
<item name="switch_button_active">@color/switch_button_active_light</item>
<item name="bottom_navigation_item_background">@drawable/bottom_navigation_item_bg_light</item>
</style>
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
@ -547,6 +548,7 @@
<item name="text_input_background">@color/text_input_background_dark</item>
<item name="image_help_announcement_time">@drawable/img_help_announcement_time_night</item>
<item name="switch_button_active">@color/switch_button_active_dark</item>
<item name="bottom_navigation_item_background">@drawable/bottom_navigation_item_bg_dark</item>
</style>
<style name="FreeVersionBanner" parent="OsmandDarkTheme">

View file

@ -951,6 +951,12 @@ public class AndroidUtils {
return value != null ? value : propertyValue;
}
public static String getActivityTypeStringPropertyName(Context ctx, String propertyName, String defValue) {
String value = getStringByProperty(ctx, "activity_type_" + propertyName + "_name");
return value != null ? value : defValue;
}
private static String getStringByProperty(@NonNull Context ctx, @NonNull String property) {
try {
Field field = R.string.class.getField(property);

View file

@ -209,9 +209,10 @@ public class GpxSelectionHelper {
}
public SelectedGpxFile getSelectedGPXFile(WptPt point) {
for (SelectedGpxFile g : selectedGPXFiles) {
if (g.getGpxFile().containsPoint(point)) {
return g;
for (SelectedGpxFile selectedGpxFile : selectedGPXFiles) {
GPXFile gpxFile = selectedGpxFile.getGpxFile();
if (gpxFile.containsPoint(point) || gpxFile.containsRoutePoint(point)) {
return selectedGpxFile;
}
}
return null;

View file

@ -136,10 +136,10 @@ import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.datastorage.DataStorageFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
import net.osmand.plus.settings.datastorage.DataStorageFragment;
import net.osmand.plus.track.TrackAppearanceFragment;
import net.osmand.plus.track.TrackMenuFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
@ -1664,6 +1664,12 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
getMapView().refreshMap();
}
public void refreshMapComplete() {
getMyApplication().getResourceManager().getRenderer().clearCache();
updateMapSettings();
getMapView().refreshMap(true);
}
public View getLayout() {
return getWindow().getDecorView().findViewById(android.R.id.content);
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.base;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.Activity;
@ -884,10 +885,28 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
updateMainViewLayout(posY);
}
if (animated) {
mainView.animate().y(posY)
.setDuration(ANIMATION_DURATION)
.setInterpolator(new DecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
animateMainView(posY, needCloseMenu, previousMenuState, newMenuState);
} else {
if (needCloseMenu && isHideable()) {
dismiss();
} else {
mainView.setY(posY);
updateMainViewLayout(posY);
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
doAfterMenuStateChange(previousMenuState, newMenuState);
}
}
}
ContextMenuFragmentListener listener = this.listener;
if (listener != null) {
listener.onContextMenuYPosChanged(this, posY, needMapAdjust, true);
}
}
return posY;
}
protected void animateMainView(final int posY, final boolean needCloseMenu, final int previousMenuState, final int newMenuState) {
animateView(mainView, posY, new AnimatorListenerAdapter() {
boolean canceled = false;
@ -909,30 +928,14 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
}
}
}
}).start();
} else {
if (needCloseMenu && isHideable()) {
dismiss();
} else {
mainView.setY(posY);
updateMainViewLayout(posY);
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
doAfterMenuStateChange(previousMenuState, newMenuState);
}
}
}
ContextMenuFragmentListener listener = this.listener;
if (listener != null) {
listener.onContextMenuYPosChanged(this, posY, needMapAdjust, true);
}
}
return posY;
});
}
public void animateView(@NonNull View view, int y) {
public void animateView(@NonNull View view, int y, @Nullable AnimatorListener listener) {
view.animate().y(y)
.setDuration(ANIMATION_DURATION)
.setInterpolator(new DecelerateInterpolator())
.setListener(listener)
.start();
}

View file

@ -133,7 +133,7 @@ public abstract class ContextMenuScrollFragment extends ContextMenuFragment impl
if (mapControlsView != null) {
int zoomY = y - getMapControlsHeight();
if (animated) {
fragment.animateView(mapControlsView, zoomY);
fragment.animateView(mapControlsView, zoomY, null);
} else {
mapControlsView.setY(zoomY);
}

View file

@ -96,6 +96,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInformationListener {
private static final org.apache.commons.logging.Log LOG =
PlatformUtil.getLog(DashboardOnMap.class);
@ -777,7 +778,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
plugin.registerLayers(mapActivity);
}
}
SRTMPlugin.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
} else if (visibleType == DashboardType.WIKIPEDIA) {
refreshContent(true);
}

View file

@ -261,11 +261,6 @@ public class ConfigureMapMenu {
app.getAidlApi().registerLayerContextMenu(adapter, activity);
}
public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings();
activity.getMapView().refreshMap(true);
}
private void createRenderingAttributeItems(List<RenderingRuleProperty> customRules,
final ContextMenuAdapter adapter, final MapActivity activity,
@ -347,7 +342,7 @@ public class ConfigureMapMenu {
public void onClick(View v) {
int which = (int) v.getTag();
view.getSettings().DAYNIGHT_MODE.set(DayNightMode.values()[which]);
refreshMapComplete(activity);
activity.refreshMapComplete();
activity.getDashboard().refreshContent(true);
// adapter.getItem(pos).setDescription(s, getDayNightDescr(activity));
// ad.notifyDataSetInvalidated();
@ -466,7 +461,7 @@ public class ConfigureMapMenu {
public void onClick(View v) {
int which = (int) v.getTag();
view.getSettings().TEXT_SCALE.set(txtValues[which]);
refreshMapComplete(activity);
activity.refreshMapComplete();
adapter.getItem(pos).setDescription(getScale(activity));
ad.notifyDataSetInvalidated();
}
@ -568,7 +563,7 @@ public class ConfigureMapMenu {
int index = dlg.getListView().getCheckedItemPosition();
view.getSettings().MAP_PREFERRED_LOCALE.set(
txtIds[index]);
refreshMapComplete(activity);
activity.refreshMapComplete();
String localeDescr = txtIds[index];
localeDescr = localeDescr == null || localeDescr.isEmpty() ? activity
.getString(R.string.local_map_names) : localeDescr;
@ -712,7 +707,7 @@ public class ConfigureMapMenu {
}
adapter.getItem(pos).setColorRes(ContextMenuItem.INVALID_ID);
a.notifyDataSetInvalidated();
refreshMapComplete(activity);
activity.refreshMapComplete();
activity.getMapLayers().updateLayers(activity.getMapView());
} else {
if (UI_CATEGORY_DETAILS.equals(category)) {
@ -883,7 +878,7 @@ public class ConfigureMapMenu {
adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
}
a.notifyDataSetInvalidated();
refreshMapComplete(activity);
activity.refreshMapComplete();
activity.getMapLayers().updateLayers(activity.getMapView());
}
});
@ -1041,7 +1036,7 @@ public class ConfigureMapMenu {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
pref.set(!pref.get());
refreshMapComplete(activity);
activity.refreshMapComplete();
return false;
}
})
@ -1096,7 +1091,7 @@ public class ConfigureMapMenu {
} else {
pref.set(p.getPossibleValues()[which - 1]);
}
refreshMapComplete(activity);
activity.refreshMapComplete();
String description = AndroidUtils.getRenderingStringPropertyValue(activity, pref.get());
adapter.getItem(pos).setDescription(description);
}

View file

@ -228,9 +228,9 @@ public class DetailsBottomSheet extends BasePreferenceBottomSheet {
}
Activity activity = getActivity();
if (activity instanceof MapActivity) {
MapActivity a = (MapActivity) activity;
ConfigureMapMenu.refreshMapComplete(a);
a.getMapLayers().updateLayers(a.getMapView());
MapActivity mapActivity = (MapActivity) activity;
mapActivity.refreshMapComplete();
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
}
super.onDismiss(dialog);
}

View file

@ -20,6 +20,7 @@ import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.RasterMapType;
public class RasterMapMenu {
private static final String TAG = "RasterMapMenu";
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
@ -105,12 +106,12 @@ public class RasterMapMenu {
@Override
public void run() {
plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback);
refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
} else if (itemId == R.string.show_polygons) {
hidePolygonsPref.set(!isChecked);
refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
} else if (itemId == R.string.show_transparency_seekbar) {
if (isChecked) {
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(currentMapTypeSeekbarMode);
@ -180,10 +181,4 @@ public class RasterMapMenu {
LayerTransparencySeekbarMode seekbarMode = app.getSettings().LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
return seekbarMode == LayerTransparencySeekbarMode.UNDEFINED || seekbarMode == currentMapTypeSeekbarMode;
}
public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings();
activity.getMapView().refreshMap(true);
}
}

View file

@ -140,7 +140,7 @@ public class SelectMapStyleBottomSheetDialogFragment extends MenuBottomSheetDial
OsmandMapTileView view = mapActivity.getMapView();
view.getSettings().RENDERER.set(selectedStyle);
app.getRendererRegistry().setCurrentSelectedRender(loaded);
ConfigureMapMenu.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
mapActivity.getDashboard().refreshContent(true);
} else {
Toast.makeText(mapActivity, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();

View file

@ -593,7 +593,7 @@ public class GpxUiHelper {
}
}
if (activity instanceof MapActivity) {
ConfigureMapMenu.refreshMapComplete((MapActivity) activity);
((MapActivity) activity).refreshMapComplete();
}
}
GPXFile currentGPX = null;

View file

@ -42,6 +42,7 @@ import java.util.regex.Pattern;
import static net.osmand.plus.activities.TrackActivity.CURRENT_RECORDING;
import static net.osmand.plus.activities.TrackActivity.TRACK_FILE_NAME;
import static net.osmand.plus.osmedit.oauth.OsmOAuthHelper.OsmAuthorizationListener;
import static net.osmand.plus.track.TrackMenuFragment.RETURN_SCREEN_NAME;
public class IntentHelper {
@ -256,8 +257,9 @@ public class IntentHelper {
}
if (intent.hasExtra(TrackMenuFragment.OPEN_TRACK_MENU)) {
String path = intent.getStringExtra(TRACK_FILE_NAME);
String name = intent.getStringExtra(RETURN_SCREEN_NAME);
boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false);
TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null);
TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null, name);
mapActivity.setIntent(null);
}
}

View file

@ -47,7 +47,7 @@ public class SelectedGpxMenuController extends MenuController {
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
String path = selectedGpxFile.getGpxFile().path;
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon);
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon, null);
}
};
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track);

View file

@ -50,7 +50,7 @@ public class WptPtMenuController extends MenuController {
SelectedGpxFile selectedGpxFile = selectionHelper.getSelectedGPXFile(wpt);
if (selectedGpxFile != null) {
String path = selectedGpxFile.getGpxFile().path;
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), new LatLon(wpt.lon, wpt.lat));
TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), new LatLon(wpt.lon, wpt.lat), null);
}
}
}

View file

@ -344,7 +344,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
public void onClick(View v) {
FragmentActivity activity = getActivity();
if (activity != null) {
openTrack(activity, null, storeState());
openTrack(activity, null, storeState(), getString(R.string.shared_string_tracks));
}
}
});
@ -1597,7 +1597,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
GpxInfo item = allGpxAdapter.getChild(groupPosition, childPosition);
if (!selectionMode) {
openTrack(getActivity(), item.file, storeState());
openTrack(getActivity(), item.file, storeState(), getString(R.string.shared_string_tracks));
} else {
if (!selectedItems.contains(item)) {
selectedItems.add(item);

View file

@ -15,7 +15,6 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType;
@ -92,7 +91,7 @@ public class MapStyleAction extends SwitchableAction<String> {
view.getSettings().RENDERER.set(params);
app.getRendererRegistry().setCurrentSelectedRender(loaded);
ConfigureMapMenu.refreshMapComplete(activity);
activity.refreshMapComplete();
Toast.makeText(activity, activity.getString(R.string.quick_action_map_style_switch,
getTranslatedItemName(activity, params)), Toast.LENGTH_SHORT).show();

View file

@ -15,20 +15,20 @@ import com.google.gson.reflect.TypeToken;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.quickaction.SwitchableAction;
import net.osmand.plus.settings.backend.OsmandSettings;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
private final static String KEY_UNDERLAYS = "underlays";
@ -141,14 +141,9 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
settings.MAP_UNDERLAY.set(null);
activity.getMapLayers().getMapControlsLayer().hideTransparencyBar();
settings.MAP_UNDERLAY_PREVIOUS.set(null);
}
final CommonPreference<Boolean> hidePolygonsPref =
activity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons");
hidePolygonsPref.set(hasUnderlay);
plugin.updateMapLayers(activity.getMapView(), settings.MAP_UNDERLAY, activity.getMapLayers());
activity.refreshMapComplete();
Toast.makeText(activity, activity.getString(R.string.quick_action_map_underlay_switch,
getTranslatedItemName(activity, params)), Toast.LENGTH_SHORT).show();
}

View file

@ -29,17 +29,16 @@ import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.DialogListItemAdapter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.DownloadTilesDialog;
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.RasterMapMenu;
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
@ -66,6 +65,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
private MapTileLayer overlayLayer;
private MapTileLayer underlayLayer;
private StateChangedListener<String> underlayListener;
private StateChangedListener<Integer> overlayLayerListener;
public OsmandRasterMapsPlugin(OsmandApplication app) {
@ -103,6 +103,19 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
return "feature_articles/online-maps-plugin.html";
}
@Override
public boolean init(@NonNull final OsmandApplication app, Activity activity) {
final CommonPreference<Boolean> hidePolygonsPref = settings.getCustomRenderBooleanProperty("noPolygons");
underlayListener = new StateChangedListener<String>() {
@Override
public void stateChanged(String change) {
hidePolygonsPref.set(settings.MAP_UNDERLAY.get() != null);
}
};
settings.MAP_UNDERLAY.addListener(underlayListener);
return true;
}
@Override
public void registerLayers(MapActivity activity) {
createLayers();
@ -147,10 +160,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
mapView.removeLayer(underlayLayer);
underlayLayer.setMap(null);
}
if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY &&
if (settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY &&
underlayLayer.getMap() != null || underlayLayer.getMapTileAdapter() != null) {
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_TRANSPARENCY, true);
} else if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY &&
} else if (settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY &&
overlayLayer.getMap() != null || overlayLayer.getMapTileAdapter() != null) {
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
} else {
@ -339,7 +352,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
adapter.notifyDataSetChanged();
RasterMapMenu.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
}
}

View file

@ -1,26 +1,11 @@
package net.osmand.plus.render;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.list.array.TLongArrayList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.TLongSet;
import gnu.trove.set.hash.TLongHashSet;
import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.TreeSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;
import net.osmand.IProgress;
import net.osmand.NativeLibrary.NativeSearchResult;
@ -39,14 +24,14 @@ import net.osmand.data.QuadPointDouble;
import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox;
import net.osmand.map.MapTileDownloader;
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.render.RenderingRuleProperty;
import net.osmand.render.RenderingRuleSearchRequest;
@ -55,16 +40,31 @@ import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms;
import net.osmand.util.MapAlgorithms;
import net.osmand.util.MapUtils;
import net.osmand.util.TransliterationHelper;
import org.apache.commons.logging.Log;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.list.array.TLongArrayList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.TLongSet;
import gnu.trove.set.hash.TLongHashSet;
public class MapRenderRepositories {
// It is needed to not draw object twice if user have map index that intersects by boundaries
@ -753,11 +753,6 @@ public class MapRenderRepositories {
now = System.currentTimeMillis();
Bitmap bmp;
boolean transparent = false;
RenderingRuleProperty rr = storage.PROPS.get("noPolygons");
if (rr != null) {
transparent = renderingReq.getIntPropertyValue(rr) > 0;
}
// 1. generate image step by step
Bitmap reuse = prevBmp;

View file

@ -767,7 +767,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
int pagesY = y - getPagesViewHeight() + fragment.getShadowHeight() +
(Build.VERSION.SDK_INT >= 21 ? AndroidUtils.getStatusBarHeight(pagesView.getContext()) : 0);
if (animated) {
fragment.animateView(pagesView, pagesY);
fragment.animateView(pagesView, pagesY, null);
} else {
pagesView.setY(pagesY);
}
@ -780,7 +780,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
int zoomY = y - getZoomButtonsHeight() +
(Build.VERSION.SDK_INT >= 21 ? AndroidUtils.getStatusBarHeight(zoomButtonsView.getContext()) : 0);
if (animated) {
fragment.animateView(zoomButtonsView, zoomY);
fragment.animateView(zoomButtonsView, zoomY, null);
} else {
zoomButtonsView.setY(zoomY);
}

View file

@ -52,8 +52,7 @@ public class ContourLinesAction extends QuickAction {
if (selected && !plugin.isActive() && !plugin.needsInstallation()) {
OsmandPlugin.enablePlugin(activity, app, plugin, true);
}
SRTMPlugin.refreshMapComplete(activity);
activity.refreshMapComplete();
}
}
});

View file

@ -109,7 +109,7 @@ public class ContourLinesMenu {
@Override
public void run() {
mapActivity.getDashboard().refreshContent(true);
SRTMPlugin.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
}
@ -123,7 +123,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, contourLinesProp, pref));
adapter.notifyDataSetChanged();
}
SRTMPlugin.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
} else if (itemId == colorSchemeStringId) {
@ -135,7 +135,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, colorSchemeProp, colorPref));
adapter.notifyDataSetChanged();
}
SRTMPlugin.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
} else if (itemId == R.string.srtm_plugin_name) {
@ -150,7 +150,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, contourWidthProp, widthPref));
adapter.notifyDataSetChanged();
}
SRTMPlugin.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
} else if (contourDensityProp != null && itemId == contourDensityName.hashCode()) {
@ -162,7 +162,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, contourDensityProp, densityPref));
adapter.notifyDataSetChanged();
}
SRTMPlugin.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
}

View file

@ -307,9 +307,8 @@ public class SRTMPlugin extends OsmandPlugin {
item.setSelected(selected);
adapter.notifyDataSetChanged();
}
refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
}
});
} else if (itemId == R.string.shared_string_terrain) {
@ -328,7 +327,7 @@ public class SRTMPlugin extends OsmandPlugin {
adapter.notifyDataSetChanged();
}
updateLayers(mapView, mapActivity);
refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
}
});
}
@ -486,7 +485,7 @@ public class SRTMPlugin extends OsmandPlugin {
} else {
pref.set(possibleValues[which - 1]);
}
refreshMapComplete(activity);
activity.refreshMapComplete();
}
}
);
@ -507,12 +506,6 @@ public class SRTMPlugin extends OsmandPlugin {
public void disable(OsmandApplication app) {
}
public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings();
activity.getMapView().refreshMap(true);
}
private static boolean isNightMode(Activity activity, OsmandApplication app) {
if (activity == null || app == null) {
return false;

View file

@ -40,7 +40,7 @@ public class TerrainAction extends QuickAction {
OsmandPlugin.enablePlugin(activity, activity.getMyApplication(), plugin, true);
}
plugin.updateLayers(activity.getMapView(), activity);
SRTMPlugin.refreshMapComplete(activity);
activity.refreshMapComplete();
}
});
}

View file

@ -4,6 +4,9 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
@ -16,13 +19,10 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.wikipedia.WikiArticleHelper;
import net.osmand.util.Algorithms;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
import static net.osmand.plus.wikipedia.WikiArticleHelper.getFirstParagraph;
public class DescriptionCard extends BaseCard {
@ -98,16 +98,6 @@ public class DescriptionCard extends BaseCard {
});
}
private String getFirstParagraph(String descriptionHtml) {
if (descriptionHtml != null) {
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
if (!Algorithms.isEmpty(firstParagraph)) {
return firstParagraph;
}
}
return descriptionHtml;
}
private void setupImage(final String imageUrl) {
if (imageUrl == null) {
return;

View file

@ -16,6 +16,14 @@ import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
@ -32,14 +40,6 @@ import net.osmand.plus.widgets.WebViewEx;
import net.osmand.plus.wikivoyage.WikivoyageUtils;
import net.osmand.util.Algorithms;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = GpxReadDescriptionDialogFragment.class.getSimpleName();
@ -242,7 +242,7 @@ public class GpxReadDescriptionDialogFragment extends BaseOsmAndDialogFragment {
return "<body style=\"color:white;\">\n" + content + "</body>\n";
}
public static void showInstance(@NonNull FragmentActivity activity, @NonNull String title, @NonNull String imageUrl, @NonNull String description) {
public static void showInstance(@NonNull FragmentActivity activity, @NonNull String title, @Nullable String imageUrl, @NonNull String description) {
FragmentManager fragmentManager = activity.getSupportFragmentManager();
if (!fragmentManager.isStateSaved()) {
Bundle args = new Bundle();

View file

@ -4,7 +4,9 @@ import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
@ -13,18 +15,23 @@ import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.Metadata;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.myplaces.SegmentActionsListener;
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
import net.osmand.util.Algorithms;
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.getMetadataImageLink;
import static net.osmand.plus.myplaces.TrackActivityFragmentAdapter.isGpxFileSelected;
import static net.osmand.plus.track.OptionsCard.APPEARANCE_BUTTON_INDEX;
import static net.osmand.plus.track.OptionsCard.DIRECTIONS_BUTTON_INDEX;
import static net.osmand.plus.track.OptionsCard.EDIT_BUTTON_INDEX;
import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
import static net.osmand.plus.wikipedia.WikiArticleHelper.getFirstParagraph;
public class OverviewCard extends BaseCard {
@ -63,6 +70,7 @@ public class OverviewCard extends BaseCard {
RecyclerView blocksView = view.findViewById(R.id.recycler_overview);
blockStatisticsBuilder.setBlocksView(blocksView);
setupDescription();
initShowButton(iconColorDef, iconColorPres);
initAppearanceButton(iconColorDef, iconColorPres);
if (fileAvailable) {
@ -125,6 +133,31 @@ public class OverviewCard extends BaseCard {
iv.setImageDrawable(icon);
}
private void setupDescription() {
GPXFile gpxFile = getGPXFile();
if (gpxFile.metadata == null) {
gpxFile.metadata = new Metadata();
}
TextView description = view.findViewById(R.id.description);
final String descriptionHtml = gpxFile.metadata.getDescription();
if (Algorithms.isBlank(descriptionHtml)) {
AndroidUiHelper.updateVisibility(description, false);
} else {
description.setText(getFirstParagraph(descriptionHtml));
description.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
GPXFile gpxFile = getGPXFile();
String title = gpxFile.metadata.getArticleTitle();
String imageUrl = getMetadataImageLink(gpxFile.metadata);
GpxReadDescriptionDialogFragment.showInstance(mapActivity, title, imageUrl, descriptionHtml);
}
});
AndroidUiHelper.updateVisibility(description, true);
}
}
private void setOnTouchItem(View item, final ImageView image, final ImageView filled, @DrawableRes final Integer resId, @ColorRes final int colorDef, @ColorRes final int colorPres) {
item.setOnTouchListener(new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")

View file

@ -110,12 +110,14 @@ import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
import static net.osmand.plus.track.OptionsCard.UPLOAD_OSM_BUTTON_INDEX;
import static net.osmand.plus.track.TrackPointsCard.ADD_WAYPOINT_INDEX;
import static net.osmand.plus.track.TrackPointsCard.DELETE_WAYPOINTS_INDEX;
import static net.osmand.plus.track.TrackPointsCard.OPEN_WAYPOINT_INDEX;
public class TrackMenuFragment extends ContextMenuScrollFragment implements CardListener,
SegmentActionsListener, RenameCallback, OnTrackFileMoveListener, OnPointsDeleteListener,
OsmAndLocationListener, OsmAndCompassListener {
public static final String OPEN_TRACK_MENU = "open_track_menu";
public static final String RETURN_SCREEN_NAME = "return_screen_name";
public static final String TAG = TrackMenuFragment.class.getName();
private static final Log log = PlatformUtil.getLog(TrackMenuFragment.class);
@ -137,12 +139,14 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
private View searchContainer;
private ImageView searchButton;
private EditText searchEditText;
private View backButtonContainer;
private TextView toolbarTextView;
private ViewGroup headerContainer;
private View routeMenuTopShadowAll;
private BottomNavigationView bottomNav;
private String gpxTitle;
private String returnScreenName;
private TrackChartPoints trackChartPoints;
private Float heading;
@ -152,6 +156,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
private LatLon latLon;
private int menuTitleHeight;
private int menuHeaderHeight;
private int toolbarHeightPx;
private boolean mapPositionAdjusted;
@ -264,6 +269,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
this.latLon = latLon;
}
public void setReturnScreenName(String returnScreenName) {
this.returnScreenName = returnScreenName;
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
@ -277,6 +286,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
toolbarTextView = view.findViewById(R.id.toolbar_title);
searchButton = view.findViewById(R.id.search_button);
searchContainer = view.findViewById(R.id.search_container);
backButtonContainer = view.findViewById(R.id.back_button_container);
if (isPortrait()) {
AndroidUiHelper.updateVisibility(getTopShadow(), true);
@ -292,8 +302,12 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
updateHeader();
setupButtons(view);
updateCardsLayout();
if (menuType == TrackMenuType.OVERVIEW && isPortrait()) {
calculateLayoutAndShowHeader();
} else {
calculateLayoutAndUpdateMenuState();
}
}
return view;
}
@ -391,6 +405,20 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
}
}
});
backButtonContainer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.launchPrevActivityIntent();
}
dismiss();
}
});
TextView backButtonText = backButtonContainer.findViewById(R.id.back_button_text);
backButtonText.setText(returnScreenName);
ImageView backButtonIcon = backButtonContainer.findViewById(R.id.back_button_icon);
backButtonIcon.setImageResource(AndroidUtils.getNavigationIconResId(backButtonIcon.getContext()));
}
private void setupCards() {
@ -462,8 +490,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
@Override
protected void calculateLayout(View view, boolean initLayout) {
menuTitleHeight = routeMenuTopShadowAll.getHeight()
+ bottomNav.getHeight();
menuHeaderHeight = headerContainer.getHeight();
menuTitleHeight = routeMenuTopShadowAll.getHeight() + bottomNav.getHeight();
super.calculateLayout(view, initLayout);
}
@ -493,6 +521,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
boolean changed = currentMenuState != previousMenuState;
if (changed) {
updateControlsVisibility(true);
boolean backButtonVisible = !Algorithms.isEmpty(returnScreenName) && currentMenuState == MenuState.HALF_SCREEN;
AndroidUiHelper.updateVisibility(backButtonContainer, backButtonVisible);
}
if (currentMenuState != MenuState.FULL_SCREEN && (changed || !mapPositionAdjusted)) {
adjustMapPosition(getMenuStatePosY(currentMenuState));
@ -794,6 +824,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
} else {
pointsCard.setSelectionMode(true);
}
} else if (buttonIndex == OPEN_WAYPOINT_INDEX) {
dismiss();
}
}
}
@ -828,8 +860,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
@Override
protected void onHeaderClick() {
if (getCurrentMenuState() == MenuState.HEADER_ONLY) {
updateMenuState();
}
}
private void adjustMapPosition(int y) {
MapActivity mapActivity = getMapActivity();
@ -887,6 +921,20 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
});
}
private void calculateLayoutAndShowHeader() {
runLayoutListener(new Runnable() {
@Override
public void run() {
int posY = getViewHeight() - menuHeaderHeight - menuTitleHeight - getShadowHeight();
if (posY < getViewY()) {
updateMainViewLayout(posY);
}
animateMainView(posY, false, getCurrentMenuState(), getCurrentMenuState());
updateMapControlsPos(TrackMenuFragment.this, posY, true);
}
});
}
private void updateMenuState() {
if (menuType == TrackMenuType.OPTIONS) {
openMenuFullScreen();
@ -1096,21 +1144,26 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
}
public static void openTrack(@NonNull Context context, @Nullable File file, Bundle prevIntentParams) {
openTrack(context, file, prevIntentParams, null);
}
public static void openTrack(@NonNull Context context, @Nullable File file, @Nullable Bundle prevIntentParams, @Nullable String returnScreenName) {
boolean currentRecording = file == null;
String path = file != null ? file.getAbsolutePath() : null;
if (context instanceof MapActivity) {
TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null);
TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null, null);
} else {
Bundle bundle = new Bundle();
bundle.putString(TRACK_FILE_NAME, path);
bundle.putBoolean(OPEN_TRACK_MENU, true);
bundle.putBoolean(CURRENT_RECORDING, currentRecording);
bundle.putString(RETURN_SCREEN_NAME, returnScreenName);
MapActivity.launchMapActivityMoveToTop(context, prevIntentParams, null, bundle);
}
}
public static void showInstance(@NonNull final MapActivity mapActivity, @Nullable String path,
boolean showCurrentTrack, @Nullable final LatLon latLon) {
public static void showInstance(@NonNull MapActivity mapActivity, @Nullable String path,
boolean showCurrentTrack, @Nullable final LatLon latLon, @Nullable final String returnScreenName) {
OsmandApplication app = mapActivity.getMyApplication();
SelectedGpxFile selectedGpxFile;
if (showCurrentTrack) {
@ -1119,7 +1172,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(path);
}
if (selectedGpxFile != null) {
showInstance(mapActivity, selectedGpxFile, latLon);
showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName);
} else if (!Algorithms.isEmpty(path)) {
String title = app.getString(R.string.loading_smth, "");
final ProgressDialog progress = ProgressDialog.show(mapActivity, title, app.getString(R.string.loading_data));
@ -1133,7 +1186,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
OsmandApplication app = mapActivity.getMyApplication();
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().selectGpxFile(result, true, false);
if (selectedGpxFile != null) {
showInstance(mapActivity, selectedGpxFile, latLon);
showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName);
}
}
if (progress != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {
@ -1146,7 +1199,8 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
}
}
public static boolean showInstance(@NonNull MapActivity mapActivity, @NonNull SelectedGpxFile selectedGpxFile, @Nullable LatLon latLon) {
public static boolean showInstance(@NonNull MapActivity mapActivity, @NonNull SelectedGpxFile selectedGpxFile,
@Nullable LatLon latLon, @Nullable String returnScreenName) {
try {
Bundle args = new Bundle();
args.putInt(ContextMenuFragment.MENU_STATE_KEY, MenuState.HEADER_ONLY);
@ -1155,6 +1209,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
fragment.setArguments(args);
fragment.setRetainInstance(true);
fragment.setSelectedGpxFile(selectedGpxFile);
fragment.setReturnScreenName(returnScreenName);
if (latLon != null) {
fragment.setLatLon(latLon);

View file

@ -26,6 +26,8 @@ import net.osmand.AndroidUtils;
import net.osmand.Collator;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.OsmAndCollator;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
@ -57,6 +59,7 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
public static final int ADD_WAYPOINT_INDEX = 0;
public static final int DELETE_WAYPOINTS_INDEX = 1;
public static final int OPEN_WAYPOINT_INDEX = 2;
private final TrackDisplayHelper displayHelper;
private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_POINTS, GpxDisplayItemType.TRACK_ROUTE_POINTS};
@ -173,6 +176,17 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
if (item != null && item.locationStart != null) {
CardListener cardListener = getListener();
if (cardListener != null) {
cardListener.onCardButtonPressed(this, OPEN_WAYPOINT_INDEX);
}
LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon);
PointDescription description = new PointDescription(PointDescription.POINT_TYPE_WPT, item.name);
mapActivity.getContextMenu().show(location, description, item.locationStart);
}
return true;
}

View file

@ -219,9 +219,8 @@ public class TransportLinesMenu {
return transportPrefs;
}
private static void refreshMap(MapActivity mapActivity) {
ConfigureMapMenu.refreshMapComplete(mapActivity);
mapActivity.refreshMapComplete();
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
}

View file

@ -333,6 +333,17 @@ public class WikiArticleHelper {
return res.toString();
}
@Nullable
public static String getFirstParagraph(String descriptionHtml) {
if (descriptionHtml != null) {
String firstParagraph = WikiArticleHelper.getPartialContent(descriptionHtml);
if (!Algorithms.isEmpty(firstParagraph)) {
return firstParagraph;
}
}
return descriptionHtml;
}
public static String buildTravelUrl(String url, String lang) {
String title = url.replace(" ", "_");
try {

View file

@ -160,7 +160,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
}
TravelHelper travelHelper = getMyApplication().getTravelHelper();
File file = travelHelper.createGpxFile(article);
openTrack(activity, new File(file.getAbsolutePath()), null);
openTrack(activity, new File(file.getAbsolutePath()), null, getString(R.string.icon_group_travel));
}
});
trackButton.setVisibility(View.GONE);

View file

@ -6,8 +6,10 @@ public class TravelGpx extends TravelArticle {
public static final String DIFF_ELE_UP = "diff_ele_up";
public static final String DIFF_ELE_DOWN = "diff_ele_down";
public static final String USER = "user";
public static final String ACTIVITY_TYPE = "route_activity_type";
public String user;
public String activityType;
public float totalDistance = 0;
public double diffElevationUp = 0;
public double diffElevationDown = 0;

View file

@ -58,6 +58,7 @@ import static net.osmand.plus.helpers.GpxUiHelper.getGpxTitle;
import static net.osmand.plus.wikivoyage.data.TravelGpx.DIFF_ELE_DOWN;
import static net.osmand.plus.wikivoyage.data.TravelGpx.DIFF_ELE_UP;
import static net.osmand.plus.wikivoyage.data.TravelGpx.DISTANCE;
import static net.osmand.plus.wikivoyage.data.TravelGpx.ACTIVITY_TYPE;
import static net.osmand.plus.wikivoyage.data.TravelGpx.USER;
import static net.osmand.util.Algorithms.capitalizeFirstLetter;
@ -203,6 +204,7 @@ public class TravelObfHelper implements TravelHelper {
LOG.debug(e.getMessage(), e);
}
res.user = Algorithms.emptyIfNull(amenity.getTagContent(USER));
res.activityType = Algorithms.emptyIfNull(amenity.getTagContent(ACTIVITY_TYPE));
articles.put("en", res);
return articles;
}

View file

@ -20,6 +20,7 @@ import com.squareup.picasso.RequestCreator;
import net.osmand.AndroidUtils;
import net.osmand.PicassoUtils;
import net.osmand.osm.RouteActivityType;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -31,11 +32,14 @@ import net.osmand.plus.wikivoyage.WikivoyageUtils;
import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.plus.wikivoyage.data.TravelGpx;
import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
import net.osmand.plus.wikivoyage.explore.travelcards.TravelGpxCard;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.plus.wikivoyage.explore.travelcards.TravelGpxCard.*;
import static net.osmand.util.Algorithms.capitalizeFirstLetterAndLowercase;
public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int HEADER_TYPE = 0;
@ -81,7 +85,7 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
case ARTICLE_TYPE:
return new ItemVH(inflate(parent, R.layout.wikivoyage_article_card));
case GPX_TYPE:
return new TravelGpxCard.TravelGpxVH(inflate(parent, R.layout.wikivoyage_travel_gpx_card));
return new TravelGpxVH(inflate(parent, R.layout.wikivoyage_travel_gpx_card));
default:
throw new RuntimeException("Unsupported view type: " + viewType);
}
@ -132,14 +136,20 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
holder.rightButton.setCompoundDrawablesWithIntrinsicBounds(null, null, deleteIcon, null);
holder.divider.setVisibility(lastItem ? View.GONE : View.VISIBLE);
holder.shadow.setVisibility(lastItem ? View.VISIBLE : View.GONE);
} else if (viewHolder instanceof TravelGpxCard.TravelGpxVH) {
} else if (viewHolder instanceof TravelGpxVH) {
final TravelGpx article = (TravelGpx) getItem(position);
final TravelGpxCard.TravelGpxVH holder = (TravelGpxCard.TravelGpxVH) viewHolder;
final TravelGpxVH holder = (TravelGpxVH) viewHolder;
holder.title.setText(article.getTitle());
Drawable icon = getActiveIcon(R.drawable.ic_action_user_account_16);
holder.user.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
holder.user.setText(WikiArticleHelper.getPartialContent(article.user));
AndroidUtils.setBackground(app, holder.user, nightMode, R.drawable.btn_border_bg_light, R.drawable.btn_border_bg_dark);
holder.userIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_user_account_16));
holder.user.setText(article.user);
String activityTypeKey = article.activityType;
if (!Algorithms.isEmpty(activityTypeKey)) {
RouteActivityType activityType = RouteActivityType.getOrCreateTypeFromName(activityTypeKey);
int activityTypeIcon = getActivityTypeIcon(activityType);
holder.activityTypeIcon.setImageDrawable(getActiveIcon(activityTypeIcon));
holder.activityType.setText(getActivityTypeTitle(activityType));
holder.activityTypeLabel.setVisibility(View.VISIBLE);
}
holder.distance.setText(OsmAndFormatter.getFormattedDistance(article.totalDistance, app));
holder.diffElevationUp.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationUp, app));
holder.diffElevationDown.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationDown, app));
@ -159,7 +169,18 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
}
}
private void updateSaveButton(final TravelGpxCard.TravelGpxVH holder, final TravelGpx article) {
@DrawableRes
private int getActivityTypeIcon(RouteActivityType activityType) {
int iconId = app.getResources().getIdentifier("mx_" + activityType.getIcon(), "drawable", app.getPackageName());
return iconId != 0 ? iconId : R.drawable.mx_special_marker;
}
private String getActivityTypeTitle(RouteActivityType activityType) {
return AndroidUtils.getActivityTypeStringPropertyName(app, activityType.getName(),
capitalizeFirstLetterAndLowercase(activityType.getName()));
}
private void updateSaveButton(final TravelGpxVH holder, final TravelGpx article) {
if (article != null) {
final TravelLocalDataHelper helper = app.getTravelHelper().getBookmarksHelper();
final boolean saved = helper.isArticleSaved(article);

View file

@ -2,22 +2,28 @@ package net.osmand.plus.wikivoyage.explore.travelcards;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils;
import net.osmand.osm.RouteActivityType;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.track.TrackMenuFragment;
import net.osmand.plus.wikivoyage.data.TravelGpx;
import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
import net.osmand.util.Algorithms;
import java.io.File;
import static net.osmand.util.Algorithms.capitalizeFirstLetterAndLowercase;
public class TravelGpxCard extends BaseTravelCard {
public static final int TYPE = 3;
@ -40,10 +46,16 @@ public class TravelGpxCard extends BaseTravelCard {
if (viewHolder instanceof TravelGpxVH) {
final TravelGpxVH holder = (TravelGpxVH) viewHolder;
holder.title.setText(article.getTitle());
Drawable icon = getActiveIcon(R.drawable.ic_action_user_account_16);
holder.user.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
holder.userIcon.setImageDrawable(getActiveIcon(R.drawable.ic_action_user_account_16));
holder.user.setText(article.user);
AndroidUtils.setBackground(app, holder.user, nightMode, R.drawable.btn_border_bg_light, R.drawable.btn_border_bg_dark);
String activityTypeKey = article.activityType;
if (!Algorithms.isEmpty(activityTypeKey)) {
RouteActivityType activityType = RouteActivityType.getOrCreateTypeFromName(activityTypeKey);
int activityTypeIcon = getActivityTypeIcon(activityType);
holder.activityTypeIcon.setImageDrawable(getActiveIcon(activityTypeIcon));
holder.activityType.setText(getActivityTypeTitle(activityType));
holder.activityTypeLabel.setVisibility(View.VISIBLE);
}
holder.distance.setText(OsmAndFormatter.getFormattedDistance(article.totalDistance, app));
holder.diffElevationUp.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationUp, app));
holder.diffElevationDown.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationDown, app));
@ -66,6 +78,17 @@ public class TravelGpxCard extends BaseTravelCard {
}
}
@DrawableRes
private int getActivityTypeIcon(RouteActivityType activityType) {
int iconId = app.getResources().getIdentifier("mx_" + activityType.getIcon(), "drawable", app.getPackageName());
return iconId != 0 ? iconId : R.drawable.mx_special_marker;
}
private String getActivityTypeTitle(RouteActivityType activityType) {
return AndroidUtils.getActivityTypeStringPropertyName(app, activityType.getName(),
capitalizeFirstLetterAndLowercase(activityType.getName()));
}
private void updateSaveButton(final TravelGpxVH holder) {
if (article != null) {
final TravelLocalDataHelper helper = app.getTravelHelper().getBookmarksHelper();
@ -92,6 +115,10 @@ public class TravelGpxCard extends BaseTravelCard {
public final TextView title;
public final TextView user;
public final ImageView userIcon;
public final TextView activityType;
public final ImageView activityTypeIcon;
public final View activityTypeLabel;
public final TextView distance;
public final TextView diffElevationUp;
public final TextView diffElevationDown;
@ -104,6 +131,10 @@ public class TravelGpxCard extends BaseTravelCard {
super(itemView);
title = itemView.findViewById(R.id.title);
user = itemView.findViewById(R.id.user_name);
userIcon = itemView.findViewById(R.id.user_icon);
activityType = itemView.findViewById(R.id.activity_type);
activityTypeIcon = itemView.findViewById(R.id.activity_type_icon);
activityTypeLabel = itemView.findViewById(R.id.activity_type_label);
distance = itemView.findViewById(R.id.distance);
diffElevationUp = itemView.findViewById(R.id.diff_ele_up);
diffElevationDown = itemView.findViewById(R.id.diff_ele_down);