commit
d350586015
57 changed files with 540 additions and 218 deletions
|
@ -93,33 +93,6 @@ public class Amenity extends MapObject {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String unzipContent(String str) {
|
|
||||||
if (str != null) {
|
|
||||||
if (str.startsWith(" gz ")) {
|
|
||||||
try {
|
|
||||||
int ind = 4;
|
|
||||||
byte[] bytes = new byte[str.length() - ind];
|
|
||||||
for (int i = ind; i < str.length(); i++) {
|
|
||||||
char ch = str.charAt(i);
|
|
||||||
bytes[i - ind] = (byte) ((int) ch - 128 - 32);
|
|
||||||
|
|
||||||
}
|
|
||||||
GZIPInputStream gzn = new GZIPInputStream(new ByteArrayInputStream(bytes));
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(gzn, "UTF-8"));
|
|
||||||
StringBuilder bld = new StringBuilder();
|
|
||||||
String s;
|
|
||||||
while ((s = br.readLine()) != null) {
|
|
||||||
bld.append(s);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
str = bld.toString();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getAdditionalInfo() {
|
public Map<String, String> getAdditionalInfo() {
|
||||||
if (additionalInfo == null) {
|
if (additionalInfo == null) {
|
||||||
|
|
|
@ -8,6 +8,10 @@ import net.osmand.util.TransliterationHelper;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -18,6 +22,7 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
|
||||||
public abstract class MapObject implements Comparable<MapObject> {
|
public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
@ -55,7 +60,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
return name;
|
return unzipContent(name);
|
||||||
}
|
}
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -73,7 +78,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
if (names == null) {
|
if (names == null) {
|
||||||
names = new HashMap<String, String>();
|
names = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
names.put(lang, name);
|
names.put(lang, unzipContent(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,19 +100,25 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
}
|
}
|
||||||
Map<String, String> mp = new HashMap<String, String>();
|
Map<String, String> mp = new HashMap<String, String>();
|
||||||
if (names != null) {
|
if (names != null) {
|
||||||
mp.putAll(names);
|
Iterator<Entry<String, String>> it = mp.entrySet().iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<String, String> e = it.next();
|
||||||
|
mp.put(e.getKey(), unzipContent(e.getValue()));
|
||||||
}
|
}
|
||||||
mp.put("en", enName);
|
}
|
||||||
|
mp.put("en", unzipContent(enName));
|
||||||
return mp;
|
return mp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAllNames() {
|
public List<String> getAllNames() {
|
||||||
List<String> l = new ArrayList<String>();
|
List<String> l = new ArrayList<String>();
|
||||||
if (!Algorithms.isEmpty(enName)) {
|
if (!Algorithms.isEmpty(enName)) {
|
||||||
l.add(enName);
|
l.add(unzipContent(enName));
|
||||||
}
|
}
|
||||||
if (names != null) {
|
if (names != null) {
|
||||||
l.addAll(names.values());
|
for(String nm : names.values()) {
|
||||||
|
l.add(unzipContent(nm));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +190,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
if (names != null) {
|
if (names != null) {
|
||||||
String nm = names.get(lang);
|
String nm = names.get(lang);
|
||||||
if (!Algorithms.isEmpty(nm)) {
|
if (!Algorithms.isEmpty(nm)) {
|
||||||
return nm;
|
return unzipContent(nm);
|
||||||
}
|
}
|
||||||
if (transliterate) {
|
if (transliterate) {
|
||||||
return TransliterationHelper.transliterate(getName());
|
return TransliterationHelper.transliterate(getName());
|
||||||
|
@ -192,7 +203,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
|
||||||
public String getEnName(boolean transliterate) {
|
public String getEnName(boolean transliterate) {
|
||||||
if (!Algorithms.isEmpty(enName)) {
|
if (!Algorithms.isEmpty(enName)) {
|
||||||
return this.enName;
|
return unzipContent(this.enName);
|
||||||
} else if (!Algorithms.isEmpty(getName()) && transliterate) {
|
} else if (!Algorithms.isEmpty(getName()) && transliterate) {
|
||||||
return TransliterationHelper.transliterate(getName());
|
return TransliterationHelper.transliterate(getName());
|
||||||
}
|
}
|
||||||
|
@ -322,12 +333,12 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
|
||||||
public JSONObject toJSON() {
|
public JSONObject toJSON() {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("name", name);
|
json.put("name", unzipContent(name));
|
||||||
json.put("enName", enName);
|
json.put("enName", unzipContent(enName));
|
||||||
if (names != null && names.size() > 0) {
|
if (names != null && names.size() > 0) {
|
||||||
JSONObject namesObj = new JSONObject();
|
JSONObject namesObj = new JSONObject();
|
||||||
for (Entry<String, String> e : names.entrySet()) {
|
for (Entry<String, String> e : names.entrySet()) {
|
||||||
namesObj.put(e.getKey(), e.getValue());
|
namesObj.put(e.getKey(), unzipContent(e.getValue()));
|
||||||
}
|
}
|
||||||
json.put("names", namesObj);
|
json.put("names", namesObj);
|
||||||
}
|
}
|
||||||
|
@ -340,6 +351,31 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String unzipContent(String str) {
|
||||||
|
if (str != null && str.startsWith(" gz ")) {
|
||||||
|
try {
|
||||||
|
int ind = 4;
|
||||||
|
byte[] bytes = new byte[str.length() - ind];
|
||||||
|
for (int i = ind; i < str.length(); i++) {
|
||||||
|
char ch = str.charAt(i);
|
||||||
|
bytes[i - ind] = (byte) ((int) ch - 128 - 32);
|
||||||
|
}
|
||||||
|
GZIPInputStream gzn = new GZIPInputStream(new ByteArrayInputStream(bytes));
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(gzn, "UTF-8"));
|
||||||
|
StringBuilder bld = new StringBuilder();
|
||||||
|
String s;
|
||||||
|
while ((s = br.readLine()) != null) {
|
||||||
|
bld.append(s);
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
str = bld.toString();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
protected static void parseJSON(JSONObject json, MapObject o) {
|
protected static void parseJSON(JSONObject json, MapObject o) {
|
||||||
if (json.has("name")) {
|
if (json.has("name")) {
|
||||||
o.name = json.getString("name");
|
o.name = json.getString("name");
|
||||||
|
|
7
OsmAnd/res/anim/slide_in_right.xml
Normal file
7
OsmAnd/res/anim/slide_in_right.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<translate android:fromXDelta="100%p" android:toXDelta="0"
|
||||||
|
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||||
|
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||||
|
android:duration="@android:integer/config_mediumAnimTime" />
|
||||||
|
</set>
|
7
OsmAnd/res/anim/slide_out_right.xml
Normal file
7
OsmAnd/res/anim/slide_out_right.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<translate android:fromXDelta="0" android:toXDelta="100%p"
|
||||||
|
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||||
|
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
|
||||||
|
android:duration="@android:integer/config_mediumAnimTime" />
|
||||||
|
</set>
|
|
@ -12,8 +12,7 @@
|
||||||
android:id="@+id/main_view"
|
android:id="@+id/main_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:background="@drawable/bg_left_menu_dark">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/top_bar_layout"
|
android:id="@+id/top_bar_layout"
|
||||||
|
|
|
@ -30,17 +30,17 @@
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical|start"
|
||||||
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
|
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_divider_margin_start"
|
android:layout_marginRight="@dimen/bottom_sheet_divider_margin_start"
|
||||||
|
android:layout_marginEnd="@dimen/bottom_sheet_divider_margin_start"
|
||||||
|
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||||
android:textColor="?attr/active_color_basic"
|
android:textColor="?attr/active_color_basic"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="Some Title"
|
tools:text="Some Title" />
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_divider_margin_start"
|
|
||||||
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/compound_button"
|
android:id="@+id/compound_button"
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
android:id="@+id/show_all_title"
|
android:id="@+id/show_all_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical|start"
|
||||||
android:paddingTop="@dimen/list_header_padding"
|
android:paddingTop="@dimen/list_header_padding"
|
||||||
android:paddingBottom="@dimen/list_header_padding"
|
android:paddingBottom="@dimen/list_header_padding"
|
||||||
android:layout_marginStart="@dimen/route_info_list_text_padding"
|
android:layout_marginStart="@dimen/route_info_list_text_padding"
|
||||||
|
|
31
OsmAnd/res/layout/popup_menu_item.xml
Normal file
31
OsmAnd/res/layout/popup_menu_item.xml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:orientation="horizontal" android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="@dimen/bottom_sheet_list_item_height">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_half"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_half"
|
||||||
|
tools:src="@drawable/ic_action_info_dark"
|
||||||
|
android:tint="?attr/primary_icon_color"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:paddingTop="@dimen/content_padding_small"
|
||||||
|
android:paddingBottom="@dimen/content_padding_small"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="Title" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -11,6 +11,10 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="vessel_width_limit_description">Set vessel width to avoid narrow bridges</string>
|
||||||
|
<string name="vessel_height_limit_description">Set vessel height to avoid low bridges. Keep in mind, if the bridge is movable, we will use its height in the open state.</string>
|
||||||
|
<string name="vessel_height_warning">You can set vessel height to avoid low bridges. Keep in mind, if the bridge is movable, we will use its height in the open state.</string>
|
||||||
|
<string name="vessel_height_warning_link">Set vessel height</string>
|
||||||
<string name="clear_tiles_warning">Applying these changes will clear the cached data for this tile source</string>
|
<string name="clear_tiles_warning">Applying these changes will clear the cached data for this tile source</string>
|
||||||
<string name="add_online_source">Add online source</string>
|
<string name="add_online_source">Add online source</string>
|
||||||
<!-- string name="shared_string_all_time">All time</string -->
|
<!-- string name="shared_string_all_time">All time</string -->
|
||||||
|
|
|
@ -155,6 +155,7 @@
|
||||||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
|
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
|
||||||
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item>
|
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item>
|
||||||
<item name="left_menu_view_bg">@drawable/bg_left_menu_light</item>
|
<item name="left_menu_view_bg">@drawable/bg_left_menu_light</item>
|
||||||
|
<item name="right_menu_view_bg">@drawable/bg_right_menu_light</item>
|
||||||
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item>
|
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item>
|
||||||
<item name="dashboard_divider">@color/divider_color_light</item>
|
<item name="dashboard_divider">@color/divider_color_light</item>
|
||||||
<item name="divider_color">@color/divider_color</item>
|
<item name="divider_color">@color/divider_color</item>
|
||||||
|
|
|
@ -425,6 +425,17 @@ public class AndroidUtils {
|
||||||
: ctx.getResources().getColor(R.color.text_color_secondary_light));
|
: ctx.getResources().getColor(R.color.text_color_secondary_light));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getTextMaxWidth(float textSize, List<String> titles) {
|
||||||
|
int width = 0;
|
||||||
|
for (String title : titles) {
|
||||||
|
int titleWidth = getTextWidth(textSize, title);
|
||||||
|
if (titleWidth > width) {
|
||||||
|
width = titleWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
public static int getTextWidth(float textSize, String text) {
|
public static int getTextWidth(float textSize, String text) {
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setTextSize(textSize);
|
paint.setTextSize(textSize);
|
||||||
|
|
80
OsmAnd/src/net/osmand/plus/SimplePopUpMenuItemAdapter.java
Normal file
80
OsmAnd/src/net/osmand/plus/SimplePopUpMenuItemAdapter.java
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
package net.osmand.plus;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import static net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SimplePopUpMenuItemAdapter
|
||||||
|
extends ArrayAdapter<SimplePopUpMenuItem> {
|
||||||
|
|
||||||
|
private List<SimplePopUpMenuItem> items;
|
||||||
|
|
||||||
|
public SimplePopUpMenuItemAdapter(@NonNull Context context, int resource,
|
||||||
|
List<SimplePopUpMenuItem> items) {
|
||||||
|
super(context, resource);
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = inflater.inflate(R.layout.popup_menu_item, parent, false);
|
||||||
|
}
|
||||||
|
SimplePopUpMenuItem item = getItem(position);
|
||||||
|
if (item != null) {
|
||||||
|
TextView tvTitle = convertView.findViewById(R.id.title);
|
||||||
|
tvTitle.setText(item.title);
|
||||||
|
ImageView ivIcon = convertView.findViewById(R.id.icon);
|
||||||
|
Drawable icon = item.icon;
|
||||||
|
if (icon != null) {
|
||||||
|
ivIcon.setImageDrawable(icon);
|
||||||
|
} else {
|
||||||
|
ivIcon.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public SimplePopUpMenuItem getItem(int position) {
|
||||||
|
return items.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SimplePopUpMenuItem {
|
||||||
|
private CharSequence title;
|
||||||
|
private Drawable icon;
|
||||||
|
|
||||||
|
public SimplePopUpMenuItem(CharSequence title, Drawable icon) {
|
||||||
|
this.title = title;
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewParent;
|
import android.view.ViewParent;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -31,6 +32,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.appcompat.view.ContextThemeWrapper;
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
|
import androidx.appcompat.widget.ListPopupWindow;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
|
@ -53,8 +55,13 @@ import net.osmand.plus.widgets.TextViewEx;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||||
|
|
||||||
|
import static net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem;
|
||||||
|
|
||||||
public class UiUtilities {
|
public class UiUtilities {
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(UiUtilities.class);
|
private static final Log LOG = PlatformUtil.getLog(UiUtilities.class);
|
||||||
|
@ -680,4 +687,39 @@ public class UiUtilities {
|
||||||
return spannable;
|
return spannable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ListPopupWindow createListPopupWindow(Context themedCtx,
|
||||||
|
View v, int minWidth,
|
||||||
|
List<SimplePopUpMenuItem> items,
|
||||||
|
final AdapterView.OnItemClickListener listener) {
|
||||||
|
int contentPadding = themedCtx.getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||||
|
int contentPaddingHalf = themedCtx.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
||||||
|
int defaultListTextSize = themedCtx.getResources().getDimensionPixelSize(R.dimen.default_list_text_size);
|
||||||
|
|
||||||
|
List<String> titles = new ArrayList<>();
|
||||||
|
for (SimplePopUpMenuItem item : items) {
|
||||||
|
titles.add(String.valueOf(item.getTitle()));
|
||||||
|
}
|
||||||
|
float itemWidth = AndroidUtils.getTextMaxWidth(defaultListTextSize, titles) + contentPadding;
|
||||||
|
|
||||||
|
SimplePopUpMenuItemAdapter adapter =
|
||||||
|
new SimplePopUpMenuItemAdapter(themedCtx, R.layout.popup_menu_item, items);
|
||||||
|
final ListPopupWindow listPopupWindow = new ListPopupWindow(themedCtx);
|
||||||
|
listPopupWindow.setAnchorView(v);
|
||||||
|
listPopupWindow.setContentWidth((int) (Math.max(itemWidth, minWidth)));
|
||||||
|
listPopupWindow.setDropDownGravity(Gravity.END | Gravity.TOP);
|
||||||
|
listPopupWindow.setVerticalOffset(-v.getHeight() + contentPaddingHalf);
|
||||||
|
listPopupWindow.setModal(true);
|
||||||
|
listPopupWindow.setAdapter(adapter);
|
||||||
|
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onItemClick(parent, view, position, id);
|
||||||
|
}
|
||||||
|
listPopupWindow.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return listPopupWindow;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.activities;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -197,8 +198,12 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
||||||
.create();
|
.create();
|
||||||
items.add(markersGroupItem);
|
items.add(markersGroupItem);
|
||||||
|
|
||||||
|
Drawable shareIcon = getContentIcon(R.drawable.ic_action_gshare_dark);
|
||||||
|
if (shareIcon != null) {
|
||||||
|
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||||
|
}
|
||||||
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getContentIcon(R.drawable.ic_action_gshare_dark))
|
.setIcon(shareIcon)
|
||||||
.setTitle(getString(R.string.shared_string_share))
|
.setTitle(getString(R.string.shared_string_share))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
|
@ -454,7 +454,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
|
|
||||||
if (!MenuItemCompat.isActionViewExpanded(mi)) {
|
if (!MenuItemCompat.isActionViewExpanded(mi)) {
|
||||||
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS, true);
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class AudioVideoNoteMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
rightTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateData();
|
updateData();
|
||||||
|
@ -164,7 +164,7 @@ public class AudioVideoNoteMenuController extends MenuController {
|
||||||
if (!mRecording.isPhoto()) {
|
if (!mRecording.isPhoto()) {
|
||||||
if (mPlugin.isPlaying(mRecording)) {
|
if (mPlugin.isPlaying(mRecording)) {
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_control_stop);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_control_stop);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_rec_stop;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_rec_stop;
|
||||||
int pos = mPlugin.getPlayingPosition();
|
int pos = mPlugin.getPlayingPosition();
|
||||||
String durationStr;
|
String durationStr;
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
|
@ -177,14 +177,14 @@ public class AudioVideoNoteMenuController extends MenuController {
|
||||||
rightTitleButtonController.visible = false;
|
rightTitleButtonController.visible = false;
|
||||||
} else {
|
} else {
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.recording_context_menu_play);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.recording_context_menu_play);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_play_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_play_dark;
|
||||||
String durationStr = mRecording.getPlainDuration(accessibilityEnabled);
|
String durationStr = mRecording.getPlainDuration(accessibilityEnabled);
|
||||||
leftTitleButtonController.needRightText = true;
|
leftTitleButtonController.needRightText = true;
|
||||||
leftTitleButtonController.rightTextCaption = "— " + durationStr;
|
leftTitleButtonController.rightTextCaption = "— " + durationStr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.recording_context_menu_show);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.recording_context_menu_show);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_view;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package net.osmand.plus.audionotes;
|
package net.osmand.plus.audionotes;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
@ -49,8 +51,12 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
||||||
.create();
|
.create();
|
||||||
items.add(playItem);
|
items.add(playItem);
|
||||||
|
|
||||||
|
Drawable shareIcon = getContentIcon(R.drawable.ic_action_gshare_dark);
|
||||||
|
if (shareIcon != null) {
|
||||||
|
AndroidUtils.getDrawableForDirection(requireContext(), shareIcon);
|
||||||
|
}
|
||||||
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getContentIcon(R.drawable.ic_action_gshare_dark))
|
.setIcon(shareIcon)
|
||||||
.setTitle(getString(R.string.shared_string_share))
|
.setTitle(getString(R.string.shared_string_share))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.audionotes;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -21,10 +22,12 @@ import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.view.ActionMode;
|
import androidx.appcompat.view.ActionMode;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
@ -33,6 +36,7 @@ import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.NotesSortByMode;
|
import net.osmand.plus.settings.backend.OsmandSettings.NotesSortByMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -163,14 +167,18 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||||
menu.clear();
|
FragmentActivity activity = getActivity();
|
||||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
if (activity == null) {
|
||||||
menu = ((ActionBarProgressActivity) getActivity()).getClearToolbar(true).getMenu();
|
return;
|
||||||
} else {
|
|
||||||
((ActionBarProgressActivity) getActivity()).getClearToolbar(false);
|
|
||||||
}
|
}
|
||||||
((ActionBarProgressActivity) getActivity()).updateListViewFooter(footerView);
|
menu.clear();
|
||||||
|
if (AndroidUiHelper.isOrientationPortrait(activity)) {
|
||||||
|
menu = ((ActionBarProgressActivity) activity).getClearToolbar(true).getMenu();
|
||||||
|
} else {
|
||||||
|
((ActionBarProgressActivity) activity).getClearToolbar(false);
|
||||||
|
}
|
||||||
|
((ActionBarProgressActivity) activity).updateListViewFooter(footerView);
|
||||||
|
|
||||||
MenuItem item = menu.add(R.string.shared_string_sort).setIcon(R.drawable.ic_action_list_sort);
|
MenuItem item = menu.add(R.string.shared_string_sort).setIcon(R.drawable.ic_action_list_sort);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@ -182,7 +190,9 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme
|
||||||
});
|
});
|
||||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
|
||||||
item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark);
|
Drawable shareIcon = AndroidUtils.getDrawableForDirection(activity,
|
||||||
|
getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark));
|
||||||
|
item = menu.add(R.string.shared_string_share).setIcon(shareIcon);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
@ -377,13 +387,16 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
|
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
|
||||||
LOG.debug("onCreateActionMode");
|
LOG.debug("onCreateActionMode");
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
if (type == MODE_SHARE) {
|
if (type == MODE_SHARE) {
|
||||||
listAdapter.insert(SHARE_LOCATION_FILE, 0);
|
listAdapter.insert(SHARE_LOCATION_FILE, 0);
|
||||||
}
|
}
|
||||||
switchSelectionMode(true);
|
switchSelectionMode(true);
|
||||||
int titleRes = type == MODE_DELETE ? R.string.shared_string_delete_all : R.string.shared_string_share;
|
int titleRes = type == MODE_DELETE ? R.string.shared_string_delete_all : R.string.shared_string_share;
|
||||||
int iconRes = type == MODE_DELETE ? R.drawable.ic_action_delete_dark : R.drawable.ic_action_gshare_dark;
|
int iconRes = type == MODE_DELETE ? R.drawable.ic_action_delete_dark : R.drawable.ic_action_gshare_dark;
|
||||||
MenuItem item = menu.add(titleRes).setIcon(iconRes);
|
Drawable icon = AndroidUtils.getDrawableForDirection(app,
|
||||||
|
app.getUIUtilities().getIcon(iconRes));
|
||||||
|
MenuItem item = menu.add(titleRes).setIcon(icon);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.ExpandableListView.OnChildClickListener;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.view.MenuItemCompat;
|
import androidx.core.view.MenuItemCompat;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
|
@ -83,10 +84,20 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType) {
|
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType) {
|
||||||
Drawable d = iconId == 0 ? null : requireMyApplication().getUIUtilities().getIcon(iconId,
|
return createMenuItem(m, id, titleRes, iconId, menuItemType, false);
|
||||||
isLightActionBar() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
}
|
||||||
|
|
||||||
|
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType,
|
||||||
|
boolean flipIconForRtl) {
|
||||||
|
OsmandApplication app = requireMyApplication();
|
||||||
|
Drawable d = iconId == 0 ? null : app.getUIUtilities().getIcon(iconId, isLightActionBar() ?
|
||||||
|
R.color.active_buttons_and_links_text_light :
|
||||||
|
R.color.active_buttons_and_links_text_dark);
|
||||||
MenuItem menuItem = m.add(0, id, 0, titleRes);
|
MenuItem menuItem = m.add(0, id, 0, titleRes);
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
|
if (flipIconForRtl) {
|
||||||
|
d = AndroidUtils.getDrawableForDirection(app, d);
|
||||||
|
}
|
||||||
menuItem.setIcon(d);
|
menuItem.setIcon(d);
|
||||||
}
|
}
|
||||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.osmand.plus.development;
|
package net.osmand.plus.development;
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -15,6 +16,7 @@ import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -94,8 +96,10 @@ public class LogcatActivity extends ActionBarProgressActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark);
|
||||||
MenuItem share = menu.add(0, SHARE_ID, 0, R.string.shared_string_export);
|
MenuItem share = menu.add(0, SHARE_ID, 0, R.string.shared_string_export);
|
||||||
share.setIcon(R.drawable.ic_action_gshare_dark);
|
share.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon));
|
||||||
share.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
share.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -616,7 +616,8 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IndexItem worldMap = getDownloadThread().getIndexes().getWorldBaseMapItem();
|
IndexItem worldMap = getDownloadThread().getIndexes().getWorldBaseMapItem();
|
||||||
if (!SUGGESTED_TO_DOWNLOAD_BASEMAP && worldMap != null && (!worldMap.isDownloaded() || worldMap.isOutdated()) &&
|
// (!worldMap.isDownloaded() || worldMap.isOutdated()) - now suggest to download if downloaded
|
||||||
|
if (!SUGGESTED_TO_DOWNLOAD_BASEMAP && worldMap != null && worldMap.isDownloaded() && worldMap.isOutdated() &&
|
||||||
!getDownloadThread().isDownloading(worldMap)) {
|
!getDownloadThread().isDownloading(worldMap)) {
|
||||||
SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
|
SUGGESTED_TO_DOWNLOAD_BASEMAP = true;
|
||||||
AskMapDownloadFragment fragment = new AskMapDownloadFragment();
|
AskMapDownloadFragment fragment = new AskMapDownloadFragment();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -67,7 +68,8 @@ public abstract class BaseMenuController {
|
||||||
|
|
||||||
public int getSlideInAnimation() {
|
public int getSlideInAnimation() {
|
||||||
if (isLandscapeLayout()) {
|
if (isLandscapeLayout()) {
|
||||||
return R.anim.slide_in_left;
|
return AndroidUtils.isLayoutRtl(getMapActivity())
|
||||||
|
? R.anim.slide_in_right : R.anim.slide_in_left;
|
||||||
} else {
|
} else {
|
||||||
return R.anim.slide_in_bottom;
|
return R.anim.slide_in_bottom;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +77,8 @@ public abstract class BaseMenuController {
|
||||||
|
|
||||||
public int getSlideOutAnimation() {
|
public int getSlideOutAnimation() {
|
||||||
if (isLandscapeLayout()) {
|
if (isLandscapeLayout()) {
|
||||||
return R.anim.slide_out_left;
|
return AndroidUtils.isLayoutRtl(getMapActivity())
|
||||||
|
? R.anim.slide_out_right : R.anim.slide_out_left;
|
||||||
} else {
|
} else {
|
||||||
return R.anim.slide_out_bottom;
|
return R.anim.slide_out_bottom;
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
}
|
}
|
||||||
Drawable drawable = getIcon(iconResId, bottomButtonsColor);
|
Drawable drawable = getIcon(iconResId, bottomButtonsColor);
|
||||||
directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor));
|
directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor));
|
||||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(directionsButton, null, null, drawable, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
directionsButton, null, null, drawable, null);
|
||||||
int contentPaddingHalf = (int) getResources().getDimension(R.dimen.content_padding_half);
|
int contentPaddingHalf = (int) getResources().getDimension(R.dimen.content_padding_half);
|
||||||
directionsButton.setCompoundDrawablePadding(contentPaddingHalf);
|
directionsButton.setCompoundDrawablePadding(contentPaddingHalf);
|
||||||
directionsButton.setOnClickListener(new View.OnClickListener() {
|
directionsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -1147,11 +1148,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
setupButton(leftTitleButtonView, leftTitleButtonController.enabled, title);
|
setupButton(leftTitleButtonView, leftTitleButtonController.enabled, title);
|
||||||
if (leftTitleButtonController.visible) {
|
if (leftTitleButtonController.visible) {
|
||||||
leftTitleButtonView.setVisibility(View.VISIBLE);
|
leftTitleButtonView.setVisibility(View.VISIBLE);
|
||||||
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
Drawable startIcon = leftTitleButtonController.getStartIcon();
|
||||||
Drawable rightIcon = leftTitleButtonController.getRightIcon();
|
Drawable endIcon = leftTitleButtonController.getEndIcon();
|
||||||
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
leftTitleButton, startIcon, null, endIcon, null);
|
||||||
leftTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
leftTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||||
((LinearLayout) leftTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
((LinearLayout) leftTitleButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||||
} else {
|
} else {
|
||||||
leftTitleButtonView.setVisibility(View.INVISIBLE);
|
leftTitleButtonView.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -1166,11 +1168,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
setupButton(rightTitleButtonView, rightTitleButtonController.enabled, rightTitleButtonController.caption);
|
setupButton(rightTitleButtonView, rightTitleButtonController.enabled, rightTitleButtonController.caption);
|
||||||
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
Drawable startIcon = rightTitleButtonController.getStartIcon();
|
||||||
Drawable rightIcon = rightTitleButtonController.getRightIcon();
|
Drawable endIcon = rightTitleButtonController.getEndIcon();
|
||||||
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
rightTitleButton, startIcon, null, endIcon, null);
|
||||||
rightTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
rightTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||||
((LinearLayout) rightTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
((LinearLayout) rightTitleButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||||
} else {
|
} else {
|
||||||
rightTitleButtonView.setVisibility(View.INVISIBLE);
|
rightTitleButtonView.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -1182,11 +1185,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
setupButton(bottomTitleButtonView, bottomTitleButtonController.enabled, bottomTitleButtonController.caption);
|
setupButton(bottomTitleButtonView, bottomTitleButtonController.enabled, bottomTitleButtonController.caption);
|
||||||
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
|
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
|
Drawable startIcon = bottomTitleButtonController.getStartIcon();
|
||||||
Drawable rightIcon = bottomTitleButtonController.getRightIcon();
|
Drawable endIcon = bottomTitleButtonController.getEndIcon();
|
||||||
bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
bottomTitleButton, startIcon, null, endIcon, null);
|
||||||
bottomTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
bottomTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||||
((LinearLayout) bottomTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
((LinearLayout) bottomTitleButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||||
} else {
|
} else {
|
||||||
bottomTitleButtonView.setVisibility(View.GONE);
|
bottomTitleButtonView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -1206,11 +1210,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
setupButton(leftDownloadButtonView, leftDownloadButtonController.enabled, leftDownloadButtonController.caption);
|
setupButton(leftDownloadButtonView, leftDownloadButtonController.enabled, leftDownloadButtonController.caption);
|
||||||
leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
|
Drawable startIcon = leftDownloadButtonController.getStartIcon();
|
||||||
Drawable rightIcon = leftDownloadButtonController.getRightIcon();
|
Drawable endIcon = leftDownloadButtonController.getEndIcon();
|
||||||
leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
leftDownloadButton, startIcon, null, endIcon, null);
|
||||||
leftDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
leftDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||||
((LinearLayout) leftDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
((LinearLayout) leftDownloadButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||||
} else {
|
} else {
|
||||||
leftDownloadButtonView.setVisibility(View.INVISIBLE);
|
leftDownloadButtonView.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -1222,11 +1227,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
setupButton(rightDownloadButtonView, rightDownloadButtonController.enabled, rightDownloadButtonController.caption);
|
setupButton(rightDownloadButtonView, rightDownloadButtonController.enabled, rightDownloadButtonController.caption);
|
||||||
rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
|
Drawable startIcon = rightDownloadButtonController.getStartIcon();
|
||||||
Drawable rightIcon = rightDownloadButtonController.getRightIcon();
|
Drawable endIcon = rightDownloadButtonController.getEndIcon();
|
||||||
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
rightDownloadButton, startIcon, null, endIcon, null);
|
||||||
rightDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
rightDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||||
((LinearLayout) rightDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
((LinearLayout) rightDownloadButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||||
} else {
|
} else {
|
||||||
rightDownloadButtonView.setVisibility(View.INVISIBLE);
|
rightDownloadButtonView.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -1292,11 +1298,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
setupButton(buttonView, buttonController.enabled, buttonController.caption);
|
setupButton(buttonView, buttonController.enabled, buttonController.caption);
|
||||||
buttonView.setVisibility(buttonController.visible ? View.VISIBLE : View.INVISIBLE);
|
buttonView.setVisibility(buttonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|
||||||
Drawable leftIcon = buttonController.getLeftIcon();
|
Drawable startIcon = buttonController.getStartIcon();
|
||||||
Drawable rightIcon = buttonController.getRightIcon();
|
Drawable endIcon = buttonController.getEndIcon();
|
||||||
buttonText.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
buttonText, startIcon, null, endIcon, null);
|
||||||
buttonText.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
buttonText.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||||
((LinearLayout) buttonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
((LinearLayout) buttonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||||
buttonView.setOnClickListener(new View.OnClickListener() {
|
buttonView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1805,7 +1812,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
if (!Algorithms.isEmpty(typeStr)) {
|
if (!Algorithms.isEmpty(typeStr)) {
|
||||||
line2Str.append(typeStr);
|
line2Str.append(typeStr);
|
||||||
Drawable icon = menu.getTypeIcon();
|
Drawable icon = menu.getTypeIcon();
|
||||||
line2.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
line2, icon, null, null, null);
|
||||||
line2.setCompoundDrawablePadding(dpToPx(5f));
|
line2.setCompoundDrawablePadding(dpToPx(5f));
|
||||||
}
|
}
|
||||||
if (!Algorithms.isEmpty(streetStr) && !menu.displayStreetNameInTitle()) {
|
if (!Algorithms.isEmpty(streetStr) && !menu.displayStreetNameInTitle()) {
|
||||||
|
@ -1830,7 +1838,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
line3.setVisibility(View.VISIBLE);
|
line3.setVisibility(View.VISIBLE);
|
||||||
line3.setText(subtypeStr);
|
line3.setText(subtypeStr);
|
||||||
Drawable icon = menu.getSubtypeIcon();
|
Drawable icon = menu.getSubtypeIcon();
|
||||||
line3.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
line3, icon, null, null, null);
|
||||||
line3.setCompoundDrawablePadding(dpToPx(5f));
|
line3.setCompoundDrawablePadding(dpToPx(5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -659,7 +659,7 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
||||||
}
|
}
|
||||||
|
|
||||||
leftDownloadButtonController.visible = !downloaded;
|
leftDownloadButtonController.visible = !downloaded;
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||||
|
|
||||||
boolean internetConnectionAvailable =
|
boolean internetConnectionAvailable =
|
||||||
mapActivity.getMyApplication().getSettings().isInternetConnectionAvailable();
|
mapActivity.getMyApplication().getSettings().isInternetConnectionAvailable();
|
||||||
|
@ -712,33 +712,33 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
||||||
|
|
||||||
public abstract class TitleButtonController {
|
public abstract class TitleButtonController {
|
||||||
public String caption = "";
|
public String caption = "";
|
||||||
public int leftIconId = 0;
|
public int startIconId = 0;
|
||||||
public int rightIconId = 0;
|
public int endIconId = 0;
|
||||||
public boolean needRightText = false;
|
public boolean needRightText = false;
|
||||||
public String rightTextCaption = "";
|
public String rightTextCaption = "";
|
||||||
public boolean visible = true;
|
public boolean visible = true;
|
||||||
public boolean tintIcon = true;
|
public boolean tintIcon = true;
|
||||||
public Drawable leftIcon;
|
public Drawable startIcon;
|
||||||
public Drawable rightIcon;
|
public Drawable endIcon;
|
||||||
public boolean enabled = true;
|
public boolean enabled = true;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getStartIcon() {
|
||||||
return getIconDrawable(true);
|
return getIconDrawable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Drawable getRightIcon() {
|
public Drawable getEndIcon() {
|
||||||
return getIconDrawable(false);
|
return getIconDrawable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Drawable getIconDrawable(boolean left) {
|
private Drawable getIconDrawable(boolean start) {
|
||||||
Drawable drawable = left ? leftIcon : rightIcon;
|
Drawable drawable = start ? startIcon : endIcon;
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
int resId = left ? leftIconId : rightIconId;
|
int resId = start ? startIconId : endIconId;
|
||||||
if (resId != 0) {
|
if (resId != 0) {
|
||||||
if (tintIcon) {
|
if (tintIcon) {
|
||||||
return enabled ? getNormalIcon(resId) : getDisabledIcon(resId);
|
return enabled ? getNormalIcon(resId) : getDisabledIcon(resId);
|
||||||
|
@ -751,11 +751,11 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
||||||
|
|
||||||
public void clearIcon(boolean left) {
|
public void clearIcon(boolean left) {
|
||||||
if (left) {
|
if (left) {
|
||||||
leftIcon = null;
|
startIcon = null;
|
||||||
leftIconId = 0;
|
startIconId = 0;
|
||||||
} else {
|
} else {
|
||||||
rightIcon = null;
|
endIcon = null;
|
||||||
rightIconId = 0;
|
endIconId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
||||||
};
|
};
|
||||||
leftDownloadButtonController.caption =
|
leftDownloadButtonController.caption =
|
||||||
downloadRegion != null ? downloadRegion.getLocaleName() : mapActivity.getString(R.string.shared_string_download);
|
downloadRegion != null ? downloadRegion.getLocaleName() : mapActivity.getString(R.string.shared_string_download);
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||||
|
|
||||||
titleProgressController = new TitleProgressController() {
|
titleProgressController = new TitleProgressController() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -278,7 +278,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
|
light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
|
||||||
Drawable pressed = app.getUIUtilities().getIcon(R.drawable.ic_action_read_text,
|
Drawable pressed = app.getUIUtilities().getIcon(R.drawable.ic_action_read_text,
|
||||||
light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p);
|
light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p);
|
||||||
button.setCompoundDrawablesWithIntrinsicBounds(Build.VERSION.SDK_INT >= 21
|
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(button, Build.VERSION.SDK_INT >= 21
|
||||||
? AndroidUtils.createPressedStateListDrawable(normal, pressed) : normal, null, null, null);
|
? AndroidUtils.createPressedStateListDrawable(normal, pressed) : normal, null, null, null);
|
||||||
button.setCompoundDrawablePadding(dpToPx(8f));
|
button.setCompoundDrawablePadding(dpToPx(8f));
|
||||||
llText.addView(button);
|
llText.addView(button);
|
||||||
|
|
|
@ -201,8 +201,8 @@ public class AMapPointMenuController extends MenuController {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
titleButtonController.caption = contextMenuButton.getLeftTextCaption();
|
titleButtonController.caption = contextMenuButton.getLeftTextCaption();
|
||||||
titleButtonController.rightTextCaption = contextMenuButton.getRightTextCaption();
|
titleButtonController.rightTextCaption = contextMenuButton.getRightTextCaption();
|
||||||
titleButtonController.leftIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getLeftIconName());
|
titleButtonController.startIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getLeftIconName());
|
||||||
titleButtonController.rightIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getRightIconName());
|
titleButtonController.endIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getRightIconName());
|
||||||
titleButtonController.enabled = contextMenuButton.isEnabled();
|
titleButtonController.enabled = contextMenuButton.isEnabled();
|
||||||
titleButtonController.tintIcon = contextMenuButton.isTintIcon();
|
titleButtonController.tintIcon = contextMenuButton.isTintIcon();
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class AmenityMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_read_text;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_read_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
openingHoursInfo = OpeningHoursParser.getInfo(amenity.getOpeningHours());
|
openingHoursInfo = OpeningHoursParser.getInfo(amenity.getOpeningHours());
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -41,7 +40,7 @@ public class ImpassibleRoadsMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_remove);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_remove);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftDownloadButtonController.caption = mapActivity.getString(R.string.shared_string_download);
|
leftDownloadButtonController.caption = mapActivity.getString(R.string.shared_string_download);
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||||
|
|
||||||
rightDownloadButtonController = new TitleButtonController() {
|
rightDownloadButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -154,7 +154,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rightDownloadButtonController.caption = mapActivity.getString(R.string.download_select_map_types);
|
rightDownloadButtonController.caption = mapActivity.getString(R.string.download_select_map_types);
|
||||||
rightDownloadButtonController.leftIconId = R.drawable.ic_plugin_srtm;
|
rightDownloadButtonController.startIconId = R.drawable.ic_plugin_srtm;
|
||||||
|
|
||||||
bottomTitleButtonController = new TitleButtonController() {
|
bottomTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,7 +171,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
bottomTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
bottomTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||||
bottomTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
bottomTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||||
|
|
||||||
titleProgressController = new TitleProgressController() {
|
titleProgressController = new TitleProgressController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -396,7 +396,7 @@ public class MapDataMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
leftDownloadButtonController.visible = true;
|
leftDownloadButtonController.visible = true;
|
||||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||||
if (backuped) {
|
if (backuped) {
|
||||||
leftDownloadButtonController.caption = mapActivity.getString(R.string.local_index_mi_restore);
|
leftDownloadButtonController.caption = mapActivity.getString(R.string.local_index_mi_restore);
|
||||||
} else if (indexItem != null) {
|
} else if (indexItem != null) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MapMarkerMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(mapMarker.history ? R.string.shared_string_restore : R.string.mark_passed);
|
leftTitleButtonController.caption = mapActivity.getString(mapMarker.history ? R.string.shared_string_restore : R.string.mark_passed);
|
||||||
leftTitleButtonController.leftIcon = createPassedIcon(getPassedIconBgNormalColorId());
|
leftTitleButtonController.startIcon = createPassedIcon(getPassedIconBgNormalColorId());
|
||||||
|
|
||||||
if (!mapMarker.history) {
|
if (!mapMarker.history) {
|
||||||
rightTitleButtonController = new TitleButtonController() {
|
rightTitleButtonController = new TitleButtonController() {
|
||||||
|
@ -69,7 +69,7 @@ public class MapMarkerMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rightTitleButtonController.caption = mapActivity.getString(R.string.make_active);
|
rightTitleButtonController.caption = mapActivity.getString(R.string.make_active);
|
||||||
rightTitleButtonController.leftIcon = createShowOnTopbarIcon(getDeviceTopNormalColorId());
|
rightTitleButtonController.startIcon = createShowOnTopbarIcon(getDeviceTopNormalColorId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class PointDescriptionMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.avoid_road);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.avoid_road);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_road_works_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_road_works_dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,10 @@ public class TargetPointMenuController extends MenuController {
|
||||||
};
|
};
|
||||||
if (nav && intermediatePointsCount == 0 && !targetPoint.start) {
|
if (nav && intermediatePointsCount == 0 && !targetPoint.start) {
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.cancel_navigation);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.cancel_navigation);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_remove_dark;
|
||||||
} else {
|
} else {
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_remove);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_remove);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,11 @@ public class TransportRouteController extends MenuController {
|
||||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_next);
|
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_next);
|
||||||
|
|
||||||
if (AndroidUtils.isLayoutRtl(mapActivity)) {
|
if (AndroidUtils.isLayoutRtl(mapActivity)) {
|
||||||
leftTitleButtonController.rightIconId = R.drawable.ic_arrow_forward;
|
leftTitleButtonController.endIconId = R.drawable.ic_arrow_forward;
|
||||||
rightTitleButtonController.leftIconId = R.drawable.ic_arrow_back;
|
rightTitleButtonController.startIconId = R.drawable.ic_arrow_back;
|
||||||
} else {
|
} else {
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_arrow_back;
|
leftTitleButtonController.startIconId = R.drawable.ic_arrow_back;
|
||||||
rightTitleButtonController.rightIconId = R.drawable.ic_arrow_forward;
|
rightTitleButtonController.endIconId = R.drawable.ic_arrow_forward;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,14 @@ package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
|
||||||
|
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
import com.github.mikephil.charting.data.Entry;
|
import com.github.mikephil.charting.data.Entry;
|
||||||
|
@ -35,7 +34,6 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||||
|
@ -49,6 +47,8 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem;
|
||||||
|
|
||||||
public class TrackDetailsMenu {
|
public class TrackDetailsMenu {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -172,6 +172,8 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
int navigationIconResId = AndroidUtils.getNavigationIconResId(mapActivity);
|
||||||
|
toolbarController.setBackBtnIconIds(navigationIconResId, navigationIconResId);
|
||||||
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
|
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -489,6 +491,9 @@ public class TrackDetailsMenu {
|
||||||
if (mapActivity == null || gpxItem == null) {
|
if (mapActivity == null || gpxItem == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
final UiUtilities ic = app.getUIUtilities();
|
||||||
|
final boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
GPXTrackAnalysis analysis = gpxItem.analysis;
|
GPXTrackAnalysis analysis = gpxItem.analysis;
|
||||||
if (analysis == null || gpxItem.chartTypes == null) {
|
if (analysis == null || gpxItem.chartTypes == null) {
|
||||||
parentView.setVisibility(View.GONE);
|
parentView.setVisibility(View.GONE);
|
||||||
|
@ -575,9 +580,6 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
|
||||||
final UiUtilities ic = app.getUIUtilities();
|
|
||||||
|
|
||||||
GpxUiHelper.setupGPXChart(app, chart, 4);
|
GpxUiHelper.setupGPXChart(app, chart, 4);
|
||||||
|
|
||||||
List<ILineDataSet> dataSets = new ArrayList<>();
|
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||||
|
@ -651,23 +653,22 @@ public class TrackDetailsMenu {
|
||||||
yAxis.setOnClickListener(new View.OnClickListener() {
|
yAxis.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
PopupMenu optionsMenu = new PopupMenu(v.getContext(), v);
|
Context themedContext = UiUtilities.getThemedContext(v.getContext(), nightMode);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
List<SimplePopUpMenuItem> items = new ArrayList<>();
|
||||||
for (final GPXDataSetType[] types : availableTypes) {
|
for (GPXDataSetType[] types : availableTypes) {
|
||||||
MenuItem menuItem = optionsMenu.getMenu()
|
items.add(new SimplePopUpMenuItem(
|
||||||
.add(GPXDataSetType.getName(app, types))
|
GPXDataSetType.getName(app, types),
|
||||||
.setIcon(GPXDataSetType.getImageDrawable(app, types));
|
GPXDataSetType.getImageDrawable(app, types)));
|
||||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
}
|
||||||
|
UiUtilities.createListPopupWindow(
|
||||||
|
themedContext, v, v.getWidth(), items, new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem mItem) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
GpxDisplayItem gpxItem = getGpxItem();
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
gpxItem.chartTypes = types;
|
gpxItem.chartTypes = availableTypes.get(position);
|
||||||
update();
|
update();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
}).show();
|
||||||
}
|
|
||||||
optionsMenu.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
yAxisArrow.setVisibility(View.VISIBLE);
|
yAxisArrow.setVisibility(View.VISIBLE);
|
||||||
|
@ -695,28 +696,25 @@ public class TrackDetailsMenu {
|
||||||
xAxis.setOnClickListener(new View.OnClickListener() {
|
xAxis.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final PopupMenu optionsMenu = new PopupMenu(v.getContext(), v);
|
Context themedContext = UiUtilities.getThemedContext(v.getContext(), nightMode);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
List<SimplePopUpMenuItem> items = new ArrayList<>();
|
||||||
for (final GPXDataSetAxisType type : GPXDataSetAxisType.values()) {
|
for (GPXDataSetAxisType type : GPXDataSetAxisType.values()) {
|
||||||
MenuItem menuItem = optionsMenu.getMenu()
|
items.add(new SimplePopUpMenuItem(
|
||||||
.add(type.getStringId()).setIcon(type.getImageDrawable(app));
|
app.getString(type.getStringId()), type.getImageDrawable(app)));
|
||||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
}
|
||||||
|
UiUtilities.createListPopupWindow(themedContext,
|
||||||
|
v, v.getWidth(), items, new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem mItem) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
GpxDisplayItem gpxItem = getGpxItem();
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
if (gpxItem != null) {
|
if (gpxItem != null) {
|
||||||
gpxItem.chartAxisType = type;
|
gpxItem.chartAxisType = GPXDataSetAxisType.values()[position];
|
||||||
gpxItem.chartHighlightPos = -1;
|
gpxItem.chartHighlightPos = -1;
|
||||||
gpxItem.chartMatrix = null;
|
gpxItem.chartMatrix = null;
|
||||||
update();
|
update();
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).show();
|
||||||
}
|
|
||||||
optionsMenu.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xAxisArrow.setVisibility(View.VISIBLE);
|
xAxisArrow.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
private TrackDetailsMenu menu;
|
private TrackDetailsMenu menu;
|
||||||
private View mainView;
|
private View mainView;
|
||||||
private boolean paused = true;
|
private boolean paused = true;
|
||||||
|
private boolean nightMode;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
|
@ -46,7 +47,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
MapActivity mapActivity = requireMapActivity();
|
MapActivity mapActivity = requireMapActivity();
|
||||||
menu = mapActivity.getTrackDetailsMenu();
|
menu = mapActivity.getTrackDetailsMenu();
|
||||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
ContextThemeWrapper context =
|
ContextThemeWrapper context =
|
||||||
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||||
View view = LayoutInflater.from(context).inflate(R.layout.track_details, container, false);
|
View view = LayoutInflater.from(context).inflate(R.layout.track_details, container, false);
|
||||||
|
@ -192,7 +193,6 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
if (ctx != null) {
|
if (ctx != null) {
|
||||||
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
||||||
boolean landscapeLayout = !portraitMode;
|
boolean landscapeLayout = !portraitMode;
|
||||||
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
|
||||||
if (!landscapeLayout) {
|
if (!landscapeLayout) {
|
||||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1492,8 +1492,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Drawable shareIcon = iconsCache.getThemedIcon((R.drawable.ic_action_gshare_dark));
|
||||||
item = optionsMenu.getMenu().add(R.string.shared_string_share)
|
item = optionsMenu.getMenu().add(R.string.shared_string_share)
|
||||||
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_gshare_dark));
|
.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon));
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
|
@ -393,7 +393,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
|
||||||
|
|
||||||
if (!mi.isActionViewExpanded()) {
|
if (!mi.isActionViewExpanded()) {
|
||||||
|
|
||||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER);
|
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER, true);
|
||||||
GPXFile gpxFile = getGpx();
|
GPXFile gpxFile = getGpx();
|
||||||
if (gpxFile != null && gpxFile.path != null) {
|
if (gpxFile != null && gpxFile.path != null) {
|
||||||
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -152,7 +153,9 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
||||||
GPXFile gpxFile = getGpx();
|
GPXFile gpxFile = getGpx();
|
||||||
if (gpxFile != null) {
|
if (gpxFile != null) {
|
||||||
if (gpxFile.path != null && !gpxFile.showCurrentTrack) {
|
if (gpxFile.path != null && !gpxFile.showCurrentTrack) {
|
||||||
MenuItem item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark)
|
Drawable shareIcon = app.getUIUtilities().getIcon((R.drawable.ic_action_gshare_dark));
|
||||||
|
MenuItem item = menu.add(R.string.shared_string_share)
|
||||||
|
.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon))
|
||||||
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class EditPOIMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_upload);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_upload);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_export;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_export;
|
||||||
|
|
||||||
rightTitleButtonController = new TitleButtonController() {
|
rightTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,7 +80,7 @@ public class EditPOIMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
rightTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||||
|
|
||||||
categoryDescr = getCategoryDescr();
|
categoryDescr = getCategoryDescr();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class OsmBugMenuController extends MenuController {
|
||||||
} else {
|
} else {
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.poi_dialog_reopen);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.poi_dialog_reopen);
|
||||||
}
|
}
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_note_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_note_dark;
|
||||||
|
|
||||||
rightTitleButtonController = new TitleButtonController() {
|
rightTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,7 +54,7 @@ public class OsmBugMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_close);
|
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_close);
|
||||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
rightTitleButtonController.startIconId = R.drawable.ic_action_remove_dark;
|
||||||
|
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -248,7 +249,9 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
||||||
});
|
});
|
||||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
|
||||||
item = menu.add(R.string.shared_string_export).setIcon(R.drawable.ic_action_gshare_dark);
|
Drawable shareIcon = getMyApplication().getUIUtilities().getIcon((R.drawable.ic_action_gshare_dark));
|
||||||
|
item = menu.add(R.string.shared_string_export)
|
||||||
|
.setIcon(AndroidUtils.getDrawableForDirection(getMyApplication(), shareIcon));
|
||||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ParkingPositionMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildParkingDescription(MapActivity mapActivity) {
|
private void buildParkingDescription(MapActivity mapActivity) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.view.ViewGroup;
|
||||||
import android.view.animation.DecelerateInterpolator;
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
|
@ -485,6 +486,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildMenuButtons(@NonNull View view) {
|
private void buildMenuButtons(@NonNull View view) {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
AppCompatImageView backButton = (AppCompatImageView) view.findViewById(R.id.back_button);
|
AppCompatImageView backButton = (AppCompatImageView) view.findViewById(R.id.back_button);
|
||||||
AppCompatImageButton backButtonFlow = (AppCompatImageButton) view.findViewById(R.id.back_button_flow);
|
AppCompatImageButton backButtonFlow = (AppCompatImageButton) view.findViewById(R.id.back_button_flow);
|
||||||
OnClickListener backOnClick = new OnClickListener() {
|
OnClickListener backOnClick = new OnClickListener() {
|
||||||
|
@ -525,8 +527,13 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
saveRoute.setOnClickListener(saveOnClick);
|
saveRoute.setOnClickListener(saveOnClick);
|
||||||
saveRouteFlow.setOnClickListener(saveOnClick);
|
saveRouteFlow.setOnClickListener(saveOnClick);
|
||||||
|
|
||||||
View shareRoute = view.findViewById(R.id.share_as_gpx);
|
ImageView shareRoute = (ImageView) view.findViewById(R.id.share_as_gpx);
|
||||||
View shareRouteFlow = view.findViewById(R.id.share_as_gpx_flow);
|
ImageView shareRouteFlow = (ImageView) view.findViewById(R.id.share_as_gpx_flow);
|
||||||
|
Drawable shareIcon = getIcon(R.drawable.ic_action_gshare_dark, nightMode ?
|
||||||
|
R.color.text_color_secondary_dark : R.color.text_color_secondary_light);
|
||||||
|
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||||
|
shareRoute.setImageDrawable(shareIcon);
|
||||||
|
shareRouteFlow.setImageDrawable(shareIcon);
|
||||||
OnClickListener shareOnClick = new OnClickListener() {
|
OnClickListener shareOnClick = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
import net.osmand.plus.routepreparationmenu.cards.NauticalBridgeHeightWarningCard;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
||||||
|
@ -633,6 +634,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
} else if (routeCalculationInProgress) {
|
} else if (routeCalculationInProgress) {
|
||||||
if (app.getRoutingHelper().isPublicTransportMode()) {
|
if (app.getRoutingHelper().isPublicTransportMode()) {
|
||||||
menuCards.add(new PublicTransportBetaWarningCard(mapActivity));
|
menuCards.add(new PublicTransportBetaWarningCard(mapActivity));
|
||||||
|
} else if (app.getRoutingHelper().isBoatMode()) {
|
||||||
|
menuCards.add(new NauticalBridgeHeightWarningCard(mapActivity));
|
||||||
} else if (app.getTargetPointsHelper().hasTooLongDistanceToNavigate()) {
|
} else if (app.getTargetPointsHelper().hasTooLongDistanceToNavigate()) {
|
||||||
menuCards.add(new LongDistanceWarningCard(mapActivity));
|
menuCards.add(new LongDistanceWarningCard(mapActivity));
|
||||||
}
|
}
|
||||||
|
@ -967,6 +970,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
RoutingHelper routingHelper = app.getRoutingHelper();
|
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||||
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
||||||
final RouteMenuAppModes mode = app.getRoutingOptionsHelper().getRouteMenuAppMode(applicationMode);
|
final RouteMenuAppModes mode = app.getRoutingOptionsHelper().getRouteMenuAppMode(applicationMode);
|
||||||
|
boolean isLayoutRTL = AndroidUtils.isLayoutRtl(app);
|
||||||
|
|
||||||
updateControlButtons(mapActivity, mainView);
|
updateControlButtons(mapActivity, mainView);
|
||||||
LinearLayout optionsButton = (LinearLayout) mainView.findViewById(R.id.map_options_route_button);
|
LinearLayout optionsButton = (LinearLayout) mainView.findViewById(R.id.map_options_route_button);
|
||||||
|
@ -984,7 +988,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
clickRouteParams();
|
clickRouteParams();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AndroidUtils.setBackground(app, optionsButton, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
AndroidUtils.setBackground(app, optionsButton, nightMode,
|
||||||
|
isLayoutRTL ? R.drawable.route_info_trans_gradient_left_light : R.drawable.route_info_trans_gradient_light,
|
||||||
|
isLayoutRTL ? R.drawable.route_info_trans_gradient_left_dark :R.drawable.route_info_trans_gradient_dark);
|
||||||
|
|
||||||
HorizontalScrollView scrollView = mainView.findViewById(R.id.route_options_scroll_container);
|
HorizontalScrollView scrollView = mainView.findViewById(R.id.route_options_scroll_container);
|
||||||
scrollView.setVerticalScrollBarEnabled(false);
|
scrollView.setVerticalScrollBarEnabled(false);
|
||||||
|
|
|
@ -511,8 +511,9 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
||||||
slideInAnim = R.anim.slide_in_bottom;
|
slideInAnim = R.anim.slide_in_bottom;
|
||||||
slideOutAnim = R.anim.slide_out_bottom;
|
slideOutAnim = R.anim.slide_out_bottom;
|
||||||
} else {
|
} else {
|
||||||
slideInAnim = R.anim.slide_in_left;
|
boolean isLayoutRtl = AndroidUtils.isLayoutRtl(mapActivity);
|
||||||
slideOutAnim = R.anim.slide_out_left;
|
slideInAnim = isLayoutRtl ? R.anim.slide_in_right : R.anim.slide_in_left;
|
||||||
|
slideOutAnim = isLayoutRtl ? R.anim.slide_out_right : R.anim.slide_out_left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
}
|
}
|
||||||
int expandType = args.getInt(EXPAND_TYPE_KEY, -1);
|
int expandType = args.getInt(EXPAND_TYPE_KEY, -1);
|
||||||
|
|
||||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
final View titleView = UiUtilities.getInflater(ctx, nightMode)
|
||||||
final View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.bottom_sheet_item_toolbar_title, null);
|
.inflate(R.layout.bottom_sheet_item_toolbar_title, null);
|
||||||
TextView textView = (TextView) titleView.findViewById(R.id.title);
|
TextView textView = (TextView) titleView.findViewById(R.id.title);
|
||||||
textView.setText(R.string.show_along_the_route);
|
textView.setText(R.string.show_along_the_route);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class MapMarkersCard extends BaseCard {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
View div = new View(ctx);
|
View div = new View(ctx);
|
||||||
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(ctx, 1f));
|
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(ctx, 1f));
|
||||||
p.setMargins(listTextPadding, 0, 0, 0);
|
AndroidUtils.setMargins(p, listTextPadding, 0, 0, 0);
|
||||||
div.setLayoutParams(p);
|
div.setLayoutParams(p);
|
||||||
AndroidUtils.setBackgroundColor(ctx, div, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
|
AndroidUtils.setBackgroundColor(ctx, div, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
|
||||||
div.setVisibility(View.VISIBLE);
|
div.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package net.osmand.plus.routepreparationmenu.cards;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||||
|
|
||||||
|
import static net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType.*;
|
||||||
|
|
||||||
|
public class NauticalBridgeHeightWarningCard extends WarningCard {
|
||||||
|
|
||||||
|
public NauticalBridgeHeightWarningCard(@NonNull MapActivity mapActivity) {
|
||||||
|
super(mapActivity);
|
||||||
|
imageId = R.drawable.ic_action_sail_boat_dark;
|
||||||
|
title = mapActivity.getString(R.string.vessel_height_warning);
|
||||||
|
linkText = mapActivity.getString(R.string.vessel_height_warning_link);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onLinkClicked() {
|
||||||
|
BaseSettingsFragment.showInstance(mapActivity, VEHICLE_PARAMETERS, mapActivity.getRoutingHelper().getAppMode());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,14 @@
|
||||||
package net.osmand.plus.routepreparationmenu.cards;
|
package net.osmand.plus.routepreparationmenu.cards;
|
||||||
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -59,6 +61,11 @@ public class PedestrianRouteCard extends BaseCard {
|
||||||
} else {
|
} else {
|
||||||
AndroidUtils.setBackground(app, buttonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
AndroidUtils.setBackground(app, buttonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||||
}
|
}
|
||||||
|
Drawable icPedestrian = app.getUIUtilities().getIcon(
|
||||||
|
R.drawable.ic_action_pedestrian_dark,
|
||||||
|
R.color.description_font_and_bottom_sheet_icons);
|
||||||
|
((ImageView) view.findViewById(R.id.image)).setImageDrawable(
|
||||||
|
AndroidUtils.getDrawableForDirection(app, icPedestrian));
|
||||||
view.findViewById(R.id.card_divider).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.card_divider).setVisibility(View.VISIBLE);
|
||||||
view.findViewById(R.id.top_divider).setVisibility(View.GONE);
|
view.findViewById(R.id.top_divider).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.view.ContextThemeWrapper;
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||||
|
@ -110,7 +111,7 @@ public class TracksCard extends BaseCard {
|
||||||
img.setVisibility(View.VISIBLE);
|
img.setVisibility(View.VISIBLE);
|
||||||
LinearLayout container = (LinearLayout) v.findViewById(R.id.container);
|
LinearLayout container = (LinearLayout) v.findViewById(R.id.container);
|
||||||
container.setMinimumHeight(minCardHeight);
|
container.setMinimumHeight(minCardHeight);
|
||||||
container.setPadding(listContentPadding, 0, 0, 0);
|
AndroidUtils.setPadding(container, listContentPadding, 0, 0, 0);
|
||||||
v.setOnClickListener(new View.OnClickListener() {
|
v.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
|
@ -1314,6 +1314,10 @@ public class RoutingHelper {
|
||||||
return mode.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT);
|
return mode.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBoatMode() {
|
||||||
|
return mode.isDerivedRoutingFrom(ApplicationMode.BOAT);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isOsmandRouting() {
|
public boolean isOsmandRouting() {
|
||||||
return mode.getRouteService() == RouteService.OSMAND;
|
return mode.getRouteService() == RouteService.OSMAND;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
private SearchUICore searchUICore;
|
private SearchUICore searchUICore;
|
||||||
private SearchResultListener defaultResultListener;
|
private SearchResultListener defaultResultListener;
|
||||||
private String searchQuery;
|
private String searchQuery;
|
||||||
|
private boolean nightMode;
|
||||||
|
|
||||||
private LatLon centerLatLon;
|
private LatLon centerLatLon;
|
||||||
private net.osmand.Location location = null;
|
private net.osmand.Location location = null;
|
||||||
|
@ -229,6 +230,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
app = getMyApplication();
|
app = getMyApplication();
|
||||||
|
nightMode = !app.getSettings().isLightContent();
|
||||||
navigationInfo = new NavigationInfo(app);
|
navigationInfo = new NavigationInfo(app);
|
||||||
accessibilityAssistant = new AccessibilityAssistant(getActivity());
|
accessibilityAssistant = new AccessibilityAssistant(getActivity());
|
||||||
boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||||
|
@ -483,7 +485,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
);
|
);
|
||||||
|
|
||||||
titleEdit = (TextView) view.findViewById(R.id.titleEdit);
|
titleEdit = (TextView) view.findViewById(R.id.titleEdit);
|
||||||
view.findViewById(R.id.shareButton).setOnClickListener(
|
Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark,
|
||||||
|
nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light);
|
||||||
|
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||||
|
ImageView shareButton = (ImageView) view.findViewById(R.id.shareButton);
|
||||||
|
shareButton.setImageDrawable(shareIcon);
|
||||||
|
shareButton.setOnClickListener(
|
||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1205,7 +1212,6 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
if (SearchUICore.isDebugMode()) {
|
if (SearchUICore.isDebugMode()) {
|
||||||
LOG.info("UI >> Start loading categories");
|
LOG.info("UI >> Start loading categories");
|
||||||
}
|
}
|
||||||
final boolean nightMode = !app.getSettings().isLightContent();
|
|
||||||
SearchResultCollection res = searchUICore.shallowSearch(SearchAmenityTypesAPI.class, "", null);
|
SearchResultCollection res = searchUICore.shallowSearch(SearchAmenityTypesAPI.class, "", null);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
List<QuickSearchListItem> rows = new ArrayList<>();
|
List<QuickSearchListItem> rows = new ArrayList<>();
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -50,11 +49,9 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet {
|
||||||
final SizePreference preference = (SizePreference) getPreference();
|
final SizePreference preference = (SizePreference) getPreference();
|
||||||
View mainView = UiUtilities.getMaterialInflater(app, nightMode)
|
View mainView = UiUtilities.getMaterialInflater(app, nightMode)
|
||||||
.inflate(R.layout.bottom_sheet_item_edit_with_recyclerview, null);
|
.inflate(R.layout.bottom_sheet_item_edit_with_recyclerview, null);
|
||||||
String key = preference.getKey();
|
|
||||||
TextView title = mainView.findViewById(R.id.title);
|
TextView title = mainView.findViewById(R.id.title);
|
||||||
title.setText(preference.getTitle().toString());
|
title.setText(preference.getTitle().toString());
|
||||||
String parameterName = key.substring(key.lastIndexOf("_") + 1);
|
VehicleSizeAssets vehicleSizeAssets = preference.getAssets();
|
||||||
VehicleSizeAssets vehicleSizeAssets = VehicleSizeAssets.getAssets(parameterName);
|
|
||||||
if (vehicleSizeAssets != null) {
|
if (vehicleSizeAssets != null) {
|
||||||
ImageView imageView = mainView.findViewById(R.id.image_view);
|
ImageView imageView = mainView.findViewById(R.id.image_view);
|
||||||
imageView.setImageDrawable(app.getUIUtilities()
|
imageView.setImageDrawable(app.getUIUtilities()
|
||||||
|
|
|
@ -1,26 +1,38 @@
|
||||||
package net.osmand.plus.settings.bottomsheets;
|
package net.osmand.plus.settings.bottomsheets;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.router.GeneralRouter;
|
|
||||||
|
import static net.osmand.router.GeneralRouter.*;
|
||||||
|
|
||||||
public enum VehicleSizeAssets {
|
public enum VehicleSizeAssets {
|
||||||
WIDTH(GeneralRouter.VEHICLE_WIDTH, R.drawable.img_help_width_limit_day, R.drawable.img_help_width_limit_night,
|
BOAT_HEIGHT(VEHICLE_HEIGHT, GeneralRouterProfile.BOAT, R.drawable.img_help_vessel_height_day,
|
||||||
|
R.drawable.img_help_vessel_height_night,
|
||||||
|
R.string.vessel_height_limit_description, R.string.shared_string_meters, R.string.m),
|
||||||
|
BOAT_WIDTH(VEHICLE_WIDTH, GeneralRouterProfile.BOAT, R.drawable.img_help_vessel_width_day,
|
||||||
|
R.drawable.img_help_vessel_width_night,
|
||||||
|
R.string.vessel_width_limit_description, R.string.shared_string_meters, R.string.m),
|
||||||
|
WIDTH(VEHICLE_WIDTH, GeneralRouterProfile.CAR, R.drawable.img_help_width_limit_day,
|
||||||
|
R.drawable.img_help_width_limit_night,
|
||||||
R.string.width_limit_description, R.string.shared_string_meters, R.string.m),
|
R.string.width_limit_description, R.string.shared_string_meters, R.string.m),
|
||||||
HEIGHT(GeneralRouter.VEHICLE_HEIGHT, R.drawable.img_help_height_limit_day, R.drawable.img_help_height_limit_night,
|
HEIGHT(VEHICLE_HEIGHT, GeneralRouterProfile.CAR, R.drawable.img_help_height_limit_day,
|
||||||
|
R.drawable.img_help_height_limit_night,
|
||||||
R.string.height_limit_description, R.string.shared_string_meters, R.string.m),
|
R.string.height_limit_description, R.string.shared_string_meters, R.string.m),
|
||||||
WEIGHT(GeneralRouter.VEHICLE_WEIGHT, R.drawable.img_help_weight_limit_day, R.drawable.img_help_weight_limit_night,
|
WEIGHT(VEHICLE_WEIGHT, GeneralRouterProfile.CAR, R.drawable.img_help_weight_limit_day,
|
||||||
|
R.drawable.img_help_weight_limit_night,
|
||||||
R.string.weight_limit_description, R.string.shared_string_tones, R.string.metric_ton);
|
R.string.weight_limit_description, R.string.shared_string_tones, R.string.metric_ton);
|
||||||
|
|
||||||
String routerParameterName;
|
String routerParameterName;
|
||||||
|
GeneralRouterProfile routerProfile;
|
||||||
int dayIconId;
|
int dayIconId;
|
||||||
int nightIconId;
|
int nightIconId;
|
||||||
int descriptionRes;
|
int descriptionRes;
|
||||||
int metricRes;
|
int metricRes;
|
||||||
int metricShortRes;
|
int metricShortRes;
|
||||||
|
|
||||||
VehicleSizeAssets(String routerParameterName, int dayIconId, int nightIconId, int descriptionRes, int metricRes,
|
VehicleSizeAssets(String routerParameterName, GeneralRouterProfile routerProfile, int dayIconId, int nightIconId,
|
||||||
int metricShortRes) {
|
int descriptionRes, int metricRes, int metricShortRes) {
|
||||||
this.routerParameterName = routerParameterName;
|
this.routerParameterName = routerParameterName;
|
||||||
|
this.routerProfile = routerProfile;
|
||||||
this.dayIconId = dayIconId;
|
this.dayIconId = dayIconId;
|
||||||
this.nightIconId = nightIconId;
|
this.nightIconId = nightIconId;
|
||||||
this.descriptionRes = descriptionRes;
|
this.descriptionRes = descriptionRes;
|
||||||
|
@ -28,9 +40,9 @@ public enum VehicleSizeAssets {
|
||||||
this.metricShortRes = metricShortRes;
|
this.metricShortRes = metricShortRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VehicleSizeAssets getAssets(String parameterName) {
|
public static VehicleSizeAssets getAssets(String parameterName, GeneralRouterProfile routerProfile) {
|
||||||
for (VehicleSizeAssets type : VehicleSizeAssets.values()) {
|
for (VehicleSizeAssets type : VehicleSizeAssets.values()) {
|
||||||
if (type.routerParameterName.equals(parameterName)) {
|
if (type.routerParameterName.equals(parameterName) && type.routerProfile == routerProfile) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.osmand.plus.settings.bottomsheets.VehicleSizeAssets;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
import net.osmand.plus.settings.preferences.SizePreference;
|
import net.osmand.plus.settings.preferences.SizePreference;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
|
import net.osmand.router.GeneralRouter.GeneralRouterProfile;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -48,21 +49,22 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
|
||||||
if (routeService == RouteService.OSMAND) {
|
if (routeService == RouteService.OSMAND) {
|
||||||
GeneralRouter router = app.getRouter(mode);
|
GeneralRouter router = app.getRouter(mode);
|
||||||
if (router != null) {
|
if (router != null) {
|
||||||
|
GeneralRouterProfile routerProfile = router.getProfile();
|
||||||
Map<String, GeneralRouter.RoutingParameter> parameters = router.getParameters();
|
Map<String, GeneralRouter.RoutingParameter> parameters = router.getParameters();
|
||||||
|
|
||||||
GeneralRouter.RoutingParameter vehicleHeight = parameters.get(GeneralRouter.VEHICLE_HEIGHT);
|
GeneralRouter.RoutingParameter vehicleHeight = parameters.get(GeneralRouter.VEHICLE_HEIGHT);
|
||||||
if (vehicleHeight != null) {
|
if (vehicleHeight != null) {
|
||||||
setupCustomRoutingPropertyPref(vehicleHeight);
|
setupCustomRoutingPropertyPref(vehicleHeight, routerProfile);
|
||||||
}
|
}
|
||||||
GeneralRouter.RoutingParameter vehicleWeight = parameters.get(GeneralRouter.VEHICLE_WEIGHT);
|
GeneralRouter.RoutingParameter vehicleWeight = parameters.get(GeneralRouter.VEHICLE_WEIGHT);
|
||||||
if (vehicleWeight != null) {
|
if (vehicleWeight != null) {
|
||||||
setupCustomRoutingPropertyPref(vehicleWeight);
|
setupCustomRoutingPropertyPref(vehicleWeight, routerProfile);
|
||||||
}
|
}
|
||||||
GeneralRouter.RoutingParameter vehicleWidth = parameters.get(GeneralRouter.VEHICLE_WIDTH);
|
GeneralRouter.RoutingParameter vehicleWidth = parameters.get(GeneralRouter.VEHICLE_WIDTH);
|
||||||
if (vehicleWidth != null) {
|
if (vehicleWidth != null) {
|
||||||
setupCustomRoutingPropertyPref(vehicleWidth);
|
setupCustomRoutingPropertyPref(vehicleWidth, routerProfile);
|
||||||
}
|
}
|
||||||
if (router.getProfile() != GeneralRouter.GeneralRouterProfile.PUBLIC_TRANSPORT) {
|
if (router.getProfile() != GeneralRouterProfile.PUBLIC_TRANSPORT) {
|
||||||
setupDefaultSpeedPref();
|
setupDefaultSpeedPref();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,8 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCustomRoutingPropertyPref(GeneralRouter.RoutingParameter parameter) {
|
private void setupCustomRoutingPropertyPref(GeneralRouter.RoutingParameter parameter,
|
||||||
|
GeneralRouterProfile routerProfile) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -80,8 +83,10 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
|
||||||
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, parameterId, parameter.getName());
|
String title = SettingsBaseActivity.getRoutingStringPropertyName(app, parameterId, parameter.getName());
|
||||||
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(app, parameterId, parameter.getDescription());
|
String description = SettingsBaseActivity.getRoutingStringPropertyDescription(app, parameterId, parameter.getDescription());
|
||||||
|
|
||||||
String defValue = parameter.getType() == GeneralRouter.RoutingParameterType.NUMERIC ? ROUTING_PARAMETER_NUMERIC_DEFAULT : ROUTING_PARAMETER_SYMBOLIC_DEFAULT;
|
String defValue = parameter.getType() == GeneralRouter.RoutingParameterType.NUMERIC
|
||||||
OsmandSettings.StringPreference pref = (OsmandSettings.StringPreference) app.getSettings().getCustomRoutingProperty(parameterId, defValue);
|
? ROUTING_PARAMETER_NUMERIC_DEFAULT : ROUTING_PARAMETER_SYMBOLIC_DEFAULT;
|
||||||
|
OsmandSettings.StringPreference pref = (OsmandSettings.StringPreference) app.getSettings()
|
||||||
|
.getCustomRoutingProperty(parameterId, defValue);
|
||||||
Object[] values = parameter.getPossibleValues();
|
Object[] values = parameter.getPossibleValues();
|
||||||
String[] valuesStr = new String[values.length];
|
String[] valuesStr = new String[values.length];
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
@ -96,7 +101,7 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
|
||||||
}
|
}
|
||||||
SizePreference vehicleSizePref = new SizePreference(ctx);
|
SizePreference vehicleSizePref = new SizePreference(ctx);
|
||||||
vehicleSizePref.setKey(pref.getId());
|
vehicleSizePref.setKey(pref.getId());
|
||||||
vehicleSizePref.setAssets(VehicleSizeAssets.getAssets(parameterId));
|
vehicleSizePref.setAssets(VehicleSizeAssets.getAssets(parameterId, routerProfile));
|
||||||
vehicleSizePref.setDefaultValue(defValue);
|
vehicleSizePref.setDefaultValue(defValue);
|
||||||
vehicleSizePref.setTitle(title);
|
vehicleSizePref.setTitle(title);
|
||||||
vehicleSizePref.setEntries(entriesStr);
|
vehicleSizePref.setEntries(entriesStr);
|
||||||
|
|
|
@ -396,6 +396,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanningBtn = createHudButton(routePlanButton, R.drawable.ic_action_gdirections_dark, ROUTE_PLANNING_HUD_ID)
|
routePlanningBtn = createHudButton(routePlanButton, R.drawable.ic_action_gdirections_dark, ROUTE_PLANNING_HUD_ID)
|
||||||
.setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark)
|
.setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark)
|
||||||
.setBg(R.drawable.btn_round, R.drawable.btn_round_night);
|
.setBg(R.drawable.btn_round, R.drawable.btn_round_night);
|
||||||
|
routePlanningBtn.flipIconForRtl = true;
|
||||||
controls.add(routePlanningBtn);
|
controls.add(routePlanningBtn);
|
||||||
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -990,6 +991,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
int resClrLight = R.color.map_button_icon_color_light;
|
int resClrLight = R.color.map_button_icon_color_light;
|
||||||
int resClrDark = R.color.map_button_icon_color_dark;
|
int resClrDark = R.color.map_button_icon_color_dark;
|
||||||
String id;
|
String id;
|
||||||
|
boolean flipIconForRtl;
|
||||||
|
|
||||||
boolean nightMode = false;
|
boolean nightMode = false;
|
||||||
boolean f = true;
|
boolean f = true;
|
||||||
|
@ -1158,6 +1160,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
d = ctx.getUIUtilities().getIcon(resLightId);
|
d = ctx.getUIUtilities().getIcon(resLightId);
|
||||||
} else if (resId != 0) {
|
} else if (resId != 0) {
|
||||||
d = ctx.getUIUtilities().getIcon(resId, nightMode ? resClrDark : resClrLight);
|
d = ctx.getUIUtilities().getIcon(resId, nightMode ? resClrDark : resClrLight);
|
||||||
|
if (flipIconForRtl) {
|
||||||
|
d = AndroidUtils.getDrawableForDirection(ctx, d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (iv instanceof ImageView) {
|
if (iv instanceof ImageView) {
|
||||||
if (compass) {
|
if (compass) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class WikivoyageWptPtMenuController extends WptPtMenuController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);
|
leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_read_text;
|
leftTitleButtonController.startIconId = R.drawable.ic_action_read_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TravelArticle getTravelArticle(@NonNull MapActivity mapActivity, @NonNull WptPt wpt) {
|
private static TravelArticle getTravelArticle(@NonNull MapActivity mapActivity, @NonNull WptPt wpt) {
|
||||||
|
|
Loading…
Reference in a new issue