Merge remote-tracking branch 'origin/master' into create_custom_poi

# Conflicts:
#	OsmAnd/res/values/strings.xml
This commit is contained in:
veliymolfar 2020-04-17 17:06:44 +03:00
commit e317a76bf4
85 changed files with 1143 additions and 587 deletions

View file

@ -19,6 +19,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.zip.GZIPInputStream;
import gnu.trove.list.array.TIntArrayList;
@ -218,6 +220,13 @@ public class Amenity extends MapObject {
return lng;
}
public Set<String> getSupportedContentLocales() {
Set<String> supported = new TreeSet<>();
supported.addAll(getNames("content", "en"));
supported.addAll(getNames("description", "en"));
return supported;
}
public List<String> getNames(String tag, String defTag) {
List<String> l = new ArrayList<String>();
for (String nm : getAdditionalInfo().keySet()) {

View file

@ -39,7 +39,6 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -346,7 +345,7 @@ public class SearchUICore {
}
}
public void setFilterOrders(Map<String, Integer> filterOrders) {
public void setFilterOrders(List<String> filterOrders) {
for (SearchCoreAPI capi : apis) {
if (capi instanceof SearchAmenityTypesAPI) {
((SearchAmenityTypesAPI) capi).setFilterOrders(filterOrders);

View file

@ -639,7 +639,7 @@ public class SearchCoreFactory {
private List<CustomSearchPoiFilter> customPoiFilters = new ArrayList<>();
private TIntArrayList customPoiFiltersPriorites = new TIntArrayList();
private MapPoiTypes types;
private Map<String, Integer> filterOrders = new HashMap<>();
private List<String> filterOrders = new ArrayList<>();
public SearchAmenityTypesAPI(MapPoiTypes types) {
super(ObjectType.POI_TYPE);
@ -656,7 +656,7 @@ public class SearchCoreFactory {
this.customPoiFiltersPriorites.add(priority);
}
public void setFilterOrders(Map<String, Integer> filterOrders) {
public void setFilterOrders(List<String> filterOrders) {
this.filterOrders = filterOrders;
}
@ -737,8 +737,8 @@ public class SearchCoreFactory {
res.firstUnknownWordMatches = startMatch.matches(res.localeName);
if (showTopFiltersOnly) {
String stdFilterId = getStandardFilterId(pt);
if (filterOrders.containsKey(stdFilterId)) {
res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.get(stdFilterId);
if (filterOrders.contains(stdFilterId)) {
res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.indexOf(stdFilterId);
resultMatcher.publish(res);
}
} else {
@ -754,8 +754,8 @@ public class SearchCoreFactory {
res.object = csf;
res.objectType = ObjectType.POI_TYPE;
if (showTopFiltersOnly) {
if (filterOrders.containsKey(csf.getFilterId())) {
res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.get(csf.getFilterId());
if (filterOrders.contains(csf.getFilterId())) {
res.priority = SEARCH_AMENITY_TYPE_PRIORITY + filterOrders.indexOf(csf.getFilterId());
resultMatcher.publish(res);
}
} else {

View file

@ -1,14 +0,0 @@
{
"categories" : {
"special" : {
"icons" : [
"special_star", "special_star_stroked", "special_marker", "special_flag_stroke", "special_house", "special_building"
]
},
"amenity" : {
"icons": [
"amenity_bar", "amenity_cafe", "amenity_atm", "amenity_biergarten", "amenity_cinema", "amenity_fire_station", "amenity_parking"
]
}
}
}

View file

@ -8,11 +8,7 @@
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/global_preference_toolbar" />
</com.google.android.material.appbar.AppBarLayout>
android:layout_height="wrap_content" />
<FrameLayout
android:layout_width="match_parent"

View file

@ -22,7 +22,7 @@
android:paddingStart="@dimen/list_content_padding"
android:paddingRight="0dp"
android:paddingEnd="0dp"
android:minHeight="@dimen/list_item_height"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:background="?attr/expandable_list_item_background">
<CheckBox
@ -46,13 +46,13 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding_large"
android:layout_weight="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Category name"
android:layout_marginStart="@dimen/list_content_padding" />
android:layout_marginStart="@dimen/list_content_padding_large" />
<ImageView
android:id="@+id/options"

View file

@ -5,7 +5,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:minHeight="@dimen/favorites_list_item_height"
android:orientation="vertical">
<View
@ -20,41 +20,45 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:layout_marginLeft="54dp"
android:visibility="gone"
android:layout_marginStart="54dp" />
android:layout_marginLeft="@dimen/settings_divider_margin_start"
android:layout_marginStart="@dimen/settings_divider_margin_start" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/favorites_list_item_height"
android:layout_gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/list_header_padding"
android:paddingLeft="@dimen/list_header_padding"
android:paddingStart="@dimen/list_header_padding">
android:paddingEnd="@dimen/list_header_padding"
android:paddingRight="@dimen/list_header_padding">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
android:layout_width="@dimen/favorites_icon_size"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">
<CheckBox
android:id="@+id/toggle_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_header_padding"
android:layout_marginLeft="@dimen/list_header_padding"
android:focusable="false"
android:visibility="gone"
tools:visibility="visible"
android:layout_marginEnd="@dimen/list_content_padding" />
tools:visibility="visible" />
<ImageView
android:id="@+id/favourite_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_gravity="center"
android:contentDescription="@string/favorite"
android:scaleType="center"
android:layout_marginRight="@dimen/list_header_settings_top_margin"
android:layout_marginEnd="@dimen/list_header_settings_top_margin" />
tools:src="@drawable/bg_point_circle"/>
</FrameLayout>
<LinearLayout
@ -63,18 +67,23 @@
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="6dp"
android:paddingRight="@dimen/list_content_padding"
android:paddingBottom="6dp"
android:paddingEnd="@dimen/list_content_padding">
android:layout_marginStart="@dimen/favorites_icon_right_margin"
android:layout_marginLeft="@dimen/favorites_icon_right_margin"
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:paddingTop="@dimen/context_menu_padding_margin_small"
android:paddingBottom="@dimen/context_menu_padding_margin_small">
<TextView
android:id="@+id/favourite_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:scrollbars="none"
android:textColor="?android:textColorPrimary"
android:layout_marginBottom="@dimen/subHeaderPadding"
android:textSize="@dimen/default_list_text_size"
tools:text="@string/lorem_ipsum"/>
tools:text="@string/lorem_ipsum" />
<LinearLayout
android:layout_width="wrap_content"
@ -85,62 +94,65 @@
android:id="@+id/direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="2dp"
android:layout_gravity="center_vertical"
android:contentDescription="@string/show_view_angle"
android:src="@drawable/ic_direction_arrow" />
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginStart="@dimen/gpx_small_icon_margin"
android:layout_marginLeft="@dimen/gpx_small_icon_margin"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="100500 km"
android:layout_marginStart="2dp" />
android:textSize="@dimen/default_desc_text_size"
tools:text="100500 km" />
<ImageView
android:id="@+id/group_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:src="@drawable/ic_small_group"
android:layout_marginStart="4dp" />
android:layout_marginStart="@dimen/list_item_button_padding"
android:layout_marginLeft="@dimen/list_item_button_padding"
android:contentDescription="@string/favorite_category_name"
android:src="@drawable/ic_small_group" />
<TextView
android:id="@+id/group_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp"
android:layout_marginStart="@dimen/gpx_small_icon_margin"
android:layout_marginLeft="@dimen/gpx_small_icon_margin"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
android:layout_marginStart="2dp" />
android:textSize="@dimen/default_desc_text_size" />
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="@+id/navigate_to"
android:contentDescription="@string/context_menu_item_directions_to"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dashFavIconMargin"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:background="?attr/dashboard_button"
android:contentDescription="@string/context_menu_item_directions_to"
android:src="@drawable/ic_action_test_light"
android:visibility="gone"
android:layout_marginStart="@dimen/dashFavIconMargin" />
android:visibility="gone" />
<ImageButton
android:id="@+id/options"
android:contentDescription="@string/shared_string_more"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_more"
android:src="@drawable/ic_overflow_menu_white"
android:visibility="gone"/>
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View file

@ -47,23 +47,4 @@
tools:listitem="@layout/gpx_track_select_item">
</androidx.recyclerview.widget.RecyclerView>
<LinearLayout
android:id="@+id/buttons_container"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="vertical"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="@dimen/content_padding_small">
<include
android:id="@+id/dismiss_button"
layout="@layout/bottom_sheet_dialog_button"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>

View file

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/settings_divider_margin_start"
android:layout_height="wrap_content"
android:minHeight="@dimen/settings_divider_margin_start"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">
@ -21,7 +22,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"

View file

@ -1,107 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/setting_list_item_large_height"
android:gravity="center_vertical">
android:gravity="center_vertical"
android:minHeight="@dimen/setting_list_item_large_height">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
tools:src="@drawable/ic_map"/>
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
tools:src="@drawable/ic_map" />
<LinearLayout
android:id="@+id/text_wrapper"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/list_content_padding"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Germany"/>
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:maxLines="25"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Contour Lines"/>
<LinearLayout
android:id="@+id/text_wrapper"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingTop="6dp"
android:paddingBottom="6dp">
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:visibility="visible"
android:visibility="gone"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Germany" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:maxLines="25"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="Contour Lines" />
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
<ImageView
android:id="@+id/secondary_icon"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:scaleType="center"
android:layout_gravity="center_vertical"
android:visibility="gone"
tools:src="@drawable/ic_action_import"
tools:visibility="visible" />
<Button
android:id="@+id/right_button"
android:layout_width="wrap_content"
android:layout_height="33dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dashFavIconMargin"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:background="@drawable/buy_btn_background_light"
android:minWidth="40dp"
android:paddingStart="18dp"
android:paddingLeft="18dp"
android:paddingEnd="18dp"
android:paddingRight="18dp"
android:text="@string/buy"
android:textColor="@color/buy_button_color"
android:visibility="gone" />
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="?attr/dashboard_divider" />
</LinearLayout>
<ImageView
android:id="@+id/secondary_icon"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:scaleType="center"
android:visibility="gone"
tools:src="@drawable/ic_action_import"
tools:visibility="visible"/>
<Button
android:id="@+id/right_button"
android:layout_width="wrap_content"
android:layout_height="33dp"
android:minWidth="40dp"
android:paddingLeft="18dp"
android:paddingRight="18dp"
android:background="@drawable/buy_btn_background_light"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginRight="@dimen/content_padding_half"
android:textColor="@color/buy_button_color"
android:text="@string/buy"
android:visibility="gone"
android:layout_marginStart="@dimen/dashFavIconMargin"
android:paddingStart="18dp"
android:paddingEnd="18dp"
android:layout_marginEnd="@dimen/content_padding_half" />
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"
android:layout_marginStart="56dp" />
</LinearLayout>

View file

@ -47,7 +47,7 @@
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="marquee"
android:paddingLeft="@dimen/content_padding"
android:paddingLeft="0dp"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half"
@ -56,7 +56,7 @@
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/poi_aerialway_transport"
android:paddingEnd="@dimen/content_padding"
android:paddingStart="@dimen/content_padding" />
android:paddingStart="0dp" />
<ImageView
android:id="@+id/move_icon"

View file

@ -139,7 +139,6 @@
android:paddingStart="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:scrollHorizontally="false"
android:textSize="16sp"
tools:text="@string/lorem_ipsum" />

View file

@ -0,0 +1,77 @@
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/actionModeBackground"
android:minHeight="@dimen/toolbar_height"
osmand:contentInsetLeft="0dp"
osmand:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageButton
android:id="@+id/close_button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="@dimen/toolbar_height"
android:layout_height="@dimen/toolbar_height"
android:contentDescription="@string/access_shared_string_navigate_up"
android:src="@drawable/ic_action_mode_back"
android:tint="?attr/app_bar_primary_item_color"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="2"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:textColor="?attr/app_bar_primary_item_color"
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/routing_settings_2" />
<TextView
android:id="@+id/toolbar_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="?attr/pstsInactiveTextColor"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:visibility="gone"
tools:text="Some description" />
</LinearLayout>
<include
layout="@layout/profile_button_small"
android:layout_width="@dimen/route_info_toolbar_button_size"
android:layout_height="@dimen/route_info_toolbar_button_size"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>

View file

@ -3363,7 +3363,7 @@
<string name="simulate_your_location_gpx_descr">محاكاة موقعك باستخدام مسار GPX مسجل.</string>
<string name="quick_action_directions_from_desc">زر لجعل مركز الشاشة نقطة الانطلاق. سيطلب بعد ذلك تعيين الوجهة أو تشغيل حساب المسار.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">شخصي</string>
<string name="shared_string_downloading_formatted">تنزيل %s</string>
<string name="rendering_value_thick_name">سميك</string>
@ -3582,7 +3582,5 @@
<string name="shared_string_languages">اللغات</string>
<string name="shared_string_language">اللغة</string>
<string name="shared_string_all_languages">جميع اللغات</string>
<string name="wikipedia_poi_languages_promo">قد لا تكون بعض مقالات ويكيبيديا متاحة باسمك ، حدد اللغات التي ستظهر بها مقالات ويكيبيديا على الخريطة.
\nستتمكن من التبديل بين جميع اللغات المتاحة أثناء قراءة المقالة.</string>
<string name="wiki_menu_download_descr">هناك حاجة إلى خرائط إضافية لعرض النقاط المهمة من ويكيبيديا على الخريطة.</string>
</resources>

View file

@ -3368,7 +3368,7 @@
<string name="save_heading">Захоўваць кірунак</string>
<string name="save_heading_descr">Падчас запісу захоўваць кірунак для кожнага пункта маршруту.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Асабісты</string>
<string name="shared_string_downloading_formatted">Спампоўванне %s</string>
<string name="rendering_value_thick_name">Тоўста</string>

View file

@ -3404,7 +3404,7 @@ Abasta l\'àrea: %1$s x %2$s</string>
<string name="join_segments">Uneix segments</string>
<string name="add_new_profile_q">Voleu afegir el nou perfil \'%1$s\'\?</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personal</string>
<string name="shared_string_downloading_formatted">S\'està baixant %s</string>
<string name="rendering_attr_showCycleNodeNetworkRoutes_name">Mostra les vies ciclistes de xarxa de nodes</string>
@ -3619,7 +3619,19 @@ Abasta l\'àrea: %1$s x %2$s</string>
<string name="shared_string_languages">Idiomes</string>
<string name="shared_string_language">Llengua</string>
<string name="shared_string_all_languages">Tots els idiomes</string>
<string name="wikipedia_poi_languages_promo">Alguns articles de la Viquipèdia podrien no estar disponibles en la vostra llengua, seleccioneu els idiomes de la Viquipèdia amb els que es localitzaran articles en el mapa.
\nPodreu anar canviant entre els idiomes disponibles mentre llegiu l\'article.</string>
<string name="wiki_menu_download_descr">Es necessiten mapes addicionals per veure els PDIs de la Viquipèdia al mapa.</string>
<string name="ui_customization">Personalització de la IU</string>
<string name="context_menu_actions">Accions del menú contextual</string>
<string name="reorder_or_hide_from">Reordena o amaga els elements des del %1$s.</string>
<string name="shared_string_divider">Divisor</string>
<string name="divider_descr">Elements per sota daquest punt separats per un divisor.</string>
<string name="shared_string_hidden">Amagat</string>
<string name="hidden_items_descr">Aquests elements no es mostren al menú, però les opcions o els connectors que representen continuen funcionant.</string>
<string name="reset_items_descr">La configuració es restablirà a l\'estat original després d\'amagar-se.</string>
<string name="main_actions_descr">Les accions principals només contenen 4 botons.</string>
<string name="main_actions">Accions principals</string>
<string name="additional_actions_descr">Podeu accedir a aquesta acció prement el botó \"Accions\".</string>
<string name="move_inside_category">Només podeu moure els elements dins d\'aquesta categoria.</string>
<string name="developer_plugin">Connector per a desenvolupadors</string>
<string name="shared_string_items">Elements</string>
</resources>

View file

@ -3406,7 +3406,7 @@ Repræsenterer område: %1$s x %2$s</string>
<string name="save_heading">Medtag retning</string>
<string name="save_heading_descr">Gem retning for hvert sporpunkt under optagelse.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personlig</string>
<string name="shared_string_downloading_formatted">Henter %s</string>
<string name="rendering_value_thick_name">Tyk</string>
@ -3598,6 +3598,4 @@ Repræsenterer område: %1$s x %2$s</string>
<string name="shared_string_language">Sprog</string>
<string name="shared_string_all_languages">Alle sprog</string>
<string name="wiki_menu_download_descr">Yderligere kort er nødvendige for at se Wikipedia Interessepunkter på kortet.</string>
<string name="wikipedia_poi_languages_promo">Nogle Wikipedia-artikler er muligvis ikke tilgængelige på nogle sprog. Vælg de sprog, som Wikipedia-artikler skal vises på kortet.
\nSkift mellem alle tilgængelige sprog, mens artiklen læses.</string>
</resources>

View file

@ -3410,7 +3410,7 @@ Lon %2$s</string>
<string name="save_heading">Richtung einbeziehen</string>
<string name="save_heading_descr">Richtung zu jedem Trackpunkt während der Aufnahme speichern.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Persönlich</string>
<string name="shared_string_downloading_formatted">%s herunterladen</string>
<string name="rendering_value_thick_name">Fett</string>
@ -3625,7 +3625,6 @@ Lon %2$s</string>
<string name="shared_string_languages">Sprachen</string>
<string name="shared_string_language">Sprache</string>
<string name="shared_string_all_languages">Alle Sprachen</string>
<string name="wikipedia_poi_languages_promo">Manche Wikipedia-Artikel liegen unter Umständen nicht in Ihrer Sprache vor. Wählen Sie die Sprachen aus, in denen Wikipedia-Artikel auf der Karte erscheinen sollen.
\nSie können beim Lesen des Artikels zwischen allen verfügbaren Sprachen wechseln.</string>
<string name="wiki_menu_download_descr">Zusätzliche Karten werden benötigt um Wikipedia-POIs auf der Karte anzuzeigen.</string>
<string name="developer_plugin">Entwickler-Plugin</string>
</resources>

View file

@ -3403,7 +3403,7 @@
<string name="save_heading">Συμπερίληψη κατεύθυνσης</string>
<string name="save_heading_descr">Αποθήκευση κατεύθυνσης για κάθε σημείο ίχνους κατά την εγγραφή.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Προσωπικό</string>
<string name="shared_string_downloading_formatted">Λήψη %s</string>
<string name="rendering_value_thick_name">Πυκνός</string>

View file

@ -3386,7 +3386,7 @@ Indikas lokon: %1$s x %2$s"</string>
<string name="save_heading">Inkluzivi direkton</string>
<string name="save_heading_descr">Konservi direkton al ĉiu punkto de kurso dum registri.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personaj</string>
<string name="shared_string_downloading_formatted">Elŝutado de %s</string>
<string name="rendering_value_thick_name">Dika</string>
@ -3601,7 +3601,11 @@ Indikas lokon: %1$s x %2$s"</string>
<string name="shared_string_languages">Lingvoj</string>
<string name="shared_string_language">Lingvo</string>
<string name="shared_string_all_languages">Ĉiuj lingvoj</string>
<string name="wikipedia_poi_languages_promo">Iuj artikoloj de Vikipedio povas ne esti disponeblaj en via(j) lingvo(j), elektu lingvojn en kiuj artikoloj de Vikipedio estos montrataj sur la mapo.
\nVi povas baskuli inter ĉiuj disponeblaj lingvoj dum legi artikolon.</string>
<string name="wiki_menu_download_descr">Kromaj mapoj estas necesaj por vidigi punktojn de Vikipedio sur la mapo.</string>
<string name="main_actions_descr">Ĉefaj agoj povas enhavi nur 4 butonojn.</string>
<string name="main_actions">Ĉefaj agoj</string>
<string name="additional_actions_descr">Vi povas aliri tiun ĉi agojn per la butono “agoj”.</string>
<string name="move_inside_category">Vi povas movi elementojn nur ene tiu ĉi kategorio.</string>
<string name="developer_plugin">Programista kromprogramo</string>
<string name="shared_string_items">Elementoj</string>
</resources>

View file

@ -3405,7 +3405,7 @@ Lon %2$s</string>
<string name="save_heading">Incluir rumbo</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="save_heading_descr">Guarda el rumbo para cada punto de la traza durante la grabación.</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personal</string>
<string name="shared_string_downloading_formatted">Descargando %s</string>
<string name="rendering_value_thick_name">Espesor</string>

View file

@ -3405,7 +3405,7 @@ Lon %2$s</string>
<string name="save_heading">Incluir rumbo</string>
<string name="save_heading_descr">Guarda el rumbo para cada punto de la traza durante la grabación.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personal</string>
<string name="shared_string_downloading_formatted">Descargando %s</string>
<string name="rendering_value_thick_name">Espesor</string>

View file

@ -3395,7 +3395,7 @@
<string name="save_heading">Incluir rumbo</string>
<string name="save_heading_descr">Guarda el rumbo para cada punto de la traza durante la grabación.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personal</string>
<string name="shared_string_downloading_formatted">Descargando %s</string>
<string name="rendering_value_thick_name">Grueso</string>

View file

@ -1033,7 +1033,7 @@
<string name="save_heading">Kaasa pealkiri</string>
<string name="save_heading_descr">Salvestamise ajal salvesta kurss igasse teekonnapunkti.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Isiklik</string>
<string name="shared_string_downloading_formatted">Allalaadimine %s</string>
<string name="rendering_value_thick_name">Jäme</string>

View file

@ -3409,7 +3409,7 @@ Area honi dagokio: %1$s x %2$s</string>
<string name="save_heading">Sartu norabidea</string>
<string name="save_heading_descr">Gorde lorratzeko puntu bakoitzerako norabidea grabatzean.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Pertsonala</string>
<string name="shared_string_downloading_formatted">%s deskargatzen</string>
<string name="rendering_value_thick_name">Lodia</string>
@ -3628,7 +3628,5 @@ Area honi dagokio: %1$s x %2$s</string>
<string name="shared_string_languages">Hizkuntzak</string>
<string name="shared_string_language">Hizkuntza</string>
<string name="shared_string_all_languages">Hizkuntza guztiak</string>
<string name="wikipedia_poi_languages_promo">Baliteke Wikipediako artikulu batzuk zure hizkuntzan erabilgarri ez egotea, hautatu mapan agertuko diren Wikipediako artikuluen hizkuntzak.
\nEskuragarri dauden hizkuntza guztien artean alda dezakezu artikulua irakurtzean.</string>
<string name="wiki_menu_download_descr">Mapa osagarriak behar dira Wikipediaren POIak mapan ikusteko.</string>
</resources>

View file

@ -3431,7 +3431,7 @@
<string name="save_heading">ثبت جهت</string>
<string name="save_heading_descr">هنگام ضبط، جهت (heading) را برای هر یک از نقطه‌های رد ثبت می‌کند.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s، %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s، %2$s</string>
<string name="personal_category_name">شخصی</string>
<string name="shared_string_downloading_formatted">در حال بارگیری %s</string>
<string name="rendering_value_thick_name">ضخیم</string>

View file

@ -3376,7 +3376,7 @@ représentant la zone : %1$s x %2$s</string>
<string name="rendering_value_walkingRoutesOSMCNodes_name">Réseaux</string>
<string name="personal_category_name">Personnel</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="shared_string_downloading_formatted">Téléchargement %s</string>
<string name="rendering_value_thick_name">Épais</string>
<string name="desert_render_descr">Pour les déserts et autres zones faiblement peuplées, affiche plus de détails.</string>
@ -3586,8 +3586,6 @@ représentant la zone : %1$s x %2$s</string>
<string name="settings_item_read_error">Impossible de lire %1$s.</string>
<string name="settings_item_write_error">Impossible d\'écrire %1$s.</string>
<string name="settings_item_import_error">Impossible d\'importer %1$s.</string>
<string name="wikipedia_poi_languages_promo">Sélectionnez les langues dans lesquelles les articles Wikipédia apparaîtront sur la carte. Certains articles Wikipédia peuvent ne pas être disponibles dans certaines langues.
\nVous pourrez basculer entre toutes les langues disponibles pendant la lecture de larticle.</string>
<string name="select_track_file">Sélectionnez le fichier de trace</string>
<string name="shared_string_languages">Langues</string>
<string name="shared_string_language">Langue</string>

View file

@ -3476,7 +3476,7 @@ Lon %2$s</string>
<string name="save_heading">Incluír encabezamento</string>
<string name="save_heading_descr">Gardar encabezamento en cada punto da pista (trackpoint) mentres se grava.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Persoal</string>
<string name="shared_string_downloading_formatted">Baixando %s</string>
<string name="rendering_value_thick_name">Groso</string>

View file

@ -3395,7 +3395,7 @@
<string name="save_heading">כולל הכותרת</string>
<string name="save_heading_descr">לשמור את הכותרת של כל נקודת דרך בזמן ההקלטה.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">אישי</string>
<string name="shared_string_downloading_formatted">%s בהורדה</string>
<string name="routing_attr_allow_classic_only_description">מסלולים שעבור גרומינג לסגנון קלסי רק ללא מסלולי ההחלקה. לרבות מסלולים שעברו גרומינג על ידי אופנוע שלג עם תוואי רופף ומסלולים שנסללו ידנית על ידי גולשי סקי.</string>
@ -3613,6 +3613,4 @@
<string name="monitoring_min_accuracy_descr_side_effect">תופעת לוואי: כתוצאה מסינון לפי דיוק, ייתכן שכמה נקודות תיעלמנה עבור למשל מתחת לגשרים, מתחת לעצים, בין בניינים גבוהים או בתנאי מזג אוויר מסוימים.</string>
<string name="monitoring_min_accuracy_descr">פעולה זו תקליט רק נקודות שנמדדו עם חיווי של דיוק מזערי (במטרים/רגל כפי שדווח על ידי Android עבור ערכת השבבים שלך). דיוק מתייחס לפיזור המדידות המחזוריות ואינו קשור לדיוק, שמגדיר כמה קרובות המדידות שלך למיקום האמתי שלך.</string>
<string name="monitoring_min_speed_descr_recommendation">המלצה: כדאי לנסות להשתמש בזיהוי תנועה דרך המסנן לסף תנועה תחתון (B) קודם לכן, הוא עשוי להביא לתוצאות טובות יותר ופחות מידע ילך לאיבוד. אם המסלולים שלך עדיין רועשים במהירויות נמוכות, כדי לנסות כאן ערכים שונים מאפס. נא לשים לב שחלק מהמדידות לא תדווחנה נתוני מהירות כלל (שיטות מבוססות רשת), שבמקרים כאלה לא יוקלט שום דבר.</string>
<string name="wikipedia_poi_languages_promo">חלק מהערכים בוויקיפדיה לא יהיו זמינים בשם שצוין, יש לבחור את השפות בהן יופיעו הערכים של ויקיפדיה במפה.
\nניתן יהיה להחליף בין כל השפות הזמינות בזמן קריאת הערך.</string>
</resources>

View file

@ -3233,7 +3233,7 @@ Ha szereted az OsmAndot és az OSM-et, és szeretnéd támogatni a fejlődésük
<string name="suggested_maps">Javasolt térképek</string>
<string name="add_new_profile_q">Hozzáadja az új „%1$s” profilt\?</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Személyes</string>
<string name="shared_string_downloading_formatted">%s letöltése</string>
<string name="new_route_calculated_dist_dbg">Útvonal: távolság %s, menetidő %s

View file

@ -3413,7 +3413,7 @@ Stendur fyrir svæði: %1$s x %2$s</string>
<string name="save_heading">Hafa með stefnu</string>
<string name="save_heading_descr">Vista stefnu í hvern ferilpunkt á meðan upptöku stendur.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Persónulegt</string>
<string name="shared_string_downloading_formatted">Sæki %s</string>
<string name="rendering_value_thick_name">Svert</string>

View file

@ -3397,7 +3397,7 @@ Rappresenta l\'area: %1$s x %2$s</string>
<string name="save_heading">Salva orientamento</string>
<string name="save_heading_descr">Durante la registrazione salva l\'orientamento per ogni punto della traccia</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personale</string>
<string name="shared_string_downloading_formatted">Scaricamento %s</string>
<string name="rendering_attr_piste_type_snow_park_name">Parco innevato</string>
@ -3623,6 +3623,4 @@ Rappresenta l\'area: %1$s x %2$s</string>
<string name="shared_string_languages">Lingue</string>
<string name="shared_string_language">Lingua</string>
<string name="shared_string_all_languages">Tutte le lingue</string>
<string name="wikipedia_poi_languages_promo">Alcuni articoli Wikipedia potrebbero non essere disponibili nella tua lingua, scegli il linguaggio con cui appariranno sulla mappa.
\nDurante la lettura potrai cambiare fra tutte le lingue disponibili.</string>
</resources>

View file

@ -3409,7 +3409,7 @@ POIの更新は利用できません</string>
<string name="rendering_value_thick_name">濃い</string>
<string name="desert_render_descr">砂漠などの過疎地に向いたマップスタイルです。各情報の詳細も表示されます。</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="select_navigation_icon">移動中の位置アイコン</string>
<string name="select_map_icon">静止中の位置アイコン</string>
<string name="delete_profiles_descr">[決定]をタップすると、プロファイルが完全に削除されます。</string>

View file

@ -362,7 +362,7 @@
<string name="save_heading">ಶೀರ್ಷಿಕೆಯನ್ನು ಸೇರಿಸಿ</string>
<string name="save_heading_descr">ರೆಕಾರ್ಡಿಂಗ್ ಮಾಡುವಾಗ ಪ್ರತಿ ಟ್ರ್ಯಾಕ್ ಪಾಯಿಂಟ್‌ಗೆ ಶೀರ್ಷಿಕೆ ಉಳಿಸಿ.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">ವೈಯಕ್ತಿಕ</string>
<string name="shared_string_downloading_formatted">ಡೌನ್‌ಲೋಡ್ ಮಾಡಲಾಗುತ್ತಿದೆ%s</string>
<string name="rendering_value_thick_name">ದಪ್ಪ</string>

View file

@ -3406,7 +3406,7 @@
<string name="shared_string_turn_off">Skru av</string>
<string name="new_plugin_added">Nytt programtillegg lagt til</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personlig</string>
<string name="shared_string_downloading_formatted">Laster ned %s</string>
<string name="rendering_value_thick_name">Tykk</string>
@ -3499,4 +3499,7 @@
<string name="settings_item_read_error">Kunne ikke lese %1$s.</string>
<string name="settings_item_import_error">Kunne ikke importere %1$s.</string>
<string name="settings_item_write_error">Kunne ikke skrive %1$s.</string>
<string name="shared_string_languages">Språk</string>
<string name="shared_string_language">Språk</string>
<string name="shared_string_all_languages">Alle språk</string>
</resources>

View file

@ -3281,7 +3281,7 @@ voor Gebied: %1$s x %2$s</string>
<string name="save_heading">Richting toevoegen</string>
<string name="personal_category_name">Persoonlijk</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="shared_string_downloading_formatted">Downloaden %s</string>
<string name="desert_render_descr">Voor woestijnen en andere dunbevolkte gebieden. Meer gedetailleerd.</string>
<string name="rendering_value_thick_name">Dik</string>

View file

@ -3403,7 +3403,7 @@ Reprezentuje obszar: %1$s x %2$s</string>
<string name="save_heading">Dołączenie kierunku</string>
<string name="save_heading_descr">Zapisuje podczas rejestrowania kierunek do każdego punktu trasy.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Osobiste</string>
<string name="shared_string_downloading_formatted">Pobieranie %s</string>
<string name="desert_render_descr">Dla pustyń i innych słabo zaludnionych obszarów. Bardziej szczegółowa.</string>

View file

@ -3392,7 +3392,7 @@ Pôr do Sol: %2$s</string>
<string name="save_heading">Incluir direção</string>
<string name="save_heading_descr">Salve o cabeçalho em cada ponto da trilha durante a gravação.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Pessoal</string>
<string name="shared_string_downloading_formatted">Baixando %s</string>
<string name="rendering_value_thick_name">Grosso</string>
@ -3606,7 +3606,5 @@ Pôr do Sol: %2$s</string>
<string name="shared_string_languages">Idiomas</string>
<string name="shared_string_language">Idioma</string>
<string name="shared_string_all_languages">Todos os idiomas</string>
<string name="wikipedia_poi_languages_promo">Alguns artigos da Wikipédia podem não estar disponíveis em seu nome. Selecione os idiomas nos quais os artigos da Wikipédia aparecerão no mapa.
\nVocê poderá alternar entre todos os idiomas disponíveis enquanto lê o artigo.</string>
<string name="wiki_menu_download_descr">Mapas adicionais são necessários para visualizar os POIs da Wikipédia no mapa.</string>
</resources>

View file

@ -3377,7 +3377,7 @@
<string name="save_heading">Incluir a direção</string>
<string name="save_heading_descr">Gravar direção para cada ponto de pista durante a gravação.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Pessoal</string>
<string name="shared_string_downloading_formatted">Descarregando %s</string>
<string name="rendering_value_thick_name">Grosso</string>

View file

@ -2654,7 +2654,7 @@
<string name="save_heading">Includeți titlu</string>
<string name="save_heading_descr">Salvați poziția fiecarui punct al traseului în timpul înregistrării.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personal</string>
<string name="shared_string_downloading_formatted">Descarcarea %s</string>
<string name="rendering_value_thick_name">Gros</string>

View file

@ -3354,7 +3354,7 @@
<string name="suggested_maps">Предлагаемые карты</string>
<string name="join_segments">Объединить сегменты</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="desert_render_descr">Для пустынь и других малонаселенных районов. Более детально.</string>
<string name="select_navigation_icon">Положение значка при движении</string>
<string name="select_map_icon">Положение значка в состоянии покоя</string>
@ -3608,10 +3608,27 @@
<string name="settings_item_write_error">Невозможно записать %1$s.</string>
<string name="settings_item_import_error">Невозможно импортировать %1$s.</string>
<string name="select_track_file">Выберите файл трека</string>
<string name="wikipedia_poi_languages_promo">Некоторые статьи Википедии могут быть недоступны на вашем родном языке, выберите языки, на которых такие статьи будут отображаться на карте.
\nВы сможете переключаться между всеми доступными языками во время чтения статьи.</string>
<string name="shared_string_languages">Языки</string>
<string name="shared_string_language">Язык</string>
<string name="shared_string_all_languages">Все языки</string>
<string name="wiki_menu_download_descr">Для просмотра POI Википедии на карте необходимы дополнительные карты.</string>
<string name="ui_customization_description">Настройка количества элементов в разделах \"Панель\", \"Настройка карты\" и контекстном меню.
\n
\nМожно отключить неиспользуемые плагины, чтобы скрыть их элементы управления из приложения %1$s.</string>
<string name="ui_customization_short_descr">Элементы панели, контекстное меню</string>
<string name="shared_string_drawer">Панель</string>
<string name="divider_descr">Элементы ниже разделенные делителем.</string>
<string name="shared_string_items">Элементы</string>
<string name="ui_customization">Настройка интерфейса</string>
<string name="context_menu_actions">Действия контекстного меню</string>
<string name="reorder_or_hide_from">Изменить порядок или скрыть элементы из %1$s.</string>
<string name="shared_string_divider">Разделитель</string>
<string name="shared_string_hidden">Скрыто</string>
<string name="hidden_items_descr">Эти элементы скрыты из меню, но представляемые ими функции или плагины продолжают работать.</string>
<string name="reset_items_descr">Настройки будут сброшены в исходное состояние после скрытия.</string>
<string name="main_actions_descr">Основные действия содержат только 4 кнопки.</string>
<string name="main_actions">Основные действия</string>
<string name="additional_actions_descr">Доступ к этим действиям происходит нажатием кнопки \"Действия\".</string>
<string name="move_inside_category">Перемещать элементы можно только внутри данной категории.</string>
<string name="developer_plugin">Плагин для разработчиков</string>
</resources>

View file

@ -3404,7 +3404,7 @@ Pro praghere iscrie su còdighe intreu</string>
<string name="save_heading">Inclue sa diretzione</string>
<string name="save_heading_descr">Sarva sa diretzione pro cada puntu cando ses registrende.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personale</string>
<string name="shared_string_downloading_formatted">Iscarrighende %s</string>
<string name="rendering_value_thick_name">Grussa</string>
@ -3618,7 +3618,5 @@ Pro praghere iscrie su còdighe intreu</string>
<string name="shared_string_languages">Limbas</string>
<string name="shared_string_language">Limba</string>
<string name="shared_string_all_languages">Totu sas limbas</string>
<string name="wikipedia_poi_languages_promo">Unos cantos artìculos de Wikipedia diant pòdere no èssere disponìbiles in sa limba tua. Issèbera sas limbas de sos artìculos de Wikipedia chi ant a apàrrere in sa mapa.
\nAs a pòdere colare dae una limba a s\'àtera in su mentres chi ses leghende un\'artìculu.</string>
<string name="wiki_menu_download_descr">Pro bìdere sos PDI de Wikipedia in sa mapa b\'at bisòngiu de mapas agiuntivas.</string>
</resources>

View file

@ -3392,7 +3392,7 @@ Zodpovedá oblasti: %1$s x %2$s</string>
<string name="save_heading">Pridať nadpis</string>
<string name="save_heading_descr">Pridať nadpis ku každému bodu trasy pri zázname.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Osobné</string>
<string name="shared_string_downloading_formatted">Sťahujem %s</string>
<string name="rendering_value_thick_name">Hrubé</string>

View file

@ -3275,7 +3275,7 @@ Koda predstavlja območje: %1$s x %2$s</string>
<string name="save_heading">Vključi glavo</string>
<string name="save_heading_descr">Shrani glavo k vsaki točki sledi med beleženjem.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Osebno</string>
<string name="shared_string_downloading_formatted">Poteka prejemanje %s</string>
<string name="rendering_value_thick_name">Debelo</string>

View file

@ -3402,7 +3402,7 @@
<string name="save_heading">Укључи заглавље</string>
<string name="save_heading_descr">Сачувај заглавље свакој тачки праћења приликом снимања.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Лични</string>
<string name="shared_string_downloading_formatted">Преузимам %s</string>
<string name="rendering_value_thick_name">Дебело</string>

View file

@ -3360,7 +3360,7 @@
<string name="save_heading">Başlığı dahil et</string>
<string name="save_heading_descr">Kayıt sırasında her izleme noktasına başlığı kaydet.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Kişisel</string>
<string name="shared_string_downloading_formatted">%s indiriliyor</string>
<string name="rendering_value_thick_name">Kalın</string>
@ -3574,7 +3574,24 @@
<string name="shared_string_languages">Diller</string>
<string name="shared_string_language">Dil</string>
<string name="shared_string_all_languages">Tüm diller</string>
<string name="wikipedia_poi_languages_promo">Bazı Wikipedia makaleleri adınızda bulunmayabilir, Wikipedia makalelerinin haritada görüneceği dilleri seçin.
\nMakaleyi okurken mevcut tüm diller arasında geçiş yapabileceksiniz.</string>
<string name="wiki_menu_download_descr">Wikipedia POI\'lerini haritada görüntülemek için ek haritalara ihtiyaç vardır.</string>
<string name="ui_customization_short_descr">Çekmece ögeleri, içerik menüsü</string>
<string name="shared_string_drawer">Çekmece</string>
<string name="reset_items_descr">Gizlendikten sonra ayarlar orijinal durumuna sıfırlanacaktır.</string>
<string name="shared_string_items">Ögeler</string>
<string name="ui_customization_description">Çekmecedeki ögelerin sayısını özelleştirin, haritayı ve içerik menüsünü yapılandırın.
\n
\n%1$s uygulamasından tüm denetimlerini gizlemek için kullanılmayan eklentileri devre dışı bırakabilirsiniz.</string>
<string name="ui_customization">Kullanıcı Arayüzü Özelleştirme</string>
<string name="context_menu_actions">İçerik menüsü eylemleri</string>
<string name="reorder_or_hide_from">%1$s\'den ögeleri yeniden sırala veya gizle.</string>
<string name="shared_string_divider">Bölücü</string>
<string name="divider_descr">Bu noktanın altındaki ögeler bir bölücü ile ayrılır.</string>
<string name="shared_string_hidden">Gizli</string>
<string name="hidden_items_descr">Bu ögeler menüden gizlenir, ancak temsil edilen seçenekler veya eklentiler hala çalışır.</string>
<string name="main_actions_descr">Ana eylemler sadece 4 düğme içerir.</string>
<string name="main_actions">Ana eylemler</string>
<string name="additional_actions_descr">Bu eylemlere “Eylemler” düğmesine dokunarak erişebilirsiniz.</string>
<string name="move_inside_category">Ögeleri yalnızca bu kategorinin içine taşıyabilirsiniz.</string>
<string name="developer_plugin">Geliştirici Eklentisi</string>
</resources>

View file

@ -3395,7 +3395,7 @@
<string name="save_heading">Зберегти заголовок</string>
<string name="save_heading_descr">Зберегти заголовок для кожної точки треку під час запису.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Особистий</string>
<string name="shared_string_downloading_formatted">Завантаження %s</string>
<string name="rendering_value_thick_name">Товсто</string>
@ -3610,7 +3610,5 @@
<string name="shared_string_languages">Мови</string>
<string name="shared_string_language">Мова</string>
<string name="shared_string_all_languages">Усі мови</string>
<string name="wikipedia_poi_languages_promo">Деякі статті у Вікіпедії можуть бути недоступними для Вашої мови, виберіть мови, якими статті на Вікіпедії будуть відображатися на мапі.
\nВи зможете перемикатися між усіма доступними мовами під час читання статті.</string>
<string name="wiki_menu_download_descr">Для перегляду POI Вікіпедії на мапі потрібні додаткові мапи.</string>
</resources>

View file

@ -3395,7 +3395,7 @@
<string name="save_heading">包含標題</string>
<string name="save_heading_descr">在記錄時將標題儲存到每個追蹤點。</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">個人</string>
<string name="shared_string_downloading_formatted">正在下載 %s</string>
<string name="rendering_value_thick_name">密集</string>
@ -3610,7 +3610,24 @@
<string name="shared_string_languages">語言</string>
<string name="shared_string_language">語言</string>
<string name="shared_string_all_languages">所有語言</string>
<string name="wikipedia_poi_languages_promo">某些維基百科文章可能無法以您的名稱提供,選取維基百科文章要在地圖上顯示何種語言。
\n您可以在閱讀文章時切換到所有可用的語言。</string>
<string name="wiki_menu_download_descr">需要額外的地圖才能在地圖上檢視維基百科的 POI。</string>
<string name="ui_customization_description">在「抽屜」、「設定地圖」與情境選單中自訂項目數量。
\n
\n您可以停用未使用的外掛程式以從應用程式 %1$s 中隱藏其控制元件。</string>
<string name="ui_customization_short_descr">抽屜項目,情境選單</string>
<string name="ui_customization">自訂使用者介面</string>
<string name="shared_string_drawer">抽屜</string>
<string name="context_menu_actions">情境選單動作</string>
<string name="reorder_or_hide_from">重新排列或從 %1$s 隱藏項目。</string>
<string name="shared_string_divider">分隔符</string>
<string name="divider_descr">低於此點的元素將由分隔符分離。</string>
<string name="shared_string_hidden">已隱藏</string>
<string name="hidden_items_descr">這些項目已從選單隱藏,但對應的選項或外掛程式仍在運作中。</string>
<string name="reset_items_descr">隱藏後,設定將會重設回原始狀態。</string>
<string name="main_actions_descr">主要動作僅包含 4 個按鈕。</string>
<string name="main_actions">主要動作</string>
<string name="additional_actions_descr">您可以透過輕點「動作」按鈕來存取此動作。</string>
<string name="move_inside_category">您只能在此分類中移動項目。</string>
<string name="developer_plugin">開發者外掛程式</string>
<string name="shared_string_items">項目</string>
</resources>

View file

@ -71,6 +71,7 @@
<dimen name="favorites_icon_right_margin">24dp</dimen>
<dimen name="favorites_icon_size">40dp</dimen>
<dimen name="favorites_list_item_height">66dp</dimen>
<dimen name="local_index_check_right_margin">10dp</dimen>
<dimen name="favorites_icon_top_margin">13dp</dimen>
<dimen name="dialog_elements_vertical_margin">16dp</dimen>

View file

@ -13,8 +13,37 @@
-->
<string name="search_poi_types_descr">Combine POI types from different categories. Tap switch to select all, tap left side to category selection.</string>
<string name="search_poi_types">Search poi types</string>
<string name="custom_color">Custom color</string>
<string name="lang_lmo">Lombard</string>
<string name="lang_an">Aragonese</string>
<string name="lang_ba">Bashkir</string>
<string name="lang_bar">Bavarian</string>
<string name="lang_ce">Chechen</string>
<string name="lang_cv">Chuvash</string>
<string name="lang_gu">Gujarati</string>
<string name="lang_jv">Javanese</string>
<string name="lang_kk">Kazakh</string>
<string name="lang_ky">Kyrgyz</string>
<string name="lang_mg">Malagasy</string>
<string name="lang_min">Minangkabau</string>
<string name="lang_mn">Mongolian</string>
<string name="lang_my">Burmese</string>
<string name="lang_nap">Neapolitan</string>
<string name="lang_ne">Nepali</string>
<string name="lang_pnb">Punjabi</string>
<string name="lang_scn">Sicilian</string>
<string name="lang_sco">Scots</string>
<string name="lang_tg">Tajik</string>
<string name="lang_tt">Tatar</string>
<string name="lang_ur">Urdu</string>
<string name="lang_uz">Uzbek</string>
<string name="lang_war">Waray</string>
<string name="lang_yo">Yoruba</string>
<string name="lang_zhminnan">Southern Min</string>
<string name="lang_zhyue">Cantonese</string>
<string name="some_articles_may_not_available_in_lang">Some Wikipedia articles may not be available in your language.</string>
<string name="select_wikipedia_article_langs">Select the languages in which Wikipedia articles will appear on the map. You can switch between all available languages while reading the article.</string>
<string name="wiki_menu_download_descr">Additional maps are needed to view Wikipedia POIs on the map.</string>
<string name="wikipedia_poi_languages_promo">Some Wikipedia articles may not be available in your name, select the languages in which Wikipedia articles will appear on the map.\nYou will be able to switch between all available languages while reading the article.</string>
<string name="shared_string_all_languages">All languages</string>
<string name="shared_string_language">Language</string>
<string name="shared_string_languages">Languages</string>
@ -218,7 +247,7 @@
<string name="edit_profiles">Edit profiles</string>
<string name="select_nav_profile_dialog_message">The \'Navigation type\' governs how routes are calculated.</string>
<string name="ltr_or_rtl_combine_via_bold_point">%1$s • %2$s</string>
<string name="street_city">%1$s, %2$s</string>
<string name="ltr_or_rtl_combine_via_comma">%1$s, %2$s</string>
<string name="personal_category_name">Personal</string>
<string name="add_new_profile_q">Add the new profile \'%1$s\'?</string>
<string name="save_heading">Include heading</string>

View file

@ -77,7 +77,11 @@ public class FavouritePoint implements Serializable, LocationPoint {
}
public int getColor() {
return color;
if ((color & 0xFF000000) != 0) {
return color;
} else {
return color | 0xFF000000;
}
}
public String getAddress() {

View file

@ -1,5 +1,6 @@
package net.osmand.plus;
import android.app.Activity;
import android.content.Context;
import androidx.annotation.NonNull;
@ -101,7 +102,11 @@ public class FavouritesDbHelper {
}
public int getColor() {
return color;
if ((color & 0xFF000000) != 0) {
return color;
} else {
return color | 0xFF000000;
}
}
public boolean isVisible() {
@ -354,7 +359,7 @@ public class FavouritesDbHelper {
}
}
public static AlertDialog.Builder checkDuplicates(FavouritePoint p, FavouritesDbHelper fdb, Context uiContext) {
public static AlertDialog.Builder checkDuplicates(FavouritePoint p, FavouritesDbHelper fdb, Activity activity) {
boolean emoticons = false;
String index = "";
int number = 0;
@ -383,12 +388,15 @@ public class FavouritesDbHelper {
}
}
if ((index.length() > 0 || emoticons)) {
AlertDialog.Builder builder = new AlertDialog.Builder(uiContext);
OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.fav_point_dublicate);
if (emoticons) {
builder.setMessage(uiContext.getString(R.string.fav_point_emoticons_message, name));
builder.setMessage(activity.getString(R.string.fav_point_emoticons_message, name));
} else {
builder.setMessage(uiContext.getString(R.string.fav_point_dublicate_message, name));
builder.setMessage(activity.getString(R.string.fav_point_dublicate_message, name));
}
p.setName(name);
return builder;

View file

@ -4,7 +4,6 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
@ -39,6 +38,7 @@ import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
import androidx.core.widget.TintableCompoundButton;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.snackbar.SnackbarContentLayout;
@ -51,8 +51,6 @@ import net.osmand.plus.widgets.TextViewEx;
import org.apache.commons.logging.Log;
import java.util.Locale;
import gnu.trove.map.hash.TLongObjectHashMap;
public class UiUtilities {
@ -414,6 +412,9 @@ public class UiUtilities {
actionView.setGravity(Gravity.CENTER_VERTICAL | Gravity.END);
container.setLayoutParams(params);
}
try {
snackbar.setAnimationMode(BaseTransientBottomBar.ANIMATION_MODE_FADE);
} catch (Throwable e) { }
}
public static void rotateImageByLayoutDirection(ImageView image, int layoutDirection) {

View file

@ -5,7 +5,6 @@ package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
@ -29,6 +28,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
@ -200,8 +200,8 @@ public class FavoritesListFragment extends OsmAndListFragment implements SearchA
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
LayoutInflater inflater = activity.getLayoutInflater();
row = inflater.inflate(R.layout.favorites_list_item, parent, false);
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
row = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorites_list_item, parent, false);
}
TextView name = (TextView) row.findViewById(R.id.favourite_label);

View file

@ -840,7 +840,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
int color = model.getColor() == 0 || model.getColor() == Color.BLACK ? getResources().getColor(R.color.color_favorite) : model.getColor();
if (!model.isPersonal()) {
setCategoryIcon(app, app.getUIUtilities().getPaintedIcon(
R.drawable.ic_action_fav_dark, visible ? (color | 0xff000000) : getResources().getColor(disabledColor)),
R.drawable.ic_action_folder, visible ? color : getResources().getColor(disabledColor)),
groupPosition, isExpanded, row, light);
}
adjustIndicator(app, groupPosition, isExpanded, row, light);
@ -955,7 +955,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
name.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor));
distanceText.setText(distance);
if (model.isAddressSpecified()) {
distanceText.setText(String.format(getString(R.string.ltr_or_rtl_combine_via_bold_point), distance.trim(), model.getAddress()));
distanceText.setText(String.format(getString(R.string.ltr_or_rtl_combine_via_comma), distance.trim(), model.getAddress()));
}
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(),
visible ? model.getColor() : getResources().getColor(disabledIconColor), false, model));

View file

@ -17,6 +17,11 @@ public class DividerItem extends BaseBottomSheetItem {
@ColorRes
private int colorId;
private int topMargin = INVALID_VALUE;
private int bottomMargin = INVALID_VALUE;
private int startMargin = INVALID_VALUE;
private int endMargin = INVALID_VALUE;
public DividerItem(Context context) {
setupView(context, INVALID_ID, INVALID_POSITION);
}
@ -42,7 +47,8 @@ public class DividerItem extends BaseBottomSheetItem {
int height = getHeight(context);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view.getLayoutParams();
AndroidUtils.setMargins(params, getStartMargin(context), getTopMargin(context), 0, getBottomMargin(context));
AndroidUtils.setMargins(params, getStartMargin(context),
getTopMargin(context), getEndMargin(context), getBottomMargin(context));
params.height = height;
view.setMinimumHeight(height);
@ -50,15 +56,28 @@ public class DividerItem extends BaseBottomSheetItem {
}
protected int getTopMargin(Context context) {
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
return topMargin != INVALID_VALUE ? topMargin :
context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
}
protected int getStartMargin(Context context) {
return 0;
return startMargin != INVALID_VALUE ? startMargin : 0;
}
protected int getBottomMargin(Context context) {
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
return bottomMargin != INVALID_VALUE ? bottomMargin :
context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
}
protected int getEndMargin(Context context) {
return endMargin != INVALID_VALUE ? endMargin : 0;
}
public void setMargins(int start, int top, int end, int bottom) {
this.startMargin = start;
this.topMargin = top;
this.endMargin = end;
this.bottomMargin = bottom;
}
protected int getHeight(Context ctx) {

View file

@ -249,9 +249,10 @@ public class ConfigureMapMenu {
WikipediaPoiMenu.toggleWikipediaPoi(ma, isChecked, true,
new CallbackWithObject<Boolean>() {
@Override
public boolean processResult(Boolean result) {
item.setSelected(result);
item.setColorRes(result ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
public boolean processResult(Boolean selected) {
item.setSelected(selected);
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
item.setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(ma.getMyApplication()) : null);
adapter.notifyDataSetChanged();
return true;
}
@ -551,6 +552,7 @@ public class ConfigureMapMenu {
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(WIKIPEDIA_ID)
.setTitleId(R.string.shared_string_wikipedia, activity)
.setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(app) : null)
.setSelected(selected)
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setIcon(R.drawable.ic_plugin_wikipedia)

View file

@ -29,6 +29,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter;
import net.osmand.plus.activities.MapActivity;
@ -41,6 +42,8 @@ public class FavoriteDialogs {
public static Dialog createReplaceFavouriteDialog(final Activity activity, final Bundle args) {
OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
final FavouritesDbHelper helper = app.getFavorites();
final List<FavouritePoint> points = new ArrayList<FavouritePoint>(helper.getFavouritePoints());
final FavouritesAdapter favouritesAdapter = new FavouritesAdapter(activity, points,false);
@ -56,15 +59,18 @@ public class FavoriteDialogs {
favouritesAdapter.sortByDefault(true);
if(points.size() == 0){
Toast.makeText(activity, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
Toast.makeText(themedContext, activity.getString(R.string.fav_points_not_exist), Toast.LENGTH_SHORT).show();
return null;
}
return showFavoritesDialog(activity, favouritesAdapter, click, null, dlgHolder, true);
return showFavoritesDialog(themedContext, favouritesAdapter, click, null, dlgHolder, true);
}
private static void confirmReplace(final Activity activity, final Bundle args, final FavouritesDbHelper helper,
final FavouritesAdapter favouritesAdapter, final Dialog[] dlgHolder, int position) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.update_existing);
final FavouritePoint fp = favouritesAdapter.getItem(position);
builder.setMessage(activity.getString(R.string.replace_favorite_confirmation, fp.getName()));
@ -111,10 +117,13 @@ public class FavoriteDialogs {
}
public static Dialog createAddFavouriteDialog(final Activity activity, final Bundle args) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
final Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.favourites_context_menu_edit);
final View v = activity.getLayoutInflater().inflate(R.layout.favorite_edit_dialog, null, false);
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
final View v = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_edit_dialog, null, false);
final FavouritesDbHelper helper = app.getFavorites();
builder.setView(v);
final EditText editText = (EditText) v.findViewById(R.id.Name);
final EditText description = (EditText) v.findViewById(R.id.description);
@ -125,15 +134,14 @@ public class FavoriteDialogs {
list[i] = gs.get(i).getName();
}
cat.setAdapter(new ArrayAdapter<String>(activity, R.layout.list_textview, list));
if (((OsmandApplication)activity.getApplication()).accessibilityEnabled()) {
if (app.accessibilityEnabled()) {
final TextView textButton = (TextView)v.findViewById(R.id.TextButton);
textButton.setClickable(true);
textButton.setFocusable(true);
textButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder b = new AlertDialog.Builder(activity);
AlertDialog.Builder b = new AlertDialog.Builder(themedContext);
b.setTitle(R.string.access_category_choice);
b.setItems(list, new DialogInterface.OnClickListener() {
@Override
@ -165,7 +173,6 @@ public class FavoriteDialogs {
@Override
public void onClick(DialogInterface dialog, int which) {
final FavouritePoint point = (FavouritePoint) args.getSerializable(KEY_FAVORITE);
OsmandApplication app = (OsmandApplication) activity.getApplication();
String categoryStr = cat.getText().toString().trim();
final FavouritesDbHelper helper = app.getFavorites();
app.getSettings().LAST_FAV_CATEGORY_ENTERED.set(categoryStr);

View file

@ -1,12 +1,9 @@
package net.osmand.plus.helpers;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@ -15,7 +12,7 @@ import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.ColorRes;
import androidx.annotation.ColorInt;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -26,7 +23,7 @@ import java.util.Random;
import gnu.trove.list.array.TIntArrayList;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.AndroidUtils.dpToPx;
public class ColorDialogs {
public static int[] paletteColors = new int[] {
@ -45,17 +42,17 @@ public class ColorDialogs {
};
public static int[] pallette = new int[] {
0xb4eecc22,
0xb4d00d0d,
0xb4ff5020,
0xb4eeee10,
0xb488e030,
0xb400842b,
0xb410c0f0,
0xb41010a0,
0xb4a71de1,
0xb4e044bb,
0xb48e2512,
0xffeecc22,
0xffd00d0d,
0xffff5020,
0xffeeee10,
0xff88e030,
0xff00842b,
0xff10c0f0,
0xff1010a0,
0xffa71de1,
0xffe044bb,
0xff8e2512,
0xff000001
};
@ -171,8 +168,8 @@ public class ColorDialogs {
colorSpinner.setSelection(selection);
}
public static void setupColorSpinnerEx(final Activity ctx, int selectedColor, final Spinner colorSpinner,
final TIntArrayList colors, OnItemSelectedListener listener) {
public static void setupColorSpinnerEx(final Context ctx, int selectedColor, final Spinner colorSpinner,
final TIntArrayList colors, OnItemSelectedListener listener) {
colors.add(pallette);
List<String> colorNames = new ArrayList<String>();
int selection = -1;
@ -237,16 +234,15 @@ public class ColorDialogs {
return "#" + c; //$NON-NLS-1$
}
private static Drawable getIcon(final Activity activity, int resId, int color) {
OsmandApplication app = (OsmandApplication)activity.getApplication();
Drawable d = app.getResources().getDrawable(resId).mutate();
private static Drawable getIcon(final Context ctx, int resId, int color) {
Drawable d = ctx.getResources().getDrawable(resId).mutate();
d.clearColorFilter();
d.setColorFilter(color, PorterDuff.Mode.SRC_IN);
return d;
}
public static int getColorName(@ColorRes int color) {
int colorName = R.string.rendering_value_darkyellow_name;
public static int getColorName(@ColorInt int color) {
int colorName = R.string.custom_color;
for (int i = 0; i < ColorDialogs.pallette.length; i++) {
if (ColorDialogs.pallette[i] == color) {
colorName = ColorDialogs.paletteColors[i];
@ -256,12 +252,14 @@ public class ColorDialogs {
return colorName;
}
private static int dpToPx(final Activity activity, float dp) {
Resources r = activity.getResources();
return (int) TypedValue.applyDimension(
COMPLEX_UNIT_DIP,
dp,
r.getDisplayMetrics()
);
public static boolean isPaletteColor(@ColorInt int color) {
boolean isPaletteColor = false;
for (int i = 0; i < ColorDialogs.pallette.length; i++) {
if (ColorDialogs.pallette[i] == color) {
isPaletteColor = true;
break;
}
}
return isPaletteColor;
}
}

View file

@ -1,6 +1,6 @@
package net.osmand.plus.helpers;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -15,6 +15,7 @@ import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities;
import net.osmand.IndexConstants;
import net.osmand.plus.GPXDatabase;
import net.osmand.plus.GpxDbHelper;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -35,14 +36,11 @@ public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackV
private OnItemClickListener onItemClickListener;
private UiUtilities iconsCache;
GpxTrackAdapter(Activity activity, List<GpxUiHelper.GPXInfo> gpxInfoList, boolean showCurrentGpx,
OnItemClickListener onItemClickListener) {
GpxTrackAdapter(Context ctx, List<GpxUiHelper.GPXInfo> gpxInfoList, boolean showCurrentGpx) {
this.showCurrentGpx = showCurrentGpx;
this.onItemClickListener = onItemClickListener;
app = (OsmandApplication) activity.getApplication();
app = (OsmandApplication) ctx.getApplicationContext();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
themedInflater = UiUtilities.getInflater(activity, nightMode);
themedInflater = UiUtilities.getInflater(ctx, nightMode);
this.gpxInfoList = gpxInfoList;
iconsCache = app.getUIUtilities();
}
@ -123,8 +121,26 @@ public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackV
}
}
private GPXDatabase.GpxDataItem getDataItem(GpxUiHelper.GPXInfo info) {
return app.getGpxDbHelper().getItem(new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), info.getFileName()));
private GPXDatabase.GpxDataItem getDataItem(final GpxUiHelper.GPXInfo info) {
GpxDbHelper.GpxDataItemCallback gpxDataItemCallback = new GpxDbHelper.GpxDataItemCallback() {
@Override
public boolean isCancelled() {
return false;
}
@Override
public void onGpxDataItemReady(GPXDatabase.GpxDataItem item) {
if (item != null && gpxInfoList != null && info != null) {
notifyItemChanged(gpxInfoList.indexOf(info));
}
}
};
return app.getGpxDbHelper().getItem(new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), info.getFileName())
, gpxDataItemCallback);
}
void setAdapterListener(OnItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
static class TrackViewHolder extends RecyclerView.ViewHolder {

View file

@ -37,8 +37,7 @@ import androidx.appcompat.widget.ListPopupWindow;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.fragment.app.FragmentActivity;
import com.github.mikephil.charting.charts.HorizontalBarChart;
import com.github.mikephil.charting.charts.LineChart;
@ -259,8 +258,8 @@ public class GpxUiHelper {
return null;
}
public static AlertDialog selectSingleGPXFile(final Activity activity, boolean showCurrentGpx,
final CallbackWithObject<GPXFile[]> callbackWithObject) {
public static void selectSingleGPXFile(final FragmentActivity activity, boolean showCurrentGpx,
final CallbackWithObject<GPXFile[]> callbackWithObject) {
OsmandApplication app = (OsmandApplication) activity.getApplication();
int gpxDirLength = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath().length();
List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
@ -279,11 +278,8 @@ public class GpxUiHelper {
list.add(new GPXInfo(gpxFile.path.substring(gpxDirLength + 1), gpxFile.modifiedTime, 0));
}
}
final ContextMenuAdapter adapter = createGpxContextMenuAdapter(list, null, showCurrentGpx, app);
return createSingleChoiceDialog(activity, showCurrentGpx, callbackWithObject, list, adapter);
SelectGpxTrackBottomSheet.showInstance(activity.getSupportFragmentManager(), showCurrentGpx, callbackWithObject, list);
}
return null;
}
private static ContextMenuAdapter createGpxContextMenuAdapter(List<GPXInfo> allGpxList,
@ -351,65 +347,6 @@ public class GpxUiHelper {
}, dir, null, filename);
}
private static AlertDialog createSingleChoiceDialog(final Activity activity,
final boolean showCurrentGpx,
final CallbackWithObject<GPXFile[]> callbackWithObject,
final List<GPXInfo> list,
final ContextMenuAdapter adapter) {
final OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
final View customLayout = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.gpx_track_select_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setView(customLayout);
final AlertDialog dlg = builder.create();
View cancelButton = customLayout.findViewById(R.id.dismiss_button);
UiUtilities.setupDialogButton(nightMode, cancelButton, UiUtilities.DialogButtonType.SECONDARY, R.string.shared_string_cancel);
TextView gpxCounter = customLayout.findViewById(R.id.counter);
gpxCounter.setText(String.valueOf(adapter.length()));
GpxTrackAdapter gpxTrackAdapter = new GpxTrackAdapter(activity, list, showCurrentGpx,
new GpxTrackAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
if (position != -1 && position < list.size()) {
if (showCurrentGpx && position == 0) {
callbackWithObject.processResult(null);
app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(null);
} else {
String fileName = list.get(position).getFileName();
app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(fileName);
SelectedGpxFile selectedGpxFile =
app.getSelectedGpxHelper().getSelectedFileByName(fileName);
if (selectedGpxFile != null) {
callbackWithObject.processResult(new GPXUtilities.GPXFile[]{selectedGpxFile.getGpxFile()});
} else {
File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
GpxUiHelper.loadGPXFileInDifferentThread(activity, callbackWithObject, dir, null, fileName);
}
}
}
dlg.dismiss();
}
});
RecyclerView recyclerView = customLayout.findViewById(R.id.gpx_track_list);
recyclerView.setAdapter(gpxTrackAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.VERTICAL, false));
dlg.setCanceledOnTouchOutside(false);
dlg.show();
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dlg.dismiss();
}
});
try {
dlg.getListView().setFastScrollEnabled(true);
} catch (Exception e) {
// java.lang.ClassCastException: com.android.internal.widget.RoundCornerListAdapter
// Unknown reason but on some devices fail
}
return dlg;
}
private static class DialogGpxDataItemCallback implements GpxDataItemCallback {
private static final int UPDATE_GPX_ITEM_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 6;
private static final long MIN_UPDATE_INTERVAL = 500;

View file

@ -31,6 +31,7 @@ import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.FavouritePoint;
import net.osmand.data.FavouritePoint.BackgroundType;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.AppInitializer.AppInitializeListener;
import net.osmand.plus.AppInitializer.InitEvents;
@ -1181,6 +1182,7 @@ public class ImportHelper {
}
fp.setColor(p.getColor(0));
fp.setIconIdFromName(app, p.getIconName());
fp.setBackgroundType(BackgroundType.getByTypeName(p.getBackgroundType(), BackgroundType.CIRCLE));
favourites.add(fp);
}
}

View file

@ -0,0 +1,112 @@
package net.osmand.plus.helpers;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.CallbackWithObject;
import net.osmand.GPXUtilities;
import net.osmand.IndexConstants;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import java.io.File;
import java.util.List;
public class SelectGpxTrackBottomSheet extends MenuBottomSheetDialogFragment {
public static final String TAG = SelectGpxTrackBottomSheet.class.getSimpleName();
protected View mainView;
protected GpxTrackAdapter adapter;
private List<GpxUiHelper.GPXInfo> gpxInfoList;
private boolean showCurrentGpx;
private CallbackWithObject<GPXUtilities.GPXFile[]> callbackWithObject;
private void setGpxInfoList(List<GpxUiHelper.GPXInfo> gpxInfoList) {
this.gpxInfoList = gpxInfoList;
}
private void setShowCurrentGpx(boolean showCurrentGpx) {
this.showCurrentGpx = showCurrentGpx;
}
private void setCallbackWithObject(CallbackWithObject<GPXUtilities.GPXFile[]> callbackWithObject) {
this.callbackWithObject = callbackWithObject;
}
@Override
public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.gpx_track_select_dialog, null);
final RecyclerView recyclerView = mainView.findViewById(R.id.gpx_track_list);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
adapter = new GpxTrackAdapter(requireContext(), gpxInfoList, showCurrentGpx);
adapter.setAdapterListener(new GpxTrackAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
if (position != RecyclerView.NO_POSITION) {
SelectGpxTrackBottomSheet.this.onItemClick(position);
}
}
});
recyclerView.setAdapter(adapter);
TextView gpxCounter = mainView.findViewById(R.id.counter);
gpxCounter.setText(String.valueOf(adapter.getItemCount()));
items.add(new BaseBottomSheetItem.Builder().setCustomView(mainView).create());
}
private void onItemClick(int position) {
if (position != -1 && position < gpxInfoList.size()) {
OsmandApplication app = (OsmandApplication) requireActivity().getApplication();
if (showCurrentGpx && position == 0) {
callbackWithObject.processResult(null);
app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(null);
} else {
String fileName = gpxInfoList.get(position).getFileName();
app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(fileName);
GpxSelectionHelper.SelectedGpxFile selectedGpxFile =
app.getSelectedGpxHelper().getSelectedFileByName(fileName);
if (selectedGpxFile != null) {
callbackWithObject.processResult(new GPXUtilities.GPXFile[]{selectedGpxFile.getGpxFile()});
} else {
File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
Activity activity = getActivity();
if (activity != null) {
GpxUiHelper.loadGPXFileInDifferentThread(activity, callbackWithObject, dir, null, fileName);
}
}
}
}
dismiss();
}
public static void showInstance(FragmentManager fragmentManager, boolean showCurrentGpx,
CallbackWithObject<GPXUtilities.GPXFile[]> callbackWithObject, List<GpxUiHelper.GPXInfo> gpxInfoList) {
if (!fragmentManager.isStateSaved()) {
SelectGpxTrackBottomSheet fragment = new SelectGpxTrackBottomSheet();
fragment.setUsedOnMap(true);
fragment.setRetainInstance(true);
fragment.setShowCurrentGpx(showCurrentGpx);
fragment.setCallbackWithObject(callbackWithObject);
fragment.setGpxInfoList(gpxInfoList);
fragment.show(fragmentManager, SelectGpxTrackBottomSheet.TAG);
}
}
@Override
protected int getDismissButtonTextId() {
return R.string.shared_string_cancel;
}
}

View file

@ -88,6 +88,7 @@ import java.util.List;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MORE_ID;
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
import static net.osmand.plus.settings.ConfigureMenuItemsFragment.MAIN_BUTTONS_QUANTITY;
public class MapContextMenuFragment extends BaseOsmAndFragment implements DownloadEvents {
@ -566,11 +567,16 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
// Action buttons
// TODO refactor section
ContextMenuAdapter adapter = menu.getActionsContextMenuAdapter(false);
List<ContextMenuItem> items = adapter.getItems();
List<ContextMenuItem> items = new ArrayList<>();
for (ContextMenuItem item : adapter.getItems()) {
if (!item.isHidden()) {
items.add(item);
}
}
ContextMenuAdapter mainAdapter = new ContextMenuAdapter(requireMyApplication());
ContextMenuAdapter additionalAdapter = new ContextMenuAdapter(requireMyApplication());
for (int i = 0; i < items.size(); i++) {
if (i < 4) {
if (i < MAIN_BUTTONS_QUANTITY) {
mainAdapter.addItem(items.get(i));
} else {
additionalAdapter.addItem(items.get(i));
@ -585,7 +591,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
ContextMenuItemClickListener mainListener = menu.getContextMenuItemClickListener(mainAdapter);
ContextMenuItemClickListener additionalListener = menu.getContextMenuItemClickListener(additionalAdapter);
for (int i = 0; i < 4; i++) {
int mainButtonsQuantity = Math.min(MAIN_BUTTONS_QUANTITY, items.size());
for (int i = 0; i < mainButtonsQuantity; i++) {
buttons.addView(getActionView(items.get(i), i, mainAdapter, additionalAdapter, mainListener, additionalListener), params);
}
buttons.setGravity(Gravity.CENTER);
@ -648,11 +655,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
private View getActionView(ContextMenuItem contextMenuItem,
final int position,
final ContextMenuAdapter mainAdapter,
final ContextMenuAdapter additionalAdapter,
final ContextMenuItemClickListener mainListener,
final ContextMenuItemClickListener additionalListener) {
final int position,
final ContextMenuAdapter mainAdapter,
final ContextMenuAdapter additionalAdapter,
final ContextMenuItemClickListener mainListener,
final ContextMenuItemClickListener additionalListener) {
UiUtilities uiUtilities = requireMyApplication().getUIUtilities();
LayoutInflater inflater = UiUtilities.getInflater(getMyApplication(), nightMode);
View view = inflater.inflate(R.layout.context_menu_action_item, null);

View file

@ -43,6 +43,7 @@ import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
import net.osmand.plus.wikipedia.WikiArticleHelper;
import net.osmand.plus.wikipedia.WikipediaArticleWikiLinkFragment;
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
import net.osmand.util.Algorithms;
import net.osmand.util.OpeningHoursParser;
@ -404,7 +405,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (amenity.getType().isWiki()) {
if (!hasWiki) {
String lng = amenity.getContentLanguage("content", preferredLang, "en");
String articleLang = WikipediaPoiMenu.getWikiArticleLanguage(app, amenity.getSupportedContentLocales(), preferredLang);
String lng = amenity.getContentLanguage("content", articleLang, "en");
if (Algorithms.isEmpty(lng)) {
lng = "en";
}

View file

@ -20,6 +20,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.util.Algorithms;
@ -69,10 +70,10 @@ public class EditCategoryDialogFragment extends DialogFragment {
} else if (getArguments() != null) {
restoreState(getArguments());
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.favorite_category_add_new_title);
final View v = activity.getLayoutInflater().inflate(R.layout.favorite_category_edit_dialog, null, false);
final View v = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_edit_dialog, null, false);
nameEdit = (EditText)v.findViewById(R.id.edit_name);
nameEdit.setText(name);
@ -81,7 +82,7 @@ public class EditCategoryDialogFragment extends DialogFragment {
colorSpinner = (Spinner)v.findViewById(R.id.edit_color);
final TIntArrayList colors = new TIntArrayList();
final int intColor = color;
ColorDialogs.setupColorSpinnerEx(activity, intColor, colorSpinner, colors, new AdapterView.OnItemSelectedListener() {
ColorDialogs.setupColorSpinnerEx(v.getContext(), intColor, colorSpinner, colors, new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
color = colors.get(position);

View file

@ -24,6 +24,7 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.FavoriteDialogs;
@ -351,7 +352,9 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
FragmentActivity activity = getActivity();
final FavouritePoint favorite = getFavorite();
if (activity != null && favorite != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setMessage(getString(R.string.favourites_remove_dialog_msg, favorite.getName()));
builder.setNegativeButton(R.string.shared_string_no, null);
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {

View file

@ -1,5 +1,6 @@
package net.osmand.plus.mapcontextmenu.editors;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
@ -10,6 +11,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@ -22,7 +24,6 @@ import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
@ -65,7 +66,7 @@ import static net.osmand.util.Algorithms.capitalizeFirstLetter;
public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
public static final String TAG = "PointEditorFragmentNew";
public static final String TAG = PointEditorFragmentNew.class.getSimpleName();
private View view;
private EditText nameEdit;
@ -87,6 +88,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private View descriptionCaption;
private EditText descriptionEdit;
@SuppressLint("ClickableViewAccessibility")
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -95,6 +97,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
nightMode = app.getDaynightHelper().isNightModeForMapControls();
view = UiUtilities.getMaterialInflater(getContext(), nightMode)
.inflate(R.layout.point_editor_fragment_new, container, false);
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
final PointEditor editor = getEditor();
if (editor == null) {
@ -131,6 +134,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
if (scrollViewY != scrollView.getScrollY()) {
scrollViewY = scrollView.getScrollY();
hideKeyboard();
descriptionEdit.clearFocus();
nameEdit.clearFocus();
}
}
});
@ -259,6 +264,23 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
createShapeSelector();
updateColorSelector(selectedColor, view);
updateShapeSelector(selectedShape, view);
scrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
descriptionEdit.getParent().requestDisallowInterceptTouchEvent(false);
return false;
}
});
descriptionEdit.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
descriptionEdit.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
return view;
}
@ -289,9 +311,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
for (int color : ColorDialogs.pallette) {
selectColor.addView(createColorItemView(color, selectColor), new FlowLayout.LayoutParams(0, 0));
}
int customColor = getPointColor();
if (!ColorDialogs.isPaletteColor(customColor)) {
selectColor.addView(createColorItemView(customColor, selectColor), new FlowLayout.LayoutParams(0, 0));
}
}
private View createColorItemView(@ColorRes final int color, final FlowLayout rootView) {
private View createColorItemView(@ColorInt final int color, final FlowLayout rootView) {
FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
.inflate(R.layout.point_editor_button, rootView, false);
ImageView outline = colorItemView.findViewById(R.id.outline);
@ -442,10 +468,11 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
IconCategoriesAdapter iconCategoriesAdapter = new IconCategoriesAdapter();
iconCategoriesAdapter.setItems(new ArrayList<>(iconCategories.keySet()));
RecyclerView groupNameRecyclerView = view.findViewById(R.id.group_name_recycler_view);
groupNameRecyclerView.setAdapter(iconCategoriesAdapter);
groupNameRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
RecyclerView iconCategoriesRecyclerView = view.findViewById(R.id.group_name_recycler_view);
iconCategoriesRecyclerView.setAdapter(iconCategoriesAdapter);
iconCategoriesRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
iconCategoriesAdapter.notifyDataSetChanged();
iconCategoriesRecyclerView.scrollToPosition(iconCategoriesAdapter.getItemPosition(selectedIconCategory));
for (String name : iconNameList) {
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
}
@ -562,7 +589,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
@Override
protected boolean isFullScreenAllowed() {
return false;
return true;
}
private void hideKeyboard() {
@ -625,6 +652,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
public void dismiss(boolean includingMenu) {
hideKeyboard();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (includingMenu) {
@ -920,6 +948,10 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
public int getItemCount() {
return items.size();
}
int getItemPosition(String name) {
return items.indexOf(name);
}
}
static class NameViewHolder extends RecyclerView.ViewHolder {

View file

@ -70,26 +70,29 @@ public class SelectCategoryDialogFragment extends DialogFragment {
}
final FragmentActivity activity = requireActivity();
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setTitle(R.string.favorite_category_select);
final View v = activity.getLayoutInflater().inflate(R.layout.favorite_categories_dialog, null, false);
final View v = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_categories_dialog, null, false);
LinearLayout ll = (LinearLayout) v.findViewById(R.id.list_container);
final FavouritesDbHelper helper = ((OsmandApplication) activity.getApplication()).getFavorites();
final FavouritesDbHelper helper = app.getFavorites();
if (gpxFile != null) {
if (gpxCategories != null) {
for (Map.Entry<String, Integer> e : gpxCategories.entrySet()) {
String categoryName = e.getKey();
addCategory(activity, ll, categoryName, e.getValue());
ll.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue()));
}
}
} else {
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
addCategory(activity, ll, category.getDisplayName(getContext()), category.getColor());
ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
category.getColor()));
}
}
View itemView = activity.getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.map_zoom_in), null, null, null);
button.setCompoundDrawablePadding(AndroidUtils.dpToPx(activity,15f));
@ -113,8 +116,8 @@ public class SelectCategoryDialogFragment extends DialogFragment {
return builder.create();
}
private void addCategory(@NonNull final Activity activity, @NonNull LinearLayout ll, final String categoryName, final int categoryColor) {
View itemView = activity.getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor) {
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
if (categoryColor != 0) {
button.setCompoundDrawablesWithIntrinsicBounds(
@ -143,7 +146,7 @@ public class SelectCategoryDialogFragment extends DialogFragment {
dismiss();
}
});
ll.addView(itemView);
return itemView;
}
public static SelectCategoryDialogFragment createInstance(String editorTag) {

View file

@ -11,6 +11,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
@ -23,6 +24,7 @@ import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.base.FavoriteImageDrawable;
@ -306,40 +308,45 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
@Override
protected void delete(final boolean needDismiss) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getString(R.string.context_menu_item_delete_waypoint));
builder.setNegativeButton(R.string.shared_string_no, null);
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WptPt wpt = getWpt();
WptPtEditor editor = getWptPtEditor();
SavingTrackHelper savingTrackHelper = getSavingTrackHelper();
if (wpt != null && editor != null && savingTrackHelper != null) {
GPXFile gpx = editor.getGpxFile();
if (gpx != null) {
if (gpx.showCurrentTrack) {
savingTrackHelper.deletePointData(wpt);
} else {
gpx.deleteWptPt(wpt);
new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
FragmentActivity activity = getActivity();
if (activity != null) {
final OsmandApplication app = (OsmandApplication) activity.getApplication();
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
builder.setMessage(getString(R.string.context_menu_item_delete_waypoint));
builder.setNegativeButton(R.string.shared_string_no, null);
builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WptPt wpt = getWpt();
WptPtEditor editor = getWptPtEditor();
SavingTrackHelper savingTrackHelper = getSavingTrackHelper();
if (wpt != null && editor != null && savingTrackHelper != null) {
GPXFile gpx = editor.getGpxFile();
if (gpx != null) {
if (gpx.showCurrentTrack) {
savingTrackHelper.deletePointData(wpt);
} else {
gpx.deleteWptPt(wpt);
new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
syncGpx(gpx);
}
syncGpx(gpx);
saved = true;
}
saved = true;
}
if (needDismiss) {
dismiss(true);
} else {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.refreshMap();
if (needDismiss) {
dismiss(true);
} else {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.refreshMap();
}
}
}
}
});
builder.create().show();
});
builder.create().show();
}
}
@Override

View file

@ -68,6 +68,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.osmedit.OsmPoint.Action;
@ -88,7 +89,7 @@ import java.util.Map.Entry;
import java.util.Set;
public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
public static final String TAG = "EditPoiDialogFragment";
public static final String TAG = EditPoiDialogFragment.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(EditPoiDialogFragment.class);
private static final String KEY_AMENITY_ENTITY = "key_amenity_entity";
@ -159,7 +160,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
viewPager = (EditPoiViewPager) view.findViewById(R.id.viewpager);
String basicTitle = getResources().getString(R.string.tab_title_basic);
String extendedTitle = getResources().getString(R.string.tab_title_advanced);
final MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
final PoiInfoPagerAdapter pagerAdapter = new PoiInfoPagerAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
viewPager.setAdapter(pagerAdapter);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
@ -743,12 +744,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static class MyAdapter extends FragmentPagerAdapter {
public static class PoiInfoPagerAdapter extends FragmentPagerAdapter {
private final Fragment[] fragments = new Fragment[]{new BasicEditPoiFragment(),
new AdvancedEditPoiFragment()};
private final String[] titles;
public MyAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
PoiInfoPagerAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
super(fm);
titles = new String[]{basicTitle, extendedTitle};
}
@ -778,7 +779,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
this.callback = callback;
}
public DeletePoiHelper(AppCompatActivity activity) {
DeletePoiHelper(AppCompatActivity activity) {
this.activity = activity;
OsmandSettings settings = ((OsmandApplication) activity.getApplication()).getSettings();
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
@ -804,12 +805,14 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, amenity);
}
public void deletePoiWithDialog(final Entity entity) {
void deletePoiWithDialog(final Entity entity) {
boolean nightMode = ((OsmandApplication) activity.getApplication()).getDaynightHelper().isNightModeForMapControls();
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
if (entity == null) {
Toast.makeText(activity, activity.getResources().getString(R.string.poi_cannot_be_found), Toast.LENGTH_LONG).show();
Toast.makeText(themedContext, activity.getResources().getString(R.string.poi_cannot_be_found), Toast.LENGTH_LONG).show();
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(R.string.poi_remove_title);
final EditText comment;
final CheckBox closeChangesetCheckBox;
@ -818,13 +821,13 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
closeChangesetCheckBox = null;
comment = null;
} else {
LinearLayout ll = new LinearLayout(activity);
LinearLayout ll = new LinearLayout(themedContext);
ll.setPadding(16, 2, 16, 0);
ll.setOrientation(LinearLayout.VERTICAL);
closeChangesetCheckBox = new CheckBox(activity);
closeChangesetCheckBox = new CheckBox(themedContext);
closeChangesetCheckBox.setText(R.string.close_changeset);
ll.addView(closeChangesetCheckBox);
comment = new EditText(activity);
comment = new EditText(themedContext);
comment.setText(R.string.poi_remove_title);
ll.addView(comment);
builder.setView(ll);
@ -852,12 +855,16 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@Override
public boolean processResult(Entity result) {
if (result != null) {
if (callback != null) {
callback.poiDeleted();
}
if (isLocalEdit) {
Toast.makeText(activity, R.string.osm_changes_added_to_local_edits,
Toast.LENGTH_LONG).show();
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
if (plugin != null && isLocalEdit) {
List<OpenstreetmapPoint> points = plugin.getDBPOI().getOpenstreetmapPoints();
if (activity instanceof MapActivity && points.size() > 0) {
OsmPoint point = points.get(points.size() - 1);
MapActivity mapActivity = (MapActivity) activity;
mapActivity.getContextMenu().showOrUpdate(
new LatLon(point.getLatitude(), point.getLongitude()),
plugin.getOsmEditsLayer(mapActivity).getObjectName(point), point);
}
} else {
Toast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG)
.show();
@ -865,6 +872,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
if (activity instanceof MapActivity) {
((MapActivity) activity).getMapView().refreshMap(true);
}
if (callback != null) {
callback.poiDeleted();
}
}
return false;
}
@ -880,7 +890,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
Context themedContext = getActivity();
if (getParentFragment() instanceof EditPoiDialogFragment) {
themedContext = UiUtilities.getThemedContext(getActivity(),
((EditPoiDialogFragment) getParentFragment()).isNightMode(true));
}
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
String msg = getString(R.string.save_poi_without_poi_type_message);
int i = getArguments().getInt("message", 0);
if(i != 0) {
@ -903,7 +918,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
Context themedContext = getActivity();
if (getParentFragment() instanceof EditPoiDialogFragment) {
themedContext = UiUtilities.getThemedContext(getActivity(),
((EditPoiDialogFragment) getParentFragment()).isNightMode(true));
}
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
builder.setTitle(getResources().getString(R.string.are_you_sure))
.setMessage(getString(R.string.unsaved_changes_will_be_lost))
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@ -921,7 +941,12 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
Context themedContext = getActivity();
if (getParentFragment() instanceof EditPoiDialogFragment) {
themedContext = UiUtilities.getThemedContext(getActivity(),
((EditPoiDialogFragment) getParentFragment()).isNightMode(true));
}
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
String msg = getString(R.string.save_poi_value_exceed_length);
String fieldTag = getArguments().getString("tag", "");
if(!Algorithms.isEmpty(fieldTag)) {

View file

@ -8,6 +8,7 @@ import net.osmand.osm.AbstractPoiType;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@ -26,7 +27,6 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@ -313,17 +313,21 @@ public class PoiFiltersHelper {
return result;
}
public Map<String, Integer> getPoiFilterOrders(boolean onlyActive) {
Map<String, Integer> filterOrders = new HashMap<>();
List<PoiUIFilter> sortedFilters = getSortedPoiFilters(onlyActive);
for (PoiUIFilter filter : sortedFilters) {
filterOrders.put(filter.getFilterId(), filter.getOrder());
public List<String> getPoiFilterOrders(boolean onlyActive) {
List<String> filterOrders = new ArrayList<>();
for (PoiUIFilter filter : getSortedPoiFilters(onlyActive)) {
filterOrders.add(filter.getFilterId());
}
return filterOrders;
}
public List<PoiUIFilter> getSortedPoiFilters(boolean onlyActive) {
initPoiUIFiltersState();
ApplicationMode selectedAppMode = application.getSettings().getApplicationMode();
return getSortedPoiFilters(selectedAppMode, onlyActive);
}
public List<PoiUIFilter> getSortedPoiFilters(@NonNull ApplicationMode appMode, boolean onlyActive) {
initPoiUIFiltersState(appMode);
List<PoiUIFilter> allFilters = new ArrayList<>();
for (PoiUIFilter filter : getTopDefinedPoiFilters()) {
if (!filter.isWikiFilter()) {
@ -345,13 +349,13 @@ public class PoiFiltersHelper {
}
}
private void initPoiUIFiltersState() {
private void initPoiUIFiltersState(@NonNull ApplicationMode appMode) {
List<PoiUIFilter> allFilters = new ArrayList<>();
allFilters.addAll(getTopDefinedPoiFilters());
allFilters.addAll(getSearchPoiFilters());
refreshPoiFiltersActivation(allFilters);
refreshPoiFiltersOrder(allFilters);
refreshPoiFiltersActivation(appMode, allFilters);
refreshPoiFiltersOrder(appMode, allFilters);
//set up the biggest order to custom filter
PoiUIFilter customFilter = getCustomPOIFilter();
@ -359,8 +363,9 @@ public class PoiFiltersHelper {
customFilter.setOrder(allFilters.size());
}
private void refreshPoiFiltersOrder(List<PoiUIFilter> filters) {
Map<String, Integer> orders = getPoiFiltersOrder();
private void refreshPoiFiltersOrder(@NonNull ApplicationMode appMode,
List<PoiUIFilter> filters) {
Map<String, Integer> orders = getPoiFiltersOrder(appMode);
List<PoiUIFilter> existedFilters = new ArrayList<>();
List<PoiUIFilter> newFilters = new ArrayList<>();
if (orders != null) {
@ -392,8 +397,9 @@ public class PoiFiltersHelper {
}
}
private void refreshPoiFiltersActivation(List<PoiUIFilter> filters) {
List<String> inactiveFiltersIds = getInactivePoiFiltersIds();
private void refreshPoiFiltersActivation(@NonNull ApplicationMode appMode,
List<PoiUIFilter> filters) {
List<String> inactiveFiltersIds = getInactivePoiFiltersIds(appMode);
if (inactiveFiltersIds != null) {
for (PoiUIFilter filter : filters) {
filter.setActive(!inactiveFiltersIds.contains(filter.getFilterId()));
@ -405,16 +411,16 @@ public class PoiFiltersHelper {
}
}
public void saveFiltersOrder(List<String> filterIds) {
application.getSettings().POI_FILTERS_ORDER.setStringsList(filterIds);
public void saveFiltersOrder(ApplicationMode appMode, List<String> filterIds) {
application.getSettings().POI_FILTERS_ORDER.setStringsListForProfile(appMode, filterIds);
}
public void saveInactiveFilters(List<String> filterIds) {
application.getSettings().INACTIVE_POI_FILTERS.setStringsList(filterIds);
public void saveInactiveFilters(ApplicationMode appMode, List<String> filterIds) {
application.getSettings().INACTIVE_POI_FILTERS.setStringsListForProfile(appMode, filterIds);
}
public Map<String, Integer> getPoiFiltersOrder() {
List<String> ids = application.getSettings().POI_FILTERS_ORDER.getStringsList();
public Map<String, Integer> getPoiFiltersOrder(@NonNull ApplicationMode appMode) {
List<String> ids = application.getSettings().POI_FILTERS_ORDER.getStringsListForProfile(appMode);
if (ids == null) {
return null;
}
@ -425,8 +431,8 @@ public class PoiFiltersHelper {
return result;
}
public List<String> getInactivePoiFiltersIds() {
return application.getSettings().INACTIVE_POI_FILTERS.getStringsList();
public List<String> getInactivePoiFiltersIds(@NonNull ApplicationMode appMode) {
return application.getSettings().INACTIVE_POI_FILTERS.getStringsListForProfile(appMode);
}
private PoiFilterDbHelper openDbHelperNoPois() {

View file

@ -3,6 +3,8 @@ package net.osmand.plus.poi;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -19,16 +21,20 @@ import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
import net.osmand.PlatformUtil;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
@ -45,14 +51,14 @@ import static net.osmand.plus.poi.RearrangePoiFiltersFragment.ItemType.DESCRIPTI
import static net.osmand.plus.poi.RearrangePoiFiltersFragment.ItemType.POI;
import static net.osmand.plus.poi.RearrangePoiFiltersFragment.ItemType.SPACE;
public class RearrangePoiFiltersFragment extends DialogFragment {
public class RearrangePoiFiltersFragment extends DialogFragment implements SelectAppModesBottomSheetDialogFragment.AppModeChangedListener {
public static final String TAG = "RearrangePoiFiltersFragment";
private static final Log LOG = PlatformUtil.getLog(RearrangePoiFiltersFragment.class);
private boolean usedOnMap;
private CallbackWithObject<Boolean> resultCallback;
private OnApplyPoiFiltersState resultCallback;
private List<ListItem> items = new ArrayList<>();
private EditPoiFiltersAdapter adapter;
@ -60,6 +66,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
private boolean activationModified;
private boolean wasReset = false;
private boolean isChanged = false;
private ApplicationMode appMode;
private HashMap<String, Integer> poiFiltersOrders = new HashMap<>();
private List<String> availableFiltersKeys = new ArrayList<>();
@ -72,6 +79,20 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
setStyle(STYLE_NO_FRAME, themeId);
}
@Override
public void onPause() {
super.onPause();
if (requireActivity().isChangingConfigurations()) {
dismiss();
}
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
updateProfileButton();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -80,17 +101,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
boolean nightMode = isNightMode(app, usedOnMap);
View mainView = UiUtilities.getInflater(app, nightMode).inflate(R.layout.edit_arrangement_list_fragment, container, false);
ImageButton closeButton = mainView.findViewById(R.id.close_button);
closeButton.setImageResource(R.drawable.ic_action_remove_dark);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
TextView toolbarTitle = mainView.findViewById(R.id.toolbar_title);
toolbarTitle.setText(R.string.rearrange_categories);
createToolbar(mainView, nightMode);
RecyclerView recyclerView = mainView.findViewById(R.id.profiles_list);
recyclerView.setLayoutManager(new LinearLayoutManager(app));
@ -159,15 +170,16 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
applyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ApplicationMode selectedAppMode = getSelectedAppMode();
if (isChanged) {
if (activationModified) {
app.getPoiFilters().saveInactiveFilters(availableFiltersKeys);
app.getPoiFilters().saveInactiveFilters(selectedAppMode, availableFiltersKeys);
} else if (wasReset) {
app.getPoiFilters().saveInactiveFilters(null);
app.getPoiFilters().saveInactiveFilters(selectedAppMode, null);
}
if (orderModified) {
List<PoiUIFilter> dataToSave = new ArrayList<>();
for (PoiUIFilter filter : getSortedPoiUiFilters(app)) {
for (PoiUIFilter filter : getSortedPoiUiFilters(selectedAppMode, app)) {
String filterId = filter.getFilterId();
Integer order = poiFiltersOrders.get(filterId);
if (order == null) {
@ -185,13 +197,13 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
for (PoiUIFilter filter : dataToSave) {
filterIds.add(filter.getFilterId());
}
app.getPoiFilters().saveFiltersOrder(filterIds);
app.getPoiFilters().saveFiltersOrder(selectedAppMode, filterIds);
} else if (wasReset) {
app.getPoiFilters().saveFiltersOrder(null);
app.getPoiFilters().saveFiltersOrder(selectedAppMode,null);
}
}
if (resultCallback != null) {
resultCallback.processResult(isChanged);
resultCallback.onApplyPoiFiltersState(selectedAppMode, isChanged);
}
dismiss();
}
@ -200,10 +212,84 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
return mainView;
}
private void createToolbar(View mainView, boolean nightMode) {
AppBarLayout appbar = mainView.findViewById(R.id.appbar);
View toolbar = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.profile_preference_toolbar_with_icon, appbar, false);
ImageButton closeButton = toolbar.findViewById(R.id.close_button);
closeButton.setImageResource(R.drawable.ic_action_remove_dark);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
toolbarTitle.setText(R.string.rearrange_categories);
View switchProfile = toolbar.findViewById(R.id.profile_button);
if (switchProfile != null) {
switchProfile.setContentDescription(getString(R.string.switch_profile));
switchProfile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
SelectAppModesBottomSheetDialogFragment.showInstance(fragmentManager,
RearrangePoiFiltersFragment.this, false, getSelectedAppMode(), false);
}
}
});
}
appbar.addView(toolbar);
}
protected void updateProfileButton() {
View view = getView();
if (view == null) {
return;
}
OsmandApplication app = requireMyApplication();
UiUtilities uiUtilities = app.getUIUtilities();
ApplicationMode selectedAppMode = getSelectedAppMode();
boolean nightMode = isNightMode(app, usedOnMap);
ImageView profileIcon = (ImageView) view.findViewById(R.id.profile_icon);
if (profileIcon != null) {
int iconRes = selectedAppMode.getIconRes();
int iconColor = selectedAppMode.getIconColorInfo().getColor(nightMode);
profileIcon.setImageDrawable(uiUtilities.getPaintedIcon(iconRes, iconColor));
}
View profileButton = view.findViewById(R.id.profile_button);
if (profileButton != null) {
int iconColor = getSelectedAppMode().getIconColorInfo().getColor(nightMode);
int bgColor = ContextCompat.getColor(app, nightMode ?
R.color.divider_color_dark : R.color.active_buttons_and_links_text_light);
int selectedColor = UiUtilities.getColorWithAlpha(iconColor, 0.3f);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
int bgResId = R.drawable.circle_background_light;
int selectableResId = R.drawable.ripple_circle;
Drawable bgDrawable = uiUtilities.getPaintedIcon(bgResId, bgColor);
Drawable selectable = uiUtilities.getPaintedIcon(selectableResId, selectedColor);
Drawable[] layers = {bgDrawable, selectable};
AndroidUtils.setBackground(profileButton, new LayerDrawable(layers));
} else {
int bgResId = R.drawable.circle_background_light;
Drawable bgDrawable = uiUtilities.getPaintedIcon(bgResId, bgColor);
AndroidUtils.setBackground(profileButton, bgDrawable);
}
}
}
private void initFiltersOrders(OsmandApplication app, boolean arrangementByDefault) {
poiFiltersOrders.clear();
availableFiltersKeys.clear();
List<PoiUIFilter> filters = getSortedPoiUiFilters(app);
ApplicationMode selectedAppMode = getSelectedAppMode();
List<PoiUIFilter> filters = getSortedPoiUiFilters(selectedAppMode, app);
if (arrangementByDefault) {
Collections.sort(filters, new Comparator<PoiUIFilter>() {
@Override
@ -272,21 +358,35 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
adapter.setItems(items);
}
public static void showInstance(@NonNull DialogFragment parentFragment, boolean usedOnMap, CallbackWithObject<Boolean> callback) {
public static void showInstance(@NonNull ApplicationMode appMode, @NonNull DialogFragment parentFragment,
boolean usedOnMap, OnApplyPoiFiltersState callback) {
try {
RearrangePoiFiltersFragment fragment = new RearrangePoiFiltersFragment();
fragment.setUsedOnMap(usedOnMap);
fragment.setResultCallback(callback);
fragment.setSelectedAppMode(appMode);
fragment.show(parentFragment.getChildFragmentManager(), RearrangePoiFiltersFragment.TAG);
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}
}
public ApplicationMode getSelectedAppMode() {
if (appMode == null) {
appMode = requireMyApplication().getSettings().getApplicationMode();
}
return appMode;
}
public void setSelectedAppMode(ApplicationMode appMode) {
this.appMode = appMode;
}
public List<ListItem> getPoiFilters(boolean isActive) {
OsmandApplication app = requireMyApplication();
ApplicationMode selectedAppMode = getSelectedAppMode();
List<ListItem> result = new ArrayList<>();
for (PoiUIFilter f : getSortedPoiUiFilters(app)) {
for (PoiUIFilter f : getSortedPoiUiFilters(selectedAppMode, app)) {
addFilterToList(result, f, isActive);
}
Collections.sort(result, new Comparator<ListItem>() {
@ -322,8 +422,9 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
}
}
private static List<PoiUIFilter> getSortedPoiUiFilters(@NonNull OsmandApplication app) {
List<PoiUIFilter> filters = app.getPoiFilters().getSortedPoiFilters(false);
private static List<PoiUIFilter> getSortedPoiUiFilters(@NonNull ApplicationMode appMode,
@NonNull OsmandApplication app) {
List<PoiUIFilter> filters = app.getPoiFilters().getSortedPoiFilters(appMode, false);
//remove custom filter
for (int i = filters.size() - 1; i >= 0; i--) {
PoiUIFilter filter = filters.get(i);
@ -339,7 +440,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
this.usedOnMap = usedOnMap;
}
public void setResultCallback(CallbackWithObject<Boolean> resultCallback) {
public void setResultCallback(OnApplyPoiFiltersState resultCallback) {
this.resultCallback = resultCallback;
}
@ -356,6 +457,13 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
return false;
}
@Override
public void onAppModeChanged(ApplicationMode appMode) {
this.appMode = appMode;
updateProfileButton();
initFiltersOrders(requireMyApplication(), false);
}
public class PoiUIFilterDataObject {
String filterId;
String name;
@ -693,4 +801,8 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
void onButtonClicked(int view);
}
public interface OnApplyPoiFiltersState {
void onApplyPoiFiltersState(ApplicationMode mode, boolean stateChanged);
}
}

View file

@ -22,6 +22,8 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import net.osmand.AndroidUtils;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
@ -67,6 +69,11 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
nightMode = !app.getSettings().isLightContent();
View mainView = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.edit_arrangement_list_fragment, container, false);
AppBarLayout appbar = mainView.findViewById(R.id.appbar);
View toolbar = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.global_preference_toolbar, container, false);
appbar.addView(toolbar);
ImageButton closeButton = mainView.findViewById(R.id.close_button);
closeButton.setImageResource(R.drawable.ic_action_remove_dark);
closeButton.setOnClickListener(new View.OnClickListener() {

View file

@ -1,12 +1,11 @@
package net.osmand.plus.quickaction;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@ -41,7 +40,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.AndroidUtils.dpToPx;
/**
* Created by okorsun on 20.12.16.
@ -224,11 +223,10 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
if (viewType == SCREEN_ITEM_TYPE) {
final QuickActionItemVH itemVH = (QuickActionItemVH) holder;
itemVH.title.setText(item.getName(getContext()));
Context ctx = getContext();
itemVH.title.setText(item.getName(ctx));
itemVH.subTitle.setText(getResources().getString(R.string.quick_action_item_action, getActionPosition(position)));
itemVH.icon.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(item.getIconRes(getContext())));
itemVH.icon.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(item.getIconRes(ctx)));
itemVH.handleView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@ -256,7 +254,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
LinearLayout.LayoutParams dividerParams = (LinearLayout.LayoutParams) itemVH.divider.getLayoutParams();
//noinspection ResourceType
dividerParams.setMargins(!isLongDivider(position) ? dpToPx(56f) : 0, 0, 0, 0);
dividerParams.setMargins(!isLongDivider(position) ? dpToPx(ctx, 56f) : 0, 0, 0, 0);
itemVH.divider.setLayoutParams(dividerParams);
} else {
QuickActionHeaderVH headerVH = (QuickActionHeaderVH) holder;
@ -361,15 +359,6 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
return getActionPosition(globalPosition) == ITEMS_IN_GROUP || globalPosition == getItemCount() - 1;
}
private int dpToPx(float dp) {
Resources r = getActivity().getResources();
return (int) TypedValue.applyDimension(
COMPLEX_UNIT_DIP,
dp,
r.getDisplayMetrics()
);
}
@Override
public boolean onItemMove(int selectedPosition, int targetPosition) {
Log.v(TAG, "selected: " + selectedPosition + ", target: " + targetPosition);

View file

@ -5,6 +5,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
@ -14,6 +15,7 @@ import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@ -44,10 +46,10 @@ import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
import net.osmand.GPXUtilities;
import net.osmand.GPXUtilities.GPXFile;
import net.osmand.GPXUtilities.WptPt;
@ -66,6 +68,7 @@ import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.AppInitializer.AppInitializeListener;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.LockableViewPager;
import net.osmand.plus.OsmAndFormatter;
@ -74,6 +77,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.Version;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
@ -1238,15 +1242,40 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
app.getString(R.string.rearrange_categories), new OnClickListener() {
@Override
public void onClick(View v) {
RearrangePoiFiltersFragment.showInstance(QuickSearchDialogFragment.this, false, new CallbackWithObject<Boolean>() {
ApplicationMode appMode = app.getSettings().getApplicationMode();
RearrangePoiFiltersFragment.showInstance(appMode, QuickSearchDialogFragment.this, false,
new RearrangePoiFiltersFragment.OnApplyPoiFiltersState() {
@Override
public boolean processResult(Boolean changed) {
if (changed) {
searchHelper.refreshFilterOrders();
reloadCategoriesInternal();
}
return false;
@Override
public void onApplyPoiFiltersState(final ApplicationMode appMode, boolean stateChanged) {
if (stateChanged) {
searchHelper.refreshFilterOrders();
reloadCategoriesInternal();
}
View containerView = getView();
if (containerView != null) {
//show "Apply to all profiles" SnackBar
String modeName = appMode.toHumanString();
String text = app.getString(R.string.changes_applied_to_profile, modeName);
SpannableString message = UiUtilities.createSpannableString(text, modeName, new StyleSpan(Typeface.BOLD));
Snackbar snackbar = Snackbar.make(containerView, message, Snackbar.LENGTH_LONG)
.setAction(R.string.apply_to_all_profiles, new View.OnClickListener() {
@Override
public void onClick(View view) {
OsmandSettings settings = app.getSettings();
String orders = settings.POI_FILTERS_ORDER.getModeValue(appMode);
String inactive = settings.INACTIVE_POI_FILTERS.getModeValue(appMode);
for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {
settings.POI_FILTERS_ORDER.setModeValue(mode, orders);
settings.INACTIVE_POI_FILTERS.setModeValue(mode, inactive);
}
searchHelper.refreshFilterOrders();
reloadCategoriesInternal();
}
});
UiUtilities.setupSnackbarVerticalLayout(snackbar);
snackbar.show();
}
}
});
}

View file

@ -275,7 +275,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
if (pointDescription != null) {
String typeName = pointDescription.getTypeName();
if (!Algorithms.isEmpty(typeName)) {
name = mapActivity.getString(R.string.street_city, pointDescription.getName(), typeName);
name = mapActivity.getString(R.string.ltr_or_rtl_combine_via_comma, pointDescription.getName(), typeName);
} else {
name = pointDescription.getName();
}

View file

@ -374,14 +374,16 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
builder.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
PoiUIFilter nFilter = new PoiUIFilter(editText.getText().toString(), null, filter.getAcceptedTypes(), app);
String filterName = editText.getText().toString();
PoiUIFilter nFilter = new PoiUIFilter(filterName, null, filter.getAcceptedTypes(), app);
applyFilterFields();
if (!Algorithms.isEmpty(filter.getFilterByName())) {
nFilter.setSavedFilterByName(filter.getFilterByName());
}
if (app.getPoiFilters().createPoiFilter(nFilter, false)) {
Toast.makeText(getContext(), MessageFormat.format(getContext().getText(R.string.edit_filter_create_message).toString(),
editText.getText().toString()), Toast.LENGTH_SHORT).show();
Toast.makeText(getContext(),
getContext().getString(R.string.edit_filter_create_message, filterName),
Toast.LENGTH_SHORT).show();
app.getSearchUICore().refreshCustomPoiFilters();
((QuickSearchDialogFragment) getParentFragment()).replaceQueryWithUiFilter(nFilter, "");
((QuickSearchDialogFragment) getParentFragment()).reloadCategories();

View file

@ -940,9 +940,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
}
});
UiUtilities.setupSnackbarVerticalLayout(snackbar);
try {
snackbar.setAnimationMode(BaseTransientBottomBar.ANIMATION_MODE_FADE);
} catch (Throwable e) { }
snackbar.show();
}
}

View file

@ -14,13 +14,14 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.ApplicationMode;
@ -68,6 +69,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
private static final String ITEMS_ORDER_KEY = "items_order_key";
private static final String HIDDEN_ITEMS_KEY = "hidden_items_key";
private static final String CONFIGURE_MENU_ITEMS_TAG = "configure_menu_items_tag";
private static final String IS_CHANGED_KEY = "is_changed_key";
private RearrangeMenuItemsAdapter rearrangeAdapter;
private HashMap<String, Integer> menuItemsOrder;
private ContextMenuAdapter contextMenuAdapter;
@ -87,6 +89,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
outState.putSerializable(ITEMS_ORDER_KEY, menuItemsOrder);
outState.putSerializable(ITEM_TYPE_KEY, screenType);
outState.putString(APP_MODE_KEY, appMode.getStringKey());
outState.putBoolean(IS_CHANGED_KEY, isChanged);
}
public static ConfigureMenuItemsFragment showInstance(
@ -126,15 +129,12 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
app = requireMyApplication();
nightMode = !app.getSettings().isLightContent();
mInflater = UiUtilities.getInflater(app, nightMode);
instantiateContextMenuAdapter();
if (savedInstanceState != null
&& savedInstanceState.containsKey(ITEM_TYPE_KEY)
&& savedInstanceState.containsKey(HIDDEN_ITEMS_KEY)
&& savedInstanceState.containsKey(ITEMS_ORDER_KEY)) {
if (savedInstanceState != null) {
appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null);
screenType = (ScreenType) savedInstanceState.getSerializable(ITEM_TYPE_KEY);
hiddenMenuItems = savedInstanceState.getStringArrayList(HIDDEN_ITEMS_KEY);
menuItemsOrder = (HashMap<String, Integer>) savedInstanceState.getSerializable(ITEMS_ORDER_KEY);
isChanged = savedInstanceState.getBoolean(IS_CHANGED_KEY);
} else {
hiddenMenuItems = new ArrayList<>(getSettingForScreen(app, screenType).getModeValue(appMode).getHiddenIds());
menuItemsOrder = new HashMap<>();
@ -143,6 +143,14 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
menuItemsOrder.put(orderIds.get(i), i);
}
}
instantiateContextMenuAdapter();
if (menuItemsOrder.isEmpty()) {
List<ContextMenuItem> defItems = contextMenuAdapter.getDefaultItems();
initDefaultOrders(defItems);
for (int i = 0; i < defItems.size(); i++) {
menuItemsOrder.put(defItems.get(i).getId(), i);
}
}
}
private void instantiateContextMenuAdapter() {
@ -169,11 +177,10 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = mInflater.inflate(R.layout.edit_arrangement_list_fragment, container, false);
Toolbar toolbar = root.findViewById(R.id.toolbar);
TextView toolbarTitle = root.findViewById(R.id.toolbar_title);
ImageButton toolbarButton = root.findViewById(R.id.close_button);
RecyclerView recyclerView = root.findViewById(R.id.profiles_list);
recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width));
AppBarLayout appbar = root.findViewById(R.id.appbar);
View toolbar = mInflater.inflate(R.layout.global_preference_toolbar, container, false);
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
ImageButton toolbarButton = toolbar.findViewById(R.id.close_button);
toolbar.setBackgroundColor(nightMode
? getResources().getColor(R.color.list_background_color_dark)
: getResources().getColor(R.color.list_background_color_light));
@ -188,8 +195,9 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
exitFragment();
}
});
appbar.addView(toolbar);
RecyclerView recyclerView = root.findViewById(R.id.profiles_list);
recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width));
rearrangeAdapter = new RearrangeMenuItemsAdapter(app, getAdapterItems());
recyclerView.setLayoutManager(new LinearLayoutManager(app));
final ItemTouchHelper touchHelper = new ItemTouchHelper(new ReorderItemTouchHelperCallback(rearrangeAdapter));
@ -300,16 +308,16 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
List<RearrangeMenuAdapterItem> visible = getItemsForRearrangeAdapter(hiddenMenuItems, wasReset ? null : menuItemsOrder, false);
List<RearrangeMenuAdapterItem> hiddenItems = getItemsForRearrangeAdapter(hiddenMenuItems, wasReset ? null : menuItemsOrder, true);
if (screenType == ScreenType.CONTEXT_MENU_ACTIONS) {
int buttonMoreIndex = MAIN_BUTTONS_QUANTITY - 1;
for (int i = 0; i < visible.size(); i++) {
ContextMenuItem value = (ContextMenuItem) visible.get(i).getValue();
if (value.getId() != null && value.getId().equals(MAP_CONTEXT_MENU_MORE_ID)) {
int buttonMoreIndex = MAIN_BUTTONS_QUANTITY - 1;
if (i > buttonMoreIndex) {
RearrangeMenuAdapterItem third = visible.get(buttonMoreIndex);
visible.set(buttonMoreIndex, visible.get(i));
menuItemsOrder.put(((ContextMenuItem) third.getValue()).getId(), i);
menuItemsOrder.put(((ContextMenuItem) visible.get(i).getValue()).getId(), buttonMoreIndex);
}
if (value.getId() != null && value.getId().equals(MAP_CONTEXT_MENU_MORE_ID) && i > buttonMoreIndex) {
RearrangeMenuAdapterItem third = visible.get(buttonMoreIndex);
visible.set(buttonMoreIndex, visible.get(i));
visible.set(i, third);
value.setOrder(buttonMoreIndex);
((ContextMenuItem) third.getValue()).setOrder(i);
break;
}
}

View file

@ -268,6 +268,9 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
super.onScrollStateChanged(recyclerView, newState);
if (newState != RecyclerView.SCROLL_STATE_IDLE) {
hideKeyboard();
if (profileName != null) {
profileName.clearFocus();
}
}
}
});
@ -359,13 +362,21 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
}
}
});
profileName.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
profileName.setSelection(profileName.getText().length());
AndroidUtils.showSoftKeyboard(profileName);
}
}
});
if (getSelectedAppMode().equals(ApplicationMode.DEFAULT) && !isNewProfile) {
profileName.setFocusableInTouchMode(false);
profileName.setFocusable(false);
} else {
profileName.requestFocus();
}
profileNameOtfb = (OsmandTextFieldBoxes) holder.findViewById(R.id.profile_name_otfb);
updateProfileNameAppearance();
} else if (MASTER_PROFILE.equals(preference.getKey())) {
baseProfileName = (EditText) holder.findViewById(R.id.master_profile_et);
baseProfileName.setFocusable(false);

View file

@ -2,7 +2,6 @@ package net.osmand.plus.views;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@ -53,7 +52,7 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.AndroidUtils.dpToPx;
public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
MapTextProvider<Amenity>, IRouteInformationListener {
@ -446,15 +445,4 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
@Override
public void routeWasFinished() {
}
public static int dpToPx(Context ctx, float dp) {
Resources r = ctx.getResources();
return (int) TypedValue.applyDimension(
COMPLEX_UNIT_DIP,
dp,
r.getDisplayMetrics()
);
}
}

View file

@ -1,5 +1,6 @@
package net.osmand.plus.wikipedia;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
@ -8,6 +9,8 @@ import android.widget.CompoundButton;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.os.ConfigurationCompat;
import androidx.core.os.LocaleListCompat;
import net.osmand.AndroidUtils;
import net.osmand.CallbackWithObject;
@ -19,13 +22,17 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.ENABLED_WIKI_POI_LANGUAGES_KEY;
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.GLOBAL_WIKI_POI_ENABLED_KEY;
@ -50,9 +57,6 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
app = requiredMyApplication();
settings = app.getSettings();
initLanguagesData();
if (savedInstanceState != null) {
dismiss();
}
}
@Override
@ -63,17 +67,18 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
@Override
public void createMenuItems(Bundle savedInstanceState) {
boolean nightMode = isNightMode(app);
final int activeColorResId = AndroidUtils.resolveAttribute(app, R.attr.active_color_basic);
final int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
final int profileColorResId = appMode.getIconColorInfo().getColor(nightMode);
final int paddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
final int paddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
final int contentPadding = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
final int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
final int contentPaddingHalf = app.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
items.add(new TitleItem(getString(R.string.shared_string_languages)));
items.add(new LongDescriptionItem(getString(R.string.wikipedia_poi_languages_promo)));
items.add(new DividerSpaceItem(app, paddingSmall));
items.add(new LongDescriptionItem(getString(R.string.some_articles_may_not_available_in_lang)));
items.add(new DividerSpaceItem(app, contentPadding));
items.add(new LongDescriptionItem(getString(R.string.select_wikipedia_article_langs)));
items.add(new DividerSpaceItem(app, contentPaddingSmall));
final BottomSheetItemWithCompoundButton[] btnSelectAll = new BottomSheetItemWithCompoundButton[1];
btnSelectAll[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
@ -92,10 +97,17 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
})
.create();
items.add(btnSelectAll[0]);
items.add(new DividerSpaceItem(app, paddingHalf));
items.add(new DividerSpaceItem(app, contentPaddingHalf));
languageItems = new ArrayList<>();
boolean categoryChanged = false;
for (final WikiLanguageItem language : languages) {
if (!categoryChanged && !language.isTopDefined()) {
categoryChanged = true;
DividerItem divider = new DividerItem(app);
divider.setMargins(contentPadding, 0, 0, 0);
items.add(divider);
}
final BottomSheetItemWithCompoundButton[] languageItem = new BottomSheetItemWithCompoundButton[1];
languageItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(language.isChecked())
@ -111,13 +123,21 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
})
.create();
languageItems.add(languageItem[0]);
items.add(languageItem[0]);
}
items.addAll(languageItems);
}
private void initLanguagesData() {
languages = new ArrayList<>();
Set<String> preferredLocales = new HashSet<>();
LocaleListCompat locales = ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration());
for (int i = 0; i < locales.size(); i++) {
preferredLocales.add(locales.get(i).getLanguage());
}
preferredLocales.add(app.getLanguage());
preferredLocales.add(Locale.getDefault().getLanguage());
Bundle wikiPoiSettings = WikipediaPoiMenu.getWikiPoiSettings(app);
List<String> enabledWikiPoiLocales = null;
if (wikiPoiSettings != null) {
@ -127,11 +147,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
if (enabledWikiPoiLocales != null) {
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
boolean checked = enabledWikiPoiLocales.contains(locale);
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked));
boolean topDefined = preferredLocales.contains(locale) || checked;
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked, topDefined));
}
} else {
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false));
boolean topDefined = preferredLocales.contains(locale);
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false, topDefined));
}
}
@ -183,8 +205,8 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
View buttonView = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.bottom_sheet_item_title_with_swith_56dp, null);
CompoundButton cb = buttonView.findViewById(R.id.compound_button);
int color = AndroidUtils.getColorFromAttr(app, R.attr.divider_color_basic);
int bgColor = UiUtilities.getColorWithAlpha(color, 0.5f);
int color = nightMode ? R.color.divider_color_dark : R.color.divider_color_light;
int bgColor = UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, color), 0.5f);
int bgResId = R.drawable.rectangle_rounded_right;
Drawable bgDrawable = app.getUIUtilities().getPaintedIcon(bgResId, bgColor);
@ -196,6 +218,14 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
return buttonView;
}
@Override
public void onPause() {
super.onPause();
if (requireActivity().isChangingConfigurations()) {
dismiss();
}
}
public void setAppMode(ApplicationMode appMode) {
this.appMode = appMode;
}
@ -208,11 +238,13 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
private String locale;
private String title;
private boolean checked;
private boolean topDefined;
public WikiLanguageItem(String locale, String title, boolean checked) {
public WikiLanguageItem(String locale, String title, boolean checked, boolean topDefined) {
this.locale = locale;
this.title = title;
this.checked = checked;
this.topDefined = topDefined;
}
public String getLocale() {
@ -227,13 +259,18 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
this.checked = checked;
}
public boolean isTopDefined() {
return topDefined;
}
public String getTitle() {
return title;
}
@Override
public int compareTo(WikiLanguageItem other) {
return this.title.compareToIgnoreCase(other.title);
int result = other.topDefined ? (!this.topDefined ? 1 : 0) : (this.topDefined ? -1 : 0);
return result != 0 ? result : this.title.compareToIgnoreCase(other.title);
}
}

View file

@ -44,7 +44,6 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
@ -231,9 +230,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
Context context = getContext();
if (context != null) {
final PopupMenu optionsMenu = new PopupMenu(context, view, Gravity.RIGHT);
Set<String> namesSet = new TreeSet<>();
namesSet.addAll(amenity.getNames("content", "en"));
namesSet.addAll(amenity.getNames("description", "en"));
Set<String> namesSet = amenity.getSupportedContentLocales();
Map<String, String> names = new HashMap<>();
for (String n : namesSet) {
@ -285,8 +282,9 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
WikipediaDialogFragment wikipediaDialogFragment = new WikipediaDialogFragment();
wikipediaDialogFragment.setAmenity(amenity);
wikipediaDialogFragment.setLanguage(lang == null ?
app.getSettings().MAP_PREFERRED_LOCALE.get() : lang);
lang = lang != null ? lang : WikipediaPoiMenu.getWikiArticleLanguage(app,
amenity.getSupportedContentLocales(), app.getSettings().MAP_PREFERRED_LOCALE.get());
wikipediaDialogFragment.setLanguage(lang);
wikipediaDialogFragment.setRetainInstance(true);
wikipediaDialogFragment.show(activity.getSupportFragmentManager(), TAG);
return true;

View file

@ -1,6 +1,7 @@
package net.osmand.plus.wikipedia;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
@ -26,6 +27,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static net.osmand.osm.MapPoiTypes.WIKI_LANG;
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
@ -354,7 +356,7 @@ public class WikipediaPoiMenu {
ph.clearSelectedPoiFilters(PoiTemplateList.WIKI);
}
private static String getLanguagesSummary(OsmandApplication app) {
public static String getLanguagesSummary(OsmandApplication app) {
Bundle wikiLanguagesSetting = getWikiPoiSettings(app);
if (wikiLanguagesSetting != null) {
boolean globalWikiEnabled = wikiLanguagesSetting.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
@ -379,4 +381,31 @@ public class WikipediaPoiMenu {
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) {
return new WikipediaPoiMenu(mapActivity).createLayersItems();
}
public static String getWikiArticleLanguage(@NonNull OsmandApplication app,
@NonNull Set<String> availableArticleLangs,
String preferredLanguage) {
Bundle wikiPoiSettings = getWikiPoiSettings(app);
if (!app.getSettings().SHOW_WIKIPEDIA_POI.get() || wikiPoiSettings == null) {
// Wikipedia POI setting disabled
return preferredLanguage;
}
if (wikiPoiSettings.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY)) {
// global Wikipedia POI filter enabled
return preferredLanguage;
}
if (Algorithms.isEmpty(preferredLanguage)) {
preferredLanguage = app.getLanguage();
}
List<String> wikiLangs = wikiPoiSettings.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
if (wikiLangs != null && !wikiLangs.contains(preferredLanguage)) {
// return first matched language from enabled Wikipedia languages
for (String language : wikiLangs) {
if (availableArticleLangs.contains(language)) {
return language;
}
}
}
return preferredLanguage;
}
}