diff --git a/OsmAnd-java/src/net/osmand/IndexConstants.java b/OsmAnd-java/src/net/osmand/IndexConstants.java
index d6834bcf4d..a829bbc47f 100644
--- a/OsmAnd-java/src/net/osmand/IndexConstants.java
+++ b/OsmAnd-java/src/net/osmand/IndexConstants.java
@@ -52,6 +52,7 @@ public class IndexConstants {
public static final String GPX_INDEX_DIR = "tracks/";
public static final String GPX_RECORDED_INDEX_DIR = GPX_INDEX_DIR + "rec/";
public static final String GPX_IMPORT_DIR = GPX_INDEX_DIR + "import/";
+
public static final String TILES_INDEX_DIR= "tiles/";
public static final String LIVE_INDEX_DIR= "live/";
public static final String TOURS_INDEX_DIR= "tours/";
@@ -59,6 +60,7 @@ public class IndexConstants {
public static final String ROADS_INDEX_DIR = "roads/"; //$NON-NLS-1$
public static final String WIKI_INDEX_DIR = "wiki/"; //$NON-NLS-1$
public static final String WIKIVOYAGE_INDEX_DIR = "travel/";
+ public static final String GPX_TRAVEL_DIR = GPX_INDEX_DIR + WIKIVOYAGE_INDEX_DIR;
public static final String AV_INDEX_DIR = "avnotes/"; //$NON-NLS-1$
public static final String FONT_INDEX_DIR = "fonts/"; //$NON-NLS-1$
public static final String VOICE_INDEX_DIR = "voice/"; //$NON-NLS-1$
diff --git a/OsmAnd/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch b/OsmAnd/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch
new file mode 100644
index 0000000000..c72add1121
--- /dev/null
+++ b/OsmAnd/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/OsmAnd/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch b/OsmAnd/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch
new file mode 100644
index 0000000000..a1a644495c
--- /dev/null
+++ b/OsmAnd/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/OsmAnd/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch b/OsmAnd/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch
new file mode 100644
index 0000000000..954c6ac82b
--- /dev/null
+++ b/OsmAnd/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/.gitignore b/OsmAnd/.gitignore
index 3bffb9f7b3..b6567d1d18 100644
--- a/OsmAnd/.gitignore
+++ b/OsmAnd/.gitignore
@@ -10,6 +10,8 @@ libs/org.*.jar
libs/commons-logging-commons-logging-api-1.1.jar
libs/fr.univ-valenciennes-bzip2-1.0.jar
libs/it.unibo.alice.tuprolog-tuprolog-3.2.1.jar
+libs/commons-codec-commons-codec-1.11.jar
+libs/OsmAndCore_android-0.1-SNAPSHOT.jar
valgrind/
bin/
diff --git a/OsmAnd/.project b/OsmAnd/.project
index 81f09b6a09..bf3e28b1a9 100644
--- a/OsmAnd/.project
+++ b/OsmAnd/.project
@@ -7,71 +7,33 @@
- org.eclipse.cdt.managedbuilder.core.genmakebuilder
-
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
- ?children?
- ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||
-
-
- ?name?
-
-
-
- org.eclipse.cdt.make.core.append_environment
- true
-
-
- org.eclipse.cdt.make.core.buildArguments
- ${ANDROID_NDK}/ndk-build
-
-
- org.eclipse.cdt.make.core.buildCommand
- sh
-
-
- org.eclipse.cdt.make.core.cleanBuildTarget
- clean
-
-
- org.eclipse.cdt.make.core.contents
- org.eclipse.cdt.make.core.activeConfigSettings
-
-
- org.eclipse.cdt.make.core.enableAutoBuild
- false
-
-
- org.eclipse.cdt.make.core.enableCleanBuild
- false
-
-
- org.eclipse.cdt.make.core.enableFullBuild
- false
-
-
- org.eclipse.cdt.make.core.fullBuildTarget
- V=1
-
-
- org.eclipse.cdt.make.core.stopOnError
- true
-
-
- org.eclipse.cdt.make.core.useDefaultBuildCmd
- false
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch
- com.android.ide.eclipse.adt.ResourceManagerBuilder
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch
+
- com.android.ide.eclipse.adt.PreCompilerBuilder
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch
+
diff --git a/OsmAnd/assets/article_style.css b/OsmAnd/assets/article_style.css
old mode 100644
new mode 100755
index 5562dbb38d..8c28ff57b7
--- a/OsmAnd/assets/article_style.css
+++ b/OsmAnd/assets/article_style.css
@@ -30,33 +30,62 @@ body {
}
h1 {
- font-size: 3em;
+ font-size: 2em;
color: #212121;
font-family: serif;
- font-weight: bold;
letter-spacing: 0.03em;
word-wrap: break-word;
padding-top: 5%;
-
+ font-weight: normal;
}
h2 {
- font-size: 2em;
+ font-size: 1.5em;
color: #454545;
font-family: serif;
- font-weight: bold;
word-wrap: break-word;
margin-top: 3%;
margin-bottom: 3%;
+ font-weight: normal;
+ line-height: 1.6em;
}
+h2.active:after {
+ transform: rotate(-135deg);
+ -webkit-transform: rotate(-135deg);
+ position: absolute;
+ right: 1em;
+}
+
+h2:after {
+ vertical-align: middle;
+ content: "";
+ border: solid black;
+ border-width: 0 3px 3px 0;
+ margin-top: 13px;
+ display: inline-block;
+ padding: 3px;
+ transform: rotate(45deg);
+ -webkit-transform: rotate(45deg);
+ position: absolute;
+ right: 1em;
+}
+
+/*
+.mw-headline {
+
+}
+*/
+
h3 {
color: #212121;
- font-size: 1.5em;
+ font-size: 1.2em;
font-family: sans-serif;
word-wrap: break-word;
+ font-weight: bold;
margin-top: 3%;
margin-bottom: 3%;
+ line-height: 1.6em;
}
p {
@@ -84,12 +113,6 @@ li {
font-size: 1.1em;
}
-.mw-headline {
- font-family: sans-serif;
- font-size: 1.1em;
- line-height: 1.6em;
- font-weight: bold;
-}
img {
width: 100%;
diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle
index e7a96711c7..eeff63d664 100644
--- a/OsmAnd/build.gradle
+++ b/OsmAnd/build.gradle
@@ -22,10 +22,18 @@ apply plugin: 'com.github.ksoichiro.eclipse.aar'
def analytics = (!System.getenv("APP_FEATURES") || System.getenv("APP_FEATURES").contains("+play_market")) &&
getGradle().getStartParameter().getTaskRequests().toString().contains("Free")
+
eclipseAar {
// See "Configurations" for details
androidTarget = 'android-27'
aarDependenciesDir = 'aarDependencies'
+ targetConfigurations = ['compile']
+
+// cleanLibsDirectoryEnabled = true
+}
+
+task printc {
+ configurations.each { if(it.isCanBeResolved()) println it.name }
}
android {
@@ -390,47 +398,47 @@ repositories {
project.logger.warn("Analytics enabled for free version: $analytics")
dependencies {
- compile project(path: ':OsmAnd-java', configuration: 'android')
+ implementation project(path: ':OsmAnd-java', configuration: 'android')
if (analytics) {
- compile 'com.google.firebase:firebase-core:12.0.1'
- compile 'com.google.firebase:firebase-messaging:12.0.1'
- compile 'com.google.firebase:firebase-iid:12.0.1'
- compile 'com.google.firebase:firebase-config:12.0.1'
- compile 'com.facebook.android:facebook-android-sdk:4.31.0'
+ implementation 'com.google.firebase:firebase-core:12.0.1'
+ implementation 'com.google.firebase:firebase-messaging:12.0.1'
+ implementation 'com.google.firebase:firebase-iid:12.0.1'
+ implementation 'com.google.firebase:firebase-config:12.0.1'
+ implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
}
- compile 'com.android.support:multidex:1.0.1'
- compile 'com.android.support:gridlayout-v7:27.1.0'
- compile 'com.android.support:cardview-v7:27.1.0'
- compile 'com.android.support:appcompat-v7:27.1.0'
- compile 'com.android.support:design:27.1.0'
- compile 'com.android.support:customtabs:27.1.0'
- compile fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
+ implementation 'com.android.support:multidex:1.0.1'
+ implementation 'com.android.support:gridlayout-v7:27.1.0'
+ implementation 'com.android.support:cardview-v7:27.1.0'
+ implementation 'com.android.support:appcompat-v7:27.1.0'
+ implementation 'com.android.support:design:27.1.0'
+ implementation 'com.android.support:customtabs:27.1.0'
+ implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
- compile 'commons-logging:commons-logging-api:1.1'
- compile 'commons-codec:commons-codec:1.11'
- compile 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
- compile 'org.beanshell:bsh-core:2.0b4'
- compile 'fr.univ-valenciennes:bzip2:1.0'
- compile 'com.moparisthebest:junidecode:0.1.1'
- compile 'org.immutables:gson:2.5.0'
- compile 'com.vividsolutions:jts-core:1.14.0'
+ implementation 'commons-logging:commons-logging-api:1.1'
+ implementation 'commons-codec:commons-codec:1.11'
+ implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
+ implementation 'org.beanshell:bsh-core:2.0b4'
+ implementation 'fr.univ-valenciennes:bzip2:1.0'
+ implementation 'com.moparisthebest:junidecode:0.1.1'
+ implementation 'org.immutables:gson:2.5.0'
+ implementation 'com.vividsolutions:jts-core:1.14.0'
- compile 'com.squareup.picasso:picasso:2.71828'
+ implementation 'com.squareup.picasso:picasso:2.71828'
// size restrictions
-// compile 'com.ibm.icu:icu4j:50.1'
-// compile 'net.sf.trove4j:trove4j:3.0.3'
+// implementation 'com.ibm.icu:icu4j:50.1'
+// implementation 'net.sf.trove4j:trove4j:3.0.3'
- legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
- qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
- qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
- qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
- qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
- compile ("com.getkeepsafe.taptargetview:taptargetview:1.6.1"){
+ legacyImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
+ qtcoredebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
+ qtcoredebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
+ qtcoreImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
+ qtcoreImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
+ implementation ("com.getkeepsafe.taptargetview:taptargetview:1.6.1"){
exclude group: 'com.android.support'
}
- compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
- compile ("com.github.HITGIF:TextFieldBoxes:1.3.5"){
+ implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
+ implementation ("com.github.HITGIF:TextFieldBoxes:1.3.5"){
exclude group: 'com.android.support'
}
}
diff --git a/OsmAnd/project.properties b/OsmAnd/project.properties
index d693eb2a9f..7dabf0f209 100644
--- a/OsmAnd/project.properties
+++ b/OsmAnd/project.properties
@@ -34,3 +34,5 @@ android.library.reference.19=aarDependencies/android.arch.lifecycle-viewmodel-1.
android.library.reference.20=aarDependencies/android.arch.lifecycle-livedata-core-1.1.0
android.library.reference.21=aarDependencies/com.android.support-transition-27.1.0
android.library.reference.22=aarDependencies/com.android.support-support-media-compat-27.1.0
+android.library.reference.23=aarDependencies/com.squareup.picasso-picasso-2.71828
+android.library.reference.24=aarDependencies/com.android.support-exifinterface-27.1.0
diff --git a/OsmAnd/res/layout/fragment_wikivoyage_article_dialog.xml b/OsmAnd/res/layout/fragment_wikivoyage_article_dialog.xml
index 787f1b54aa..5e871cf1bc 100644
--- a/OsmAnd/res/layout/fragment_wikivoyage_article_dialog.xml
+++ b/OsmAnd/res/layout/fragment_wikivoyage_article_dialog.xml
@@ -1,14 +1,11 @@
-
-
@@ -26,8 +23,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
-
@@ -55,13 +57,22 @@
+
+
+
-
-
-
+ android:layout_gravity="bottom"
+ android:layout_height="10dp"
+ android:background="@drawable/bg_contextmenu_shadow_top_light" />
+
+
-
+
+
+
+
-
+
diff --git a/OsmAnd/res/layout/fragment_wikivoyage_show_images_first_time.xml b/OsmAnd/res/layout/fragment_wikivoyage_show_images_first_time.xml
new file mode 100644
index 0000000000..ec891a84cb
--- /dev/null
+++ b/OsmAnd/res/layout/fragment_wikivoyage_show_images_first_time.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/layout/wikivoyage_contents_list_item.xml b/OsmAnd/res/layout/wikivoyage_contents_list_item.xml
index 5a8df25af2..068f05da69 100644
--- a/OsmAnd/res/layout/wikivoyage_contents_list_item.xml
+++ b/OsmAnd/res/layout/wikivoyage_contents_list_item.xml
@@ -41,6 +41,7 @@
android:layout_gravity="end"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
+ android:background="?attr/selectableItemBackground"
android:scaleType="center"
tools:src="@drawable/ic_action_arrow_up" />
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 6c8e23e6cd..bff61aa316 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,10 +9,19 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ Don\'t
+ Do
+ Only with WiFi
+ Download Pictures
+ We can download & show images in the articles and store them on device, so you will access them while offline.
+ You can always change the setting in Explore > Options.
+ Only WiFi
+ Select travel book
+ Travel book
This page is only available online. Do you wish to open it in a web browser?
Images cache
Delete search history
- Show images
+ Download images
Travel maps
Wikivoyage
Article removed
diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java
index 749c5dcb44..2c12d35383 100644
--- a/OsmAnd/src/net/osmand/plus/AppInitializer.java
+++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java
@@ -47,7 +47,7 @@ import net.osmand.plus.voice.CommandPlayer;
import net.osmand.plus.voice.CommandPlayerException;
import net.osmand.plus.voice.MediaCommandPlayerImpl;
import net.osmand.plus.voice.TTSCommandPlayerImpl;
-import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.router.RoutingConfiguration;
import net.osmand.util.Algorithms;
@@ -445,7 +445,7 @@ public class AppInitializer implements IProgress {
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
- app.wikivoyageDbHelper = startupInit(new WikivoyageDbHelper(app), WikivoyageDbHelper.class);
+ app.travelDbHelper = startupInit(new TravelDbHelper(app), TravelDbHelper.class);
initOpeningHoursParser();
}
diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java
index 977c15c434..320ee0c2f8 100644
--- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java
@@ -7,7 +7,6 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.ColorInt;
import android.text.TextUtils;
-
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.data.LocationPoint;
@@ -812,7 +811,7 @@ public class GPXUtilities {
return points.isEmpty();
}
- int getPointsSize() {
+ public int getPointsSize() {
return points.size();
}
@@ -1210,8 +1209,13 @@ public class GPXUtilities {
public static String writeGpxFile(File fout, GPXFile file, OsmandApplication ctx) {
Writer output = null;
try {
+ fout.getParentFile().mkdirs();
output = new OutputStreamWriter(new FileOutputStream(fout), "UTF-8"); //$NON-NLS-1$
- return writeGpx(output, file, ctx);
+ String msg = writeGpx(output, file, ctx);
+ if(Algorithms.isEmpty(file.path)) {
+ file.path = fout.getAbsolutePath();
+ }
+ return msg;
} catch (IOException e) {
log.error("Error saving gpx", e); //$NON-NLS-1$
return ctx.getString(R.string.error_occurred_saving_gpx);
@@ -1286,8 +1290,10 @@ public class GPXUtilities {
}
serializer.endTag(null, "gpx"); //$NON-NLS-1$
- serializer.flush();
serializer.endDocument();
+ serializer.flush();
+
+
} catch (RuntimeException e) {
log.error("Error saving gpx", e); //$NON-NLS-1$
return ctx.getString(R.string.error_occurred_saving_gpx);
@@ -1396,10 +1402,10 @@ public class GPXUtilities {
} catch (IOException e) {
}
return file;
- } catch (FileNotFoundException e) {
+ } catch (IOException e) {
GPXFile res = new GPXFile();
res.path = f.getAbsolutePath();
- log.error("Error reading gpx", e); //$NON-NLS-1$
+ log.error("Error reading gpx " + res.path, e); //$NON-NLS-1$
res.warning = ctx.getString(R.string.error_reading_gpx);
return res;
} finally {
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
index 137752ec5f..456d1ae47b 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
@@ -6,7 +6,6 @@ import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
-
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.data.FavouritePoint;
@@ -20,6 +19,8 @@ import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
+import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
@@ -497,6 +498,26 @@ public class MapMarkersHelper {
}
return res;
}
+
+ @NonNull
+ public List getGroupsForSavedArticlesTravelBook() {
+ List res = new ArrayList<>();
+ TravelDbHelper travelDbHelper = ctx.getTravelDbHelper();
+ if(travelDbHelper.getSelectedTravelBook() != null) {
+ List savedArticles = travelDbHelper.getLocalDataHelper().getSavedArticles();
+ for (TravelArticle art : savedArticles) {
+ String gpxName = travelDbHelper.getGPXName(art);
+ File path = ctx.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
+ MapMarkersGroup group = getOrCreateGroup(new File(path.getAbsolutePath()));
+ if (!isGroupSynced(group.getId())) {
+ group.disabled = true;
+ createHeaderInGroup(group);
+ res.add(group);
+ }
+ }
+ }
+ return res;
+ }
@Nullable
public MapMarker getMapMarker(WptPt wptPt) {
diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
index f1ba71a69a..48b0755ec8 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
@@ -56,7 +56,7 @@ import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.search.QuickSearchHelper;
import net.osmand.plus.voice.CommandPlayer;
-import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.router.RoutingConfiguration;
import net.osmand.search.SearchUICore;
import net.osmand.util.Algorithms;
@@ -119,7 +119,7 @@ public class OsmandApplication extends MultiDexApplication {
OsmandRegions regions;
GeocodingLookupService geocodingLookupService;
QuickSearchHelper searchUICore;
- WikivoyageDbHelper wikivoyageDbHelper;
+ TravelDbHelper travelDbHelper;
RoutingConfiguration.Builder defaultRoutingConfig;
private Locale preferredLocale = null;
@@ -392,8 +392,8 @@ public class OsmandApplication extends MultiDexApplication {
return searchUICore;
}
- public WikivoyageDbHelper getWikivoyageDbHelper() {
- return wikivoyageDbHelper;
+ public TravelDbHelper getTravelDbHelper() {
+ return travelDbHelper;
}
public CommandPlayer getPlayer() {
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index b686d58f9d..5f01e9c314 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -717,7 +717,8 @@ public class OsmandSettings {
public final CommonPreference SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile();
public final CommonPreference SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile();
- public final CommonPreference WIKIVOYAGE_SHOW_IMAGES = new BooleanPreference("wikivoyage_show_images", false);
+ public final CommonPreference WIKIVOYAGE_SHOW_IMAGES_ASKED = new BooleanPreference("wikivoyage_show_images_asked", false).makeGlobal();
+ public final CommonPreference WIKIVOYAGE_SHOW_IMAGES = new EnumIntPreference<>("wikivoyage_show_imgs", WikivoyageShowImages.OFF, WikivoyageShowImages.values()).makeGlobal();
public final CommonPreference SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference("select_marker_on_single_tap", false).makeProfile();
@@ -3310,4 +3311,17 @@ public class OsmandSettings {
SECOND,
EMPTY
}
+
+ public enum WikivoyageShowImages {
+ ON(R.string.shared_string_on),
+ OFF(R.string.shared_string_off),
+ WIFI(R.string.shared_string_wifi_only);
+
+ public final int name;
+
+ WikivoyageShowImages(int name) {
+ this.name = name;
+ }
+ }
+
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index e748cbcc61..4680db276b 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -63,7 +63,7 @@ import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreDialogFragment;
-import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.router.GeneralRouter;
import org.apache.commons.logging.Log;
@@ -771,7 +771,7 @@ public class MapActivityActions implements DialogProvider {
.setListener(new ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
- getMyApplication().getWikivoyageDbHelper().initTravelBooks();
+ getMyApplication().getTravelDbHelper().initTravelBooks();
MapActivity.clearPrevActivityIntent();
WikivoyageExploreDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
return true;
diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java
index b4309e66e7..e042761017 100644
--- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java
@@ -72,11 +72,13 @@ public class TrackActivity extends TabActivity {
finish();
return;
}
- file = null;
+ if (intent.hasExtra(TRACK_FILE_NAME)) {
+ file = new File(intent.getStringExtra(TRACK_FILE_NAME));
+ }
+
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
- if (intent.hasExtra(TRACK_FILE_NAME)) {
- file = new File(intent.getStringExtra(TRACK_FILE_NAME));
+ if(file != null) {
String fn = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
actionBar.setTitle(fn);
} else {
diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
index 6ca1f973c3..d187857aee 100644
--- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
@@ -250,7 +250,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
return nightMode ? R.drawable.bg_bottom_sheet_sides_landscape_dark : R.drawable.bg_bottom_sheet_sides_landscape_light;
}
- protected boolean isNightMode() {
+ private boolean isNightMode() {
if (usedOnMap) {
return getMyApplication().getDaynightHelper().isNightModeForMapControls();
}
diff --git a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java
index 4bc30fe322..190452c22a 100644
--- a/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java
+++ b/OsmAnd/src/net/osmand/plus/development/SettingsDevelopmentActivity.java
@@ -17,6 +17,7 @@ import android.view.View;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmAndLocationSimulation;
import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.activities.actions.AppModeDialog;
@@ -70,10 +71,13 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
getMyApplication().getAppInitializer().resetFirstTimeRun();
- getMyApplication().getSettings().FIRST_MAP_IS_DOWNLOADED.set(false);
- getMyApplication().getSettings().MAPILLARY_FIRST_DIALOG_SHOWN.set(false);
- getMyApplication().getSettings().WEBGL_SUPPORTED.set(true);
- getMyApplication().getSettings().METRIC_SYSTEM_CHANGED_MANUALLY.set(false);
+ OsmandSettings settings = getMyApplication().getSettings();
+ settings.FIRST_MAP_IS_DOWNLOADED.set(false);
+ settings.MAPILLARY_FIRST_DIALOG_SHOWN.set(false);
+ settings.WEBGL_SUPPORTED.set(true);
+ settings.METRIC_SYSTEM_CHANGED_MANUALLY.set(false);
+ settings.WIKIVOYAGE_SHOW_IMAGES_ASKED.set(false);
+
getMyApplication().showToastMessage(R.string.shared_string_ok);
return true;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java
index 2feadfacc0..cf7f07199d 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java
@@ -93,6 +93,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter groups = new ArrayList<>(helper.getMapMarkersGroups());
groups.addAll(helper.getGroupsForDisplayedGpx());
+ groups.addAll(helper.getGroupsForSavedArticlesTravelBook());
for (int i = 0; i < groups.size(); i++) {
MapMarkersGroup group = groups.get(i);
if (!group.isVisible()) {
diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
index abeaa4c08c..8903632d87 100644
--- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
+++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java
@@ -449,14 +449,18 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
});
if (!MenuItemCompat.isActionViewExpanded(mi)) {
- final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
- final MapMarkersGroup markersGr = markersHelper.getOrCreateGroup(getGpxDataItem().getFile());
- final boolean synced = markersHelper.isGroupSynced(markersGr.getId());
+
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
- createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers : R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark,
- R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
+ if (getGpx().path != null) {
+ final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
+ final MapMarkersGroup markersGr = markersHelper.getOrCreateGroup(new File(getGpx().path));
+ final boolean synced = markersHelper.isGroupSynced(markersGr.getId());
+ createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers
+ : R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark,
+ R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
+ }
createMenuItem(menu, SELECT_FAVORITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_fav_dark,
R.drawable.ic_action_fav_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageShowPicturesDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageShowPicturesDialogFragment.java
new file mode 100644
index 0000000000..5377bb69c0
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageShowPicturesDialogFragment.java
@@ -0,0 +1,66 @@
+package net.osmand.plus.wikivoyage;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandSettings.WikivoyageShowImages;
+import net.osmand.plus.R;
+import net.osmand.plus.base.BottomSheetDialogFragment;
+
+public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragment {
+ public static final String TAG = WikivoyageShowPicturesDialogFragment.class.getSimpleName();
+
+ public static final int SHOW_PICTURES_CHANGED = 1;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+
+ View view = inflater.inflate(R.layout.fragment_wikivoyage_show_images_first_time, container, false);
+ view.findViewById(R.id.button_no).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ OsmandApplication app = getMyApplication();
+ if (app != null) {
+ app.getSettings().WIKIVOYAGE_SHOW_IMAGES.set(WikivoyageShowImages.OFF);
+ }
+ sendResult();
+ dismiss();
+ }
+ });
+ view.findViewById(R.id.button_wifi).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ OsmandApplication app = getMyApplication();
+ if (app != null) {
+ app.getSettings().WIKIVOYAGE_SHOW_IMAGES.set(WikivoyageShowImages.WIFI);
+ }
+ sendResult();
+ dismiss();
+ }
+ });
+ view.findViewById(R.id.button_yes).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ OsmandApplication app = getMyApplication();
+ if (app != null) {
+ app.getSettings().WIKIVOYAGE_SHOW_IMAGES.set(WikivoyageShowImages.ON);
+ }
+ sendResult();
+ dismiss();
+ }
+ });
+
+ return view;
+ }
+
+ private void sendResult() {
+ Fragment fragment = getTargetFragment();
+ if (fragment != null) {
+ fragment.onActivityResult(getTargetRequestCode(), SHOW_PICTURES_CHANGED, null);
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageUtils.java b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageUtils.java
new file mode 100644
index 0000000000..70f500d176
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageUtils.java
@@ -0,0 +1,24 @@
+package net.osmand.plus.wikivoyage;
+
+import com.squareup.picasso.NetworkPolicy;
+import com.squareup.picasso.RequestCreator;
+
+import net.osmand.plus.OsmandSettings;
+
+public class WikivoyageUtils {
+
+ public static void setupNetworkPolicy(OsmandSettings settings, RequestCreator rc) {
+ switch (settings.WIKIVOYAGE_SHOW_IMAGES.get()) {
+ case ON:
+ break;
+ case OFF:
+ rc.networkPolicy(NetworkPolicy.OFFLINE);
+ break;
+ case WIFI:
+ if (!settings.isWifiConnected()) {
+ rc.networkPolicy(NetworkPolicy.OFFLINE);
+ }
+ break;
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageWebViewClient.java
similarity index 88%
rename from OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java
rename to OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageWebViewClient.java
index e26bf7cf53..e1b8c6a042 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/CustomWebViewClient.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/WikivoyageWebViewClient.java
@@ -1,4 +1,4 @@
-package net.osmand.plus.wikivoyage.data;
+package net.osmand.plus.wikivoyage;
import android.content.Context;
@@ -22,7 +22,7 @@ import java.net.URLDecoder;
* Custom WebView client to handle the internal links.
*/
-public class CustomWebViewClient extends WebViewClient {
+public class WikivoyageWebViewClient extends WebViewClient {
private OsmandApplication app;
private FragmentManager mFragmentManager;
@@ -31,7 +31,7 @@ public class CustomWebViewClient extends WebViewClient {
private static final String PAGE_PREFIX = "https://";
private static final String WEB_DOMAIN = ".wikivoyage.com/wiki/";
- public CustomWebViewClient(FragmentActivity context, FragmentManager fm) {
+ public WikivoyageWebViewClient(FragmentActivity context, FragmentManager fm) {
app = (OsmandApplication) context.getApplication();
mFragmentManager = fm;
mContext = context;
@@ -48,7 +48,7 @@ public class CustomWebViewClient extends WebViewClient {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
- long articleId = app.getWikivoyageDbHelper().getArticleId(articleName, lang);
+ long articleId = app.getTravelDbHelper().getArticleId(articleName, lang);
if (articleId != 0) {
WikivoyageArticleDialogFragment.showInstance(app, mFragmentManager,
articleId, lang);
@@ -63,6 +63,7 @@ public class CustomWebViewClient extends WebViewClient {
private void warnAboutExternalLoad(final String url) {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
+ builder.setTitle(url);
builder.setMessage(R.string.online_webpage_warning);
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java
index b5a52f0c55..f705450861 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleContentsFragment.java
@@ -29,6 +29,7 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag
public static final String CONTENTS_JSON_KEY = "contents_json";
public static final String CONTENTS_LINK_KEY = "contents_link";
+ public static final String CONTENTS_TITLE_KEY = "title";
public static final int REQUEST_LINK_CODE = 0;
@@ -70,19 +71,23 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
- String link = contentItem.getSubItems().get(groupPosition).getSubItems().get(childPosition).getLink();
- sendResult(link);
+ WikivoyageContentItem wikivoyageContentItem = contentItem.getSubItems().get(groupPosition);
+ String link = wikivoyageContentItem.getSubItems().get(childPosition).getLink();
+ String name = wikivoyageContentItem.getLink().substring(1);
+ sendResults(link, name);
dismiss();
- return false;
+ return true;
}
});
expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
- String link = contentItem.getSubItems().get(groupPosition).getLink();
- sendResult(link);
+ WikivoyageContentItem wikivoyageContentItem = contentItem.getSubItems().get(groupPosition);
+ String link = wikivoyageContentItem.getLink();
+ String name = wikivoyageContentItem.getLink().substring(1);
+ sendResults(link, name);
dismiss();
- return false;
+ return true;
}
});
LinearLayout container = new LinearLayout(getContext());
@@ -91,9 +96,10 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag
items.add(new SimpleBottomSheetItem.Builder().setCustomView(container).create());
}
- private void sendResult(String link) {
+ private void sendResults(String link, String name) {
Intent intent = new Intent();
intent.putExtra(CONTENTS_LINK_KEY, link);
+ intent.putExtra(CONTENTS_TITLE_KEY, name);
Fragment fragment = getTargetFragment();
if (fragment != null) {
fragment.onActivityResult(getTargetRequestCode(), REQUEST_LINK_CODE, intent);
@@ -155,7 +161,7 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag
}
TextView txtListChild = (TextView) convertView.findViewById(R.id.item_label);
txtListChild.setText(childText);
- txtListChild.setTextColor(getResolvedColor(nightMode
+ txtListChild.setTextColor(ContextCompat.getColor(context, nightMode
? R.color.wikivoyage_contents_parent_icon_dark
: R.color.wikivoyage_contents_parent_icon_light));
txtListChild.setCompoundDrawablesWithIntrinsicBounds(itemChildIcon, null, null, null);
@@ -202,7 +208,7 @@ public class WikivoyageArticleContentsFragment extends MenuBottomSheetDialogFrag
}
TextView lblListHeader = (TextView) convertView.findViewById(R.id.item_label);
lblListHeader.setText(headerTitle);
- lblListHeader.setTextColor(getResolvedColor(isNightMode() ? R.color.wikivoyage_contents_parent_icon_dark : R.color.wikivoyage_contents_parent_icon_light));
+ lblListHeader.setTextColor(ContextCompat.getColor(context, nightMode ? R.color.wikivoyage_contents_parent_icon_dark : R.color.wikivoyage_contents_parent_icon_light));
lblListHeader.setCompoundDrawablesWithIntrinsicBounds(itemGroupIcon, null, null, null);
adjustIndicator(getMyApplication(), groupPosition, isExpanded, convertView, !nightMode);
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java
index dc929bca03..c4bd9066c6 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java
@@ -8,6 +8,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
@@ -23,12 +24,19 @@ import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
+import net.osmand.plus.GPXUtilities;
+import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.OsmandSettings.WikivoyageShowImages;
import net.osmand.plus.R;
+import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
-import net.osmand.plus.wikivoyage.data.CustomWebViewClient;
-import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
-import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
+import net.osmand.plus.wikivoyage.WikivoyageShowPicturesDialogFragment;
+import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
+import net.osmand.plus.wikivoyage.data.TravelArticle;
+import net.osmand.plus.wikivoyage.data.TravelDbHelper;
+import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
import net.osmand.util.Algorithms;
import java.io.File;
@@ -48,19 +56,58 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
"\n" +
"\n" +
"\n" +
- "\n" + "";
- private static final String FOOTER_INNER = "