Merge branch 'master' of https://github.com/osmandapp/Osmand into custom_downloads

# Conflicts:
#	OsmAnd/res/values/strings.xml
#	OsmAnd/src/net/osmand/plus/settings/ConfigureMenuItemsFragment.java
This commit is contained in:
Vitaliy 2020-04-20 17:12:05 +03:00
commit 2967b8f140
62 changed files with 363 additions and 272 deletions

View file

@ -119,7 +119,7 @@ public class BinaryRoutePlanner {
printMemoryConsumption("Memory occupied before exception : ");
}
if (ctx.memoryOverhead > ctx.config.memoryLimitation * 0.95) {
throw new IllegalStateException("There is no enough memory " + ctx.config.memoryLimitation / (1 << 20) + " Mb");
throw new IllegalStateException("There is not enough memory " + ctx.config.memoryLimitation / (1 << 20) + " Mb");
}
ctx.visitedSegments ++;
if (forwardSearch) {

View file

@ -29,7 +29,7 @@ public class RoutingConfiguration {
// 1.1 tile load parameters (should not affect routing)
public int ZOOM_TO_LOAD_TILES = 16;
public int memoryLimitation;
public long memoryLimitation;
// 1.2 Build A* graph in backward/forward direction (can affect results)
// 0 - 2 ways, 1 - direct way, -1 - reverse way
@ -98,12 +98,12 @@ public class RoutingConfiguration {
i.ZOOM_TO_LOAD_TILES = parseSilentInt(getAttribute(i.router, "zoomToLoadTiles"), i.ZOOM_TO_LOAD_TILES);
int desirable = parseSilentInt(getAttribute(i.router, "memoryLimitInMB"), 0);
if(desirable != 0) {
i.memoryLimitation = desirable * (1 << 20);
i.memoryLimitation = desirable * (1l << 20);
} else {
if(memoryLimitMB == 0) {
memoryLimitMB = DEFAULT_MEMORY_LIMIT;
}
i.memoryLimitation = memoryLimitMB * (1 << 20);
i.memoryLimitation = memoryLimitMB * (1l << 20);
}
i.planRoadDirection = parseSilentInt(getAttribute(i.router, "planRoadDirection"), i.planRoadDirection);
// i.planRoadDirection = 1;

View file

@ -265,7 +265,7 @@ public class RoutingContext {
public RouteSegment loadRouteSegment(int x31, int y31, int memoryLimit) {
public RouteSegment loadRouteSegment(int x31, int y31, long memoryLimit) {
long tileId = getRoutingTile(x31, y31, memoryLimit);
TLongObjectHashMap<RouteDataObject> excludeDuplications = new TLongObjectHashMap<RouteDataObject>();
RouteSegment original = null;
@ -443,7 +443,7 @@ public class RoutingContext {
}
@SuppressWarnings("unused")
private long getRoutingTile(int x31, int y31, int memoryLimit) {
private long getRoutingTile(int x31, int y31, long memoryLimit) {
// long now = System.nanoTime();
long xloc = x31 >> (31 - config.ZOOM_TO_LOAD_TILES);
long yloc = y31 >> (31 - config.ZOOM_TO_LOAD_TILES);
@ -515,11 +515,11 @@ public class RoutingContext {
public boolean checkIfMemoryLimitCritical(int memoryLimit) {
public boolean checkIfMemoryLimitCritical(long memoryLimit) {
return getCurrentEstimatedSize() > 0.9 * memoryLimit;
}
public void unloadUnusedTiles(int memoryLimit) {
public void unloadUnusedTiles(long memoryLimit) {
float desirableSize = memoryLimit * 0.7f;
List<RoutingSubregionTile> list = new ArrayList<RoutingSubregionTile>(subregionTiles.size() / 2);
int loaded = 0;

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

@ -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

@ -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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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>

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

@ -12,6 +12,7 @@
-->
<string name="extra_maps_menu_group">Extra maps</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>
@ -57,11 +58,11 @@
<string name="replace_point_descr">Replace another point with this</string>
<string name="developer_plugin">Developer Plugin</string>
<string name="move_inside_category">You can move items only inside this category.</string>
<string name="additional_actions_descr">You can acsess this actions by taping “Actions” button.</string>
<string name="additional_actions_descr">You can access these actions by tapping the “Actions” button.</string>
<string name="main_actions">Main actions</string>
<string name="main_actions_descr">Main actions containt only 4 buttons.</string>
<string name="reset_items_descr">Settings will be reset to the original state after hiding.</string>
<string name="hidden_items_descr">These items are hidden from the menu, but the represented options or plugins still be working.</string>
<string name="hidden_items_descr">These items are hidden from the menu, but the represented options or plugins will remain working.</string>
<string name="shared_string_hidden">Hidden</string>
<string name="divider_descr">Elements below this point separated by a divider.</string>
<string name="shared_string_divider">Divider</string>
@ -245,7 +246,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

@ -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

@ -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

@ -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

@ -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

@ -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() {
@ -921,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

@ -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

@ -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

@ -38,10 +38,10 @@ import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet;
import net.osmand.plus.settings.ConfigureMenuRootFragment.ScreenType;
import net.osmand.plus.settings.RearrangeMenuItemsAdapter.MenuItemsAdapterListener;
import net.osmand.plus.settings.RearrangeMenuItemsAdapter.RearrangeMenuAdapterItem;
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import net.osmand.plus.settings.RearrangeMenuItemsAdapter.RearrangeMenuAdapterItem;
import net.osmand.plus.settings.RearrangeMenuItemsAdapter.MenuItemsAdapterListener;
import org.apache.commons.logging.Log;
@ -69,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;
@ -88,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(
@ -127,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<>();
@ -144,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() {
@ -170,15 +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);
AppBarLayout appbar = root.findViewById(R.id.appbar);
View toolbar = mInflater.inflate(R.layout.global_preference_toolbar, container, false);
appbar.addView(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));
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));
@ -193,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));
@ -305,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

@ -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()
);
}
}