This commit is contained in:
Victor Shcherb 2014-08-22 01:46:57 +02:00
parent ce972b4957
commit 709573e65e
5 changed files with 19 additions and 13 deletions

View file

@ -795,9 +795,9 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> SAVE_TRACK_TO_GPX = new BooleanPreference("save_track_to_gpx", false).makeProfile().cache();
{
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.CAR, true);
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.BICYCLE, true);
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.CAR, false);
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.BICYCLE, false);
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.PEDESTRIAN, false);
}
// this value string is synchronized with settings_pref.xml preference name
@ -1102,6 +1102,10 @@ public class OsmandSettings {
defaultLocation));
}
public Object getGlobalPreferences() {
return globalPreferences;
}
public static final int VERSION_DEFAULTLOCATION_CHANGED = 19;
public String getDefaultExternalStorageLocation() {

View file

@ -412,7 +412,8 @@ public class MapActivityLayers {
WptPt locToShow = null;
for (GPXFile g : result) {
if (g.showCurrentTrack) {
if (!settings.SAVE_TRACK_TO_GPX.get()) {
if (!settings.SAVE_TRACK_TO_GPX.get() && !
settings.SAVE_GLOBAL_TRACK_TO_GPX.get()) {
AccessibleToast.makeText(activity, R.string.gpx_monitoring_disabled_warn, Toast.LENGTH_SHORT).show();
}
break;

View file

@ -983,7 +983,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
boolean newFileIndexed = indexSingleFile(f);
if (newFileIndexed && registerInGPX) {
Recording rec = recordingByFileName.get(f.getName());
if (rec != null && app.getSettings().SAVE_TRACK_TO_GPX.get()
if (rec != null &&
(app.getSettings().SAVE_TRACK_TO_GPX.get()
|| app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get())
&& OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
String name = f.getName();
SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper();

View file

@ -64,7 +64,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
private static final String ACCESS_CODE = "access_code";
private static final String SELECTED_STAGE = "selected_stage_int";
private static final String VISITED_STAGES = "visited_stages_int";
private CommonPreference<String> selectedTourPref;
private CommonPreference<Integer> selectedStagePref;
private CommonPreference<Integer> visitedStagesPref;
private boolean toursIndexed;
@ -77,13 +76,14 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
private SettingsAPI originalApi;
private CommonPreference<String> saveGPXFolder;
public static final String TOUR_SERVER = "download.osmand.net";
private static final String SAVE_GPX_FOLDER = "save_gpx_folder";
private static final String SAVE_GPX_FOLDER = "save_gpx_folder";
private Object originalGlobal;
@Override
public void setup(OsmandApplication app) {
super.setup(app);
originalApi = osmandSettings.getSettingsAPI();
selectedTourPref = osmandSettings.registerStringPreference(SELECTED_TOUR, null).makeGlobal();
originalGlobal = osmandSettings.getGlobalPreferences();
saveGPXFolder = osmandSettings.registerStringPreference(SAVE_GPX_FOLDER, null).makeGlobal();
if(osmandSettings.OSMAND_THEME.get() != OsmandSettings.OSMAND_LIGHT_THEME) {
osmandSettings.OSMAND_THEME.set(OsmandSettings.OSMAND_LIGHT_THEME);
@ -124,7 +124,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
}
public boolean isTourSelected() {
return selectedTourPref.get() != null;
return originalApi.getString(originalGlobal, SELECTED_TOUR, null)!= null;
}
public boolean checkExceptionsOnStart() {
@ -181,7 +181,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
if(toursFolder.exists()) {
File[] availableTours = toursFolder.listFiles();
if(availableTours != null) {
String selectedName = selectedTourPref.get();
String selectedName = originalApi.getString(originalGlobal, SELECTED_TOUR, null);
for(File tr : availableTours) {
if (tr.isDirectory()) {
String date = app.getResourceManager().getDateFormat()
@ -453,9 +453,9 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
public void selectTour(TourInformation tour, IProgress progress) {
if (tour == null) {
selectedTourPref.set(null);
originalApi.edit(originalGlobal).putString(SELECTED_TOUR, null).commit();
} else {
selectedTourPref.set(tour.getName());
originalApi.edit(originalGlobal).putString(SELECTED_TOUR, tour.getName()).commit();
}
selectedTour = tour;
reloadSelectedTour(progress, tour);

View file

@ -2,7 +2,6 @@ package net.osmand.plus.sherpafy;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.util.Algorithms;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;