Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 committed Nov 19, 2015
2 parents a20d75e + aebec2d commit ef21ec3
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 210 deletions.
12 changes: 8 additions & 4 deletions Applications/Android/Samples/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" explicit permission needed only for DownloadManager, see
github.com/mapsforge/mapsforge/issues/723
/>
-->

<uses-sdk
android:minSdkVersion="10"
Expand Down Expand Up @@ -191,4 +195,4 @@
</activity>
</application>

</manifest>
</manifest>
31 changes: 16 additions & 15 deletions Applications/Android/Samples/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

<string name="copyright_osm">Map data © OpenStreetMap contributors</string>

<string name="menu_preferences">Settings</string>
<string name="menu_preferences">Settings</string>
<string name="menu_position_enter_coordinates">Map Position</string>
<string name="menu_svgclear">Clear SVG icon cache</string>

<string name="cancelbutton">Cancel</string>
<string name="okbutton">OK</string>
<string name="downloadnowbutton">OK</string>
<string name="rotate_button">Rotate</string>
<string name="zoomin_button">+</string>
<string name="zoomout_button">-</string>
<string name="latitude">Latitude</string>
<string name="longitude">Longitude</string>
<string name="zoomlevel">Zoom Level</string>
<string name="cancelbutton">Cancel</string>
<string name="okbutton">OK</string>
<string name="downloadnowbutton">OK</string>
<string name="rotate_button">Rotate</string>
<string name="zoomin_button">+</string>
<string name="zoomout_button">-</string>

<string name="latitude">Latitude</string>
<string name="longitude">Longitude</string>
<string name="zoomlevel">Zoom Level</string>

<string name="preferences_scale">Display Scale</string>
<string name="preferences_scale_desc">Adjust scale of the map display</string>
Expand All @@ -41,8 +41,8 @@
<string name="preferences_wayfiltering_distance_desc">The higher the number the less artifacts, but slower.</string>

<string name="preferences_category_tilecache">Tilecache</string>
<string name="preferences_tilecache_persistence">Persistence</string>
<string name="preferences_tilecache_persistence_desc">Keep tiles over activity restart.</string>
<string name="preferences_tilecache_persistence">Persistence</string>
<string name="preferences_tilecache_persistence_desc">Keep tiles over activity restart.</string>
<string name="preferences_tilecache_threading">Threading</string>
<string name="preferences_tilecache_threading_desc">Threading makes the app more responsive, with some risk.</string>
<string name="preferences_tilecache_queuelimit">Queue limit</string>
Expand Down Expand Up @@ -89,8 +89,9 @@
<string name="dialog_location_title">Coordinates</string>

<string name="startup_dontshowagain">Don\'t show again</string>
<string name="startup_message">To run this samples app, you need any map with filename germany.map installed on the sdcard.</string>
<string name="startup_message">To run this samples app, you need any map with filename germany.map installed on storage.</string>
<string name="startup_message_tilestore">To run this sample activity, you need a TMS tile store at /sdcard/tilestore. Sample data in the Samples/data directory.</string>
<string name="startup_message_multimap">To run this sample activity, you need to download a low-resolution world map first.</string>
<string name="startup_message_multimap">To run this sample activity, you need to download a low-resolution world map first.</string>
<string name="startup_message_twomaps">To run this sample activity, you need also a map with filename second.map installed on storage.</string>

</resources>
97 changes: 48 additions & 49 deletions Applications/Android/Samples/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,77 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/menu_preferences">
android:title="@string/menu_preferences">
<ListPreference
android:negativeButtonText="@string/cancelbutton"
android:title="@string/preferences_scale"
android:summary="@string/preferences_scale_desc"
android:key="scale"
android:defaultValue="1.0"
android:entries="@array/pref_scale_entries"
android:entryValues="@array/pref_scale_values"/>
<ListPreference
android:entryValues="@array/pref_scale_values"
android:key="scale"
android:negativeButtonText="@string/cancelbutton"
android:title="@string/preferences_textwidth"
android:summary="@string/preferences_textwidth_desc"
android:key="textwidth"
android:summary="@string/preferences_scale_desc"
android:title="@string/preferences_scale" />
<ListPreference
android:defaultValue="0.7"
android:entries="@array/pref_textwidth_entries"
android:entryValues="@array/pref_textwidth_values"/>
<ListPreference
android:entryValues="@array/pref_textwidth_values"
android:key="textwidth"
android:negativeButtonText="@string/cancelbutton"
android:title="@string/preferences_scalebar"
android:summary="@string/preferences_scalebar_desc"
android:key="scalebar"
android:summary="@string/preferences_textwidth_desc"
android:title="@string/preferences_textwidth" />
<ListPreference
android:defaultValue="both"
android:entries="@array/pref_scalebar_entries"
android:entryValues="@array/pref_scalebar_values"/>
<ListPreference
android:entryValues="@array/pref_scalebar_values"
android:key="scalebar"
android:negativeButtonText="@string/cancelbutton"
android:title="@string/preferences_language"
android:summary="@string/preferences_language_desc"
android:key="language_selection"
android:summary="@string/preferences_scalebar_desc"
android:title="@string/preferences_scalebar" />
<ListPreference
android:defaultValue=""
android:entries="@array/pref_language_selection_entries"
android:entryValues="@array/pref_language_selection_values"/>
android:entryValues="@array/pref_language_selection_values"
android:key="language_selection"
android:negativeButtonText="@string/cancelbutton"
android:summary="@string/preferences_language_desc"
android:title="@string/preferences_language" />
<CheckBoxPreference
android:title="@string/preferences_language_showlocal"
android:summary="@string/preferences_language_showlocal_desc"
android:defaultValue="false"
android:key="language_showlocal"
android:defaultValue="false" />

