Merge branch 'master' into issue_6515
# Conflicts: # OsmAnd/res/values/strings.xml
This commit is contained in:
commit
be173c0557
33 changed files with 4228 additions and 4127 deletions
|
@ -82,18 +82,16 @@ dependencies {
|
|||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'com.google.code.gson:gson:2.8.2'
|
||||
testImplementation 'org.hamcrest:hamcrest-core:1.3'
|
||||
|
||||
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
|
||||
implementation group: 'org.json', name: 'json', version: '20171018'
|
||||
implementation group: 'org.json', name: 'json', version: '20171018'
|
||||
implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
|
||||
implementation 'org.beanshell:bsh-core:2.0b4'
|
||||
implementation 'org.apache.commons:commons-compress:1.17'
|
||||
implementation 'com.moparisthebest:junidecode:0.1.1'
|
||||
implementation 'com.vividsolutions:jts-core:1.14.0'
|
||||
|
||||
// turn off for now
|
||||
//implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
implementation 'net.sf.kxml:kxml2:2.1.8'
|
||||
|
||||
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.osmand.data.MapObject;
|
|||
import net.osmand.data.Postcode;
|
||||
import net.osmand.data.Street;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
switch (tag) {
|
||||
case 0:
|
||||
if (region.enName == null || region.enName.length() == 0) {
|
||||
region.enName = region.name == null ? "" : Junidecode.unidecode(region.name);
|
||||
region.enName = region.name == null ? "" : TransliterationHelper.transliterate(region.name);
|
||||
}
|
||||
return;
|
||||
case OsmandOdb.OsmAndAddressIndex.NAME_FIELD_NUMBER:
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.osmand.data.TransportStopExit;
|
|||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.osm.edit.Way;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
|
||||
import com.google.protobuf.CodedInputStream;
|
||||
import com.google.protobuf.WireFormat;
|
||||
|
@ -435,7 +435,7 @@ public class BinaryMapTransportReaderAdapter {
|
|||
dataObject.setEnName(stringTable.get(dataObject.getEnName(false).charAt(0)));
|
||||
}
|
||||
if(dataObject.getName().length() > 0 && dataObject.getName("en").length() == 0){
|
||||
dataObject.setEnName(Junidecode.unidecode(dataObject.getName()));
|
||||
dataObject.setEnName(TransliterationHelper.transliterate(dataObject.getName()));
|
||||
}
|
||||
if(dataObject.getOperator() != null && dataObject.getOperator().length() > 0){
|
||||
dataObject.setOperator(stringTable.get(dataObject.getOperator().charAt(0)));
|
||||
|
@ -547,7 +547,7 @@ public class BinaryMapTransportReaderAdapter {
|
|||
case 0:
|
||||
dataObject.setReferencesToRoutes(req.cacheTypes.toArray());
|
||||
if(dataObject.getName("en").length() == 0){
|
||||
dataObject.setEnName(Junidecode.unidecode(dataObject.getName()));
|
||||
dataObject.setEnName(TransliterationHelper.transliterate(dataObject.getName()));
|
||||
}
|
||||
return dataObject;
|
||||
case OsmandOdb.TransportStop.ROUTES_FIELD_NUMBER :
|
||||
|
@ -611,7 +611,7 @@ public class BinaryMapTransportReaderAdapter {
|
|||
switch (tag) {
|
||||
case 0:
|
||||
if (dataObject.getName("en").length() == 0) {
|
||||
dataObject.setEnName(Junidecode.unidecode(dataObject.getName()));
|
||||
dataObject.setEnName(TransliterationHelper.transliterate(dataObject.getName()));
|
||||
}
|
||||
if (x != 0 || y != 0) {
|
||||
dataObject.setLocation(BinaryMapIndexReader.TRANSPORT_STOP_ZOOM, x, y);
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
|||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
|
||||
|
||||
public class RouteDataObject {
|
||||
|
@ -261,7 +261,7 @@ public class RouteDataObject {
|
|||
}
|
||||
String nmDef = names.get(region.nameTypeRule);
|
||||
if(transliterate && nmDef != null && nmDef.length() > 0) {
|
||||
return Junidecode.unidecode(nmDef);
|
||||
return TransliterationHelper.transliterate(nmDef);
|
||||
}
|
||||
return nmDef;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public class RouteDataObject {
|
|||
}
|
||||
String refDefault = names.get(region.refTypeRule);
|
||||
if(transliterate && refDefault != null && refDefault.length() > 0) {
|
||||
return Junidecode.unidecode(refDefault);
|
||||
return TransliterationHelper.transliterate(refDefault);
|
||||
}
|
||||
return refDefault;
|
||||
}
|
||||
|
@ -358,13 +358,13 @@ public class RouteDataObject {
|
|||
int k = kt[i];
|
||||
if(region.routeEncodingRules.size() > k) {
|
||||
if(!Algorithms.isEmpty(lang) && destinationTagLangFB.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||
return destRef1 + ((transliterate) ? Junidecode.unidecode(names.get(k)) : names.get(k));
|
||||
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(names.get(k)) : names.get(k));
|
||||
}
|
||||
if(destinationTagFB.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||
return destRef1 + ((transliterate) ? Junidecode.unidecode(names.get(k)) : names.get(k));
|
||||
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(names.get(k)) : names.get(k));
|
||||
}
|
||||
if(!Algorithms.isEmpty(lang) && destinationTagLang.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||
return destRef1 + ((transliterate) ? Junidecode.unidecode(names.get(k)) : names.get(k));
|
||||
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(names.get(k)) : names.get(k));
|
||||
}
|
||||
if(destinationTagDefault.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||
destinationDefault = names.get(k);
|
||||
|
@ -372,7 +372,7 @@ public class RouteDataObject {
|
|||
}
|
||||
}
|
||||
if(destinationDefault != null) {
|
||||
return destRef1 + ((transliterate) ? Junidecode.unidecode(destinationDefault) : destinationDefault);
|
||||
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(destinationDefault) : destinationDefault);
|
||||
}
|
||||
}
|
||||
return "".equals(destRef) ? null : destRef;
|
||||
|
|
|
@ -4,7 +4,7 @@ package net.osmand.data;
|
|||
import net.osmand.Collator;
|
||||
import net.osmand.OsmAndCollator;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
@ -182,7 +182,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
|||
return nm;
|
||||
}
|
||||
if (transliterate) {
|
||||
return Junidecode.unidecode(getName());
|
||||
return TransliterationHelper.transliterate(getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
|||
if (!Algorithms.isEmpty(enName)) {
|
||||
return this.enName;
|
||||
} else if (!Algorithms.isEmpty(getName()) && transliterate) {
|
||||
return Junidecode.unidecode(getName());
|
||||
return TransliterationHelper.transliterate(getName());
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
package net.osmand.util;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public class TransliterationHelper {
|
||||
|
||||
public final static Log LOG = PlatformUtil.getLog(TransliterationHelper.class);
|
||||
|
||||
private static boolean japanese;
|
||||
|
||||
//private static Tokenizer tokenizer;
|
||||
//private static Map<String, String> katakanaMap = new HashMap<>();
|
||||
|
||||
private TransliterationHelper() {
|
||||
}
|
||||
|
||||
public static boolean isJapanese() {
|
||||
return japanese;
|
||||
}
|
||||
|
||||
public static void setJapanese(boolean japanese) {
|
||||
TransliterationHelper.japanese = japanese;
|
||||
}
|
||||
|
||||
public static String transliterate(String text) {
|
||||
if (japanese) {
|
||||
// do not transliterate japanese for now
|
||||
//return japanese2Romaji(text);
|
||||
return text;
|
||||
} else {
|
||||
return Junidecode.unidecode(text);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private static String japanese2Romaji(String text) {
|
||||
|
||||
if (tokenizer == null) {
|
||||
tokenizer = new Tokenizer();
|
||||
}
|
||||
|
||||
boolean capitalizeWords = true;
|
||||
|
||||
List<Token> tokens = tokenizer.tokenize(text);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (katakanaMap.isEmpty()) {
|
||||
initKanaMap();
|
||||
}
|
||||
for (Token token : tokens) {
|
||||
String type = token.getAllFeaturesArray()[1];
|
||||
|
||||
if (token.getAllFeaturesArray()[0].equals("記号")) {
|
||||
builder.append(token.getSurface());
|
||||
continue;
|
||||
}
|
||||
switch (token.getAllFeaturesArray()[1]) {
|
||||
case "数":
|
||||
case "アルファベット":
|
||||
case "サ変接続":
|
||||
builder.append(token.getSurface());
|
||||
continue;
|
||||
default:
|
||||
String lastFeature = token.getAllFeaturesArray()[8];
|
||||
if (lastFeature.equals("*")) {
|
||||
builder.append(token.getSurface());
|
||||
} else {
|
||||
String romaji = convertKanaToRomaji(token.getAllFeaturesArray()[8]);
|
||||
|
||||
if (capitalizeWords) {
|
||||
builder.append(romaji.substring(0, 1).toUpperCase());
|
||||
builder.append(romaji.substring(1));
|
||||
} else {
|
||||
if (token.getSurface()
|
||||
.equals(token.getPronunciation())) {
|
||||
romaji = romaji.toUpperCase();
|
||||
}
|
||||
builder.append(romaji);
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.append(" ");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static String convertKanaToRomaji(String s) {
|
||||
StringBuilder t = new StringBuilder();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
if (i <= s.length() - 2) {
|
||||
if (katakanaMap.containsKey(s.substring(i, i + 2))) {
|
||||
t.append(katakanaMap.get(s.substring(i, i + 2)));
|
||||
i++;
|
||||
} else if (katakanaMap.containsKey(s.substring(i, i + 1))) {
|
||||
t.append(katakanaMap.get(s.substring(i, i + 1)));
|
||||
} else if (s.charAt(i) == 'ッ') {
|
||||
t.append(katakanaMap.get(s.substring(i + 1, i + 2)).charAt(0));
|
||||
} else {
|
||||
t.append(s.charAt(i));
|
||||
}
|
||||
} else {
|
||||
if (katakanaMap.containsKey(s.substring(i, i + 1))) {
|
||||
t.append(katakanaMap.get(s.substring(i, i + 1)));
|
||||
} else {
|
||||
t.append(s.charAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return t.toString();
|
||||
}
|
||||
|
||||
private static void initKanaMap() {
|
||||
katakanaMap.put("ア", "a");
|
||||
katakanaMap.put("イ", "i");
|
||||
katakanaMap.put("ウ", "u");
|
||||
katakanaMap.put("エ", "e");
|
||||
katakanaMap.put("オ", "o");
|
||||
katakanaMap.put("カ", "ka");
|
||||
katakanaMap.put("キ", "ki");
|
||||
katakanaMap.put("ク", "ku");
|
||||
katakanaMap.put("ケ", "ke");
|
||||
katakanaMap.put("コ", "ko");
|
||||
katakanaMap.put("サ", "sa");
|
||||
katakanaMap.put("シ", "shi");
|
||||
katakanaMap.put("ス", "su");
|
||||
katakanaMap.put("セ", "se");
|
||||
katakanaMap.put("ソ", "so");
|
||||
katakanaMap.put("タ", "ta");
|
||||
katakanaMap.put("チ", "chi");
|
||||
katakanaMap.put("ツ", "tsu");
|
||||
katakanaMap.put("テ", "te");
|
||||
katakanaMap.put("ト", "to");
|
||||
katakanaMap.put("ナ", "na");
|
||||
katakanaMap.put("ニ", "ni");
|
||||
katakanaMap.put("ヌ", "nu");
|
||||
katakanaMap.put("ネ", "ne");
|
||||
katakanaMap.put("ノ", "no");
|
||||
katakanaMap.put("ハ", "ha");
|
||||
katakanaMap.put("ヒ", "hi");
|
||||
katakanaMap.put("フ", "fu");
|
||||
katakanaMap.put("ヘ", "he");
|
||||
katakanaMap.put("ホ", "ho");
|
||||
katakanaMap.put("マ", "ma");
|
||||
katakanaMap.put("ミ", "mi");
|
||||
katakanaMap.put("ム", "mu");
|
||||
katakanaMap.put("メ", "me");
|
||||
katakanaMap.put("モ", "mo");
|
||||
katakanaMap.put("ヤ", "ya");
|
||||
katakanaMap.put("ユ", "yu");
|
||||
katakanaMap.put("ヨ", "yo");
|
||||
katakanaMap.put("ラ", "ra");
|
||||
katakanaMap.put("リ", "ri");
|
||||
katakanaMap.put("ル", "ru");
|
||||
katakanaMap.put("レ", "re");
|
||||
katakanaMap.put("ロ", "ro");
|
||||
katakanaMap.put("ワ", "wa");
|
||||
katakanaMap.put("ヲ", "wo");
|
||||
katakanaMap.put("ン", "n");
|
||||
katakanaMap.put("ガ", "ga");
|
||||
katakanaMap.put("ギ", "gi");
|
||||
katakanaMap.put("グ", "gu");
|
||||
katakanaMap.put("ゲ", "ge");
|
||||
katakanaMap.put("ゴ", "go");
|
||||
katakanaMap.put("ザ", "za");
|
||||
katakanaMap.put("ジ", "ji");
|
||||
katakanaMap.put("ズ", "zu");
|
||||
katakanaMap.put("ゼ", "ze");
|
||||
katakanaMap.put("ゾ", "zo");
|
||||
katakanaMap.put("ダ", "da");
|
||||
katakanaMap.put("ヂ", "ji");
|
||||
katakanaMap.put("ヅ", "zu");
|
||||
katakanaMap.put("デ", "de");
|
||||
katakanaMap.put("ド", "do");
|
||||
katakanaMap.put("バ", "ba");
|
||||
katakanaMap.put("ビ", "bi");
|
||||
katakanaMap.put("ブ", "bu");
|
||||
katakanaMap.put("ベ", "be");
|
||||
katakanaMap.put("ボ", "bo");
|
||||
katakanaMap.put("パ", "pa");
|
||||
katakanaMap.put("ピ", "pi");
|
||||
katakanaMap.put("プ", "pu");
|
||||
katakanaMap.put("ペ", "pe");
|
||||
katakanaMap.put("ポ", "po");
|
||||
katakanaMap.put("キャ", "kya");
|
||||
katakanaMap.put("キュ", "kyu");
|
||||
katakanaMap.put("キョ", "kyo");
|
||||
katakanaMap.put("シャ", "sha");
|
||||
katakanaMap.put("シュ", "shu");
|
||||
katakanaMap.put("ショ", "sho");
|
||||
katakanaMap.put("チャ", "cha");
|
||||
katakanaMap.put("チュ", "chu");
|
||||
katakanaMap.put("チョ", "cho");
|
||||
katakanaMap.put("ニャ", "nya");
|
||||
katakanaMap.put("ニュ", "nyu");
|
||||
katakanaMap.put("ニョ", "nyo");
|
||||
katakanaMap.put("ヒャ", "hya");
|
||||
katakanaMap.put("ヒュ", "hyu");
|
||||
katakanaMap.put("ヒョ", "hyo");
|
||||
katakanaMap.put("リャ", "rya");
|
||||
katakanaMap.put("リュ", "ryu");
|
||||
katakanaMap.put("リョ", "ryo");
|
||||
katakanaMap.put("ギャ", "gya");
|
||||
katakanaMap.put("ギュ", "gyu");
|
||||
katakanaMap.put("ギョ", "gyo");
|
||||
katakanaMap.put("ジャ", "ja");
|
||||
katakanaMap.put("ジュ", "ju");
|
||||
katakanaMap.put("ジョ", "jo");
|
||||
katakanaMap.put("ティ", "ti");
|
||||
katakanaMap.put("ディ", "di");
|
||||
katakanaMap.put("ツィ", "tsi");
|
||||
katakanaMap.put("ヂャ", "dya");
|
||||
katakanaMap.put("ヂュ", "dyu");
|
||||
katakanaMap.put("ヂョ", "dyo");
|
||||
katakanaMap.put("ビャ", "bya");
|
||||
katakanaMap.put("ビュ", "byu");
|
||||
katakanaMap.put("ビョ", "byo");
|
||||
katakanaMap.put("ピャ", "pya");
|
||||
katakanaMap.put("ピュ", "pyu");
|
||||
katakanaMap.put("ピョ", "pyo");
|
||||
katakanaMap.put("ー", "-");
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -66,6 +66,13 @@ android {
|
|||
warningsAsErrors false
|
||||
}
|
||||
|
||||
// related to kuromoji
|
||||
//packagingOptions {
|
||||
// exclude '/META-INF/CONTRIBUTORS.md'
|
||||
// exclude '/META-INF/LICENSE.md'
|
||||
// exclude '/META-INF/NOTICE.md'
|
||||
//}
|
||||
|
||||
// This is from OsmAndCore_android.aar - for some reason it's not inherited
|
||||
aaptOptions {
|
||||
// Don't compress any embedded resources
|
||||
|
@ -391,7 +398,8 @@ dependencies {
|
|||
implementation 'com.moparisthebest:junidecode:0.1.1'
|
||||
implementation 'org.immutables:gson:2.5.0'
|
||||
implementation 'com.vividsolutions:jts-core:1.14.0'
|
||||
|
||||
// turn off for now
|
||||
//implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
// JS core
|
||||
implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9'
|
||||
|
|
101
OsmAnd/res/layout/gpx_route_card.xml
Normal file
101
OsmAnd/res/layout/gpx_route_card.xml
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/prev_route_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_top" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/route_info_button_go_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/route_info_list_item_height"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gpx_card_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
tools:text="Tracks on the map - 10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/items"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/show_all_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/route_info_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginStart="@dimen/route_info_list_text_padding"
|
||||
android:layout_marginLeft="@dimen/route_info_list_text_padding"
|
||||
tools:background="?attr/dashboard_divider" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/show_all_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/route_info_list_text_padding"
|
||||
android:layout_marginLeft="@dimen/route_info_list_text_padding"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
osmand:textAllCapsCompat="true"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="SHOW ALL"
|
||||
tools:textColor="?attr/color_dialog_buttons"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="14dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -14,6 +14,7 @@
|
|||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/prev_route_card_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_content_padding"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -428,7 +428,7 @@
|
|||
<string name="poi_railway_platform">רציף רכבת</string>
|
||||
<string name="poi_halt">תחנת רכבת</string>
|
||||
<string name="poi_subway_entrance">כניסה לרכבת תחתית</string>
|
||||
<string name="poi_subway_station">תחנת רכבת תחתית</string>
|
||||
<string name="poi_subway_station">כן</string>
|
||||
<string name="poi_taxi">עמדת מוניות</string>
|
||||
<string name="poi_aerodrome">נמל תעופה</string>
|
||||
<string name="poi_runway">מסלול ריצה</string>
|
||||
|
@ -563,7 +563,7 @@
|
|||
<string name="poi_customs">מכס</string>
|
||||
<string name="poi_country">מדינה</string>
|
||||
<string name="poi_city">עיר</string>
|
||||
<string name="poi_capital">עיר בירה</string>
|
||||
<string name="poi_capital">כן</string>
|
||||
<string name="poi_town">עיירה</string>
|
||||
<string name="poi_village">כפר</string>
|
||||
<string name="poi_hamlet">כפריר</string>
|
||||
|
@ -2098,4 +2098,10 @@
|
|||
<string name="poi_observatory_type_gravitational">כבידתי</string>
|
||||
<string name="poi_blood_donation">תרומת דם</string>
|
||||
<string name="poi_park_ride_ferry">מעבורת</string>
|
||||
<string name="poi_bulk_purchase">רכישה בכמות גדולה</string>
|
||||
<string name="poi_substation_type">סוג</string>
|
||||
<string name="poi_books_type">ספרים</string>
|
||||
<string name="poi_park_ride">חנה וסע</string>
|
||||
<string name="poi_theme_park">פארק שעשועים</string>
|
||||
<string name="poi_denomination_assemblies_of_god">קהילות השם</string>
|
||||
</resources>
|
|
@ -2910,4 +2910,5 @@
|
|||
<string name="add_work">הוספת עבודה</string>
|
||||
<string name="work_button">עבודה</string>
|
||||
<string name="previous_route">נתיב קודם</string>
|
||||
<string name="add_destination_query">נא להוסיף יעד תחילה</string>
|
||||
</resources>
|
|
@ -2918,4 +2918,5 @@
|
|||
<string name="add_work">Legg til arbeidssted</string>
|
||||
<string name="work_button">Arbeid</string>
|
||||
<string name="previous_route">Forrige rute</string>
|
||||
<string name="add_destination_query">Legg til mål først</string>
|
||||
</resources>
|
|
@ -1603,7 +1603,7 @@
|
|||
<string name="wake_on_voice_descr">Включать экран устройства (если он выключен) при приближении к повороту.</string>
|
||||
<string name="map_update">Карты доступные для обновления: %1$s</string>
|
||||
<string name="coordinates">Координаты</string>
|
||||
<string name="home_button">Домой</string>
|
||||
<string name="home_button">Дом</string>
|
||||
<string name="search_for">Поиск</string>
|
||||
<string name="everything_up_to_date">Все файлы обновлены</string>
|
||||
<string name="use_opengl_render">Использовать OpenGL для рендеринга</string>
|
||||
|
@ -2906,4 +2906,5 @@
|
|||
<string name="work_button">Работа</string>
|
||||
<string name="route_smoothness_stat_container">Ровность</string>
|
||||
<string name="previous_route">Предыдущий маршрут</string>
|
||||
<string name="add_destination_query">Сначала добавьте пункт назначения</string>
|
||||
</resources>
|
|
@ -279,6 +279,7 @@
|
|||
<dimen name="route_info_app_modes_padding">40dp</dimen>
|
||||
<dimen name="route_info_card_row_min_height">60dp</dimen>
|
||||
<dimen name="route_info_card_item_height">56dp</dimen>
|
||||
<dimen name="route_info_list_text_padding">54dp</dimen>
|
||||
|
||||
<dimen name="multi_selection_header_height">52dp</dimen>
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
- For wording and consistency, please note https://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience
|
||||
Thx - Hardy
|
||||
-->
|
||||
<string name="tracks_on_map">Tracks on the map</string>
|
||||
<string name="quick_action_show_hide_gpx_tracks">Show/Hide GPX Tracks</string>
|
||||
<string name="quick_action_show_hide_gpx_tracks_descr">Tapping this action button shows or hides selected GPX tracks on map</string>
|
||||
<string name="quick_action_gpx_tracks_hide">Hide GPX Tracks</string>
|
||||
|
|
|
@ -458,62 +458,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public void enterRoutePlanningMode(final LatLon from, final PointDescription fromName) {
|
||||
final boolean useIntermediatePointsByDefault = true;
|
||||
List<SelectedGpxFile> selectedGPXFiles = mapActivity.getMyApplication().getSelectedGpxHelper()
|
||||
.getSelectedGPXFiles();
|
||||
final List<GPXFile> gpxFiles = new ArrayList<>();
|
||||
for (SelectedGpxFile gs : selectedGPXFiles) {
|
||||
if (!gs.isShowCurrentTrack() && !gs.notShowNavigationDialog) {
|
||||
if (gs.getGpxFile().hasRtePt() || gs.getGpxFile().hasTrkPt()) {
|
||||
gpxFiles.add(gs.getGpxFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gpxFiles.size() > 0) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(mapActivity);
|
||||
if (gpxFiles.size() == 1) {
|
||||
bld.setMessage(R.string.use_displayed_track_for_navigation);
|
||||
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
enterRoutePlanningModeGivenGpx(gpxFiles.get(0), from, fromName, useIntermediatePointsByDefault, true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
bld.setTitle(R.string.navigation_over_track);
|
||||
ArrayAdapter<GPXFile> adapter = new ArrayAdapter<GPXFile>(mapActivity, R.layout.drawer_list_item, gpxFiles) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = mapActivity.getLayoutInflater().inflate(R.layout.drawer_list_item, null);
|
||||
}
|
||||
String path = getItem(position).path;
|
||||
String name = path.substring(path.lastIndexOf("/") + 1, path.length());
|
||||
((TextView) convertView.findViewById(R.id.title)).setText(name);
|
||||
convertView.findViewById(R.id.icon).setVisibility(View.GONE);
|
||||
convertView.findViewById(R.id.toggle_item).setVisibility(View.GONE);
|
||||
return convertView;
|
||||
}
|
||||
};
|
||||
bld.setAdapter(adapter, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
enterRoutePlanningModeGivenGpx(gpxFiles.get(i), from, fromName, useIntermediatePointsByDefault, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bld.setNegativeButton(R.string.shared_string_no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
enterRoutePlanningModeGivenGpx(null, from, fromName, useIntermediatePointsByDefault, true);
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
} else {
|
||||
enterRoutePlanningModeGivenGpx(null, from, fromName, useIntermediatePointsByDefault, true);
|
||||
}
|
||||
enterRoutePlanningModeGivenGpx(null, from, fromName, true, true);
|
||||
}
|
||||
|
||||
public void enterRoutePlanningModeGivenGpx(GPXFile gpxFile, LatLon from, PointDescription fromName,
|
||||
|
|
|
@ -70,6 +70,7 @@ import net.osmand.plus.routing.RoutingHelper;
|
|||
import net.osmand.plus.views.TurnPathHelper;
|
||||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.router.RouteSegmentResult;
|
||||
import net.osmand.router.RouteStatistics;
|
||||
import net.osmand.router.RouteStatistics.Incline;
|
||||
import net.osmand.router.RouteStatistics.RouteSegmentAttribute;
|
||||
|
@ -209,15 +210,18 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
if (slopeDataSet != null) {
|
||||
List<Incline> inclines = createInclinesAndAdd100MetersWith0Incline(slopeDataSet.getValues());
|
||||
|
||||
RouteStatistics routeStatistics = RouteStatistics.newRouteStatistic(helper.getRoute().getOriginalRoute());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_class_stat_chart,
|
||||
R.id.route_class_stat_items, routeStatistics.getRouteClassStatistic());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_surface_stat_chart,
|
||||
R.id.route_surface_stat_items, routeStatistics.getRouteSurfaceStatistic());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_smoothness_stat_chart,
|
||||
R.id.route_smoothness_stat_items, routeStatistics.getRouteSmoothnessStatistic());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_steepness_stat_chart,
|
||||
R.id.route_steepness_stat_items, routeStatistics.getRouteSteepnessStatistic(inclines));
|
||||
List<RouteSegmentResult> route = helper.getRoute().getOriginalRoute();
|
||||
if (route != null) {
|
||||
RouteStatistics routeStatistics = RouteStatistics.newRouteStatistic(route);
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_class_stat_chart,
|
||||
R.id.route_class_stat_items, routeStatistics.getRouteClassStatistic());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_surface_stat_chart,
|
||||
R.id.route_surface_stat_items, routeStatistics.getRouteSurfaceStatistic());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_smoothness_stat_chart,
|
||||
R.id.route_smoothness_stat_items, routeStatistics.getRouteSmoothnessStatistic());
|
||||
buildChartAndAttachLegend(app, view, inflater, R.id.route_steepness_stat_chart,
|
||||
R.id.route_steepness_stat_items, routeStatistics.getRouteSteepnessStatistic(inclines));
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -273,12 +273,8 @@ public class GpxUiHelper {
|
|||
//element position in adapter
|
||||
int i = 0;
|
||||
for (GPXInfo gpxInfo : allGpxList) {
|
||||
String s = gpxInfo.getFileName();
|
||||
String fileName = s;
|
||||
if (s.endsWith(".gpx")) {
|
||||
s = s.substring(0, s.length() - ".gpx".length());
|
||||
}
|
||||
s = s.replace('_', ' ');
|
||||
String fileName = gpxInfo.getFileName();
|
||||
String s = getGpxTitle(fileName);
|
||||
|
||||
adapter.addItem(ContextMenuItem.createBuilder(s).setSelected(false)
|
||||
.setIcon(R.drawable.ic_action_polygom_dark).createItem());
|
||||
|
@ -292,6 +288,15 @@ public class GpxUiHelper {
|
|||
return adapter;
|
||||
}
|
||||
|
||||
public static String getGpxTitle(String fileName) {
|
||||
String s = fileName;
|
||||
if (s.toLowerCase().endsWith(".gpx")) {
|
||||
s = s.substring(0, s.length() - ".gpx".length());
|
||||
}
|
||||
s = s.replace('_', ' ');
|
||||
return s;
|
||||
}
|
||||
|
||||
protected static void updateSelection(List<String> selectedGpxList, boolean showCurrentTrack,
|
||||
final ContextMenuAdapter adapter, int position, String fileName) {
|
||||
ContextMenuItem item = adapter.getItem(position);
|
||||
|
@ -472,7 +477,7 @@ public class GpxUiHelper {
|
|||
|
||||
final ContextMenuItem item = adapter.getItem(position);
|
||||
GPXInfo info = list.get(position);
|
||||
updateGpxInfoView(v, item, info, getDataItem(info), showCurrentGpx && position == 0, app);
|
||||
updateGpxInfoView(v, item.getTitle(), info, getDataItem(info), showCurrentGpx && position == 0, app);
|
||||
|
||||
if (item.getSelected() == null) {
|
||||
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
||||
|
@ -710,9 +715,9 @@ public class GpxUiHelper {
|
|||
return dlg;
|
||||
}
|
||||
|
||||
public static void updateGpxInfoView(View v, ContextMenuItem item, GPXInfo info, GpxDataItem dataItem, boolean currentlyRecordingTrack, OsmandApplication app) {
|
||||
public static void updateGpxInfoView(View v, String itemTitle, GPXInfo info, GpxDataItem dataItem, boolean currentlyRecordingTrack, OsmandApplication app) {
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||
viewName.setText(item.getTitle().replace("/", " • ").trim());
|
||||
viewName.setText(itemTitle.replace("/", " • ").trim());
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
icon.setVisibility(View.GONE);
|
||||
//icon.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_polygom_dark));
|
||||
|
@ -1914,7 +1919,7 @@ public class GpxUiHelper {
|
|||
private long fileSize;
|
||||
private boolean selected;
|
||||
|
||||
GPXInfo(String fileName, long lastModified, long fileSize) {
|
||||
public GPXInfo(String fileName, long lastModified, long fileSize) {
|
||||
this.fileName = fileName;
|
||||
this.lastModified = lastModified;
|
||||
this.fileSize = fileSize;
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.text.style.ForegroundColorSpan;
|
|||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -99,16 +100,20 @@ public class ImportHelper {
|
|||
}
|
||||
|
||||
public boolean handleGpxImport(final Uri contentUri, final boolean useImportDir) {
|
||||
final String name = getNameFromContentUri(contentUri);
|
||||
final boolean isOsmandSubdir = isSubDirectory(app.getAppPath(IndexConstants.GPX_INDEX_DIR), new File(contentUri.getPath()));
|
||||
String name = getNameFromContentUri(contentUri);
|
||||
boolean isOsmandSubdir = isSubDirectory(app.getAppPath(IndexConstants.GPX_INDEX_DIR), new File(contentUri.getPath()));
|
||||
if (!isOsmandSubdir && name != null) {
|
||||
if (name.endsWith(GPX_SUFFIX)) {
|
||||
String nameLC = name.toLowerCase();
|
||||
if (nameLC.endsWith(GPX_SUFFIX)) {
|
||||
name = name.substring(0, name.length() - 4) + GPX_SUFFIX;
|
||||
handleGpxImport(contentUri, name, true, useImportDir);
|
||||
return true;
|
||||
} else if (name.endsWith(KML_SUFFIX)) {
|
||||
} else if (nameLC.endsWith(KML_SUFFIX)) {
|
||||
name = name.substring(0, name.length() - 4) + KML_SUFFIX;
|
||||
handleKmlImport(contentUri, name, true, useImportDir);
|
||||
return true;
|
||||
} else if (name.endsWith(KMZ_SUFFIX)) {
|
||||
} else if (nameLC.endsWith(KMZ_SUFFIX)) {
|
||||
name = name.substring(0, name.length() - 4) + KMZ_SUFFIX;
|
||||
handleKmzImport(contentUri, name, true, useImportDir);
|
||||
return true;
|
||||
}
|
||||
|
@ -609,11 +614,12 @@ public class ImportHelper {
|
|||
//noinspection ResultOfMethodCallIgnored
|
||||
importDir.mkdirs();
|
||||
if (importDir.exists() && importDir.isDirectory() && importDir.canWrite()) {
|
||||
final GPXUtilities.WptPt pt = gpxFile.findPointToShow();
|
||||
final WptPt pt = gpxFile.findPointToShow();
|
||||
final File toWrite = getFileToSave(fileName, importDir, pt);
|
||||
Exception e = GPXUtilities.writeGpxFile(toWrite, gpxFile);
|
||||
if(e == null) {
|
||||
gpxFile.path = toWrite.getAbsolutePath();
|
||||
app.getGpxDatabase().remove(new File(gpxFile.path));
|
||||
warning = null;
|
||||
} else {
|
||||
warning = app.getString(R.string.error_reading_gpx);
|
||||
|
@ -626,7 +632,7 @@ public class ImportHelper {
|
|||
return warning;
|
||||
}
|
||||
|
||||
private File getFileToSave(final String fileName, final File importDir, final GPXUtilities.WptPt pt) {
|
||||
private File getFileToSave(final String fileName, final File importDir, final WptPt pt) {
|
||||
final StringBuilder builder = new StringBuilder(fileName);
|
||||
if ("".equals(fileName)) {
|
||||
builder.append("import_").append(new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time))).append(GPX_SUFFIX); //$NON-NLS-1$
|
||||
|
@ -678,7 +684,7 @@ public class ImportHelper {
|
|||
private void showGpxOnMap(final GPXFile result) {
|
||||
if (mapView != null && getMapActivity() != null) {
|
||||
app.getSelectedGpxHelper().setGpxFileToDisplay(result);
|
||||
final GPXUtilities.WptPt moveTo = result.findPointToShow();
|
||||
final WptPt moveTo = result.findPointToShow();
|
||||
if (moveTo != null) {
|
||||
mapView.getAnimatedDraggingThread().startMoving(moveTo.lat, moveTo.lon, mapView.getZoom(), true);
|
||||
}
|
||||
|
@ -736,9 +742,9 @@ public class ImportHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private List<FavouritePoint> asFavourites(final List<GPXUtilities.WptPt> wptPts, String fileName, boolean forceImportFavourites) {
|
||||
private List<FavouritePoint> asFavourites(final List<WptPt> wptPts, String fileName, boolean forceImportFavourites) {
|
||||
final List<FavouritePoint> favourites = new ArrayList<>();
|
||||
for (GPXUtilities.WptPt p : wptPts) {
|
||||
for (WptPt p : wptPts) {
|
||||
if (p.name != null) {
|
||||
final String fpCat;
|
||||
if (p.category == null) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
@ -137,7 +137,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
|
|||
a.setId(Long.parseLong(parser.getAttributeValue("", "place_id"))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String name = parser.getAttributeValue("", "display_name"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
a.setName(name);
|
||||
a.setEnName(Junidecode.unidecode(name));
|
||||
a.setEnName(TransliterationHelper.transliterate(getName()));
|
||||
a.setSubType(parser.getAttributeValue("", "type")); //$NON-NLS-1$//$NON-NLS-2$
|
||||
PoiType pt = poiTypes.getPoiTypeByKey(a.getSubType());
|
||||
a.setType(pt != null ? pt.getCategory() : poiTypes.getOtherPoiCategory());
|
||||
|
@ -153,7 +153,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
|
|||
String name = parser.getText();
|
||||
if (name != null) {
|
||||
a.setName(name);
|
||||
a.setEnName(Junidecode.unidecode(name));
|
||||
a.setEnName(TransliterationHelper.transliterate(getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
||||
|
||||
public static final int TYPE = 15;
|
||||
|
||||
private final static String KEY_OVERLAYS = "overlays";
|
||||
|
@ -84,23 +83,31 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
List<Pair<String, String>> sources = loadListFromParams();
|
||||
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> currentSource = new Pair<>(
|
||||
settings.MAP_OVERLAY.get(),
|
||||
settings.MAP_OVERLAY.get());
|
||||
if (sources.size() > 0) {
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
int index = -1;
|
||||
final String currentSource = settings.MAP_OVERLAY.get() == null ? KEY_NO_OVERLAY
|
||||
: settings.MAP_OVERLAY.get();
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
for (int idx = 0; idx < sources.size(); idx++) {
|
||||
if (sources.get(idx).first.equals(currentSource)) {
|
||||
index = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,8 +200,7 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
super.fillParams(root, activity);
|
||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||
return true;
|
||||
return super.fillParams(root, activity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,24 +77,25 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
List<Pair<String, String>> sources = loadListFromParams();
|
||||
if (sources.size() > 0) {
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> currentSource = settings.MAP_ONLINE_DATA.get()
|
||||
Pair<String, String> currentSource = settings.MAP_ONLINE_DATA.get()
|
||||
? new Pair<>(settings.MAP_TILE_SOURCES.get(), settings.MAP_TILE_SOURCES.get())
|
||||
: new Pair<>(LAYER_OSM_VECTOR, activity.getString(R.string.vector_data));
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,8 +196,7 @@ public class MapSourceAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
super.fillParams(root, activity);
|
||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||
return true;
|
||||
return super.fillParams(root, activity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
||||
|
||||
public static final int TYPE = 16;
|
||||
|
||||
private final static String KEY_UNDERLAYS = "underlays";
|
||||
|
@ -82,24 +81,31 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
OsmandSettings settings = activity.getMyApplication().getSettings();
|
||||
List<Pair<String, String>> sources = loadListFromParams();
|
||||
if (sources.size() > 0) {
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
}
|
||||
|
||||
boolean showBottomSheetStyles = Boolean.valueOf(getParams().get(KEY_DIALOG));
|
||||
if (showBottomSheetStyles) {
|
||||
showChooseDialog(activity.getSupportFragmentManager());
|
||||
return;
|
||||
int index = -1;
|
||||
final String currentSource = settings.MAP_UNDERLAY.get() == null ? KEY_NO_UNDERLAY
|
||||
: settings.MAP_UNDERLAY.get();
|
||||
|
||||
for (int idx = 0; idx < sources.size(); idx++) {
|
||||
if (sources.get(idx).first.equals(currentSource)) {
|
||||
index = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
|
||||
Pair<String, String> currentSource = new Pair<>(
|
||||
settings.MAP_UNDERLAY.get(),
|
||||
settings.MAP_UNDERLAY.get());
|
||||
|
||||
Pair<String, String> nextSource = sources.get(0);
|
||||
int index = sources.indexOf(currentSource);
|
||||
|
||||
if (index >= 0 && index + 1 < sources.size()) {
|
||||
nextSource = sources.get(index + 1);
|
||||
}
|
||||
executeWithParams(activity, nextSource.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,8 +202,7 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
|
|||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
super.fillParams(root, activity);
|
||||
getParams().put(KEY_DIALOG, Boolean.toString(((SwitchCompat) root.findViewById(R.id.saveButton)).isChecked()));
|
||||
return true;
|
||||
return super.fillParams(root, activity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.render;
|
||||
|
||||
|
||||
import gnu.trove.iterator.TIntObjectIterator;
|
||||
import gnu.trove.list.TLongList;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
@ -56,6 +55,7 @@ import net.osmand.util.Algorithms;
|
|||
import net.osmand.util.MapAlgorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -300,10 +300,11 @@ public class MapRenderRepositories {
|
|||
if(library == null) {
|
||||
return;
|
||||
}
|
||||
boolean containsJapanMapData = false;
|
||||
boolean useLive = context.getSettings().USE_OSM_LIVE_FOR_ROUTING.get();
|
||||
for (String mapName : files.keySet()) {
|
||||
BinaryMapIndexReader fr = files.get(mapName);
|
||||
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
||||
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
||||
fr.containsRouteData(leftX, topY, rightX, bottomY, zoom))) {
|
||||
if (!nativeFiles.contains(mapName)) {
|
||||
long time = System.currentTimeMillis();
|
||||
|
@ -313,8 +314,12 @@ public class MapRenderRepositories {
|
|||
}
|
||||
log.debug("Native resource " + mapName + " initialized " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
if (fr.getCountryName().equals("Japan")) {
|
||||
containsJapanMapData = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
TransliterationHelper.setJapanese(containsJapanMapData);
|
||||
}
|
||||
|
||||
private void readRouteDataAsMapObjects(SearchRequest<BinaryMapDataObject> sr, BinaryMapIndexReader c,
|
||||
|
@ -530,6 +535,7 @@ public class MapRenderRepositories {
|
|||
}
|
||||
MapIndex mi = null;
|
||||
searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom, searchFilter);
|
||||
boolean containsJapanMapData = false;
|
||||
for (BinaryMapIndexReader c : files.values()) {
|
||||
boolean basemap = c.isBasemap();
|
||||
searchRequest.clearSearchResults();
|
||||
|
@ -540,12 +546,15 @@ public class MapRenderRepositories {
|
|||
res = new ArrayList<BinaryMapDataObject>();
|
||||
log.debug("Search failed " + c.getRegionNames(), e); //$NON-NLS-1$
|
||||
}
|
||||
if(res.size() > 0) {
|
||||
if (res.size() > 0) {
|
||||
if(basemap) {
|
||||
renderedState |= 1;
|
||||
} else {
|
||||
renderedState |= 2;
|
||||
}
|
||||
if (c.getCountryName().equals("Japan")) {
|
||||
containsJapanMapData = true;
|
||||
}
|
||||
}
|
||||
for (BinaryMapDataObject r : res) {
|
||||
if (checkForDuplicateObjectIds && !basemap) {
|
||||
|
@ -585,6 +594,7 @@ public class MapRenderRepositories {
|
|||
land[0] = true;
|
||||
}
|
||||
}
|
||||
TransliterationHelper.setJapanese(containsJapanMapData);
|
||||
return mi;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.render;
|
||||
|
||||
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import gnu.trove.procedure.TIntObjectProcedure;
|
||||
|
||||
|
@ -8,6 +9,7 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.binary.BinaryMapDataObject;
|
||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||
import net.osmand.data.QuadRect;
|
||||
|
@ -16,7 +18,7 @@ import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
|||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
import net.osmand.util.TransliterationHelper;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -29,6 +31,7 @@ import android.graphics.PointF;
|
|||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Typeface;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public class TextRenderer {
|
||||
|
||||
|
@ -236,7 +239,7 @@ public class TextRenderer {
|
|||
TextDrawInfo text = rc.textToDraw.get(i);
|
||||
if (text.text != null && text.text.length() > 0) {
|
||||
if (preferredLocale.length() > 0) {
|
||||
text.text = Junidecode.unidecode(text.text);
|
||||
text.text = TransliterationHelper.transliterate(text.text);
|
||||
}
|
||||
|
||||
// sest text size before finding intersection (it is used there)
|
||||
|
|
|
@ -20,7 +20,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.ValueHolder;
|
||||
|
@ -31,6 +31,7 @@ import net.osmand.data.RotatedTileBox;
|
|||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.GeocodingLookupService;
|
||||
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -49,10 +50,12 @@ import net.osmand.plus.helpers.WaypointHelper;
|
|||
import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
||||
import net.osmand.plus.routepreparationmenu.cards.HomeWorkCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.PreviousRouteCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.PublicTransportCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.SimpleRouteCard;
|
||||
import net.osmand.plus.routepreparationmenu.cards.TracksCard;
|
||||
import net.osmand.plus.routing.IRouteInformationListener;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.TransportRoutingHelper;
|
||||
|
@ -72,7 +75,7 @@ import java.util.Set;
|
|||
|
||||
import static net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.DRIVING_STYLE;
|
||||
|
||||
public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||
public class MapRouteInfoMenu implements IRouteInformationListener, CardListener {
|
||||
|
||||
public static class MenuState {
|
||||
public static final int HEADER_ONLY = 1;
|
||||
|
@ -334,6 +337,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
fragmentRef.get().updateInfo();
|
||||
}
|
||||
|
||||
public void updateLayout() {
|
||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
||||
if (fragmentRef != null)
|
||||
fragmentRef.get().updateLayout();
|
||||
}
|
||||
|
||||
public void updateFromIcon() {
|
||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
||||
if (fragmentRef != null)
|
||||
|
@ -362,7 +371,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
menuCards.clear();
|
||||
|
||||
if (isBasicRouteCalculated()) {
|
||||
GPXUtilities.GPXFile gpx = GpxUiHelper.makeGpxFromRoute(routingHelper.getRoute(), mapActivity.getMyApplication());
|
||||
GPXFile gpx = GpxUiHelper.makeGpxFromRoute(routingHelper.getRoute(), mapActivity.getMyApplication());
|
||||
if (gpx != null) {
|
||||
menuCards.add(new SimpleRouteCard(mapActivity, gpx));
|
||||
}
|
||||
|
@ -388,6 +397,22 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
PreviousRouteCard previousRouteCard = new PreviousRouteCard(mapActivity);
|
||||
menuCards.add(previousRouteCard);
|
||||
}
|
||||
|
||||
List<SelectedGpxFile> selectedGPXFiles =
|
||||
mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles();
|
||||
final List<GPXFile> gpxFiles = new ArrayList<>();
|
||||
for (SelectedGpxFile gs : selectedGPXFiles) {
|
||||
if (!gs.isShowCurrentTrack()) {
|
||||
if (gs.getGpxFile().hasRtePt() || gs.getGpxFile().hasTrkPt()) {
|
||||
gpxFiles.add(gs.getGpxFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gpxFiles.size() > 0) {
|
||||
TracksCard tracksCard = new TracksCard(mapActivity, gpxFiles);
|
||||
tracksCard.setListener(this);
|
||||
menuCards.add(tracksCard);
|
||||
}
|
||||
}
|
||||
setupCards();
|
||||
}
|
||||
|
@ -397,6 +422,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
build(cardsContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCardLayoutNeeded() {
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
public boolean isRouteCalculated() {
|
||||
return isBasicRouteCalculated() || isTransportRouteCalculated();
|
||||
}
|
||||
|
@ -1391,6 +1421,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
visible = false;
|
||||
}
|
||||
routingHelper.removeListener(this);
|
||||
removeTargetPointListener();
|
||||
}
|
||||
|
||||
public void setShowMenu() {
|
||||
|
|
|
@ -786,6 +786,12 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateLayout() {
|
||||
if (menu != null) {
|
||||
runLayoutListener();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFromIcon() {
|
||||
if (menu != null) {
|
||||
menu.updateFromIcon(mainView);
|
||||
|
|
|
@ -24,6 +24,12 @@ public abstract class BaseCard {
|
|||
boolean showBottomShadow;
|
||||
protected boolean nightMode;
|
||||
|
||||
private CardListener listener;
|
||||
|
||||
public interface CardListener {
|
||||
void onCardLayoutNeeded();
|
||||
}
|
||||
|
||||
public BaseCard(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
this.app = mapActivity.getMyApplication();
|
||||
|
@ -39,6 +45,21 @@ public abstract class BaseCard {
|
|||
}
|
||||
}
|
||||
|
||||
public CardListener getListener() {
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void setListener(CardListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setLayoutNeeded() {
|
||||
CardListener listener = this.listener;
|
||||
if (listener != null) {
|
||||
listener.onCardLayoutNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void updateContent();
|
||||
|
||||
public View build(Context ctx) {
|
||||
|
|
|
@ -71,6 +71,7 @@ public class PreviousRouteCard extends BaseCard {
|
|||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
AndroidUtils.setTextSecondaryColor(app, (TextView) view.findViewById(R.id.prev_route_card_title), nightMode);
|
||||
AndroidUtils.setTextSecondaryColor(app, (TextView) view.findViewById(R.id.start_title), nightMode);
|
||||
AndroidUtils.setTextPrimaryColor(app, (TextView) view.findViewById(R.id.destination_title), nightMode);
|
||||
Drawable img = app.getUIUtilities().getIcon(R.drawable.ic_action_previous_route, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||
|
|
|
@ -1,25 +1,148 @@
|
|||
package net.osmand.plus.routepreparationmenu.cards;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class TracksCard extends BaseCard {
|
||||
|
||||
public TracksCard(MapActivity mapActivity) {
|
||||
private List<GPXFile> gpxFiles;
|
||||
private boolean showLimited = true;
|
||||
private List<GpxDataItem> dataItems;
|
||||
|
||||
private static class GpxItem {
|
||||
String title;
|
||||
GPXFile file;
|
||||
GPXInfo info;
|
||||
|
||||
GpxItem(String title, GPXFile file, GPXInfo info) {
|
||||
this.title = title;
|
||||
this.file = file;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
public TracksCard(MapActivity mapActivity, List<GPXFile> gpxFiles) {
|
||||
super(mapActivity);
|
||||
this.gpxFiles = gpxFiles;
|
||||
this.dataItems = app.getGpxDatabase().getItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCardLayoutId() {
|
||||
return 0;
|
||||
return R.layout.gpx_route_card;
|
||||
}
|
||||
|
||||
|
||||
private GpxDataItem getDataItem(GPXInfo info) {
|
||||
for (GpxDataItem item : dataItems) {
|
||||
if (item.getFile().getAbsolutePath().endsWith(info.getFileName())) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
final List<GpxItem> list = new ArrayList<>();
|
||||
for (GPXFile gpx : gpxFiles) {
|
||||
File f = new File(gpx.path);
|
||||
list.add(new GpxItem(GpxUiHelper.getGpxTitle(f.getName()), gpx, new GPXInfo(f.getName(), f.lastModified(), f.length())));
|
||||
}
|
||||
Collections.sort(list, new Comparator<GpxItem>() {
|
||||
@Override
|
||||
public int compare(GpxItem i1, GpxItem i2) {
|
||||
return i1.title.toLowerCase().compareTo(i2.title.toLowerCase());
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayout tracks = (LinearLayout) view.findViewById(R.id.items);
|
||||
tracks.removeAllViews();
|
||||
|
||||
int minCardHeight = app.getResources().getDimensionPixelSize(R.dimen.route_info_card_item_height);
|
||||
int listContentPadding = app.getResources().getDimensionPixelSize(R.dimen.list_content_padding);
|
||||
int listTextPadding = app.getResources().getDimensionPixelSize(R.dimen.route_info_list_text_padding);
|
||||
|
||||
int i = 0;
|
||||
boolean showLimitExceeds = list.size() > 4;
|
||||
LayoutInflater inflater = mapActivity.getLayoutInflater();
|
||||
for (final GpxItem item : list) {
|
||||
if (showLimitExceeds && i >= 3 && showLimited) {
|
||||
break;
|
||||
}
|
||||
View v = inflater.inflate(R.layout.gpx_track_item, tracks, false);
|
||||
GpxUiHelper.updateGpxInfoView(v, item.title, item.info, getDataItem(item.info), false, app);
|
||||
|
||||
View div = v.findViewById(R.id.divider);
|
||||
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(div.getLayoutParams().width, div.getLayoutParams().height);
|
||||
p.setMargins(listTextPadding, 0, 0, 0);
|
||||
div.setLayoutParams(p);
|
||||
div.setVisibility(i == 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
ImageView img = (ImageView) v.findViewById(R.id.icon);
|
||||
img.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_polygom_dark, R.color.color_distance));
|
||||
img.setVisibility(View.VISIBLE);
|
||||
LinearLayout container = (LinearLayout) v.findViewById(R.id.container);
|
||||
container.setMinimumHeight(minCardHeight);
|
||||
container.setPadding(listContentPadding, 0, 0, 0);
|
||||
v.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mapActivity.getMapActions().setGPXRouteParams(item.file);
|
||||
app.getTargetPointsHelper().updateRouteAndRefresh(true);
|
||||
app.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
||||
}
|
||||
});
|
||||
tracks.addView(v);
|
||||
i++;
|
||||
}
|
||||
|
||||
View showAllButton = view.findViewById(R.id.show_all_button);
|
||||
if (showLimited && showLimitExceeds) {
|
||||
((TextView) view.findViewById(R.id.show_all_title)).setText(
|
||||
String.format("%s — %d", app.getString(R.string.shared_string_show_all).toUpperCase(), list.size()));
|
||||
showAllButton.setVisibility(View.VISIBLE);
|
||||
showAllButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showLimited = false;
|
||||
updateContent();
|
||||
setLayoutNeeded();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showAllButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
((TextView) view.findViewById(R.id.gpx_card_title)).setText(
|
||||
String.format("%s — %d", app.getString(R.string.tracks_on_map), list.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
|
||||
AndroidUtils.setTextSecondaryColor(app, (TextView) view.findViewById(R.id.gpx_card_title), nightMode);
|
||||
((TextView) view.findViewById(R.id.show_all_title)).setTextColor(mapActivity.getResources().getColor(
|
||||
nightMode ? R.color.color_dialog_buttons_dark : R.color.color_dialog_buttons_light));
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.card_content), nightMode, R.color.route_info_bg_light, R.color.route_info_bg_dark);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.divider), nightMode, R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.divider_list), nightMode, R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@ import android.support.v4.view.ViewPropertyAnimatorListener;
|
|||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
@ -56,7 +54,6 @@ import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
|||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.search.QuickSearchDialogFragment;
|
||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||
|
||||
|
@ -416,7 +413,6 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
if (!hasTargets) {
|
||||
//getTargets().restoreTargetPoints(false);
|
||||
if (getTargets().getPointToNavigate() == null) {
|
||||
mapActivity.getMapActions().setFirstMapMarkerAsTarget();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue