Merge branch 'master' of https://github.com/osmandapp/Osmand
|
@ -281,13 +281,13 @@ public class NativeLibrary {
|
|||
return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
|
||||
}
|
||||
|
||||
public static void loadFontData(String dir) {
|
||||
File dr = new File(dir);
|
||||
if (dr.listFiles() == null) {
|
||||
public void loadFontData(File dr) {
|
||||
File[] lf = dr.listFiles();
|
||||
if (lf == null) {
|
||||
System.err.println("No fonts loaded from " + dr.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
ArrayList<File> lst = new ArrayList<File>(Arrays.asList(dr.listFiles()));
|
||||
ArrayList<File> lst = new ArrayList<File>(Arrays.asList(lf));
|
||||
Collections.sort(lst, new Comparator<File>() {
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package net.osmand.util;
|
||||
/* Can be commented out in order to run the main function separately */
|
||||
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -21,7 +16,6 @@ import java.util.Calendar;
|
|||
* if the OSM feature is open at a certain time.
|
||||
*/
|
||||
public class OpeningHoursParser {
|
||||
private static final Log LOG = PlatformUtil.getLog(OpeningHoursParser.class);
|
||||
private static final String[] daysStr = new String[] {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
|
||||
private static final String[] monthsStr = new String[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
|
@ -113,15 +107,6 @@ public class OpeningHoursParser {
|
|||
public String getCurrentRuleTime(Calendar cal) {
|
||||
String ruleOpen = null;
|
||||
String ruleClosed = null;
|
||||
for (OpeningHoursRule r : rules){
|
||||
if(r.containsDay(cal) && r.containsMonth(cal)){
|
||||
if(r.isOpenedForTime(cal, false)) {
|
||||
ruleOpen = r.toRuleString(true);
|
||||
} else {
|
||||
ruleClosed = r.toRuleString(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (OpeningHoursRule r : rules){
|
||||
if(r.containsPreviousDay(cal) && r.containsMonth(cal)){
|
||||
if(r.isOpenedForTime(cal, true)) {
|
||||
|
@ -131,6 +116,16 @@ public class OpeningHoursParser {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (OpeningHoursRule r : rules){
|
||||
if(r.containsDay(cal) && r.containsMonth(cal)){
|
||||
if(r.isOpenedForTime(cal, false)) {
|
||||
ruleOpen = r.toRuleString(true);
|
||||
} else {
|
||||
ruleClosed = r.toRuleString(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ruleOpen != null) {
|
||||
return ruleOpen;
|
||||
}
|
||||
|
@ -726,8 +721,8 @@ public class OpeningHoursParser {
|
|||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new SimpleDateFormat("dd.MM.yyyy HH:mm").parse(time));
|
||||
boolean calculated = hours.isOpenedForTime(cal);
|
||||
System.out.printf(" %sok: Expected %s: %b = %b\n",
|
||||
((calculated != expected) ? "NOT " : ""), time, expected, calculated);
|
||||
System.out.printf(" %sok: Expected %s: %b = %b (rule %s)\n",
|
||||
((calculated != expected) ? "NOT " : ""), time, expected, calculated, hours.getCurrentRuleTime(cal));
|
||||
if(calculated != expected) {
|
||||
throw new IllegalArgumentException("BUG!!!");
|
||||
}
|
||||
|
@ -741,6 +736,12 @@ public class OpeningHoursParser {
|
|||
testOpened("09.08.2012 11:00", hours, true);
|
||||
testOpened("09.08.2012 16:00", hours, false);
|
||||
|
||||
hours = parseOpenedHours("Mo-Fr 11:30-15:00,17:30-23:00; Sa-Su,PH 11:30-23:00");
|
||||
System.out.println(hours);
|
||||
testOpened("7.09.2015 14:54", hours, true);
|
||||
testOpened("7.09.2015 15:05", hours, false);
|
||||
|
||||
|
||||
// two time and date ranges
|
||||
hours = parseOpenedHours("Mo-We, Fr 08:30-14:40,15:00-19:00"); //$NON-NLS-1$
|
||||
System.out.println(hours);
|
||||
|
|
1
OsmAnd/.gitignore
vendored
|
@ -3,6 +3,7 @@ dist/
|
|||
res/values/no_translate.xml
|
||||
assets/specialphrases/*
|
||||
assets/voice/*
|
||||
assets/fonts/*
|
||||
gen/
|
||||
local.properties
|
||||
raw/
|
||||
|
|
|
@ -43,14 +43,11 @@
|
|||
<asset source="voice/ru/config.p" destination="voice/ru/_config.p" mode="overwriteOnlyIfExists" />
|
||||
|
||||
|
||||
<!-- TODO delete deprecated
|
||||
<asset source="voice/fr-ov/config.p" destination="voice/fr/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/he-ov/config.p" destination="voice/he/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/it-Chiara-ov/config.p" destination="voice/it-Chiara/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/it-Roberto-ov/config.p" destination="voice/it-Roberto/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/ru2-ov/config.p" destination="voice/ru2/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/ru3-ov/config.p" destination="voice/ru3/_config.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/sk-Ruzena-ov/config.p" destination="voice/sk-Ruzena/_config.p" mode="overwriteOnlyIfExists" />
|
||||
-->
|
||||
<asset source="fonts/OpenSans-Italic.ttf" destination="fonts/OpenSans-Italic.ttf" mode="alwaysOverwriteOrCopy" />
|
||||
<asset source="fonts/OpenSans-Regular.ttf" destination="fonts/OpenSans-Regular.ttf" mode="alwaysOverwriteOrCopy" />
|
||||
<asset source="fonts/OpenSans-Semibold.ttf" destination="fonts/OpenSans-Semibold.ttf" mode="alwaysOverwriteOrCopy" />
|
||||
<asset source="fonts/OpenSans-SemiboldItalic.ttf" destination="fonts/OpenSans-SemiboldItalic.ttf" mode="alwaysOverwriteOrCopy" />
|
||||
|
||||
|
||||
<asset source="sounds/camera_click.ogg" destination="sounds/camera_click.ogg" mode="copyOnlyIfDoesNotExist" />
|
||||
</assets>
|
||||
|
|
|
@ -19,7 +19,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "23.0.0"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
|
@ -190,6 +190,14 @@ task collectVoiceAssets(type: Sync) {
|
|||
include "**/*.p"
|
||||
}
|
||||
|
||||
|
||||
task collectFonts(type: Copy) {
|
||||
from "../../resources/fonts"
|
||||
from "../../resources/rendering_styles/fonts/OpenSans"
|
||||
into "assets/fonts"
|
||||
include "*.ttf"
|
||||
}
|
||||
|
||||
task collectHelpContentsAssets(type: Sync) {
|
||||
from "../../help/help"
|
||||
into "assets/help"
|
||||
|
@ -237,6 +245,7 @@ task copyStyleIcons(type: Copy) {
|
|||
|
||||
task collectExternalResources << {}
|
||||
collectExternalResources.dependsOn collectVoiceAssets,
|
||||
collectFonts,
|
||||
collectHelpContentsAssets,
|
||||
collectRoutingResources,
|
||||
collectRenderingStylesResources,
|
||||
|
|
|
@ -81,6 +81,14 @@
|
|||
<include name="voice/**/*.p" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="assets/fonts">
|
||||
<fileset dir="../../resources/fonts">
|
||||
<include name="*.ttf" />
|
||||
</fileset>
|
||||
<fileset dir="../../resources/rendering_styles/fonts/OpenSans">
|
||||
<include name="*.ttf" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="res/">
|
||||
<fileset dir="../../resources/rendering_styles/style-icons/" >
|
||||
<include name="**/*" />
|
||||
|
|
BIN
OsmAnd/res/drawable-hdpi/bg_contextmenu_dots_dark.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
OsmAnd/res/drawable-hdpi/bg_contextmenu_dots_light.9.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
OsmAnd/res/drawable-hdpi/bg_contextmenu_dots_light.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
OsmAnd/res/drawable-hdpi/bg_shadow_gorizontal.9.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-mdpi/bg_contextmenu_dots_dark.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-mdpi/bg_contextmenu_dots_light.9.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
OsmAnd/res/drawable-mdpi/bg_contextmenu_dots_light.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-mdpi/bg_shadow_gorizontal.9.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-xhdpi/bg_contextmenu_dots_dark.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
OsmAnd/res/drawable-xhdpi/bg_contextmenu_dots_light.9.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
OsmAnd/res/drawable-xhdpi/bg_contextmenu_dots_light.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
OsmAnd/res/drawable-xhdpi/bg_shadow_gorizontal.9.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/bg_contextmenu_dots_dark.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/bg_contextmenu_dots_light.9.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/bg_contextmenu_dots_light.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/bg_shadow_gorizontal.9.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
|
@ -7,23 +7,17 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_shadow_layout"
|
||||
android:id="@+id/context_menu_shadow_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/context_menu_shadow_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
android:layout_weight="0"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_main"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/bg_map_context_menu"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -43,11 +37,11 @@
|
|||
<ImageView
|
||||
android:id="@+id/context_menu_icon_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="center"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:src="@drawable/ic_action_building_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -56,7 +50,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -68,8 +62,7 @@
|
|||
android:layout_marginRight="12dp"
|
||||
android:text="@string/search_address_building"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/context_menu_line2"
|
||||
|
@ -77,7 +70,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/other_location"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
@ -113,8 +106,7 @@
|
|||
android:id="@+id/context_menu_buttons"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_gravity="bottom">
|
||||
android:layout_height="54dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/context_menu_route_button"
|
||||
|
@ -169,7 +161,7 @@
|
|||
android:layout_weight="1"
|
||||
android:scaleType="center"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:src="@drawable/ic_action_core_overflow_dark"/>
|
||||
android:src="@drawable/ic_overflow_menu_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -177,7 +169,8 @@
|
|||
android:id="@+id/context_menu_bottom_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/ctx_menu_info_view_bg">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -189,4 +182,13 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_bottom_border"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -74,6 +74,12 @@
|
|||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:lines="1"
|
||||
android:singleLine="true"
|
||||
android:scrollHorizontally="true"
|
||||
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
|
|
|
@ -355,14 +355,14 @@
|
|||
<string name="poi_chalet">Udlejningshytte</string>
|
||||
|
||||
<string name="poi_place_of_worship">Sted for tilbedelse</string>
|
||||
<string name="poi_religion_christian">Sted for tilbedelse: Kristen</string>
|
||||
<string name="poi_religion_jewish">Sted for tilbedelse: Jødisk</string>
|
||||
<string name="poi_religion_muslim">Sted for tilbedelse: Muslim</string>
|
||||
<string name="poi_religion_sikh">Sted for tilbedelse: Sikh</string>
|
||||
<string name="poi_religion_buddhist">Sted for tilbedelse: Buddhist</string>
|
||||
<string name="poi_religion_hindu">Sted for tilbedelse: Hindu</string>
|
||||
<string name="poi_religion_shinto">Sted for tilbedelse: Shinto</string>
|
||||
<string name="poi_religion_taoist">Sted for tilbedelse: Taoistisk</string>
|
||||
<string name="poi_religion_christian">Kristendom</string>
|
||||
<string name="poi_religion_jewish">Jødedom</string>
|
||||
<string name="poi_religion_muslim">Islam</string>
|
||||
<string name="poi_religion_sikh">Sikhisme</string>
|
||||
<string name="poi_religion_buddhist">Buddhisme</string>
|
||||
<string name="poi_religion_hindu">Hinduisme</string>
|
||||
<string name="poi_religion_shinto">Shinto</string>
|
||||
<string name="poi_religion_taoist">Taoisme</string>
|
||||
<string name="poi_monastery">Kloster</string>
|
||||
<string name="poi_historic_monastery">Historisk kloster</string>
|
||||
<string name="poi_wayside_cross">Vejside kors</string>
|
||||
|
@ -1080,7 +1080,7 @@
|
|||
<string name="poi_financial">Finansiel kontor</string>
|
||||
<string name="poi_foundation">Fondskontor</string>
|
||||
<string name="poi_religion_voodoo">Voodoo</string>
|
||||
<string name="poi_religion_scientologist">Scientolog</string>
|
||||
<string name="poi_religion_scientologist">Scientology</string>
|
||||
<string name="poi_denomination_catholic">Katolsk</string>
|
||||
<string name="poi_denomination_baptist">Baptist</string>
|
||||
<string name="poi_denomination_roman_catholic">Romersk-katolsk</string>
|
||||
|
@ -1117,11 +1117,11 @@
|
|||
<string name="poi_denomination_coptic_orthodox">Koptisk-ortodoks</string>
|
||||
<string name="poi_denomination_mahayana">Mahayana</string>
|
||||
|
||||
<string name="poi_religion_unitarian_universalist">Unitarisk universalistisk</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitarisk universalisme</string>
|
||||
<string name="poi_religion_multifaith">Multireligiøs</string>
|
||||
<string name="poi_religion_jain">Jainisme</string>
|
||||
<string name="poi_religion_spiritualist">Spiritist</string>
|
||||
<string name="poi_religion_bahai">Bahai</string>
|
||||
<string name="poi_religion_spiritualist">Spiritisme</string>
|
||||
<string name="poi_religion_bahai">Bahaism</string>
|
||||
<string name="poi_religion_pagan">Hedenskab</string>
|
||||
<string name="poi_religion_tenrikyo">Tenrikyo</string>
|
||||
<string name="poi_religion_zoroastrian">Zarathustrisme</string>
|
||||
|
|
|
@ -1938,7 +1938,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
|
|||
<string name="download_additional_maps">Fehlende Karten herunterladen: %1$s (%2$d MB)?</string>
|
||||
<string name="shared_string_more">Mehr…</string>
|
||||
<string name="osmo_specify_tracker_id">Bitte ID eingeben</string>
|
||||
<string name="home">Ausgangsposition</string>
|
||||
<string name="home">Übersicht</string>
|
||||
<string name="rendering_attr_publicTransportMode_name">Bus-, Oberleitungsbus-, Sammeltaxi-Linien</string>
|
||||
<string name="record_plugin_name">Streckenaufzeichnung</string>
|
||||
<string name="int_hour">h</string>
|
||||
|
|
|
@ -862,7 +862,7 @@
|
|||
<string name="poi_garden_furniture">Almacén de jardinería</string>
|
||||
<string name="poi_leather">Marroquinería</string>
|
||||
<string name="poi_tyres">Neumáticos</string>
|
||||
<string name="poi_watches">Relojería (watches)</string>
|
||||
<string name="poi_watches">Relojería</string>
|
||||
<string name="poi_games">Juegos</string>
|
||||
<string name="poi_model">Modelos a escala</string>
|
||||
<string name="poi_trophy">Trofeos, premios</string>
|
||||
|
@ -1157,4 +1157,12 @@
|
|||
<string name="poi_content_slurry">Mezcla (contenido)</string>
|
||||
<string name="poi_brownfield">Terreno abandonado</string>
|
||||
<string name="poi_greenfield">Suelo urbanizable</string>
|
||||
<string name="poi_wholesale">Venta mayorista</string>
|
||||
|
||||
<string name="poi_trade_building_supplies">Materiales de construcción</string>
|
||||
<string name="poi_trade_plumbing">Suministros de plomería</string>
|
||||
<string name="poi_trade_wood">Venta de madera</string>
|
||||
<string name="poi_trade_agricultural_supplies">Suministros agrícolas</string>
|
||||
<string name="poi_trade_tile">Venta de azulejos</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1160,4 +1160,12 @@
|
|||
|
||||
<string name="poi_brownfield">Terreno abandonado</string>
|
||||
<string name="poi_greenfield">Suelo urbanizable</string>
|
||||
<string name="poi_wholesale">Venta mayorista</string>
|
||||
|
||||
<string name="poi_trade_building_supplies">Materiales de construcción</string>
|
||||
<string name="poi_trade_plumbing">Materiales de fontanería/plomería</string>
|
||||
<string name="poi_trade_wood">Suministros de madera</string>
|
||||
<string name="poi_trade_agricultural_supplies">Insumos agrícolas</string>
|
||||
<string name="poi_trade_tile">Azulejos</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -2185,4 +2185,5 @@
|
|||
<string name="working_days">Días laborales</string>
|
||||
<string name="recent_places">Lugares recientes</string>
|
||||
<string name="favourites">Favoritos</string>
|
||||
<string name="poi_action_delete">borrar</string>
|
||||
</resources>
|
||||
|
|
|
@ -517,14 +517,14 @@
|
|||
<string name="poi_hunting_lodge">Pavilhão de caça</string>
|
||||
|
||||
<string name="poi_place_of_worship">Lugar de prática religiosa</string>
|
||||
<string name="poi_religion_christian">Lugar de culto: cristão</string>
|
||||
<string name="poi_religion_jewish">Lugar de culto: judaico</string>
|
||||
<string name="poi_religion_muslim">Lugar de culto: muçulmano</string>
|
||||
<string name="poi_religion_sikh">Lugar de culto: siquista</string>
|
||||
<string name="poi_religion_buddhist">Lugar de culto: budista</string>
|
||||
<string name="poi_religion_hindu">Lugar de culto: hindu</string>
|
||||
<string name="poi_religion_shinto">Lugar de culto: xintoísta</string>
|
||||
<string name="poi_religion_taoist">Lugar de culto: taoísta</string>
|
||||
<string name="poi_religion_christian">Cristianismo</string>
|
||||
<string name="poi_religion_jewish">Judaísmo</string>
|
||||
<string name="poi_religion_muslim">Islamismo</string>
|
||||
<string name="poi_religion_sikh">Sikhismo</string>
|
||||
<string name="poi_religion_buddhist">Budismo</string>
|
||||
<string name="poi_religion_hindu">Hinduísmo</string>
|
||||
<string name="poi_religion_shinto">Xintoísmo</string>
|
||||
<string name="poi_religion_taoist">Taoísmo</string>
|
||||
|
||||
<string name="poi_internet_access_wlan">Acesso à Internet: wlan</string>
|
||||
<string name="poi_internet_access_terminal">Acesso à Internet: terminal</string>
|
||||
|
@ -1064,18 +1064,18 @@
|
|||
|
||||
<string name="poi_religion_voodoo">Voodoo</string>
|
||||
<string name="poi_religion_multifaith">Multirreligiosa</string>
|
||||
<string name="poi_religion_spiritualist">Espiritualista</string>
|
||||
<string name="poi_religion_bahai">Bahai</string>
|
||||
<string name="poi_religion_scientologist">Cientologista</string>
|
||||
<string name="poi_religion_pagan">Pagão</string>
|
||||
<string name="poi_religion_spiritualist">Espiritualismo</string>
|
||||
<string name="poi_religion_bahai">Bahaísmo</string>
|
||||
<string name="poi_religion_scientologist">Cientologismo</string>
|
||||
<string name="poi_religion_pagan">Paganismo</string>
|
||||
<string name="poi_religion_zoroastrian">Zoroastrismo</string>
|
||||
|
||||
<string name="poi_denomination_catholic">Católica</string>
|
||||
<string name="poi_denomination_baptist">Batista</string>
|
||||
<string name="poi_denomination_roman_catholic">Católica romana</string>
|
||||
<string name="poi_denomination_orthodox">Ortodoxo</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitário-Universalista</string>
|
||||
<string name="poi_religion_jain">Jainista</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitário-Universalismo</string>
|
||||
<string name="poi_religion_jain">Jainismo</string>
|
||||
<string name="poi_religion_tenrikyo">Tenrikyo</string>
|
||||
<string name="poi_denomination_lutheran">Luterana</string>
|
||||
<string name="poi_denomination_sunni">Sunita</string>
|
||||
|
@ -1158,4 +1158,12 @@
|
|||
<string name="poi_content_salt">Sal (conteúdo)</string>
|
||||
<string name="poi_content_grain">Grão (conteúdo)</string>
|
||||
|
||||
<string name="poi_wholesale">Atacado</string>
|
||||
|
||||
<string name="poi_trade_building_supplies">Materiais de construção</string>
|
||||
<string name="poi_trade_plumbing">Material de canalização</string>
|
||||
<string name="poi_trade_agricultural_supplies">Suprimentos agrícolas</string>
|
||||
<string name="poi_trade_wood">Suprimentos de madeira</string>
|
||||
<string name="poi_trade_tile">Suprimentos de telha</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -437,14 +437,14 @@
|
|||
<string name="poi_chalet">Шале</string>
|
||||
|
||||
<string name="poi_place_of_worship">Место поклонения</string>
|
||||
<string name="poi_religion_christian">Храм, церковь (часовня)</string>
|
||||
<string name="poi_religion_jewish">Синагога</string>
|
||||
<string name="poi_religion_muslim">Мечеть</string>
|
||||
<string name="poi_religion_sikh">Место поклонения: сикхизм</string>
|
||||
<string name="poi_religion_buddhist">Место поклонения: буддизм</string>
|
||||
<string name="poi_religion_hindu">Место поклонения: индуизм</string>
|
||||
<string name="poi_religion_shinto">Место поклонения: синтоизм</string>
|
||||
<string name="poi_religion_taoist">Место поклонения: даосизм</string>
|
||||
<string name="poi_religion_christian">Христианство</string>
|
||||
<string name="poi_religion_jewish">Иудаизм</string>
|
||||
<string name="poi_religion_muslim">Мусульманство</string>
|
||||
<string name="poi_religion_sikh">Сикхизм</string>
|
||||
<string name="poi_religion_buddhist">Буддизм</string>
|
||||
<string name="poi_religion_hindu">Индуизм</string>
|
||||
<string name="poi_religion_shinto">Синтоизм</string>
|
||||
<string name="poi_religion_taoist">Даосизм</string>
|
||||
<string name="poi_monastery">Монастырь</string>
|
||||
<string name="poi_historic_monastery">Исторический монастырь</string>
|
||||
<string name="poi_wayside_cross">Придорожный крест</string>
|
||||
|
|
|
@ -508,14 +508,14 @@
|
|||
<string name="poi_hunting_lodge">狩獵小屋</string>
|
||||
|
||||
<string name="poi_place_of_worship">宗教場所</string>
|
||||
<string name="poi_religion_christian">宗教場所:基督教</string>
|
||||
<string name="poi_religion_jewish">宗教場所:猶太教</string>
|
||||
<string name="poi_religion_muslim">宗教場所:回教</string>
|
||||
<string name="poi_religion_sikh">宗教場所:錫克教</string>
|
||||
<string name="poi_religion_buddhist">宗教場所:佛教</string>
|
||||
<string name="poi_religion_hindu">宗教場所:印度教</string>
|
||||
<string name="poi_religion_shinto">宗教場所:日本神道教</string>
|
||||
<string name="poi_religion_taoist">宗教場所:道教</string>
|
||||
<string name="poi_religion_christian">基督教</string>
|
||||
<string name="poi_religion_jewish">猶太教</string>
|
||||
<string name="poi_religion_muslim">回教</string>
|
||||
<string name="poi_religion_sikh">錫克教</string>
|
||||
<string name="poi_religion_buddhist">佛教</string>
|
||||
<string name="poi_religion_hindu">印度教</string>
|
||||
<string name="poi_religion_shinto">神道教</string>
|
||||
<string name="poi_religion_taoist">道教</string>
|
||||
|
||||
<string name="poi_internet_access_wlan">網際網路存取:無線網路</string>
|
||||
<string name="poi_internet_access_terminal">網際網路存取:終端</string>
|
||||
|
@ -940,7 +940,7 @@
|
|||
<string name="poi_access_permissive">容許通行</string>
|
||||
<string name="poi_access_customers">顧客通行</string>
|
||||
<string name="poi_access_delivery">交貨通行</string>
|
||||
<string name="poi_access_agricultural">農用通路</string>
|
||||
<string name="poi_access_agricultural">農產通路</string>
|
||||
|
||||
<string name="poi_monitoring_station">監測站</string>
|
||||
<string name="poi_capital">首都</string>
|
||||
|
@ -1156,4 +1156,12 @@
|
|||
<string name="poi_content_salt">鹽 (內容)</string>
|
||||
<string name="poi_content_grain">榖物 (內容)</string>
|
||||
|
||||
<string name="poi_wholesale">批發商</string>
|
||||
|
||||
<string name="poi_trade_building_supplies">建材供應商</string>
|
||||
<string name="poi_trade_plumbing">配管供應商</string>
|
||||
<string name="poi_trade_wood">木材供應商</string>
|
||||
<string name="poi_trade_agricultural_supplies">農藝供應商</string>
|
||||
<string name="poi_trade_tile">磚瓦供應商</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<attr name="bg_color" format="reference" />
|
||||
<attr name="bg_card" format="reference" />
|
||||
<attr name="bg_map_context_menu" format="reference" />
|
||||
<attr name="ctx_menu_info_view_bg" format="reference" />
|
||||
|
||||
<attr name="dashboard_divider" format="reference" />
|
||||
<attr name="dashboard_button" format="reference" />
|
||||
|
|
|
@ -58,6 +58,13 @@
|
|||
<color name="icon_color">#727272</color>
|
||||
<color name="icon_color_light">#ccc</color>
|
||||
|
||||
<color name="ctx_menu_info_view_bg_light">#eaeaea</color>
|
||||
<color name="ctx_menu_info_view_bg_dark">#292f33</color>
|
||||
<color name="ctx_menu_info_text_light">#212121</color>
|
||||
<color name="ctx_menu_info_text_dark">#b4c3cc</color>
|
||||
<color name="ctx_menu_info_divider_light">#d9d9d9</color>
|
||||
<color name="ctx_menu_info_divider_dark">#333b40</color>
|
||||
|
||||
<color name="dashboard_gpx_on_map">#448AFF</color>
|
||||
<color name="dashboard_background">#eaeaea</color>
|
||||
<color name="dashboard_divider_light">#F0F0F0</color>
|
||||
|
|
|
@ -627,24 +627,24 @@
|
|||
<string name="poi_hunting_lodge">Hunting lodge</string>
|
||||
|
||||
<string name="poi_place_of_worship">Place of worship</string>
|
||||
<string name="poi_religion_christian">Place of worship: christian</string>
|
||||
<string name="poi_religion_jewish">Place of worship: jewish</string>
|
||||
<string name="poi_religion_muslim">Place of worship: muslim</string>
|
||||
<string name="poi_religion_sikh">Place of worship: sikh</string>
|
||||
<string name="poi_religion_buddhist">Place of worship: buddhist</string>
|
||||
<string name="poi_religion_hindu">Place of worship: hindu</string>
|
||||
<string name="poi_religion_shinto">Place of worship: shinto</string>
|
||||
<string name="poi_religion_taoist">Place of worship: taoist</string>
|
||||
<string name="poi_religion_christian">Сhristianity</string>
|
||||
<string name="poi_religion_jewish">Judaism</string>
|
||||
<string name="poi_religion_muslim">Islam</string>
|
||||
<string name="poi_religion_sikh">Sikhism</string>
|
||||
<string name="poi_religion_buddhist">Buddhism</string>
|
||||
<string name="poi_religion_hindu">Hinduism</string>
|
||||
<string name="poi_religion_shinto">Shinto</string>
|
||||
<string name="poi_religion_taoist">Taoism</string>
|
||||
<string name="poi_religion_voodoo">Voodoo</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitarian universalist</string>
|
||||
<string name="poi_religion_unitarian_universalist">Unitarian universalism</string>
|
||||
<string name="poi_religion_multifaith">Multifaith</string>
|
||||
<string name="poi_religion_jain">Jain</string>
|
||||
<string name="poi_religion_spiritualist">Spiritualist</string>
|
||||
<string name="poi_religion_bahai">Bahai</string>
|
||||
<string name="poi_religion_scientologist">Scientologist</string>
|
||||
<string name="poi_religion_pagan">Pagan</string>
|
||||
<string name="poi_religion_jain">Jainism</string>
|
||||
<string name="poi_religion_spiritualist">Spiritualism</string>
|
||||
<string name="poi_religion_bahai">Bahaism</string>
|
||||
<string name="poi_religion_scientologist">Scientologism</string>
|
||||
<string name="poi_religion_pagan">Paganism</string>
|
||||
<string name="poi_religion_tenrikyo">Tenrikyo</string>
|
||||
<string name="poi_religion_zoroastrian">Zoroastrian</string>
|
||||
<string name="poi_religion_zoroastrian">Zoroastrism</string>
|
||||
|
||||
<string name="poi_denomination_catholic">Catholic</string>
|
||||
<string name="poi_denomination_baptist">Baptist</string>
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
|
||||
<item name="dashboard_divider">@color/dashboard_divider_light</item>
|
||||
<item name="dashboard_button">@drawable/dashboard_button_light</item>
|
||||
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_light</item>
|
||||
<item name="search_background">@color/search_background_dark</item>
|
||||
<item name="actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
|
||||
<item name="actionModeStyle">@style/WhiteActionMode</item>
|
||||
|
@ -160,6 +161,7 @@
|
|||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_dark</item>
|
||||
<item name="dashboard_divider">@color/dashboard_divider_dark</item>
|
||||
<item name="dashboard_button">@drawable/dashboard_button_dark</item>
|
||||
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_dark</item>
|
||||
<item name="search_background">@color/color_white</item>
|
||||
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
|
||||
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>
|
||||
|
|
|
@ -442,11 +442,16 @@ public class AppInitializer implements IProgress {
|
|||
osmandSettings.NATIVE_RENDERING_FAILED.set(true);
|
||||
startTask(app.getString(R.string.init_native_library), -1);
|
||||
RenderingRulesStorage storage = app.getRendererRegistry().getCurrentSelectedRenderer();
|
||||
boolean initialized = NativeOsmandLibrary.getLibrary(storage, app) != null;
|
||||
NativeOsmandLibrary lib = NativeOsmandLibrary.getLibrary(storage, app);
|
||||
boolean initialized = lib != null;
|
||||
osmandSettings.NATIVE_RENDERING_FAILED.set(false);
|
||||
if (!initialized) {
|
||||
LOG.info("Native library could not be loaded!");
|
||||
} else {
|
||||
File ls = app.getAppPath("fonts");
|
||||
lib.loadFontData(ls);
|
||||
}
|
||||
|
||||
}
|
||||
app.getResourceManager().initMapBoundariesCacheNative();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class IconsCache {
|
|||
d = app.getResources().getDrawable(resId).mutate();
|
||||
d.clearColorFilter();
|
||||
if (clrId != 0) {
|
||||
d.setColorFilter(app.getResources().getColor(clrId), PorterDuff.Mode.MULTIPLY);
|
||||
d.setColorFilter(app.getResources().getColor(clrId), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
drawable.put(hash, d);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class IconsCache {
|
|||
if(d == null) {
|
||||
d = app.getResources().getDrawable(resId).mutate();
|
||||
d.clearColorFilter();
|
||||
d.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
|
||||
d.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
drawable.put(hash, d);
|
||||
}
|
||||
return d;
|
||||
|
|
|
@ -84,7 +84,7 @@ public class OsmAndLocationSimulation {
|
|||
@Override
|
||||
public boolean processResult(GPXUtilities.GPXFile[] result) {
|
||||
GPXRouteParamsBuilder builder = new GPXRouteParamsBuilder(result[0], app.getSettings());
|
||||
startAnimationThread(app.getRoutingHelper(), ma, builder.getPoints(), true,
|
||||
startAnimationThread(app, builder.getPoints(), true,
|
||||
speedup.getProgress() + 1);
|
||||
return true;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class OsmAndLocationSimulation {
|
|||
if(currentRoute.isEmpty()) {
|
||||
AccessibleToast.makeText(app, R.string.animate_routing_route_not_calculated, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
startAnimationThread(app.getRoutingHelper(), ma, new ArrayList<Location>(currentRoute), false, 1);
|
||||
startAnimationThread(app, new ArrayList<Location>(currentRoute), false, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,7 @@ public class OsmAndLocationSimulation {
|
|||
}
|
||||
}
|
||||
|
||||
private void startAnimationThread(final RoutingHelper routingHelper,
|
||||
final MapActivity ma, final List<Location> directions, final boolean useLocationTime, final float coeff) {
|
||||
private void startAnimationThread(final OsmandApplication app, final List<Location> directions, final boolean useLocationTime, final float coeff) {
|
||||
final float time = 1.5f;
|
||||
routeAnimation = new Thread() {
|
||||
@Override
|
||||
|
@ -148,7 +147,7 @@ public class OsmAndLocationSimulation {
|
|||
current.setBearing(prev.bearingTo(current));
|
||||
}
|
||||
final Location toset = current;
|
||||
ma.runOnUiThread(new Runnable() {
|
||||
app.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
provider.setLocationFromSimulation(toset);
|
||||
|
|
|
@ -125,6 +125,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
private boolean intentLocation = false;
|
||||
|
||||
private DashboardOnMap dashboardOnMap = new DashboardOnMap(this);
|
||||
private MapContextMenu contextMenuOnMap;
|
||||
private AppInitializeListener initListener;
|
||||
private IMapDownloaderCallback downloaderCallback;
|
||||
private DrawerLayout drawerLayout;
|
||||
|
@ -156,6 +157,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
app = getMyApplication();
|
||||
settings = app.getSettings();
|
||||
app.applyTheme(this);
|
||||
contextMenuOnMap = new MapContextMenu(app);
|
||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(savedInstanceState);
|
||||
// Full screen is not used here
|
||||
|
@ -249,9 +251,6 @@ public class MapActivity extends AccessibleActivity {
|
|||
});
|
||||
|
||||
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
||||
MapContextMenu.getInstance().setApp(app);
|
||||
MapContextMenu.getInstance().setMapActivity(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -975,6 +974,10 @@ public class MapActivity extends AccessibleActivity {
|
|||
return dashboardOnMap;
|
||||
}
|
||||
|
||||
public MapContextMenu getContextMenu() {
|
||||
return contextMenuOnMap;
|
||||
}
|
||||
|
||||
public void openDrawer() {
|
||||
drawerLayout.openDrawer(Gravity.LEFT);
|
||||
}
|
||||
|
|
|
@ -548,6 +548,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
recordControl = null;
|
||||
mapInfoLayer.recreateControls();
|
||||
}
|
||||
recordControl = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,6 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
|
||||
|
||||
public boolean isShowViewAngle() {
|
||||
|
||||
return showViewAngle;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.sections.AmenityInfoMenuController;
|
||||
import net.osmand.plus.mapcontextmenu.sections.MenuController;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
|
@ -19,7 +21,6 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
public class MapContextMenu {
|
||||
|
||||
private MapActivity mapActivity;
|
||||
private OsmandApplication app;
|
||||
private OsmandSettings settings;
|
||||
|
||||
|
@ -28,7 +29,7 @@ public class MapContextMenu {
|
|||
|
||||
private String foundStreetName;
|
||||
|
||||
public boolean isMenuVisible() {
|
||||
public boolean isMenuVisible(MapActivity mapActivity) {
|
||||
return mapActivity.getSupportFragmentManager().findFragmentByTag("MapContextMenuFragment") != null;
|
||||
}
|
||||
|
||||
|
@ -40,29 +41,15 @@ public class MapContextMenu {
|
|||
return object;
|
||||
}
|
||||
|
||||
public void setMapActivity(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
}
|
||||
|
||||
public void setApp(OsmandApplication app) {
|
||||
public MapContextMenu(OsmandApplication app) {
|
||||
this.app = app;
|
||||
settings = app.getSettings();
|
||||
}
|
||||
|
||||
private static MapContextMenu ourInstance = new MapContextMenu();
|
||||
public void show(MapActivity mapActivity, PointDescription pointDescription, Object object) {
|
||||
|
||||
public static MapContextMenu getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private MapContextMenu() {
|
||||
|
||||
}
|
||||
|
||||
public void show(PointDescription pointDescription, Object object) {
|
||||
|
||||
if (isMenuVisible())
|
||||
hide();
|
||||
if (isMenuVisible(mapActivity))
|
||||
hide(mapActivity);
|
||||
|
||||
this.pointDescription = pointDescription;
|
||||
this.object = object;
|
||||
|
@ -73,7 +60,7 @@ public class MapContextMenu {
|
|||
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
public void hide(MapActivity mapActivity) {
|
||||
|
||||
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag("MapContextMenuFragment");
|
||||
if (fragment != null)
|
||||
|
@ -137,29 +124,29 @@ public class MapContextMenu {
|
|||
return Algorithms.isEmpty(res) ? "Address is unknown yet" : res; // todo: text constant
|
||||
}
|
||||
|
||||
public String getLocationStr() {
|
||||
public String getLocationStr(MapActivity mapActivity) {
|
||||
if (foundStreetName == null)
|
||||
return pointDescription.getLocationName(mapActivity, true).replaceAll("\n", "");
|
||||
else
|
||||
return foundStreetName;
|
||||
}
|
||||
|
||||
public BottomSectionBuilder getBottomSectionBuilder() {
|
||||
public MenuController getMenuController() {
|
||||
|
||||
if (object != null) {
|
||||
if (object instanceof Amenity) {
|
||||
return new InfoSectionBuilder(app, (Amenity)object);
|
||||
return new AmenityInfoMenuController(app, (Amenity)object);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void buttonNavigatePressed() {
|
||||
public void buttonNavigatePressed(MapActivity mapActivity) {
|
||||
mapActivity.getMapActions().showNavigationContextMenuPoint(pointDescription.getLat(), pointDescription.getLon());
|
||||
}
|
||||
|
||||
public void buttonFavoritePressed() {
|
||||
public void buttonFavoritePressed(MapActivity mapActivity) {
|
||||
if (object != null && object instanceof FavouritePoint) {
|
||||
mapActivity.getMapActions().editFavoritePoint((FavouritePoint)object);
|
||||
} else {
|
||||
|
@ -167,11 +154,11 @@ public class MapContextMenu {
|
|||
}
|
||||
}
|
||||
|
||||
public void buttonSharePressed() {
|
||||
public void buttonSharePressed(MapActivity mapActivity) {
|
||||
mapActivity.getMapActions().shareLocation(pointDescription.getLat(), pointDescription.getLon());
|
||||
}
|
||||
|
||||
public void buttonMorePressed() {
|
||||
public void buttonMorePressed(MapActivity mapActivity) {
|
||||
final ContextMenuAdapter menuAdapter = new ContextMenuAdapter(mapActivity);
|
||||
if (object != null) {
|
||||
for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
|
||||
|
|
|
@ -2,13 +2,18 @@ package net.osmand.plus.mapcontextmenu;
|
|||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
|
@ -19,9 +24,12 @@ import net.osmand.plus.IconsCache;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.sections.MenuController;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
|
||||
public class MapContextMenuFragment extends Fragment {
|
||||
|
||||
|
@ -30,8 +38,16 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
private View view;
|
||||
private View mainView;
|
||||
private View bottomView;
|
||||
private View shadowView;
|
||||
private View bottomBorder;
|
||||
|
||||
private float mainViewHeight;
|
||||
MenuController menuController;
|
||||
|
||||
private int menuTopHeight;
|
||||
private int menuButtonsHeight;
|
||||
private int menuBottomViewHeight;
|
||||
private int menuFullHeight;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
@ -74,7 +90,39 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
|
||||
|
||||
View shadowView = view.findViewById(R.id.context_menu_shadow_view);
|
||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
|
||||
menuTopHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
|
||||
menuButtonsHeight = view.findViewById(R.id.context_menu_buttons).getHeight();
|
||||
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
||||
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
|
||||
|
||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
obs.removeOnGlobalLayoutListener(this);
|
||||
} else {
|
||||
obs.removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
|
||||
doLayoutMenu();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
bottomBorder = view.findViewById(R.id.context_menu_bottom_border);
|
||||
bottomBorder.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
shadowView = view.findViewById(R.id.context_menu_shadow_view);
|
||||
shadowView.setOnTouchListener(new View.OnTouchListener() {
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
dismissMenu();
|
||||
|
@ -84,32 +132,103 @@ public class MapContextMenuFragment extends Fragment {
|
|||
|
||||
View topView = view.findViewById(R.id.context_menu_top_view);
|
||||
mainView = view.findViewById(R.id.context_menu_main);
|
||||
//LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(400));
|
||||
//mainView.setLayoutParams(lp);
|
||||
|
||||
topView.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
||||
private float dy;
|
||||
private float dyMain;
|
||||
private int destinationState;
|
||||
private VelocityTracker velocity;
|
||||
private boolean slidingUp;
|
||||
private boolean slidingDown;
|
||||
|
||||
private float velocityY;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
dy = event.getY();
|
||||
mainViewHeight = mainView.getHeight();
|
||||
dyMain = mainView.getY();
|
||||
velocity = VelocityTracker.obtain();
|
||||
velocityY = 0;
|
||||
velocity.addMovement(event);
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
float y = event.getY();
|
||||
mainView.setY(mainView.getY() + (y - dy));
|
||||
float newY = mainView.getY() + (y - dy);
|
||||
mainView.setY(newY);
|
||||
|
||||
ViewGroup.LayoutParams lp = bottomBorder.getLayoutParams();
|
||||
lp.height = (int)(view.getHeight() - newY - menuFullHeight) + 10;
|
||||
bottomBorder.setLayoutParams(lp);
|
||||
bottomBorder.setY(newY + menuFullHeight);
|
||||
bottomBorder.requestLayout();
|
||||
|
||||
velocity.addMovement(event);
|
||||
velocity.computeCurrentVelocity(1000);
|
||||
float vel = Math.abs(velocity.getYVelocity());
|
||||
if (vel > velocityY)
|
||||
velocityY = vel;
|
||||
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
|
||||
float posY = view.getHeight() - mainViewHeight;
|
||||
if (mainView.getY() != posY)
|
||||
slidingUp = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) < -50;
|
||||
slidingDown = Math.abs(velocityY) > 500 && (mainView.getY() - dyMain) > 50;
|
||||
|
||||
velocity.recycle();
|
||||
|
||||
if (menuController != null) {
|
||||
if (slidingUp) {
|
||||
menuController.slideUp();
|
||||
} else if (slidingDown) {
|
||||
menuController.slideDown();
|
||||
}
|
||||
destinationState = menuController.getCurrentMenuState();
|
||||
} else {
|
||||
destinationState = MenuController.MenuState.HEADER_ONLY;
|
||||
}
|
||||
|
||||
float posY = 0;
|
||||
switch (destinationState) {
|
||||
case MenuController.MenuState.HEADER_ONLY:
|
||||
posY = view.getHeight() - (menuFullHeight - menuBottomViewHeight);
|
||||
break;
|
||||
case MenuController.MenuState.HALF_SCREEN:
|
||||
posY = view.getHeight() - menuFullHeight;
|
||||
break;
|
||||
case MenuController.MenuState.FULL_SCREEN:
|
||||
posY = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float minY = Math.min(posY, mainView.getY());
|
||||
lp = bottomBorder.getLayoutParams();
|
||||
lp.height = (int)(view.getHeight() - minY - menuFullHeight) + 10;
|
||||
if (lp.height < 0)
|
||||
lp.height = 0;
|
||||
bottomBorder.setLayoutParams(lp);
|
||||
bottomBorder.requestLayout();
|
||||
|
||||
if (mainView.getY() != posY) {
|
||||
mainView.animate().y(posY).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
||||
bottomBorder.animate().y(posY + menuFullHeight).setDuration(200).setInterpolator(new DecelerateInterpolator()).start();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
lp = shadowView.getLayoutParams();
|
||||
lp.height = view.getHeight() - (int)posY;
|
||||
shadowView.setLayoutParams(lp);
|
||||
shadowView.requestLayout();
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
|
@ -122,7 +241,7 @@ public class MapContextMenuFragment extends Fragment {
|
|||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
|
||||
int iconId = MapContextMenu.getInstance().getLeftIconId();
|
||||
int iconId = getCtxMenu().getLeftIconId();
|
||||
|
||||
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
||||
final ImageView iconView = (ImageView)view.findViewById(R.id.context_menu_icon_view);
|
||||
|
@ -130,21 +249,21 @@ public class MapContextMenuFragment extends Fragment {
|
|||
iconLayout.setVisibility(View.GONE);
|
||||
} else {
|
||||
iconView.setImageDrawable(iconsCache.getIcon(iconId,
|
||||
light ? R.color.icon_color : R.color.icon_color_light));
|
||||
light ? R.color.osmand_orange : R.color.osmand_orange_dark));
|
||||
}
|
||||
|
||||
// Text line 1
|
||||
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
|
||||
line1.setText(MapContextMenu.getInstance().getAddressStr());
|
||||
line1.setText(getCtxMenu().getAddressStr());
|
||||
|
||||
// Text line 2
|
||||
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
|
||||
line2.setText(MapContextMenu.getInstance().getLocationStr());
|
||||
line2.setText(getCtxMenu().getLocationStr(getMapActivity()));
|
||||
|
||||
// Close button
|
||||
final ImageView closeButtonView = (ImageView)view.findViewById(R.id.context_menu_close_btn_view);
|
||||
closeButtonView.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color_light : R.color.dash_search_icon_dark));
|
||||
closeButtonView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -156,99 +275,109 @@ public class MapContextMenuFragment extends Fragment {
|
|||
// Action buttons
|
||||
final ImageButton buttonNavigate = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
||||
buttonNavigate.setImageDrawable(iconsCache.getIcon(R.drawable.map_directions,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonNavigate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonNavigatePressed();
|
||||
getCtxMenu().buttonNavigatePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_fav_dark,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonFavoritePressed();
|
||||
getCtxMenu().buttonFavoritePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
||||
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.abc_ic_menu_share_mtrl_alpha,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonShare.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonSharePressed();
|
||||
getCtxMenu().buttonSharePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
||||
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_core_overflow_dark,
|
||||
light ? R.color.actionbar_dark_color : R.color.actionbar_light_color));
|
||||
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.ic_overflow_menu_white,
|
||||
light ? R.color.icon_color : R.color.dash_search_icon_dark));
|
||||
buttonMore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapContextMenu.getInstance().buttonMorePressed();
|
||||
getCtxMenu().buttonMorePressed(getMapActivity());
|
||||
}
|
||||
});
|
||||
|
||||
// Bottom view
|
||||
BottomSectionBuilder bottomSectionBuilder = MapContextMenu.getInstance().getBottomSectionBuilder();
|
||||
if (bottomSectionBuilder != null) {
|
||||
View bottomView = view.findViewById(R.id.context_menu_bottom_view);
|
||||
// Menu controller
|
||||
menuController = getCtxMenu().getMenuController();
|
||||
bottomView = view.findViewById(R.id.context_menu_bottom_view);
|
||||
if (menuController != null) {
|
||||
bottomView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
bottomSectionBuilder.buildSection(bottomView);
|
||||
menuController.build(bottomView);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setTitle(R.string.poi_create_title);
|
||||
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
|
||||
fragmentManager.beginTransaction().remove(MapContextMenuFragment.this).commit();
|
||||
fragmentManager.popBackStack();
|
||||
}
|
||||
});
|
||||
|
||||
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
|
||||
String basicTitle = getResources().getString(R.string.tab_title_basic);
|
||||
String extendedTitle = getResources().getString(R.string.tab_title_advanced);
|
||||
MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
|
||||
viewPager.setAdapter(pagerAdapter);
|
||||
|
||||
final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
|
||||
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
|
||||
|
||||
// Hack due to bug in design support library v22.2.1
|
||||
// https://code.google.com/p/android/issues/detail?id=180462
|
||||
// TODO remove in new version
|
||||
if (ViewCompat.isLaidOut(tabLayout)) {
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
} else {
|
||||
tabLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
tabLayout.removeOnLayoutChangeListener(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
return view;
|
||||
}
|
||||
|
||||
private void doLayoutMenu() {
|
||||
int shadowViewHeight = 0;
|
||||
int bottomBorderHeight = 0;
|
||||
|
||||
int menuState;
|
||||
if (menuController != null)
|
||||
menuState = menuController.getCurrentMenuState();
|
||||
else
|
||||
menuState = MenuController.MenuState.HEADER_ONLY;
|
||||
|
||||
switch (menuState) {
|
||||
case MenuController.MenuState.HEADER_ONLY:
|
||||
shadowViewHeight = view.getHeight() - (menuFullHeight - menuBottomViewHeight);
|
||||
bottomBorderHeight = 0;
|
||||
break;
|
||||
case MenuController.MenuState.HALF_SCREEN:
|
||||
int maxHeight = (int)(menuController.getHalfScreenMaxHeightKoef() * view.getHeight());
|
||||
if (maxHeight > menuFullHeight) {
|
||||
shadowViewHeight = view.getHeight() - menuFullHeight;
|
||||
bottomBorderHeight = 0;
|
||||
} else {
|
||||
shadowViewHeight = view.getHeight() - maxHeight;
|
||||
bottomBorderHeight = 0;
|
||||
mainView.setY(shadowViewHeight);
|
||||
}
|
||||
break;
|
||||
case MenuController.MenuState.FULL_SCREEN:
|
||||
shadowViewHeight = 0;
|
||||
bottomBorderHeight = view.getHeight() - menuFullHeight;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ViewGroup.LayoutParams lp = bottomBorder.getLayoutParams();
|
||||
lp.height = bottomBorderHeight + 10;
|
||||
bottomBorder.setLayoutParams(lp);
|
||||
bottomBorder.setY(view.getHeight() - bottomBorderHeight);
|
||||
|
||||
lp = shadowView.getLayoutParams();
|
||||
lp.height = shadowViewHeight;
|
||||
shadowView.setLayoutParams(lp);
|
||||
|
||||
lp = mainView.getLayoutParams();
|
||||
lp.height = menuFullHeight;
|
||||
mainView.setLayoutParams(lp);
|
||||
|
||||
}
|
||||
|
||||
public void dismissMenu() {
|
||||
getActivity().getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
|
@ -267,5 +396,29 @@ public class MapContextMenuFragment extends Fragment {
|
|||
.add(R.id.fragmentContainer, fragment, "MapContextMenuFragment")
|
||||
.addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
private MapContextMenu getCtxMenu() {
|
||||
return ((MapActivity)getActivity()).getContextMenu();
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
return (MapActivity)getActivity();
|
||||
}
|
||||
|
||||
// Utils
|
||||
private int getScreenHeight() {
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
return dm.heightPixels;
|
||||
}
|
||||
|
||||
private int dpToPx(float dp) {
|
||||
Resources r = getActivity().getResources();
|
||||
return (int) TypedValue.applyDimension(
|
||||
COMPLEX_UNIT_DIP,
|
||||
dp,
|
||||
r.getDisplayMetrics()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
package net.osmand.plus.mapcontextmenu.sections;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
@ -15,37 +18,40 @@ import net.osmand.osm.MapPoiTypes;
|
|||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
public class InfoSectionBuilder extends BottomSectionBuilder {
|
||||
public class AmenityInfoMenuBuilder extends MenuBuilder {
|
||||
|
||||
private final Amenity amenity;
|
||||
|
||||
public InfoSectionBuilder(OsmandApplication app, final Amenity amenity) {
|
||||
public AmenityInfoMenuBuilder(OsmandApplication app, final Amenity amenity) {
|
||||
super(app);
|
||||
this.amenity = amenity;
|
||||
}
|
||||
|
||||
private void buildRow(View view, int iconId, String text) {
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
|
||||
LinearLayout ll = new LinearLayout(view.getContext());
|
||||
ll.setOrientation(LinearLayout.HORIZONTAL);
|
||||
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) ;
|
||||
llParams.setMargins(0, dpToPx(10f), 0, dpToPx(10f));
|
||||
//llParams.setMargins(0, dpToPx(14f), 0, dpToPx(14f));
|
||||
ll.setLayoutParams(llParams);
|
||||
|
||||
// Icon
|
||||
LinearLayout llIcon = new LinearLayout(view.getContext());
|
||||
llIcon.setOrientation(LinearLayout.HORIZONTAL);
|
||||
llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(42f), ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f)));
|
||||
llIcon.setGravity(Gravity.CENTER_VERTICAL);
|
||||
ll.addView(llIcon);
|
||||
|
||||
ImageView icon = new ImageView(view.getContext());
|
||||
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) ;
|
||||
llIconParams.setMargins(dpToPx(12f), 0, 0, 0);
|
||||
llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f));
|
||||
llIconParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
icon.setLayoutParams(llIconParams);
|
||||
icon.setScaleType(ImageView.ScaleType.CENTER);
|
||||
|
@ -55,18 +61,28 @@ public class InfoSectionBuilder extends BottomSectionBuilder {
|
|||
// Text
|
||||
LinearLayout llText = new LinearLayout(view.getContext());
|
||||
llText.setOrientation(LinearLayout.VERTICAL);
|
||||
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
llTextParams.setMargins(0, dpToPx(4f), 0, dpToPx(4f));
|
||||
llText.setLayoutParams(llTextParams);
|
||||
ll.addView(llText);
|
||||
|
||||
TextView textView = new TextView(view.getContext());
|
||||
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
llTextParams.setMargins(0, dpToPx(8f), 0, dpToPx(8f));
|
||||
textView.setLayoutParams(llTextParams);
|
||||
textView.setTextSize(18); // todo: create constant
|
||||
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
|
||||
|
||||
SpannableString spannable = new SpannableString(text);
|
||||
Linkify.addLinks(spannable, Linkify.ALL);
|
||||
textView.setClickable(true);
|
||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
textView.setLinksClickable(true);
|
||||
|
||||
textView.setText(spannable);
|
||||
//textView.setText("sdf dsaf fsdasdfg adsf asdsfd asdf sdf adsfg asdf sdfa sdf dsf agsfdgd fgsfd sdf asdf adg adf sdf asdf dfgdfsg sdfg adsf asdf asdf sdf SDF ASDF ADSF ASDF ASDF DAF SDAF dfg dsfg dfg sdfg rg rth sfghs dfgs dfgsdfg adfg dfg sdfg dfs ");
|
||||
|
||||
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
llTextViewParams.setMargins(dpToPx(10f), 0, dpToPx(10f), 0);
|
||||
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
|
||||
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
llText.setLayoutParams(llTextViewParams);
|
||||
textView.setText(text);
|
||||
//textView.setText("sdf dsaf fsdasdfg adsf asdsfd asdf sdf adsfg asdf sdfa sdf dsf agsfdgd fgsfd sdf asdf adg adf sdf asdf dfgdfsg sdfg adsf asdf asdf sdf SDF ASDF ADSF ASDF ASDF DAF SDAF dfg dsfg dfg sdfg rg rth sfghs dfgs dfgsdfg adfg dfg sdfg dfs ");
|
||||
llText.addView(textView);
|
||||
|
||||
((LinearLayout)view).addView(ll);
|
||||
|
@ -75,11 +91,8 @@ public class InfoSectionBuilder extends BottomSectionBuilder {
|
|||
LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f));
|
||||
llHorLineParams.gravity = Gravity.BOTTOM;
|
||||
horizontalLine.setLayoutParams(llHorLineParams);
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = view.getContext().getTheme();
|
||||
theme.resolveAttribute(R.attr.dashboard_divider, typedValue, true);
|
||||
int color = typedValue.data;
|
||||
horizontalLine.setBackgroundColor(color);
|
||||
|
||||
horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_info_divider_light : R.color.ctx_menu_info_divider_dark));
|
||||
|
||||
((LinearLayout)view).addView(horizontalLine);
|
||||
}
|
||||
|
@ -94,33 +107,37 @@ public class InfoSectionBuilder extends BottomSectionBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void buildSection(View view) {
|
||||
public void build(View view) {
|
||||
|
||||
MapPoiTypes poiTypes = app.getPoiTypes();
|
||||
for(Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
||||
int iconId = 0;
|
||||
int iconId;
|
||||
String key = e.getKey();
|
||||
String vl = e.getValue();
|
||||
if(key.startsWith("name:")) {
|
||||
continue;
|
||||
} else if(Amenity.OPENING_HOURS.equals(key)) {
|
||||
iconId = R.drawable.mm_clock; // todo: change icon
|
||||
iconId = R.drawable.ic_action_time;
|
||||
} else if(Amenity.PHONE.equals(key)) {
|
||||
iconId = R.drawable.mm_amenity_telephone; // todo: change icon
|
||||
iconId = R.drawable.ic_action_call_dark;
|
||||
} else if(Amenity.WEBSITE.equals(key)) {
|
||||
iconId = R.drawable.mm_internet_access; // todo: change icon
|
||||
iconId = R.drawable.ic_world_globe_dark;
|
||||
} else {
|
||||
iconId = R.drawable.ic_type_info; // todo: change icon
|
||||
if (Amenity.DESCRIPTION.equals(key)) {
|
||||
iconId = R.drawable.ic_action_note_dark;
|
||||
} else {
|
||||
iconId = R.drawable.ic_action_info_dark;
|
||||
}
|
||||
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(e.getKey());
|
||||
if (pt != null) {
|
||||
if(pt instanceof PoiType && !((PoiType) pt).isText()) {
|
||||
vl = pt.getTranslation();
|
||||
} else {
|
||||
vl = /*pt.getTranslation() + ": " + */amenity.unzipContent(e.getValue());
|
||||
vl = pt.getTranslation() + ": " + amenity.unzipContent(e.getValue());
|
||||
}
|
||||
} else {
|
||||
vl = /*Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) +
|
||||
": " + */amenity.unzipContent(e.getValue());
|
||||
vl = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()) +
|
||||
": " + amenity.unzipContent(e.getValue());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package net.osmand.plus.mapcontextmenu.sections;
|
||||
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
||||
public class AmenityInfoMenuController extends MenuController {
|
||||
|
||||
public AmenityInfoMenuController(OsmandApplication app, final Amenity amenity) {
|
||||
super(new AmenityInfoMenuBuilder(app, amenity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportedMenuStates() {
|
||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
package net.osmand.plus.mapcontextmenu.sections;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
|
@ -7,15 +7,15 @@ import net.osmand.plus.IconsCache;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public abstract class BottomSectionBuilder {
|
||||
public abstract class MenuBuilder {
|
||||
|
||||
protected OsmandApplication app;
|
||||
|
||||
public BottomSectionBuilder(OsmandApplication app) {
|
||||
public MenuBuilder(OsmandApplication app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public abstract void buildSection(View view);
|
||||
public abstract void build(View view);
|
||||
|
||||
public Drawable getRowIcon(int iconId) {
|
||||
IconsCache iconsCache = app.getIconsCache();
|
|
@ -0,0 +1,72 @@
|
|||
package net.osmand.plus.mapcontextmenu.sections;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public abstract class MenuController {
|
||||
|
||||
public class MenuState {
|
||||
public static final int HEADER_ONLY = 1;
|
||||
public static final int HALF_SCREEN = 2;
|
||||
public static final int FULL_SCREEN = 4;
|
||||
}
|
||||
|
||||
private MenuBuilder builder;
|
||||
private int currentMenuState;
|
||||
|
||||
public MenuController(MenuBuilder builder) {
|
||||
this.builder = builder;
|
||||
this.currentMenuState = getInitialMenuState();
|
||||
}
|
||||
|
||||
public void build(View rootView) {
|
||||
builder.build(rootView);
|
||||
}
|
||||
|
||||
public int getInitialMenuState() {
|
||||
return MenuState.HEADER_ONLY;
|
||||
}
|
||||
|
||||
public int getSupportedMenuStates() {
|
||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||
}
|
||||
|
||||
public int getCurrentMenuState() {
|
||||
return currentMenuState;
|
||||
}
|
||||
|
||||
public boolean slideUp() {
|
||||
int v = currentMenuState;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
v = v << 1;
|
||||
if ((v & getSupportedMenuStates()) != 0) {
|
||||
currentMenuState = v;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean slideDown() {
|
||||
int v = currentMenuState;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
v = v >> 1;
|
||||
if ((v & getSupportedMenuStates()) != 0) {
|
||||
currentMenuState = v;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setCurrentMenuState(int currentMenuState) {
|
||||
this.currentMenuState = currentMenuState;
|
||||
}
|
||||
|
||||
public float getHalfScreenMaxHeightKoef() {
|
||||
return .6f;
|
||||
}
|
||||
|
||||
public boolean shouldShowButtons() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,6 @@ import net.osmand.data.RotatedTileBox;
|
|||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -511,7 +510,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
this.latLon = new LatLon(pointDescription.getLat(), pointDescription.getLon());
|
||||
|
||||
showMapContextMenuMarker();
|
||||
MapContextMenu.getInstance().show(pointDescription, selectedObj);
|
||||
activity.getContextMenu().show(activity, pointDescription, selectedObj);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class PointLocationLayer extends OsmandMapLayer {
|
|||
|
||||
|
||||
private RectF getHeadingRect(int locationX, int locationY){
|
||||
int rad = (int) (view.getDensity() * 35);
|
||||
int rad = (int) (view.getDensity() * 60);
|
||||
return new RectF(locationX - rad, locationY - rad, locationX + rad, locationY + rad);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
@ -11,6 +12,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -31,7 +33,7 @@ import alice.tuprolog.Term;
|
|||
import alice.tuprolog.Theory;
|
||||
import alice.tuprolog.Var;
|
||||
|
||||
public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
|
||||
public abstract class AbstractPrologCommandPlayer implements CommandPlayer, StateChangedListener<ApplicationMode> {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(AbstractPrologCommandPlayer.class);
|
||||
|
||||
|
@ -56,6 +58,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
|
|||
protected int streamType;
|
||||
private int currentVersion;
|
||||
|
||||
|
||||
protected AbstractPrologCommandPlayer(OsmandApplication ctx, String voiceProvider, String configFile, int[] sortedVoiceVersions)
|
||||
throws CommandPlayerException
|
||||
{
|
||||
|
@ -91,6 +94,15 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
|
|||
"alice.tuprolog.lib.ISOLibrary"/*, "alice.tuprolog.lib.IOLibrary"*/};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateChanged(ApplicationMode change) {
|
||||
prologSystem.getTheoryManager().retract(new Struct("appMode", new Var()));
|
||||
prologSystem.getTheoryManager()
|
||||
.assertA(
|
||||
new Struct("appMode", new Struct(ctx.getSettings().APPLICATION_MODE.get().getStringKey()
|
||||
.toLowerCase())), true, "", true);
|
||||
}
|
||||
|
||||
private void init(String voiceProvider, OsmandSettings settings, String configFile) throws CommandPlayerException {
|
||||
prologSystem.clearTheory();
|
||||
voiceDir = null;
|
||||
|
@ -123,7 +135,11 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
|
|||
if(m.getParent() != null) {
|
||||
m = m.getParent();
|
||||
}
|
||||
prologSystem.addTheory(new Theory("appMode('"+m.getStringKey().toLowerCase()+"')."));
|
||||
settings.APPLICATION_MODE.addListener(this);
|
||||
prologSystem.getTheoryManager()
|
||||
.assertA(
|
||||
new Struct("appMode", new Struct(ctx.getSettings().APPLICATION_MODE.get().getStringKey()
|
||||
.toLowerCase())), true, "", true);
|
||||
prologSystem.addTheory(new Theory("measure('"+mc.toTTSString()+"')."));
|
||||
prologSystem.addTheory(new Theory(config));
|
||||
config.close();
|
||||
|
@ -150,6 +166,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected Term solveSimplePredicate(String predicate) {
|
||||
Term val = null;
|
||||
Var v = new Var("MyVariable"); //$NON-NLS-1$
|
||||
|
|
|
@ -6,7 +6,7 @@ dependencies {
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
|
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 7
|
||||
|
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/*___Generated_by_IDEA___*/
|
||||
|
||||
package net.osmand.addressPlugin;
|
||||
|
||||
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = Boolean.parseBoolean(null);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
/*___Generated_by_IDEA___*/
|
||||
|
||||
package net.osmand.addressPlugin;
|
||||
|
||||
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
|
||||
public final class Manifest {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
/*___Generated_by_IDEA___*/
|
||||
|
||||
package net.osmand.addressPlugin;
|
||||
|
||||
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
|
||||
public final class R {
|
||||
}
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
|
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
|
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
4
plugins/Osmand-Sherpafy/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
bin
|
||||
gen
|
||||
raw
|
||||
obj
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Osmand-Sherpafy</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.osmand.sherpafy"
|
||||
android:versionCode="6"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="16" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
<supports-screens android:resizeable="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"
|
||||
android:xlargeScreens="true" android:anyDensity="true" />
|
||||
<application
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name" >
|
||||
<activity
|
||||
android:name=".SherpafyPluginActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,67 +0,0 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
storeFile file("../../keystores/debug.keystore")
|
||||
storePassword "android"
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword "android"
|
||||
}
|
||||
|
||||
publishing {
|
||||
storeFile file("../../osmand_key")
|
||||
storePassword System.getenv("OSMAND_APK_PASSWORD")
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword System.getenv("OSMAND_APK_PASSWORD")
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 21
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
jni.srcDirs = []
|
||||
jniLibs.srcDirs = []
|
||||
aidl.srcDirs = ["src"]
|
||||
java.srcDirs = ["src"]
|
||||
resources.srcDirs = ["src"]
|
||||
renderscript.srcDirs = ["src"]
|
||||
res.srcDirs = ["res"]
|
||||
assets.srcDirs = ["assets"]
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.development
|
||||
}
|
||||
release {
|
||||
signingConfig signingConfigs.publishing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
ivy {
|
||||
name = "OsmAndBinariesIvy"
|
||||
url = "http://builder.osmand.net"
|
||||
layout "pattern", {
|
||||
artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
|
@ -1,14 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 10 KiB |
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="@string/parking_plugin_installed"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="shared_string_no">No</string>
|
||||
<string name="shared_string_yes">Yes</string>
|
||||
<string name="osmand_app_not_found">OsmAnd is not installed</string>
|
||||
<string name="app_name">Sherpafy</string>
|
||||
<string name="parking_plugin_installed">OsmAnd Sherpafy is installed and enabled in OsmAnd settings.</string>
|
||||
</resources>
|
|
@ -1,63 +0,0 @@
|
|||
package net.osmand.sherpafy;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class SherpafyPluginActivity extends Activity {
|
||||
private static final String OSMAND_COMPONENT = "net.osmand"; //$NON-NLS-1$
|
||||
private static final String OSMAND_COMPONENT_PLUS = "net.osmand.plus"; //$NON-NLS-1$
|
||||
private static final String OSMAND_ACTIVITY = "net.osmand.plus.sherpafy.TourViewActivity"; //$NON-NLS-1$
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
Intent intentPlus = new Intent();
|
||||
intentPlus.setComponent(new ComponentName(OSMAND_COMPONENT_PLUS, OSMAND_ACTIVITY));
|
||||
intentPlus.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
ResolveInfo resolved = getPackageManager().resolveActivity(intentPlus, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if(resolved != null) {
|
||||
stopService(intentPlus);
|
||||
startActivity(intentPlus);
|
||||
finish();
|
||||
} else {
|
||||
Intent intentNormal = new Intent();
|
||||
intentNormal.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
intentNormal.setComponent(new ComponentName(OSMAND_COMPONENT, OSMAND_ACTIVITY));
|
||||
resolved = getPackageManager().resolveActivity(intentNormal, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if (resolved != null) {
|
||||
stopService(intentNormal);
|
||||
intentNormal.putExtra("SHERPAFY", true);
|
||||
startActivity(intentNormal);
|
||||
finish();
|
||||
} else {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.osmand_app_not_found));
|
||||
builder.setPositiveButton(getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + OSMAND_COMPONENT_PLUS));
|
||||
try {
|
||||
stopService(intent);
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.shared_string_no), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
buildToolsVersion "23.0.1"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
|
|