android:summary="@string/preferences_language_showlocal_desc"
android:title="@string/preferences_language_showlocal" />
<CheckBoxPreference
android:title="@string/preferences_debug_timing"
android:summary="@string/preferences_debug_timing_desc"
android:defaultValue="false"
android:key="debug_timing"
android:defaultValue="false" />
<EditTextPreference
android:title="@string/preferences_rendering_threads"
android:summary="@string/preferences_rendering_threads_desc"
android:inputType="number"
android:key="rendering_threads" />

android:summary="@string/preferences_debug_timing_desc"
android:title="@string/preferences_debug_timing" />
<EditTextPreference
android:defaultValue="1"
android:inputType="number"
android:key="rendering_threads"
android:summary="@string/preferences_rendering_threads_desc"
android:title="@string/preferences_rendering_threads" />
<PreferenceCategory android:title="@string/preferences_category_wayfiltering">
<CheckBoxPreference
android:title="@string/preferences_wayfiltering"
android:summary="@string/preferences_wayfiltering_desc"
android:defaultValue="true"
android:key="wayfiltering"
android:defaultValue="true" />
android:summary="@string/preferences_wayfiltering_desc"
android:title="@string/preferences_wayfiltering" />
<EditTextPreference
android:defaultValue="20"
android:dependency="wayfiltering"
android:title="@string/preferences_wayfiltering_distance"
android:summary="@string/preferences_wayfiltering_distance_desc"
android:inputType="number"
android:key="wayfiltering_distance" />
android:key="wayfiltering_distance"
android:summary="@string/preferences_wayfiltering_distance_desc"
android:title="@string/preferences_wayfiltering_distance" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_category_tilecache">
<CheckBoxPreference
android:title="@string/preferences_tilecache_persistence"
android:summary="@string/preferences_tilecache_persistence_desc"
android:key="tilecache_persistence"
android:defaultValue="true" />
</PreferenceCategory>
<PreferenceCategory android:title="Map Style for Rendertheme V4" android:key="renderthememenu">

<CheckBoxPreference
android:defaultValue="true"
android:key="tilecache_persistence"
android:summary="@string/preferences_tilecache_persistence_desc"
android:title="@string/preferences_tilecache_persistence" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceCategory
android:key="renderthememenu"
android:title="Map Style for Rendertheme V4" />
</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Ludwig M Brinckmann
* Copyright 2015 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
Expand All @@ -17,9 +18,10 @@
import android.content.Context;
import android.os.Bundle;

import org.mapsforge.core.model.Tile;
import org.mapsforge.map.datastore.MapDataStore;
import org.mapsforge.map.reader.MapFile;
import org.mapsforge.map.datastore.MultiMapDataStore;
import org.mapsforge.map.reader.MapFile;

import java.io.File;

Expand All @@ -31,32 +33,9 @@
* should download this automatically.
*/
public class MultiMapLowResWorld extends RenderTheme4 {

private MultiMapDataStore multiMapDataStore;
private MapFile worldMapFile;

/**
* @return the name of the low res world map file.
*/
public static String getWorldMapFileName() {
return "world.map";
}

public static File getWorldMapFile(Context context) {
return new File(context.getExternalFilesDir(SamplesApplication.MAPS), getWorldMapFileName());
}

@Override
protected void onCreate(Bundle savedInstanceState) {

worldMapFile = new MapFile(getWorldMapFile(this));
multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);
multiMapDataStore.addMapDataStore(getMapFile1(), true, true);
multiMapDataStore.addMapDataStore(getMapFile2(), false, false);

super.onCreate(savedInstanceState);
}

@Override
public MapDataStore getMapFile() {
return this.multiMapDataStore;
Expand All @@ -76,4 +55,33 @@ protected MapDataStore getMapFile2() {
return this.worldMapFile;
}

/**
* @return the low res world map file.
*/
public static File getWorldMapFile(Context context) {
return new File(context.getExternalFilesDir(SamplesApplication.MAPS), getWorldMapFileName());
}

/**
* @return the name of the low res world map file.
*/
public static String getWorldMapFileName() {
return "world.map";
}

@Override
protected void onCreate(Bundle savedInstanceState) {
worldMapFile = new MapFile(getWorldMapFile(this)) {
@Override
public boolean supportsTile(Tile tile) {
// Example low res world map has sufficient detail up to zoom level 7
return tile.zoomLevel <= 7 && super.supportsTile(tile);
}
};
multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);
multiMapDataStore.addMapDataStore(getMapFile1(), true, true);
multiMapDataStore.addMapDataStore(getMapFile2(), false, false);

super.onCreate(savedInstanceState);
}
}
Loading

0 comments on commit ef21ec3

Please sign in to comment.