refactor OsmandSettings remove Enum
This commit is contained in:
parent
ace5e92f93
commit
2867736814
91 changed files with 703 additions and 662 deletions
|
@ -23,6 +23,7 @@ import net.osmand.plus.inapp.InAppPurchases.InAppPurchase;
|
||||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||||
import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription;
|
import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription;
|
||||||
import net.osmand.plus.inapp.util.BillingManager;
|
import net.osmand.plus.inapp.util.BillingManager;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -407,7 +408,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OsmandSettings.OsmandPreference<Long> subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME;
|
OsmandPreference<Long> subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME;
|
||||||
if (!subscribedToLiveUpdates && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) {
|
if (!subscribedToLiveUpdates && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) {
|
||||||
if (subscriptionCancelledTime.get() == 0) {
|
if (subscriptionCancelledTime.get() == 0) {
|
||||||
subscriptionCancelledTime.set(System.currentTimeMillis());
|
subscriptionCancelledTime.set(System.currentTimeMillis());
|
||||||
|
|
|
@ -31,7 +31,7 @@ import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo;
|
import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo;
|
||||||
import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription;
|
import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
|
@ -223,6 +223,19 @@ public class FileUtils {
|
||||||
return tempDir;
|
return tempDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isWritable(File dirToTest) {
|
||||||
|
boolean isWriteable;
|
||||||
|
try {
|
||||||
|
dirToTest.mkdirs();
|
||||||
|
File writeTestFile = File.createTempFile("osmand_", ".tmp", dirToTest);
|
||||||
|
isWriteable = writeTestFile.exists();
|
||||||
|
writeTestFile.delete();
|
||||||
|
} catch (IOException e) {
|
||||||
|
isWriteable = false;
|
||||||
|
}
|
||||||
|
return isWriteable;
|
||||||
|
}
|
||||||
|
|
||||||
public interface RenameCallback {
|
public interface RenameCallback {
|
||||||
void renamedTo(File file);
|
void renamedTo(File file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.layers.AidlMapLayer;
|
import net.osmand.plus.views.layers.AidlMapLayer;
|
||||||
import net.osmand.plus.views.layers.MapInfoLayer;
|
import net.osmand.plus.views.layers.MapInfoLayer;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import net.osmand.map.OsmandRegions.RegionTranslation;
|
||||||
import net.osmand.map.WorldRegion;
|
import net.osmand.map.WorldRegion;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.plus.activities.DayNightHelper;
|
import net.osmand.plus.helpers.DayNightHelper;
|
||||||
import net.osmand.plus.activities.LocalIndexHelper;
|
import net.osmand.plus.activities.LocalIndexHelper;
|
||||||
import net.osmand.plus.activities.LocalIndexInfo;
|
import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.google.gson.reflect.TypeToken;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.api.SettingsAPI;
|
import net.osmand.plus.api.SettingsAPI;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.EnumStringPreference;
|
import net.osmand.plus.settings.backend.EnumStringPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
|
@ -18,6 +19,7 @@ import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -133,7 +135,7 @@ class AppVersionUpgradeOnInit {
|
||||||
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_7_01).commit();
|
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_7_01).commit();
|
||||||
}
|
}
|
||||||
if (prevAppVersion < VERSION_3_8_00) {
|
if (prevAppVersion < VERSION_3_8_00) {
|
||||||
app.getSettings().migrateQuickActionStates();
|
migrateQuickActionStates();
|
||||||
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_8_00).commit();
|
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_8_00).commit();
|
||||||
}
|
}
|
||||||
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, lastVersion).commit();
|
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, lastVersion).commit();
|
||||||
|
@ -253,6 +255,21 @@ class AppVersionUpgradeOnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void migrateQuickActionStates() {
|
||||||
|
String quickActionsJson = settings.getSettingsAPI().getString(settings.getGlobalPreferences(), "quick_action_new", "");
|
||||||
|
if (!Algorithms.isEmpty(quickActionsJson)) {
|
||||||
|
Gson gson = new GsonBuilder().create();
|
||||||
|
Type type = new TypeToken<HashMap<String, Boolean>>() {
|
||||||
|
}.getType();
|
||||||
|
HashMap<String, Boolean> quickActions = gson.fromJson(quickActionsJson, type);
|
||||||
|
if (!Algorithms.isEmpty(quickActions)) {
|
||||||
|
for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {
|
||||||
|
settings.setQuickActions(quickActions, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void migrateEnumPref(EnumStringPreference enumPref, SharedPreferences sharedPreferences) {
|
private void migrateEnumPref(EnumStringPreference enumPref, SharedPreferences sharedPreferences) {
|
||||||
Object value = sharedPreferences.getAll().get(enumPref.getId());
|
Object value = sharedPreferences.getAll().get(enumPref.getId());
|
||||||
if (value instanceof Integer) {
|
if (value instanceof Integer) {
|
||||||
|
|
|
@ -38,9 +38,6 @@ import net.osmand.plus.dialogs.HelpArticleDialogFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.ContextMenuItemsPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.settings.backend.ContextMenuItemsPreference;
|
import net.osmand.plus.settings.backend.ContextMenuItemsPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
|
||||||
import net.osmand.plus.routing.RouteProvider;
|
import net.osmand.plus.routing.RouteProvider;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.track.GpxSplitType;
|
import net.osmand.plus.track.GpxSplitType;
|
||||||
import net.osmand.plus.track.GradientScaleType;
|
import net.osmand.plus.track.GradientScaleType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
|
@ -15,9 +15,9 @@ import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.AngularConstants;
|
import net.osmand.plus.helpers.enums.AngularConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.SpeedConstants;
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.text.DateFormatSymbols;
|
import java.text.DateFormatSymbols;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import androidx.multidex.MultiDex;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.access.AccessibilityPlugin;
|
import net.osmand.access.AccessibilityPlugin;
|
||||||
|
@ -42,7 +43,7 @@ import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
import net.osmand.plus.AppInitializer.AppInitializeListener;
|
||||||
import net.osmand.plus.access.AccessibilityMode;
|
import net.osmand.plus.access.AccessibilityMode;
|
||||||
import net.osmand.plus.activities.DayNightHelper;
|
import net.osmand.plus.helpers.DayNightHelper;
|
||||||
import net.osmand.plus.activities.ExitActivity;
|
import net.osmand.plus.activities.ExitActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
@ -56,7 +57,9 @@ import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
import net.osmand.plus.download.DownloadService;
|
import net.osmand.plus.download.DownloadService;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||||
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
import net.osmand.plus.helpers.LockHelper;
|
import net.osmand.plus.helpers.LockHelper;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
||||||
|
@ -189,7 +192,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
osmandSettings.initExternalStorageDirectory();
|
osmandSettings.initExternalStorageDirectory();
|
||||||
}
|
}
|
||||||
externalStorageDirectory = osmandSettings.getExternalStorageDirectory();
|
externalStorageDirectory = osmandSettings.getExternalStorageDirectory();
|
||||||
if (!OsmandSettings.isWritable(externalStorageDirectory)) {
|
if (!FileUtils.isWritable(externalStorageDirectory)) {
|
||||||
externalStorageDirectoryReadOnly = true;
|
externalStorageDirectoryReadOnly = true;
|
||||||
externalStorageDirectory = osmandSettings.getInternalAppPath();
|
externalStorageDirectory = osmandSettings.getInternalAppPath();
|
||||||
}
|
}
|
||||||
|
@ -983,15 +986,15 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupDrivingRegion(WorldRegion reg) {
|
public void setupDrivingRegion(WorldRegion reg) {
|
||||||
OsmandSettings.DrivingRegion drg = null;
|
DrivingRegion drg = null;
|
||||||
WorldRegion.RegionParams params = reg.getParams();
|
WorldRegion.RegionParams params = reg.getParams();
|
||||||
// boolean americanSigns = "american".equals(params.getRegionRoadSigns());
|
// boolean americanSigns = "american".equals(params.getRegionRoadSigns());
|
||||||
boolean leftHand = "yes".equals(params.getRegionLeftHandDriving());
|
boolean leftHand = "yes".equals(params.getRegionLeftHandDriving());
|
||||||
OsmandSettings.MetricsConstants mc1 = "miles".equals(params.getRegionMetric()) ?
|
MetricsConstants mc1 = "miles".equals(params.getRegionMetric()) ?
|
||||||
OsmandSettings.MetricsConstants.MILES_AND_FEET : OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS;
|
MetricsConstants.MILES_AND_FEET : MetricsConstants.KILOMETERS_AND_METERS;
|
||||||
OsmandSettings.MetricsConstants mc2 = "miles".equals(params.getRegionMetric()) ?
|
MetricsConstants mc2 = "miles".equals(params.getRegionMetric()) ?
|
||||||
OsmandSettings.MetricsConstants.MILES_AND_METERS : OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS;
|
MetricsConstants.MILES_AND_METERS : MetricsConstants.KILOMETERS_AND_METERS;
|
||||||
for (OsmandSettings.DrivingRegion r : OsmandSettings.DrivingRegion.values()) {
|
for (DrivingRegion r : DrivingRegion.values()) {
|
||||||
if (r.leftHandDriving == leftHand && (r.defMetrics == mc1 || r.defMetrics == mc2)) {
|
if (r.leftHandDriving == leftHand && (r.defMetrics == mc1 || r.defMetrics == mc2)) {
|
||||||
drg = r;
|
drg = r;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -74,6 +74,7 @@ import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndLocationSimulation;
|
import net.osmand.plus.OsmAndLocationSimulation;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.helpers.DayNightHelper;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -132,7 +133,6 @@ import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchTab;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
||||||
import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
|
import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
|
||||||
|
|
|
@ -32,9 +32,6 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.profiles.AppProfileArrayAdapter;
|
import net.osmand.plus.profiles.AppProfileArrayAdapter;
|
||||||
import net.osmand.plus.profiles.ProfileDataObject;
|
import net.osmand.plus.profiles.ProfileDataObject;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,9 @@ import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.AngularConstants;
|
import net.osmand.plus.helpers.enums.AngularConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.DrivingRegion;
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
|
|
|
@ -34,11 +34,12 @@ import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.AutoZoomMap;
|
import net.osmand.plus.helpers.enums.AutoZoomMap;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.SpeedConstants;
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
@ -49,10 +50,6 @@ import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper;
|
||||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.AutoZoomMap;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.SpeedConstants;
|
|
||||||
import net.osmand.plus.voice.CommandPlayer;
|
import net.osmand.plus.voice.CommandPlayer;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.GeneralRouter.GeneralRouterProfile;
|
import net.osmand.router.GeneralRouter.GeneralRouterProfile;
|
||||||
|
@ -176,7 +173,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
||||||
//array size must be equal!
|
//array size must be equal!
|
||||||
Float[] speedLimitsKmhPos = new Float[]{0f, 5f, 7f, 10f, 15f, 20f};
|
Float[] speedLimitsKmhPos = new Float[]{0f, 5f, 7f, 10f, 15f, 20f};
|
||||||
Float[] speedLimitsMphPos = new Float[]{0f, 3f, 5f, 7f, 10f, 15f};
|
Float[] speedLimitsMphPos = new Float[]{0f, 3f, 5f, 7f, 10f, 15f};
|
||||||
if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
|
if (settings.METRIC_SYSTEM.get() == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
String[] speedNames = new String[speedLimitsKmh.length];
|
String[] speedNames = new String[speedLimitsKmh.length];
|
||||||
String[] speedNamesPos = new String[speedLimitsKmhPos.length];
|
String[] speedNamesPos = new String[speedLimitsKmhPos.length];
|
||||||
for (int i = 0; i < speedLimitsKmh.length; i++) {
|
for (int i = 0; i < speedLimitsKmh.length; i++) {
|
||||||
|
|
|
@ -38,7 +38,6 @@ import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.NotesSortByMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||||
|
|
14
OsmAnd/src/net/osmand/plus/audionotes/NotesSortByMode.java
Normal file
14
OsmAnd/src/net/osmand/plus/audionotes/NotesSortByMode.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package net.osmand.plus.audionotes;
|
||||||
|
|
||||||
|
public enum NotesSortByMode {
|
||||||
|
BY_TYPE,
|
||||||
|
BY_DATE;
|
||||||
|
|
||||||
|
public boolean isByType() {
|
||||||
|
return this == BY_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isByDate() {
|
||||||
|
return this == BY_DATE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.NotesSortByMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
@ -113,7 +114,7 @@ public class DashChooseAppDirFragment {
|
||||||
boolean copyFiles = !currentAppFile.getAbsolutePath().equals(selectedFile.getAbsolutePath()) && !mapsCopied;
|
boolean copyFiles = !currentAppFile.getAbsolutePath().equals(selectedFile.getAbsolutePath()) && !mapsCopied;
|
||||||
warningReadonly.setVisibility(copyFiles ? View.VISIBLE : View.GONE);
|
warningReadonly.setVisibility(copyFiles ? View.VISIBLE : View.GONE);
|
||||||
if (copyFiles) {
|
if (copyFiles) {
|
||||||
if (!OsmandSettings.isWritable(currentAppFile)) {
|
if (!FileUtils.isWritable(currentAppFile)) {
|
||||||
warningReadonly.setText(activity.getString(R.string.android_19_location_disabled,
|
warningReadonly.setText(activity.getString(R.string.android_19_location_disabled,
|
||||||
currentAppFile.getAbsolutePath()));
|
currentAppFile.getAbsolutePath()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -385,7 +386,7 @@ public class DashChooseAppDirFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
boolean wr = OsmandSettings.isWritable(selectedFile);
|
boolean wr = FileUtils.isWritable(selectedFile);
|
||||||
if (wr) {
|
if (wr) {
|
||||||
boolean changed = !currentAppFile.getAbsolutePath().equals(selectedFile.getAbsolutePath());
|
boolean changed = !currentAppFile.getAbsolutePath().equals(selectedFile.getAbsolutePath());
|
||||||
getMyApplication().setExternalStorageDirectory(type, selectedFile.getAbsolutePath());
|
getMyApplication().setExternalStorageDirectory(type, selectedFile.getAbsolutePath());
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
|
||||||
v += "\n \u25CF BT SCO: The current app profile is not set to use 'Phone call audio'.";
|
v += "\n \u25CF BT SCO: The current app profile is not set to use 'Phone call audio'.";
|
||||||
}
|
}
|
||||||
|
|
||||||
//OsmandSettings.OsmandPreference<Integer> pref = ((OsmandApplication) getApplication()).getSettings().VOICE_PROMPT_DELAY[stream];
|
//OsmandPreference<Integer> pref = ((OsmandApplication) getApplication()).getSettings().VOICE_PROMPT_DELAY[stream];
|
||||||
//if(pref != null) {
|
//if(pref != null) {
|
||||||
// v += "\n \u25CF Voice prompt delay for selected output: " + pref.get() + "\u00A0ms";
|
// v += "\n \u25CF Voice prompt delay for selected output: " + pref.get() + "\u00A0ms";
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.DialogListItemAdapter;
|
import net.osmand.plus.DialogListItemAdapter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.helpers.enums.DayNightMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
|
@ -44,9 +45,6 @@ import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.ListStringPreference;
|
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import net.osmand.plus.transport.TransportLinesMenu;
|
import net.osmand.plus.transport.TransportLinesMenu;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -311,7 +309,7 @@ public class ConfigureMapMenu {
|
||||||
DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
|
DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
|
||||||
String sunriseTime = dateFormat.format(sunriseSunset.getSunrise());
|
String sunriseTime = dateFormat.format(sunriseSunset.getSunrise());
|
||||||
String sunsetTime = dateFormat.format(sunriseSunset.getSunset());
|
String sunsetTime = dateFormat.format(sunriseSunset.getSunset());
|
||||||
OsmandSettings.DayNightMode dayNightMode = activity.getMyApplication().getSettings().DAYNIGHT_MODE.get();
|
DayNightMode dayNightMode = activity.getMyApplication().getSettings().DAYNIGHT_MODE.get();
|
||||||
if (dayNightMode.isDay() || dayNightMode.isNight()) {
|
if (dayNightMode.isDay() || dayNightMode.isNight()) {
|
||||||
if (sunriseSunset.isDaytime()) {
|
if (sunriseSunset.isDaytime()) {
|
||||||
description = String.format(app.getString(R.string.sunset_at), sunsetTime);
|
description = String.format(app.getString(R.string.sunset_at), sunsetTime);
|
||||||
|
@ -338,9 +336,9 @@ public class ConfigureMapMenu {
|
||||||
final OsmandMapTileView view = activity.getMapView();
|
final OsmandMapTileView view = activity.getMapView();
|
||||||
AlertDialog.Builder bld = new AlertDialog.Builder(new ContextThemeWrapper(view.getContext(), themeRes));
|
AlertDialog.Builder bld = new AlertDialog.Builder(new ContextThemeWrapper(view.getContext(), themeRes));
|
||||||
bld.setTitle(R.string.daynight);
|
bld.setTitle(R.string.daynight);
|
||||||
final String[] items = new String[OsmandSettings.DayNightMode.values().length];
|
final String[] items = new String[DayNightMode.values().length];
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (int i = 0; i < items.length; i++) {
|
||||||
items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(app);
|
items[i] = DayNightMode.values()[i].toHumanString(app);
|
||||||
}
|
}
|
||||||
int i = view.getSettings().DAYNIGHT_MODE.get().ordinal();
|
int i = view.getSettings().DAYNIGHT_MODE.get().ordinal();
|
||||||
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
||||||
|
@ -349,7 +347,7 @@ public class ConfigureMapMenu {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int which = (int) v.getTag();
|
int which = (int) v.getTag();
|
||||||
view.getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.values()[which]);
|
view.getSettings().DAYNIGHT_MODE.set(DayNightMode.values()[which]);
|
||||||
refreshMapComplete(activity);
|
refreshMapComplete(activity);
|
||||||
activity.getDashboard().refreshContent(true);
|
activity.getDashboard().refreshContent(true);
|
||||||
// adapter.getItem(pos).setDescription(s, getDayNightDescr(activity));
|
// adapter.getItem(pos).setDescription(s, getDayNightDescr(activity));
|
||||||
|
|
|
@ -27,7 +27,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemTwoChoicesButton.OnBo
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
|
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.bottomsheets.BasePreferenceBottomSheet;
|
import net.osmand.plus.settings.bottomsheets.BasePreferenceBottomSheet;
|
||||||
import net.osmand.render.RenderingRuleProperty;
|
import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRuleStorageProperties;
|
import net.osmand.render.RenderingRuleStorageProperties;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityLayers;
|
import net.osmand.plus.activities.MapActivityLayers;
|
||||||
|
@ -182,8 +182,8 @@ public class RasterMapMenu {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static Boolean isSeekbarVisible(OsmandApplication app, RasterMapType type) {
|
public static Boolean isSeekbarVisible(OsmandApplication app, RasterMapType type) {
|
||||||
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
|
final LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
|
||||||
type == RasterMapType.OVERLAY ? OsmandSettings.LayerTransparencySeekbarMode.OVERLAY : OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
|
type == RasterMapType.OVERLAY ? LayerTransparencySeekbarMode.OVERLAY : LayerTransparencySeekbarMode.UNDERLAY;
|
||||||
LayerTransparencySeekbarMode seekbarMode = app.getSettings().LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
|
LayerTransparencySeekbarMode seekbarMode = app.getSettings().LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
|
||||||
return seekbarMode == LayerTransparencySeekbarMode.UNDEFINED || seekbarMode == currentMapTypeSeekbarMode;
|
return seekbarMode == LayerTransparencySeekbarMode.UNDEFINED || seekbarMode == currentMapTypeSeekbarMode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
import net.osmand.plus.OnDismissDialogFragmentListener;
|
import net.osmand.plus.OnDismissDialogFragmentListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -71,7 +72,7 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
||||||
|
|
||||||
File internalStorage = getInternalStorageDirectory(activity);
|
File internalStorage = getInternalStorageDirectory(activity);
|
||||||
File external1Storage = getExternal1StorageDirectory(activity);
|
File external1Storage = getExternal1StorageDirectory(activity);
|
||||||
if (external1Storage != null && external1Storage.exists() && OsmandSettings.isWritable(external1Storage)) {
|
if (external1Storage != null && external1Storage.exists() && FileUtils.isWritable(external1Storage)) {
|
||||||
deviceStorage = external1Storage;
|
deviceStorage = external1Storage;
|
||||||
deviceStorageType = OsmandSettings.EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE;
|
deviceStorageType = OsmandSettings.EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE;
|
||||||
deviceStorageName = getString(R.string.storage_directory_external);
|
deviceStorageName = getString(R.string.storage_directory_external);
|
||||||
|
@ -246,7 +247,7 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment {
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean saveFilesLocation(int type, File selectedFile, Activity context) {
|
public boolean saveFilesLocation(int type, File selectedFile, Activity context) {
|
||||||
boolean wr = OsmandSettings.isWritable(selectedFile);
|
boolean wr = FileUtils.isWritable(selectedFile);
|
||||||
if (wr) {
|
if (wr) {
|
||||||
((OsmandApplication) context.getApplication())
|
((OsmandApplication) context.getApplication())
|
||||||
.setExternalStorageDirectory(type, selectedFile.getAbsolutePath());
|
.setExternalStorageDirectory(type, selectedFile.getAbsolutePath());
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus.activities;
|
package net.osmand.plus.helpers;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -8,9 +8,9 @@ import java.util.TimeZone;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.StateChangedListener;
|
import net.osmand.StateChangedListener;
|
||||||
|
import net.osmand.plus.helpers.enums.DayNightMode;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.DayNightMode;
|
|
||||||
import net.osmand.util.SunriseSunset;
|
import net.osmand.util.SunriseSunset;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
|
@ -80,6 +80,8 @@ import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -95,7 +97,6 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
||||||
import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem;
|
import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult;
|
import net.osmand.plus.routing.RouteCalculationResult;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.render.RenderingRuleProperty;
|
import net.osmand.render.RenderingRuleProperty;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.router.RouteStatisticsHelper;
|
import net.osmand.router.RouteStatisticsHelper;
|
||||||
|
@ -1041,7 +1042,7 @@ public class GpxUiHelper {
|
||||||
|
|
||||||
private static float setupAxisDistance(OsmandApplication ctx, AxisBase axisBase, float meters) {
|
private static float setupAxisDistance(OsmandApplication ctx, AxisBase axisBase, float meters) {
|
||||||
OsmandSettings settings = ctx.getSettings();
|
OsmandSettings settings = ctx.getSettings();
|
||||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||||
float divX;
|
float divX;
|
||||||
|
|
||||||
String format1 = "{0,number,0.#} ";
|
String format1 = "{0,number,0.#} ";
|
||||||
|
@ -1050,10 +1051,10 @@ public class GpxUiHelper {
|
||||||
float granularity = 1f;
|
float granularity = 1f;
|
||||||
int mainUnitStr;
|
int mainUnitStr;
|
||||||
float mainUnitInMeters;
|
float mainUnitInMeters;
|
||||||
if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
|
if (mc == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
mainUnitStr = R.string.km;
|
mainUnitStr = R.string.km;
|
||||||
mainUnitInMeters = METERS_IN_KILOMETER;
|
mainUnitInMeters = METERS_IN_KILOMETER;
|
||||||
} else if (mc == OsmandSettings.MetricsConstants.NAUTICAL_MILES) {
|
} else if (mc == MetricsConstants.NAUTICAL_MILES) {
|
||||||
mainUnitStr = R.string.nm;
|
mainUnitStr = R.string.nm;
|
||||||
mainUnitInMeters = METERS_IN_ONE_NAUTICALMILE;
|
mainUnitInMeters = METERS_IN_ONE_NAUTICALMILE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1067,10 +1068,10 @@ public class GpxUiHelper {
|
||||||
if (meters >= 100 * mainUnitInMeters ||
|
if (meters >= 100 * mainUnitInMeters ||
|
||||||
meters > 9.99f * mainUnitInMeters ||
|
meters > 9.99f * mainUnitInMeters ||
|
||||||
meters > 0.999f * mainUnitInMeters ||
|
meters > 0.999f * mainUnitInMeters ||
|
||||||
mc == OsmandSettings.MetricsConstants.MILES_AND_FEET && meters > 0.249f * mainUnitInMeters ||
|
mc == MetricsConstants.MILES_AND_FEET && meters > 0.249f * mainUnitInMeters ||
|
||||||
mc == OsmandSettings.MetricsConstants.MILES_AND_METERS && meters > 0.249f * mainUnitInMeters ||
|
mc == MetricsConstants.MILES_AND_METERS && meters > 0.249f * mainUnitInMeters ||
|
||||||
mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS && meters > 0.249f * mainUnitInMeters ||
|
mc == MetricsConstants.MILES_AND_YARDS && meters > 0.249f * mainUnitInMeters ||
|
||||||
mc == OsmandSettings.MetricsConstants.NAUTICAL_MILES && meters > 0.99f * mainUnitInMeters) {
|
mc == MetricsConstants.NAUTICAL_MILES && meters > 0.99f * mainUnitInMeters) {
|
||||||
|
|
||||||
divX = mainUnitInMeters;
|
divX = mainUnitInMeters;
|
||||||
if (fmt == null) {
|
if (fmt == null) {
|
||||||
|
@ -1080,13 +1081,13 @@ public class GpxUiHelper {
|
||||||
} else {
|
} else {
|
||||||
fmt = null;
|
fmt = null;
|
||||||
granularity = 1f;
|
granularity = 1f;
|
||||||
if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS || mc == OsmandSettings.MetricsConstants.MILES_AND_METERS) {
|
if (mc == MetricsConstants.KILOMETERS_AND_METERS || mc == MetricsConstants.MILES_AND_METERS) {
|
||||||
divX = 1f;
|
divX = 1f;
|
||||||
mainUnitStr = R.string.m;
|
mainUnitStr = R.string.m;
|
||||||
} else if (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) {
|
} else if (mc == MetricsConstants.MILES_AND_FEET) {
|
||||||
divX = 1f / FEET_IN_ONE_METER;
|
divX = 1f / FEET_IN_ONE_METER;
|
||||||
mainUnitStr = R.string.foot;
|
mainUnitStr = R.string.foot;
|
||||||
} else if (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS) {
|
} else if (mc == MetricsConstants.MILES_AND_YARDS) {
|
||||||
divX = 1f / YARDS_IN_ONE_METER;
|
divX = 1f / YARDS_IN_ONE_METER;
|
||||||
mainUnitStr = R.string.yard;
|
mainUnitStr = R.string.yard;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1308,8 +1309,8 @@ public class GpxUiHelper {
|
||||||
boolean drawFilled,
|
boolean drawFilled,
|
||||||
boolean calcWithoutGaps) {
|
boolean calcWithoutGaps) {
|
||||||
OsmandSettings settings = ctx.getSettings();
|
OsmandSettings settings = ctx.getSettings();
|
||||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||||
boolean useFeet = (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) || (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS);
|
boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS);
|
||||||
boolean light = settings.isLightContent();
|
boolean light = settings.isLightContent();
|
||||||
final float convEle = useFeet ? 3.28084f : 1.0f;
|
final float convEle = useFeet ? 3.28084f : 1.0f;
|
||||||
|
|
||||||
|
@ -1410,19 +1411,19 @@ public class GpxUiHelper {
|
||||||
divX = setupAxisDistance(ctx, xAxis, calcWithoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance);
|
divX = setupAxisDistance(ctx, xAxis, calcWithoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
OsmandSettings.SpeedConstants sps = settings.SPEED_SYSTEM.get();
|
SpeedConstants sps = settings.SPEED_SYSTEM.get();
|
||||||
float mulSpeed = Float.NaN;
|
float mulSpeed = Float.NaN;
|
||||||
float divSpeed = Float.NaN;
|
float divSpeed = Float.NaN;
|
||||||
final String mainUnitY = sps.toShortString(ctx);
|
final String mainUnitY = sps.toShortString(ctx);
|
||||||
if (sps == OsmandSettings.SpeedConstants.KILOMETERS_PER_HOUR) {
|
if (sps == SpeedConstants.KILOMETERS_PER_HOUR) {
|
||||||
mulSpeed = 3.6f;
|
mulSpeed = 3.6f;
|
||||||
} else if (sps == OsmandSettings.SpeedConstants.MILES_PER_HOUR) {
|
} else if (sps == SpeedConstants.MILES_PER_HOUR) {
|
||||||
mulSpeed = 3.6f * METERS_IN_KILOMETER / METERS_IN_ONE_MILE;
|
mulSpeed = 3.6f * METERS_IN_KILOMETER / METERS_IN_ONE_MILE;
|
||||||
} else if (sps == OsmandSettings.SpeedConstants.NAUTICALMILES_PER_HOUR) {
|
} else if (sps == SpeedConstants.NAUTICALMILES_PER_HOUR) {
|
||||||
mulSpeed = 3.6f * METERS_IN_KILOMETER / METERS_IN_ONE_NAUTICALMILE;
|
mulSpeed = 3.6f * METERS_IN_KILOMETER / METERS_IN_ONE_NAUTICALMILE;
|
||||||
} else if (sps == OsmandSettings.SpeedConstants.MINUTES_PER_KILOMETER) {
|
} else if (sps == SpeedConstants.MINUTES_PER_KILOMETER) {
|
||||||
divSpeed = METERS_IN_KILOMETER / 60;
|
divSpeed = METERS_IN_KILOMETER / 60;
|
||||||
} else if (sps == OsmandSettings.SpeedConstants.MINUTES_PER_MILE) {
|
} else if (sps == SpeedConstants.MINUTES_PER_MILE) {
|
||||||
divSpeed = METERS_IN_ONE_MILE / 60;
|
divSpeed = METERS_IN_ONE_MILE / 60;
|
||||||
} else {
|
} else {
|
||||||
mulSpeed = 1f;
|
mulSpeed = 1f;
|
||||||
|
@ -1573,8 +1574,8 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
OsmandSettings settings = ctx.getSettings();
|
OsmandSettings settings = ctx.getSettings();
|
||||||
boolean light = settings.isLightContent();
|
boolean light = settings.isLightContent();
|
||||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||||
boolean useFeet = (mc == OsmandSettings.MetricsConstants.MILES_AND_FEET) || (mc == OsmandSettings.MetricsConstants.MILES_AND_YARDS);
|
boolean useFeet = (mc == MetricsConstants.MILES_AND_FEET) || (mc == MetricsConstants.MILES_AND_YARDS);
|
||||||
final float convEle = useFeet ? 3.28084f : 1.0f;
|
final float convEle = useFeet ? 3.28084f : 1.0f;
|
||||||
final float totalDistance = calcWithoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
final float totalDistance = calcWithoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.IntermediatePointsDialog;
|
import net.osmand.plus.activities.IntermediatePointsDialog;
|
||||||
import net.osmand.plus.base.PointImageDrawable;
|
import net.osmand.plus.base.PointImageDrawable;
|
||||||
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.routing.AlarmInfo;
|
import net.osmand.plus.routing.AlarmInfo;
|
||||||
|
@ -31,8 +34,6 @@ import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult;
|
import net.osmand.plus.routing.RouteCalculationResult;
|
||||||
import net.osmand.plus.routing.VoiceRouter;
|
import net.osmand.plus.routing.VoiceRouter;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -193,7 +194,7 @@ public class WaypointHelper {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmInfo getMostImportantAlarm(OsmandSettings.SpeedConstants sc, boolean showCameras) {
|
public AlarmInfo getMostImportantAlarm(SpeedConstants sc, boolean showCameras) {
|
||||||
Location lastProjection = app.getRoutingHelper().getLastProjection();
|
Location lastProjection = app.getRoutingHelper().getLastProjection();
|
||||||
float mxspeed = route.getCurrentMaxSpeed();
|
float mxspeed = route.getCurrentMaxSpeed();
|
||||||
float delta = app.getSettings().SPEED_LIMIT_EXCEED_KMH.get() / 3.6f;
|
float delta = app.getSettings().SPEED_LIMIT_EXCEED_KMH.get() / 3.6f;
|
||||||
|
@ -291,7 +292,7 @@ public class WaypointHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc, MetricsConstants mc,
|
public AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc, MetricsConstants mc,
|
||||||
OsmandSettings.SpeedConstants sc, boolean showCameras) {
|
SpeedConstants sc, boolean showCameras) {
|
||||||
float mxspeed = ro.getMaximumSpeed(ro.bearingVsRouteDirection(loc));
|
float mxspeed = ro.getMaximumSpeed(ro.bearingVsRouteDirection(loc));
|
||||||
float delta = app.getSettings().SPEED_LIMIT_EXCEED_KMH.get() / 3.6f;
|
float delta = app.getSettings().SPEED_LIMIT_EXCEED_KMH.get() / 3.6f;
|
||||||
AlarmInfo speedAlarm = createSpeedAlarm(sc, mxspeed, loc, delta);
|
AlarmInfo speedAlarm = createSpeedAlarm(sc, mxspeed, loc, delta);
|
||||||
|
@ -331,7 +332,7 @@ public class WaypointHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AlarmInfo createSpeedAlarm(OsmandSettings.SpeedConstants sc, float mxspeed, Location loc, float delta) {
|
private static AlarmInfo createSpeedAlarm(SpeedConstants sc, float mxspeed, Location loc, float delta) {
|
||||||
AlarmInfo speedAlarm = null;
|
AlarmInfo speedAlarm = null;
|
||||||
if (mxspeed != 0 && loc != null && loc.hasSpeed() && mxspeed != RouteDataObject.NONE_MAX_SPEED) {
|
if (mxspeed != 0 && loc != null && loc.hasSpeed() && mxspeed != RouteDataObject.NONE_MAX_SPEED) {
|
||||||
if (loc.getSpeed() > mxspeed + delta) {
|
if (loc.getSpeed() > mxspeed + delta) {
|
||||||
|
@ -790,7 +791,7 @@ public class WaypointHelper {
|
||||||
} else if (type == ALARMS) {
|
} else if (type == ALARMS) {
|
||||||
//assign alarm list icons manually for now
|
//assign alarm list icons manually for now
|
||||||
String typeString = ((AlarmInfo) point).getType().toString();
|
String typeString = ((AlarmInfo) point).getType().toString();
|
||||||
OsmandSettings.DrivingRegion region = app.getSettings().DRIVING_REGION.get();
|
DrivingRegion region = app.getSettings().DRIVING_REGION.get();
|
||||||
if (typeString.equals("SPEED_CAMERA")) {
|
if (typeString.equals("SPEED_CAMERA")) {
|
||||||
return AppCompatResources.getDrawable(uiCtx, R.drawable.mx_highway_speed_camera);
|
return AppCompatResources.getDrawable(uiCtx, R.drawable.mx_highway_speed_camera);
|
||||||
} else if (typeString.equals("BORDER_CONTROL")) {
|
} else if (typeString.equals("BORDER_CONTROL")) {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum AngularConstants {
|
||||||
|
DEGREES(R.string.shared_string_degrees, "°"),
|
||||||
|
DEGREES360(R.string.shared_string_degrees, "°"),
|
||||||
|
MILLIRADS(R.string.shared_string_milliradians, "mil");
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
private final String unit;
|
||||||
|
|
||||||
|
AngularConstants(int key, String unit) {
|
||||||
|
this.key = key;
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUnitSymbol() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
OsmAnd/src/net/osmand/plus/helpers/enums/AutoZoomMap.java
Normal file
19
OsmAnd/src/net/osmand/plus/helpers/enums/AutoZoomMap.java
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum AutoZoomMap {
|
||||||
|
FARTHEST(R.string.auto_zoom_farthest, 1f, 15.5f),
|
||||||
|
FAR(R.string.auto_zoom_far, 1.4f, 17f),
|
||||||
|
CLOSE(R.string.auto_zoom_close, 2f, 19f);
|
||||||
|
public final float coefficient;
|
||||||
|
public final int name;
|
||||||
|
public final float maxZoom;
|
||||||
|
|
||||||
|
AutoZoomMap(int name, float coefficient, float maxZoom) {
|
||||||
|
this.name = name;
|
||||||
|
this.coefficient = coefficient;
|
||||||
|
this.maxZoom = maxZoom;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
62
OsmAnd/src/net/osmand/plus/helpers/enums/DayNightMode.java
Normal file
62
OsmAnd/src/net/osmand/plus/helpers/enums/DayNightMode.java
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.hardware.Sensor;
|
||||||
|
import android.hardware.SensorManager;
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum DayNightMode {
|
||||||
|
AUTO(R.string.daynight_mode_auto, R.drawable.ic_action_map_sunset),
|
||||||
|
DAY(R.string.daynight_mode_day, R.drawable.ic_action_map_day),
|
||||||
|
NIGHT(R.string.daynight_mode_night, R.drawable.ic_action_map_night),
|
||||||
|
SENSOR(R.string.daynight_mode_sensor, R.drawable.ic_action_map_light_sensor);
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
@DrawableRes
|
||||||
|
private final int drawableRes;
|
||||||
|
|
||||||
|
DayNightMode(@StringRes int key, @DrawableRes int drawableRes) {
|
||||||
|
this.key = key;
|
||||||
|
this.drawableRes = drawableRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DrawableRes
|
||||||
|
public int getIconRes() {
|
||||||
|
return drawableRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSensor() {
|
||||||
|
return this == SENSOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAuto() {
|
||||||
|
return this == AUTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDay() {
|
||||||
|
return this == DAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNight() {
|
||||||
|
return this == NIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DayNightMode[] possibleValues(Context context) {
|
||||||
|
SensorManager mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
|
||||||
|
Sensor mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
|
||||||
|
boolean isLightSensorEnabled = mLight != null;
|
||||||
|
if (isLightSensorEnabled) {
|
||||||
|
return DayNightMode.values();
|
||||||
|
} else {
|
||||||
|
return new DayNightMode[]{AUTO, DAY, NIGHT};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
62
OsmAnd/src/net/osmand/plus/helpers/enums/DrivingRegion.java
Normal file
62
OsmAnd/src/net/osmand/plus/helpers/enums/DrivingRegion.java
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class represents specific for driving region
|
||||||
|
* Signs, leftHandDriving
|
||||||
|
*/
|
||||||
|
public enum DrivingRegion {
|
||||||
|
|
||||||
|
EUROPE_ASIA(R.string.driving_region_europe_asia, MetricsConstants.KILOMETERS_AND_METERS, false),
|
||||||
|
US(R.string.driving_region_us, MetricsConstants.MILES_AND_FEET, false),
|
||||||
|
CANADA(R.string.driving_region_canada, MetricsConstants.KILOMETERS_AND_METERS, false),
|
||||||
|
UK_AND_OTHERS(R.string.driving_region_uk, MetricsConstants.MILES_AND_METERS, true),
|
||||||
|
JAPAN(R.string.driving_region_japan, MetricsConstants.KILOMETERS_AND_METERS, true),
|
||||||
|
AUSTRALIA(R.string.driving_region_australia, MetricsConstants.KILOMETERS_AND_METERS, true);
|
||||||
|
|
||||||
|
public final boolean leftHandDriving;
|
||||||
|
public final MetricsConstants defMetrics;
|
||||||
|
public final int name;
|
||||||
|
|
||||||
|
DrivingRegion(int name, MetricsConstants def, boolean leftHandDriving) {
|
||||||
|
this.name = name;
|
||||||
|
defMetrics = def;
|
||||||
|
this.leftHandDriving = leftHandDriving;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAmericanTypeSigns() {
|
||||||
|
return this == DrivingRegion.AUSTRALIA ||
|
||||||
|
this == DrivingRegion.US ||
|
||||||
|
this == DrivingRegion.CANADA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription(Context ctx) {
|
||||||
|
return ctx.getString(leftHandDriving ? R.string.left_side_navigation : R.string.right_side_navigation) +
|
||||||
|
", " +
|
||||||
|
defMetrics.toHumanString(ctx).toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DrivingRegion getDrivingRegionByLocale() {
|
||||||
|
Locale df = Locale.getDefault();
|
||||||
|
if (df == null) {
|
||||||
|
return DrivingRegion.EUROPE_ASIA;
|
||||||
|
}
|
||||||
|
if (df.getCountry().equalsIgnoreCase(Locale.US.getCountry())) {
|
||||||
|
return DrivingRegion.US;
|
||||||
|
} else if (df.getCountry().equalsIgnoreCase(Locale.CANADA.getCountry())) {
|
||||||
|
return DrivingRegion.CANADA;
|
||||||
|
} else if (df.getCountry().equalsIgnoreCase(Locale.JAPAN.getCountry())) {
|
||||||
|
return DrivingRegion.JAPAN;
|
||||||
|
} else if (df.getCountry().equalsIgnoreCase("au")) {
|
||||||
|
return DrivingRegion.AUSTRALIA;
|
||||||
|
} else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) {
|
||||||
|
return DrivingRegion.UK_AND_OTHERS;
|
||||||
|
}
|
||||||
|
return DrivingRegion.EUROPE_ASIA;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum MetricsConstants {
|
||||||
|
KILOMETERS_AND_METERS(R.string.si_km_m, "km-m"),
|
||||||
|
MILES_AND_FEET(R.string.si_mi_feet, "mi-f"),
|
||||||
|
MILES_AND_METERS(R.string.si_mi_meters, "mi-m"),
|
||||||
|
MILES_AND_YARDS(R.string.si_mi_yard, "mi-y"),
|
||||||
|
NAUTICAL_MILES(R.string.si_nm, "nm");
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
private final String ttsString;
|
||||||
|
|
||||||
|
MetricsConstants(int key, String ttsString) {
|
||||||
|
this.key = key;
|
||||||
|
this.ttsString = ttsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toTTSString() {
|
||||||
|
return ttsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
33
OsmAnd/src/net/osmand/plus/helpers/enums/SpeedConstants.java
Normal file
33
OsmAnd/src/net/osmand/plus/helpers/enums/SpeedConstants.java
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum SpeedConstants {
|
||||||
|
KILOMETERS_PER_HOUR(R.string.km_h, R.string.si_kmh, false),
|
||||||
|
MILES_PER_HOUR(R.string.mile_per_hour, R.string.si_mph, true),
|
||||||
|
METERS_PER_SECOND(R.string.m_s, R.string.si_m_s, false),
|
||||||
|
MINUTES_PER_MILE(R.string.min_mile, R.string.si_min_m, true),
|
||||||
|
MINUTES_PER_KILOMETER(R.string.min_km, R.string.si_min_km, false),
|
||||||
|
NAUTICALMILES_PER_HOUR(R.string.nm_h, R.string.si_nm_h, true);
|
||||||
|
|
||||||
|
public final int key;
|
||||||
|
public final int descr;
|
||||||
|
public final boolean imperial;
|
||||||
|
|
||||||
|
SpeedConstants(int key, int descr, boolean imperial) {
|
||||||
|
this.key = key;
|
||||||
|
this.descr = descr;
|
||||||
|
this.imperial = imperial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(descr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toShortString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package net.osmand.plus.helpers.enums;
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum TracksSortByMode {
|
||||||
|
BY_DATE(R.string.sort_last_modified, R.drawable.ic_action_time_start),
|
||||||
|
BY_NAME_ASCENDING(R.string.sort_name_ascending, R.drawable.ic_action_sort_by_name_ascending),
|
||||||
|
BY_NAME_DESCENDING(R.string.sort_name_descending, R.drawable.ic_action_sort_by_name_descending);
|
||||||
|
|
||||||
|
private final int iconId;
|
||||||
|
private final int nameId;
|
||||||
|
|
||||||
|
TracksSortByMode(int nameId, int iconId) {
|
||||||
|
this.nameId = nameId;
|
||||||
|
this.iconId = iconId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isByName() {
|
||||||
|
return this == BY_NAME_ASCENDING || this == BY_NAME_DESCENDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isByDate() {
|
||||||
|
return this == BY_DATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
public int getNameId() {
|
||||||
|
return nameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DrawableRes
|
||||||
|
public int getIconId() {
|
||||||
|
return iconId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -314,7 +314,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
|
|
||||||
public void add(LocalIndexInfo info) {
|
public void add(LocalIndexInfo info) {
|
||||||
CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(
|
CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(
|
||||||
info.getFileName(), getSettings());
|
info.getFileName(), app.getSettings());
|
||||||
if (preference.get()) {
|
if (preference.get()) {
|
||||||
dataShouldUpdate.add(info);
|
dataShouldUpdate.add(info);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -76,7 +76,6 @@ import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
|
||||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||||
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.transport.TransportStopRoute;
|
import net.osmand.plus.transport.TransportStopRoute;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -644,7 +643,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
// Action buttons
|
// Action buttons
|
||||||
ContextMenuAdapter adapter = menu.getActionsContextMenuAdapter(false);
|
ContextMenuAdapter adapter = menu.getActionsContextMenuAdapter(false);
|
||||||
List<ContextMenuItem> items = adapter.getVisibleItems();
|
List<ContextMenuItem> items = adapter.getVisibleItems();
|
||||||
List<String> mainIds = ((OsmandSettings.MainContextMenuItemsSettings) mapActivity.getMyApplication()
|
List<String> mainIds = ((MainContextMenuItemsSettings) mapActivity.getMyApplication()
|
||||||
.getSettings().CONTEXT_MENU_ACTIONS_ITEMS.get()).getMainIds();
|
.getSettings().CONTEXT_MENU_ACTIONS_ITEMS.get()).getMainIds();
|
||||||
ContextMenuAdapter mainAdapter = new ContextMenuAdapter(requireMyApplication());
|
ContextMenuAdapter mainAdapter = new ContextMenuAdapter(requireMyApplication());
|
||||||
ContextMenuAdapter additionalAdapter = new ContextMenuAdapter(requireMyApplication());
|
ContextMenuAdapter additionalAdapter = new ContextMenuAdapter(requireMyApplication());
|
||||||
|
|
|
@ -36,8 +36,7 @@ import net.osmand.plus.mapcontextmenu.CollapsableView;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
|
||||||
import net.osmand.plus.views.layers.POIMapLayer;
|
import net.osmand.plus.views.layers.POIMapLayer;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
|
import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
|
||||||
|
@ -70,7 +69,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
private static final String WIKI_LINK = ".wikipedia.org/w";
|
private static final String WIKI_LINK = ".wikipedia.org/w";
|
||||||
public final static Log LOG = PlatformUtil.getLog(AmenityMenuBuilder.class);
|
public final static Log LOG = PlatformUtil.getLog(AmenityMenuBuilder.class);
|
||||||
private final static DecimalFormat DF = new DecimalFormat("#.##");
|
private final static DecimalFormat DF = new DecimalFormat("#.##");
|
||||||
private OsmandSettings.MetricsConstants metricSystem;
|
private MetricsConstants metricSystem;
|
||||||
private final Amenity amenity;
|
private final Amenity amenity;
|
||||||
|
|
||||||
|
|
||||||
|
@ -714,10 +713,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
case "seamark_height":
|
case "seamark_height":
|
||||||
if (Algorithms.isFloat(value)) {
|
if (Algorithms.isFloat(value)) {
|
||||||
double valueAsDouble = Double.valueOf(value);
|
double valueAsDouble = Double.valueOf(value);
|
||||||
if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_FEET) {
|
if (metricSystem == MetricsConstants.MILES_AND_FEET) {
|
||||||
formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.FEET_IN_ONE_METER))
|
formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.FEET_IN_ONE_METER))
|
||||||
+ " " + mapActivity.getResources().getString(R.string.foot);
|
+ " " + mapActivity.getResources().getString(R.string.foot);
|
||||||
} else if (metricSystem == OsmandSettings.MetricsConstants.MILES_AND_YARDS) {
|
} else if (metricSystem == MetricsConstants.MILES_AND_YARDS) {
|
||||||
formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.YARDS_IN_ONE_METER))
|
formattedValue = String.valueOf(DF.format(valueAsDouble * OsmAndFormatter.YARDS_IN_ONE_METER))
|
||||||
+ " " + mapActivity.getResources().getString(R.string.yard);
|
+ " " + mapActivity.getResources().getString(R.string.yard);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MapMarkersMode;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
|
37
OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersMode.java
Normal file
37
OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersMode.java
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum MapMarkersMode {
|
||||||
|
TOOLBAR(R.string.shared_string_topbar),
|
||||||
|
WIDGETS(R.string.shared_string_widgets),
|
||||||
|
NONE(R.string.shared_string_none);
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
|
||||||
|
MapMarkersMode(int key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToolbar() {
|
||||||
|
return this == TOOLBAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWidgets() {
|
||||||
|
return this == WIDGETS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNone() {
|
||||||
|
return this == NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MapMarkersMode[] possibleValues(Context context) {
|
||||||
|
return new MapMarkersMode[]{TOOLBAR, WIDGETS, NONE};
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -63,7 +62,7 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
((ImageView) mainView.findViewById(R.id.sort_by_icon)).setImageDrawable(getContentIcon(R.drawable.ic_sort_waypoint_dark));
|
((ImageView) mainView.findViewById(R.id.sort_by_icon)).setImageDrawable(getContentIcon(R.drawable.ic_sort_waypoint_dark));
|
||||||
OsmandSettings.MapMarkersMode mode = getMyApplication().getSettings().MAP_MARKERS_MODE.get();
|
MapMarkersMode mode = getMyApplication().getSettings().MAP_MARKERS_MODE.get();
|
||||||
int displayedCount = getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
int displayedCount = getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||||
ImageView showDirectionIcon = (ImageView) mainView.findViewById(R.id.show_direction_icon);
|
ImageView showDirectionIcon = (ImageView) mainView.findViewById(R.id.show_direction_icon);
|
||||||
int imageResId = 0;
|
int imageResId = 0;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
import net.osmand.plus.helpers.GpxTrackAdapter;
|
import net.osmand.plus.helpers.GpxTrackAdapter;
|
||||||
import net.osmand.plus.helpers.GpxTrackAdapter.OnItemClickListener;
|
import net.osmand.plus.helpers.GpxTrackAdapter.OnItemClickListener;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
|
||||||
|
import net.osmand.plus.helpers.enums.TracksSortByMode;
|
||||||
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
|
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
|
||||||
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionAdapterListener;
|
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionAdapterListener;
|
||||||
|
|
||||||
|
@ -38,7 +39,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import static net.osmand.plus.SimplePopUpMenuItemAdapter.*;
|
import static net.osmand.plus.SimplePopUpMenuItemAdapter.*;
|
||||||
import static net.osmand.plus.helpers.GpxUiHelper.getSortedGPXFilesInfo;
|
import static net.osmand.plus.helpers.GpxUiHelper.getSortedGPXFilesInfo;
|
||||||
import static net.osmand.plus.settings.backend.OsmandSettings.*;
|
|
||||||
import static net.osmand.util.Algorithms.collectDirs;
|
import static net.osmand.util.Algorithms.collectDirs;
|
||||||
|
|
||||||
public class SelectFileBottomSheet extends BottomSheetBehaviourDialogFragment {
|
public class SelectFileBottomSheet extends BottomSheetBehaviourDialogFragment {
|
||||||
|
|
|
@ -84,7 +84,7 @@ import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.TracksSortByMode;
|
import net.osmand.plus.helpers.enums.TracksSortByMode;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
|
|
@ -58,8 +58,6 @@ import net.osmand.plus.activities.TrackActivity;
|
||||||
import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
||||||
import net.osmand.plus.measurementtool.GpxData;
|
import net.osmand.plus.measurementtool.GpxData;
|
||||||
import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener;
|
import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.track.GpxSplitType;
|
import net.osmand.plus.track.GpxSplitType;
|
||||||
import net.osmand.plus.track.SplitTrackAsyncTask;
|
import net.osmand.plus.track.SplitTrackAsyncTask;
|
||||||
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
|
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.text.format.Time;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
@ -36,20 +35,15 @@ import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.quickaction.QuickActionType;
|
import net.osmand.plus.quickaction.QuickActionType;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.layers.MapInfoLayer;
|
import net.osmand.plus.views.layers.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.helpers.enums.DayNightMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.DayNightMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.quickaction.QuickAction;
|
import net.osmand.plus.quickaction.QuickAction;
|
||||||
|
@ -27,9 +26,9 @@ public class DayNightModeAction extends QuickAction {
|
||||||
@Override
|
@Override
|
||||||
public void execute(MapActivity activity) {
|
public void execute(MapActivity activity) {
|
||||||
if (activity.getMyApplication().getDaynightHelper().isNightMode()) {
|
if (activity.getMyApplication().getDaynightHelper().isNightMode()) {
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(DayNightMode.DAY);
|
||||||
} else {
|
} else {
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
|
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(DayNightMode.NIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package net.osmand.plus.rastermaps;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum LayerTransparencySeekbarMode {
|
||||||
|
OVERLAY(R.string.overlay_transparency),
|
||||||
|
UNDERLAY(R.string.map_transparency),
|
||||||
|
OFF(R.string.shared_string_off),
|
||||||
|
UNDEFINED(R.string.shared_string_none);
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
|
||||||
|
LayerTransparencySeekbarMode(int key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,6 @@ import com.google.gson.reflect.TypeToken;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -137,7 +136,7 @@ public class MapOverlayAction extends SwitchableAction<Pair<String, String>> {
|
||||||
if (settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDEFINED) {
|
if (settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDEFINED) {
|
||||||
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(LayerTransparencySeekbarMode.OVERLAY);
|
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(LayerTransparencySeekbarMode.OVERLAY);
|
||||||
}
|
}
|
||||||
if (settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == OsmandSettings.LayerTransparencySeekbarMode.OVERLAY) {
|
if (settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY) {
|
||||||
activity.getMapLayers().getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
|
activity.getMapLayers().getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
|
|
@ -31,7 +31,6 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.DownloadTilesDialog;
|
import net.osmand.plus.activities.DownloadTilesDialog;
|
||||||
|
@ -41,9 +40,6 @@ import net.osmand.plus.activities.MapActivityLayers;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||||
import net.osmand.plus.dialogs.RasterMapMenu;
|
import net.osmand.plus.dialogs.RasterMapMenu;
|
||||||
import net.osmand.plus.quickaction.QuickActionType;
|
import net.osmand.plus.quickaction.QuickActionType;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
import net.osmand.plus.views.MapTileLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -562,10 +558,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
||||||
ITileSource map = layer.getMap();
|
ITileSource map = layer.getMap();
|
||||||
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode = type ==
|
final LayerTransparencySeekbarMode currentMapTypeSeekbarMode = type ==
|
||||||
OsmandRasterMapsPlugin.RasterMapType.OVERLAY
|
OsmandRasterMapsPlugin.RasterMapType.OVERLAY
|
||||||
? OsmandSettings.LayerTransparencySeekbarMode.OVERLAY
|
? LayerTransparencySeekbarMode.OVERLAY
|
||||||
: OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
|
: LayerTransparencySeekbarMode.UNDERLAY;
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
mapTypePreference.set(null);
|
mapTypePreference.set(null);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
|
|
|
@ -105,9 +105,6 @@ import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.TransportRoutingHelper;
|
import net.osmand.plus.routing.TransportRoutingHelper;
|
||||||
import net.osmand.plus.search.QuickSearchHelper;
|
import net.osmand.plus.search.QuickSearchHelper;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.widgets.TextViewExProgress;
|
import net.osmand.plus.widgets.TextViewExProgress;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameter;
|
import net.osmand.router.GeneralRouter.RoutingParameter;
|
||||||
|
|
|
@ -30,13 +30,10 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameter;
|
import net.osmand.router.GeneralRouter.RoutingParameter;
|
||||||
import net.osmand.router.GeneralRouter.RoutingParameterType;
|
import net.osmand.router.GeneralRouter.RoutingParameterType;
|
||||||
import net.osmand.router.PrecalculatedRouteDirection;
|
import net.osmand.router.PrecalculatedRouteDirection;
|
||||||
import net.osmand.router.RouteCalculationProgress;
|
|
||||||
import net.osmand.router.RouteExporter;
|
import net.osmand.router.RouteExporter;
|
||||||
import net.osmand.router.RouteImporter;
|
import net.osmand.router.RouteImporter;
|
||||||
import net.osmand.router.RoutePlannerFrontEnd;
|
import net.osmand.router.RoutePlannerFrontEnd;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.notifications.OsmandNotification.NotificationType;
|
import net.osmand.plus.notifications.OsmandNotification.NotificationType;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
|
@ -408,8 +409,8 @@ public class RoutingHelper {
|
||||||
} else if (mode.getRouteService() == RouteService.DIRECT_TO) {
|
} else if (mode.getRouteService() == RouteService.DIRECT_TO) {
|
||||||
return -1.0f;
|
return -1.0f;
|
||||||
} else if (mode.getRouteService() == RouteService.STRAIGHT) {
|
} else if (mode.getRouteService() == RouteService.STRAIGHT) {
|
||||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.getModeValue(mode);
|
MetricsConstants mc = settings.METRIC_SYSTEM.getModeValue(mode);
|
||||||
if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS || mc == OsmandSettings.MetricsConstants.MILES_AND_METERS) {
|
if (mc == MetricsConstants.KILOMETERS_AND_METERS || mc == MetricsConstants.MILES_AND_METERS) {
|
||||||
return 500.f;
|
return 500.f;
|
||||||
} else {
|
} else {
|
||||||
// 1/4 mile
|
// 1/4 mile
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.settings.backend;
|
package net.osmand.plus.settings.backend;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
|
|
||||||
class BooleanAccessibilityPreference extends BooleanPreference {
|
class BooleanAccessibilityPreference extends BooleanPreference {
|
||||||
|
|
||||||
BooleanAccessibilityPreference(OsmandSettings osmandSettings, String id, boolean defaultValue) {
|
BooleanAccessibilityPreference(OsmandSettings osmandSettings, String id, boolean defaultValue) {
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package net.osmand.plus.settings.backend;
|
||||||
|
|
||||||
|
public class BooleanStringPreference extends BooleanPreference {
|
||||||
|
|
||||||
|
public BooleanStringPreference(OsmandSettings osmandSettings, String id, boolean defaultValue) {
|
||||||
|
super(osmandSettings, id, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getValue(Object prefs, Boolean defaultValue) {
|
||||||
|
Boolean value;
|
||||||
|
try {
|
||||||
|
value = parseString(getSettingsAPI().getString(prefs, getId(), defaultValue.toString()));
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
value = getSettingsAPI().getBoolean(prefs, getId(), defaultValue);
|
||||||
|
setValue(prefs, value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
|
return getSettingsAPI().edit(prefs).putString(getId(), val != null ? val.toString() : null).commit();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.settings.backend;
|
package net.osmand.plus.settings.backend;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.api.SettingsAPI;
|
import net.osmand.plus.api.SettingsAPI;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.settings.backend;
|
package net.osmand.plus.settings.backend;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.settings.backend;
|
package net.osmand.plus.settings.backend;
|
||||||
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.settings.backend;
|
package net.osmand.plus.settings.backend;
|
||||||
|
|
||||||
import net.osmand.StateChangedListener;
|
import net.osmand.StateChangedListener;
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
|
@ -6,29 +6,19 @@ import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
|
||||||
import androidx.core.util.Pair;
|
import androidx.core.util.Pair;
|
||||||
import androidx.preference.PreferenceDataStore;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
import net.osmand.data.FavouritePoint;
|
|
||||||
import net.osmand.aidl.OsmandAidlApi;
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.map.ITileSource;
|
import net.osmand.map.ITileSource;
|
||||||
|
@ -36,8 +26,6 @@ import net.osmand.map.TileSourceManager;
|
||||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.io.NetworkUtils;
|
import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.ApplicationMode;
|
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
|
@ -46,19 +34,30 @@ import net.osmand.plus.access.RelativeDirectionStyle;
|
||||||
import net.osmand.plus.api.SettingsAPI;
|
import net.osmand.plus.api.SettingsAPI;
|
||||||
import net.osmand.plus.api.SettingsAPI.SettingsEditor;
|
import net.osmand.plus.api.SettingsAPI.SettingsEditor;
|
||||||
import net.osmand.plus.api.SettingsAPIImpl;
|
import net.osmand.plus.api.SettingsAPIImpl;
|
||||||
|
import net.osmand.plus.audionotes.NotesSortByMode;
|
||||||
import net.osmand.plus.dialogs.RateUsBottomSheetDialogFragment.RateUsState;
|
import net.osmand.plus.dialogs.RateUsBottomSheetDialogFragment.RateUsState;
|
||||||
|
import net.osmand.plus.helpers.enums.AngularConstants;
|
||||||
|
import net.osmand.plus.helpers.enums.AutoZoomMap;
|
||||||
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
|
||||||
|
import net.osmand.plus.helpers.enums.DayNightMode;
|
||||||
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||||
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
|
import net.osmand.plus.helpers.enums.TracksSortByMode;
|
||||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||||
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
|
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersMode;
|
||||||
import net.osmand.plus.profiles.LocationIcon;
|
import net.osmand.plus.profiles.LocationIcon;
|
||||||
import net.osmand.plus.profiles.NavigationIcon;
|
import net.osmand.plus.profiles.NavigationIcon;
|
||||||
import net.osmand.plus.profiles.ProfileIconColors;
|
import net.osmand.plus.profiles.ProfileIconColors;
|
||||||
|
import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
|
import net.osmand.plus.srtmplugin.TerrainMode;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBuilder;
|
import net.osmand.plus.views.layers.RulerMode;
|
||||||
import net.osmand.plus.voice.CommandPlayer;
|
import net.osmand.plus.voice.CommandPlayer;
|
||||||
|
import net.osmand.plus.wikipedia.WikiArticleShowImages;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -78,7 +77,6 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
@ -213,7 +211,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO doesn't look correct package visibility
|
// TODO doesn't look correct package visibility
|
||||||
public Object getProfilePreferences(String modeKey) {
|
Object getProfilePreferences(String modeKey) {
|
||||||
return settingsAPI.getPreferenceObject(getSharedPreferencesNameForKey(modeKey));
|
return settingsAPI.getPreferenceObject(getSharedPreferencesNameForKey(modeKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,51 +691,47 @@ public class OsmandSettings {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommonPreference<RulerMode> RULER_MODE = new EnumStringPreference<>("ruler_mode", RulerMode.FIRST, RulerMode.values()).makeGlobal();
|
public final CommonPreference<RulerMode> RULER_MODE = new EnumStringPreference<>(this, "ruler_mode", RulerMode.FIRST, RulerMode.values()).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> SHOW_COMPASS_CONTROL_RULER = new BooleanPreference("show_compass_ruler", true).makeGlobal();
|
public final OsmandPreference<Boolean> SHOW_COMPASS_CONTROL_RULER = new BooleanPreference(this, "show_compass_ruler", true).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile();
|
public final CommonPreference<Boolean> SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference(this, "show_lines_to_first_markers", false).makeProfile();
|
||||||
public final CommonPreference<Boolean> SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile();
|
public final CommonPreference<Boolean> SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference(this, "show_arrows_to_first_markers", false).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> WIKI_ARTICLE_SHOW_IMAGES_ASKED = new BooleanPreference("wikivoyage_show_images_asked", false).makeGlobal();
|
public final CommonPreference<Boolean> WIKI_ARTICLE_SHOW_IMAGES_ASKED = new BooleanPreference(this, "wikivoyage_show_images_asked", false).makeGlobal();
|
||||||
public final CommonPreference<WikiArticleShowImages> WIKI_ARTICLE_SHOW_IMAGES = new EnumStringPreference<>("wikivoyage_show_imgs", WikiArticleShowImages.OFF, WikiArticleShowImages.values()).makeGlobal();
|
public final CommonPreference<WikiArticleShowImages> WIKI_ARTICLE_SHOW_IMAGES = new EnumStringPreference<>(this, "wikivoyage_show_imgs", WikiArticleShowImages.OFF, WikiArticleShowImages.values()).makeGlobal();
|
||||||
public final CommonPreference<Boolean> GLOBAL_WIKIPEDIA_POI_ENABLED = new BooleanPreference("global_wikipedia_poi_enabled", false).makeProfile();
|
public final CommonPreference<Boolean> GLOBAL_WIKIPEDIA_POI_ENABLED = new BooleanPreference(this, "global_wikipedia_poi_enabled", false).makeProfile();
|
||||||
public final ListStringPreference WIKIPEDIA_POI_ENABLED_LANGUAGES = (ListStringPreference) new ListStringPreference("wikipedia_poi_enabled_languages", null, ",").makeProfile().cache();
|
public final ListStringPreference WIKIPEDIA_POI_ENABLED_LANGUAGES = (ListStringPreference) new ListStringPreference(this, "wikipedia_poi_enabled_languages", null, ",").makeProfile().cache();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference("select_marker_on_single_tap", false).makeProfile();
|
public final CommonPreference<Boolean> SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference(this, "select_marker_on_single_tap", false).makeProfile();
|
||||||
public final CommonPreference<Boolean> KEEP_PASSED_MARKERS_ON_MAP = new BooleanPreference("keep_passed_markers_on_map", true).makeProfile();
|
public final CommonPreference<Boolean> KEEP_PASSED_MARKERS_ON_MAP = new BooleanPreference(this, "keep_passed_markers_on_map", true).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> COORDS_INPUT_USE_RIGHT_SIDE = new BooleanPreference("coords_input_use_right_side", true).makeGlobal();
|
public final CommonPreference<Boolean> COORDS_INPUT_USE_RIGHT_SIDE = new BooleanPreference(this, "coords_input_use_right_side", true).makeGlobal();
|
||||||
public final OsmandPreference<Format> COORDS_INPUT_FORMAT = new EnumStringPreference<>("coords_input_format", Format.DD_MM_MMM, Format.values()).makeGlobal();
|
public final OsmandPreference<Format> COORDS_INPUT_FORMAT = new EnumStringPreference<>(this, "coords_input_format", Format.DD_MM_MMM, Format.values()).makeGlobal();
|
||||||
public final CommonPreference<Boolean> COORDS_INPUT_USE_OSMAND_KEYBOARD = new BooleanPreference("coords_input_use_osmand_keyboard", Build.VERSION.SDK_INT >= 16).makeGlobal();
|
public final CommonPreference<Boolean> COORDS_INPUT_USE_OSMAND_KEYBOARD = new BooleanPreference(this, "coords_input_use_osmand_keyboard", Build.VERSION.SDK_INT >= 16).makeGlobal();
|
||||||
public final CommonPreference<Boolean> COORDS_INPUT_TWO_DIGITS_LONGTITUDE = new BooleanPreference("coords_input_two_digits_longitude", false).makeGlobal();
|
public final CommonPreference<Boolean> COORDS_INPUT_TWO_DIGITS_LONGTITUDE = new BooleanPreference(this, "coords_input_two_digits_longitude", false).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> USE_MAPILLARY_FILTER = new BooleanPreference("use_mapillary_filters", false).makeGlobal();
|
public final CommonPreference<Boolean> USE_MAPILLARY_FILTER = new BooleanPreference(this, "use_mapillary_filters", false).makeGlobal();
|
||||||
public final CommonPreference<String> MAPILLARY_FILTER_USER_KEY = new StringPreference("mapillary_filter_user_key", "").makeGlobal();
|
public final CommonPreference<String> MAPILLARY_FILTER_USER_KEY = new StringPreference(this, "mapillary_filter_user_key", "").makeGlobal();
|
||||||
public final CommonPreference<String> MAPILLARY_FILTER_USERNAME = new StringPreference("mapillary_filter_username", "").makeGlobal();
|
public final CommonPreference<String> MAPILLARY_FILTER_USERNAME = new StringPreference(this, "mapillary_filter_username", "").makeGlobal();
|
||||||
public final CommonPreference<Long> MAPILLARY_FILTER_FROM_DATE = new LongPreference("mapillary_filter_from_date", 0).makeGlobal();
|
public final CommonPreference<Long> MAPILLARY_FILTER_FROM_DATE = new LongPreference(this, "mapillary_filter_from_date", 0).makeGlobal();
|
||||||
public final CommonPreference<Long> MAPILLARY_FILTER_TO_DATE = new LongPreference("mapillary_filter_to_date", 0).makeGlobal();
|
public final CommonPreference<Long> MAPILLARY_FILTER_TO_DATE = new LongPreference(this, "mapillary_filter_to_date", 0).makeGlobal();
|
||||||
public final CommonPreference<Boolean> MAPILLARY_FILTER_PANO = new BooleanPreference("mapillary_filter_pano", false).makeGlobal();
|
public final CommonPreference<Boolean> MAPILLARY_FILTER_PANO = new BooleanPreference(this, "mapillary_filter_pano", false).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
|
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference(this, "use_fast_recalculation", true).makeGlobal().cache();
|
||||||
public final CommonPreference<Boolean> FORCE_PRIVATE_ACCESS_ROUTING_ASKED = new BooleanPreference("force_private_access_routing", false).makeProfile().cache();
|
public final CommonPreference<Boolean> FORCE_PRIVATE_ACCESS_ROUTING_ASKED = new BooleanPreference(this, "force_private_access_routing", false).makeProfile().cache();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", false).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference(this, "show_card_to_choose_drawer", false).makeGlobal();
|
||||||
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", false).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference(this, "should_show_dashboard_on_start", false).makeGlobal();
|
||||||
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", false).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference(this, "show_dashboard_on_map_screen", false).makeGlobal();
|
||||||
public final CommonPreference<Boolean> SHOW_OSMAND_WELCOME_SCREEN = new BooleanPreference("show_osmand_welcome_screen", true).makeGlobal();
|
public final CommonPreference<Boolean> SHOW_OSMAND_WELCOME_SCREEN = new BooleanPreference(this, "show_osmand_welcome_screen", true).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<String> API_NAV_DRAWER_ITEMS_JSON = new StringPreference("api_nav_drawer_items_json", "{}").makeGlobal();
|
public final CommonPreference<String> API_NAV_DRAWER_ITEMS_JSON = new StringPreference(this, "api_nav_drawer_items_json", "{}").makeGlobal();
|
||||||
public final CommonPreference<String> API_CONNECTED_APPS_JSON = new StringPreference("api_connected_apps_json", "[]").makeGlobal();
|
public final CommonPreference<String> API_CONNECTED_APPS_JSON = new StringPreference(this, "api_connected_apps_json", "[]").makeGlobal();
|
||||||
public final CommonPreference<String> NAV_DRAWER_LOGO = new StringPreference("drawer_logo", "").makeProfile();
|
public final CommonPreference<String> NAV_DRAWER_LOGO = new StringPreference(this, "drawer_logo", "").makeProfile();
|
||||||
public final CommonPreference<String> NAV_DRAWER_URL = new StringPreference("drawer_url", "").makeProfile();
|
public final CommonPreference<String> NAV_DRAWER_URL = new StringPreference(this, "drawer_url", "").makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<Integer> NUMBER_OF_STARTS_FIRST_XMAS_SHOWN = new IntPreference("number_of_starts_first_xmas_shown", 0).makeGlobal();
|
public final CommonPreference<Integer> NUMBER_OF_STARTS_FIRST_XMAS_SHOWN = new IntPreference(this, "number_of_starts_first_xmas_shown", 0).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<String> AVAILABLE_APP_MODES = new StringPreference("available_application_modes", "car,bicycle,pedestrian,public_transport,").makeGlobal().cache();
|
|
||||||
|
|
||||||
public final OsmandPreference<String> LAST_FAV_CATEGORY_ENTERED = new StringPreference("last_fav_category", "").makeGlobal();
|
|
||||||
|
|
||||||
public final OsmandPreference<String> AVAILABLE_APP_MODES = new StringPreference(this, "available_application_modes", "car,bicycle,pedestrian,public_transport,").makeGlobal().cache();
|
public final OsmandPreference<String> AVAILABLE_APP_MODES = new StringPreference(this, "available_application_modes", "car,bicycle,pedestrian,public_transport,").makeGlobal().cache();
|
||||||
|
|
||||||
|
@ -844,22 +838,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DrivingRegion getDefaultValue() {
|
protected DrivingRegion getDefaultValue() {
|
||||||
Locale df = Locale.getDefault();
|
return DrivingRegion.getDrivingRegionByLocale();
|
||||||
if (df == null) {
|
|
||||||
return DrivingRegion.EUROPE_ASIA;
|
|
||||||
}
|
|
||||||
if (df.getCountry().equalsIgnoreCase(Locale.US.getCountry())) {
|
|
||||||
return DrivingRegion.US;
|
|
||||||
} else if (df.getCountry().equalsIgnoreCase(Locale.CANADA.getCountry())) {
|
|
||||||
return DrivingRegion.CANADA;
|
|
||||||
} else if (df.getCountry().equalsIgnoreCase(Locale.JAPAN.getCountry())) {
|
|
||||||
return DrivingRegion.JAPAN;
|
|
||||||
} else if (df.getCountry().equalsIgnoreCase("au")) {
|
|
||||||
return DrivingRegion.AUSTRALIA;
|
|
||||||
} else if(df.getCountry().equalsIgnoreCase(Locale.UK.getCountry())) {
|
|
||||||
return DrivingRegion.UK_AND_OTHERS;
|
|
||||||
}
|
|
||||||
return DrivingRegion.EUROPE_ASIA;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}.makeProfile().cache();
|
}.makeProfile().cache();
|
||||||
|
@ -1047,24 +1026,24 @@ public class OsmandSettings {
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> DISABLE_OFFROUTE_RECALC =
|
public final OsmandPreference<Boolean> DISABLE_OFFROUTE_RECALC =
|
||||||
new BooleanPreference(this,"disable_offroute_recalc", false).makeProfile();
|
new BooleanPreference(this, "disable_offroute_recalc", false).makeProfile();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> DISABLE_WRONG_DIRECTION_RECALC =
|
public final OsmandPreference<Boolean> DISABLE_WRONG_DIRECTION_RECALC =
|
||||||
new BooleanPreference("disable_wrong_direction_recalc", false).makeProfile();
|
new BooleanPreference(this, "disable_wrong_direction_recalc", false).makeProfile();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> DIRECTION_AUDIO_FEEDBACK =
|
public final OsmandPreference<Boolean> DIRECTION_AUDIO_FEEDBACK =
|
||||||
new BooleanAccessibilityPreference(this, "direction_audio_feedback", false).makeProfile();
|
new BooleanAccessibilityPreference(this, "direction_audio_feedback", false).makeProfile();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> DIRECTION_HAPTIC_FEEDBACK =
|
public final OsmandPreference<Boolean> DIRECTION_HAPTIC_FEEDBACK =
|
||||||
new BooleanAccessibilityPreference(this, "direction_haptic_feedback", false).makeProfile();
|
new BooleanAccessibilityPreference(this, "direction_haptic_feedback", false).makeProfile();
|
||||||
|
|
||||||
// magnetic field doesn'torkmost of the time on some phones
|
// magnetic field doesn'torkmost of the time on some phones
|
||||||
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference(this, "use_magnetic_field_sensor_compass", false).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeProfile().cache();
|
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference(this, "use_kalman_filter_compass", true).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> USE_VOLUME_BUTTONS_AS_ZOOM = new BooleanPreference("use_volume_buttons_as_zoom", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> USE_VOLUME_BUTTONS_AS_ZOOM = new BooleanPreference(this, "use_volume_buttons_as_zoom", false).makeProfile().cache();
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> DO_NOT_SHOW_STARTUP_MESSAGES = new BooleanPreference(this, "do_not_show_startup_messages", false).makeGlobal().cache();
|
public final OsmandPreference<Boolean> DO_NOT_SHOW_STARTUP_MESSAGES = new BooleanPreference(this, "do_not_show_startup_messages", false).makeGlobal().cache();
|
||||||
public final OsmandPreference<Boolean> SHOW_DOWNLOAD_MAP_DIALOG = new BooleanPreference(this, "show_download_map_dialog", true).makeGlobal().cache();
|
public final OsmandPreference<Boolean> SHOW_DOWNLOAD_MAP_DIALOG = new BooleanPreference(this, "show_download_map_dialog", true).makeGlobal().cache();
|
||||||
|
@ -1117,23 +1096,23 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> INAPPS_READ = new BooleanPreference(this, "inapps_read", false).makeGlobal();
|
public final OsmandPreference<Boolean> INAPPS_READ = new BooleanPreference(this, "inapps_read", false).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<String> BILLING_USER_ID = new StringPreference("billing_user_id", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_ID = new StringPreference(this, "billing_user_id", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_TOKEN = new StringPreference("billing_user_token", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_TOKEN = new StringPreference(this, "billing_user_token", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_NAME = new StringPreference("billing_user_name", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_NAME = new StringPreference(this, "billing_user_name", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_EMAIL = new StringPreference("billing_user_email", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_EMAIL = new StringPreference(this, "billing_user_email", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_COUNTRY = new StringPreference("billing_user_country", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_COUNTRY = new StringPreference(this, "billing_user_country", "").makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_USER_COUNTRY_DOWNLOAD_NAME = new StringPreference("billing_user_country_download_name", BILLING_USER_DONATION_NONE_PARAMETER).makeGlobal();
|
public final OsmandPreference<String> BILLING_USER_COUNTRY_DOWNLOAD_NAME = new StringPreference(this, "billing_user_country_download_name", BILLING_USER_DONATION_NONE_PARAMETER).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> BILLING_HIDE_USER_NAME = new BooleanPreference("billing_hide_user_name", false).makeGlobal();
|
public final OsmandPreference<Boolean> BILLING_HIDE_USER_NAME = new BooleanPreference(this, "billing_hide_user_name", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> BILLING_PURCHASE_TOKEN_SENT = new BooleanPreference("billing_purchase_token_sent", false).makeGlobal();
|
public final OsmandPreference<Boolean> BILLING_PURCHASE_TOKEN_SENT = new BooleanPreference(this, "billing_purchase_token_sent", false).makeGlobal();
|
||||||
public final OsmandPreference<String> BILLING_PURCHASE_TOKENS_SENT = new StringPreference("billing_purchase_tokens_sent", "").makeGlobal();
|
public final OsmandPreference<String> BILLING_PURCHASE_TOKENS_SENT = new StringPreference(this, "billing_purchase_tokens_sent", "").makeGlobal();
|
||||||
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASED = new BooleanPreference("billing_live_updates_purchased", false).makeGlobal();
|
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASED = new BooleanPreference(this, "billing_live_updates_purchased", false).makeGlobal();
|
||||||
public final OsmandPreference<Long> LIVE_UPDATES_PURCHASE_CANCELLED_TIME = new LongPreference("live_updates_purchase_cancelled_time", 0).makeGlobal();
|
public final OsmandPreference<Long> LIVE_UPDATES_PURCHASE_CANCELLED_TIME = new LongPreference(this, "live_updates_purchase_cancelled_time", 0).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN = new BooleanPreference("live_updates_purchase_cancelled_first_dlg_shown", false).makeGlobal();
|
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN = new BooleanPreference(this, "live_updates_purchase_cancelled_first_dlg_shown", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN = new BooleanPreference("live_updates_purchase_cancelled_second_dlg_shown", false).makeGlobal();
|
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN = new BooleanPreference(this, "live_updates_purchase_cancelled_second_dlg_shown", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> FULL_VERSION_PURCHASED = new BooleanPreference("billing_full_version_purchased", false).makeGlobal();
|
public final OsmandPreference<Boolean> FULL_VERSION_PURCHASED = new BooleanPreference(this, "billing_full_version_purchased", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> DEPTH_CONTOURS_PURCHASED = new BooleanPreference("billing_sea_depth_purchased", false).makeGlobal();
|
public final OsmandPreference<Boolean> DEPTH_CONTOURS_PURCHASED = new BooleanPreference(this, "billing_sea_depth_purchased", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> CONTOUR_LINES_PURCHASED = new BooleanPreference("billing_srtm_purchased", false).makeGlobal();
|
public final OsmandPreference<Boolean> CONTOUR_LINES_PURCHASED = new BooleanPreference(this, "billing_srtm_purchased", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> EMAIL_SUBSCRIBED = new BooleanPreference("email_subscribed", false).makeGlobal();
|
public final OsmandPreference<Boolean> EMAIL_SUBSCRIBED = new BooleanPreference(this, "email_subscribed", false).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<Integer> DISCOUNT_ID = new IntPreference(this, "discount_id", 0).makeGlobal();
|
public final OsmandPreference<Integer> DISCOUNT_ID = new IntPreference(this, "discount_id", 0).makeGlobal();
|
||||||
public final OsmandPreference<Integer> DISCOUNT_SHOW_NUMBER_OF_STARTS = new IntPreference(this, "number_of_starts_on_discount_show", 0).makeGlobal();
|
public final OsmandPreference<Integer> DISCOUNT_SHOW_NUMBER_OF_STARTS = new IntPreference(this, "number_of_starts_on_discount_show", 0).makeGlobal();
|
||||||
|
@ -1284,17 +1263,19 @@ public class OsmandSettings {
|
||||||
{
|
{
|
||||||
SPEAK_TRAFFIC_WARNINGS.setModeDefaultValue(ApplicationMode.CAR, true);
|
SPEAK_TRAFFIC_WARNINGS.setModeDefaultValue(ApplicationMode.CAR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommonPreference<Boolean> SPEAK_PEDESTRIAN = new BooleanPreference(this, "speak_pedestrian", false).makeProfile().cache();
|
public final CommonPreference<Boolean> SPEAK_PEDESTRIAN = new BooleanPreference(this, "speak_pedestrian", false).makeProfile().cache();
|
||||||
|
|
||||||
{
|
{
|
||||||
SPEAK_PEDESTRIAN.setModeDefaultValue(ApplicationMode.CAR, true);
|
SPEAK_PEDESTRIAN.setModeDefaultValue(ApplicationMode.CAR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> SPEAK_SPEED_LIMIT = new BooleanPreference(this, "speak_speed_limit", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> SPEAK_SPEED_LIMIT = new BooleanPreference(this, "speak_speed_limit", false).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> SPEAK_SPEED_CAMERA = new BooleanPreference(this, "speak_cameras", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> SPEAK_SPEED_CAMERA = new BooleanPreference(this, "speak_cameras", false).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> SPEAK_TUNNELS = new BooleanPreference(this, "speak_tunnels", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> SPEAK_TUNNELS = new BooleanPreference(this, "speak_tunnels", false).makeProfile().cache();
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference(this, "announce_wpt", true) {
|
public final OsmandPreference<Boolean> SPEED_CAMERAS_UNINSTALLED = new BooleanPreference(this, "speed_cameras_uninstalled", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_UNINSTALLED = new BooleanPreference("speed_cameras_uninstalled", false).makeGlobal();
|
public final OsmandPreference<Boolean> SPEED_CAMERAS_ALERT_SHOWED = new BooleanPreference(this, "speed_cameras_alert_showed", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_ALERT_SHOWED = new BooleanPreference("speed_cameras_alert_showed", false).makeGlobal();
|
|
||||||
|
|
||||||
public Set<String> getForbiddenTypes() {
|
public Set<String> getForbiddenTypes() {
|
||||||
Set<String> typeNames = new HashSet<>();
|
Set<String> typeNames = new HashSet<>();
|
||||||
|
@ -1304,7 +1285,7 @@ public class OsmandSettings {
|
||||||
return typeNames;
|
return typeNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true) {
|
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference(this, "announce_wpt", true) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean setValue(Object prefs, Boolean val) {
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
boolean valueSaved = super.setValue(prefs, val);
|
boolean valueSaved = super.setValue(prefs, val);
|
||||||
|
@ -1343,11 +1324,7 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Boolean> GPX_ROUTE_CALC_OSMAND_PARTS = new BooleanPreference(this, "gpx_routing_calculate_osmand_route", true).makeGlobal().cache();
|
public final OsmandPreference<Boolean> GPX_ROUTE_CALC_OSMAND_PARTS = new BooleanPreference(this, "gpx_routing_calculate_osmand_route", true).makeGlobal().cache();
|
||||||
public final OsmandPreference<Boolean> GPX_CALCULATE_RTEPT = new BooleanPreference(this, "gpx_routing_calculate_rtept", true).makeGlobal().cache();
|
public final OsmandPreference<Boolean> GPX_CALCULATE_RTEPT = new BooleanPreference(this, "gpx_routing_calculate_rtept", true).makeGlobal().cache();
|
||||||
public final OsmandPreference<Boolean> GPX_ROUTE_CALC = new BooleanPreference(this, "calc_gpx_route", false).makeGlobal().cache();
|
public final OsmandPreference<Boolean> GPX_ROUTE_CALC = new BooleanPreference(this, "calc_gpx_route", false).makeGlobal().cache();
|
||||||
public final OsmandPreference<Boolean> SHOW_START_FINISH_ICONS = new BooleanPreference("show_start_finish_icons", true).makeGlobal().cache();
|
public final OsmandPreference<Boolean> SHOW_START_FINISH_ICONS = new BooleanPreference(this, "show_start_finish_icons", true).makeGlobal().cache();
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> GPX_ROUTE_CALC_OSMAND_PARTS = new BooleanPreference("gpx_routing_calculate_osmand_route", true).makeGlobal().cache();
|
|
||||||
// public final OsmandPreference<Boolean> GPX_CALCULATE_RTEPT = new BooleanPreference("gpx_routing_calculate_rtept", true).makeGlobal().cache();
|
|
||||||
public final OsmandPreference<Boolean> GPX_ROUTE_CALC = new BooleanPreference("calc_gpx_route", false).makeGlobal().cache();
|
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference(this, "avoid_toll_roads", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference(this, "avoid_toll_roads", false).makeProfile().cache();
|
||||||
public final OsmandPreference<Boolean> AVOID_MOTORWAY = new BooleanPreference(this, "avoid_motorway", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> AVOID_MOTORWAY = new BooleanPreference(this, "avoid_motorway", false).makeProfile().cache();
|
||||||
|
@ -1358,11 +1335,11 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final OsmandPreference<Long> LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal();
|
public final OsmandPreference<Long> LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<Integer> CURRENT_TRACK_COLOR = new IntPreference("current_track_color", 0).makeGlobal().cache();
|
public final CommonPreference<Integer> CURRENT_TRACK_COLOR = new IntPreference(this, "current_track_color", 0).makeGlobal().cache();
|
||||||
public final CommonPreference<String> CURRENT_TRACK_WIDTH = new StringPreference("current_track_width", "").makeGlobal().cache();
|
public final CommonPreference<String> CURRENT_TRACK_WIDTH = new StringPreference(this, "current_track_width", "").makeGlobal().cache();
|
||||||
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference("current_track_show_arrows", false).makeGlobal().cache();
|
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference(this, "current_track_show_arrows", false).makeGlobal().cache();
|
||||||
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference("current_track_show_start_finish", true).makeGlobal().cache();
|
public final CommonPreference<Boolean> CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference(this, "current_track_show_start_finish", true).makeGlobal().cache();
|
||||||
public final ListStringPreference CUSTOM_TRACK_COLORS = (ListStringPreference) new ListStringPreference("custom_track_colors", null, ",").makeGlobal();
|
public final ListStringPreference CUSTOM_TRACK_COLORS = (ListStringPreference) new ListStringPreference(this, "custom_track_colors", null, ",").makeGlobal();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final CommonPreference<Integer> SAVE_TRACK_INTERVAL = new IntPreference(this, "save_track_interval", 5000).makeProfile();
|
public final CommonPreference<Integer> SAVE_TRACK_INTERVAL = new IntPreference(this, "save_track_interval", 5000).makeProfile();
|
||||||
|
@ -1420,6 +1397,7 @@ public class OsmandSettings {
|
||||||
public final CommonPreference<Integer> SHOW_OSM_BUGS_MIN_ZOOM = new IntPreference(this, "show_osm_bugs_min_zoom", 8).makeProfile().cache();
|
public final CommonPreference<Integer> SHOW_OSM_BUGS_MIN_ZOOM = new IntPreference(this, "show_osm_bugs_min_zoom", 8).makeProfile().cache();
|
||||||
|
|
||||||
public final CommonPreference<String> MAP_INFO_CONTROLS = new StringPreference(this, "map_info_controls", "").makeProfile();
|
public final CommonPreference<String> MAP_INFO_CONTROLS = new StringPreference(this, "map_info_controls", "").makeProfile();
|
||||||
|
|
||||||
{
|
{
|
||||||
for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {
|
for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {
|
||||||
MAP_INFO_CONTROLS.setModeDefaultValue(mode, "");
|
MAP_INFO_CONTROLS.setModeDefaultValue(mode, "");
|
||||||
|
@ -1474,7 +1452,7 @@ public class OsmandSettings {
|
||||||
KEEP_INFORMING.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0);
|
KEEP_INFORMING.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommonPreference<Boolean> USE_SYSTEM_SCREEN_TIMEOUT = new BooleanPreference("use_system_screen_timeout", false).makeProfile();
|
public final CommonPreference<Boolean> USE_SYSTEM_SCREEN_TIMEOUT = new BooleanPreference(this, "use_system_screen_timeout", false).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<Integer> TURN_SCREEN_ON_TIME_INT = new IntPreference(this, "turn_screen_on_time_int", 0).makeProfile();
|
public final CommonPreference<Integer> TURN_SCREEN_ON_TIME_INT = new IntPreference(this, "turn_screen_on_time_int", 0).makeProfile();
|
||||||
|
|
||||||
|
@ -1492,9 +1470,9 @@ public class OsmandSettings {
|
||||||
TURN_SCREEN_ON_SENSOR.setModeDefaultValue(ApplicationMode.PEDESTRIAN, false);
|
TURN_SCREEN_ON_SENSOR.setModeDefaultValue(ApplicationMode.PEDESTRIAN, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommonPreference<Boolean> TURN_SCREEN_ON_NAVIGATION_INSTRUCTIONS = new BooleanPreference("turn_screen_on_navigation_instructions", false).makeProfile();
|
public final CommonPreference<Boolean> TURN_SCREEN_ON_NAVIGATION_INSTRUCTIONS = new BooleanPreference(this, "turn_screen_on_navigation_instructions", false).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<Boolean> TURN_SCREEN_ON_POWER_BUTTON = new BooleanPreference("turn_screen_on_power_button", false).makeProfile();
|
public final CommonPreference<Boolean> TURN_SCREEN_ON_POWER_BUTTON = new BooleanPreference(this, "turn_screen_on_power_button", false).makeProfile();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
// try without AUTO_FOLLOW_ROUTE_NAV (see forum discussion 'Simplify our navigation preference menu')
|
// try without AUTO_FOLLOW_ROUTE_NAV (see forum discussion 'Simplify our navigation preference menu')
|
||||||
|
@ -1567,7 +1545,8 @@ public class OsmandSettings {
|
||||||
VOICE_PROMPT_DELAY[3] = new IntPreference(this, "voice_prompt_delay_3", 0).makeGlobal().cache(); /*AudioManager.STREAM_MUSIC*/
|
VOICE_PROMPT_DELAY[3] = new IntPreference(this, "voice_prompt_delay_3", 0).makeGlobal().cache(); /*AudioManager.STREAM_MUSIC*/
|
||||||
VOICE_PROMPT_DELAY[5] = new IntPreference(this, "voice_prompt_delay_5", 0).makeGlobal().cache(); /*AudioManager.STREAM_NOTIFICATION*/
|
VOICE_PROMPT_DELAY[5] = new IntPreference(this, "voice_prompt_delay_5", 0).makeGlobal().cache(); /*AudioManager.STREAM_NOTIFICATION*/
|
||||||
}
|
}
|
||||||
public final OsmandPreference<Boolean> DISPLAY_TTS_UTTERANCE = new BooleanPreference("display_tts_utterance", false).makeGlobal();
|
|
||||||
|
public final OsmandPreference<Boolean> DISPLAY_TTS_UTTERANCE = new BooleanPreference(this, "display_tts_utterance", false).makeGlobal();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference(this, "map_online_data", false).makeProfile();
|
public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference(this, "map_online_data", false).makeProfile();
|
||||||
|
@ -1636,8 +1615,8 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> SHOW_COORDINATES_WIDGET = new BooleanPreference(this, "show_coordinates_widget", false).makeProfile().cache();
|
public final OsmandPreference<Boolean> SHOW_COORDINATES_WIDGET = new BooleanPreference(this, "show_coordinates_widget", false).makeProfile().cache();
|
||||||
|
|
||||||
public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumStringPreference<>("notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values());
|
public final CommonPreference<NotesSortByMode> NOTES_SORT_BY_MODE = new EnumStringPreference<>(this, "notes_sort_by_mode", NotesSortByMode.BY_DATE, NotesSortByMode.values());
|
||||||
public final CommonPreference<TracksSortByMode> TRACKS_SORT_BY_MODE = new EnumStringPreference<>("tracks_sort_by_mode", TracksSortByMode.BY_DATE, TracksSortByMode.values());
|
public final CommonPreference<TracksSortByMode> TRACKS_SORT_BY_MODE = new EnumStringPreference<>(this, "tracks_sort_by_mode", TracksSortByMode.BY_DATE, TracksSortByMode.values());
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> ANIMATE_MY_LOCATION = new BooleanPreference(this, "animate_my_location", true).makeProfile().cache();
|
public final OsmandPreference<Boolean> ANIMATE_MY_LOCATION = new BooleanPreference(this, "animate_my_location", true).makeProfile().cache();
|
||||||
|
|
||||||
|
@ -1791,7 +1770,7 @@ public class OsmandSettings {
|
||||||
setExternalStorageDirectoryPre19(getInternalAppPath().getAbsolutePath());
|
setExternalStorageDirectoryPre19(getInternalAppPath().getAbsolutePath());
|
||||||
} else {
|
} else {
|
||||||
File externalStorage = getExternal1AppPath();
|
File externalStorage = getExternal1AppPath();
|
||||||
if (externalStorage != null && OsmandSettings.isWritable(externalStorage)) {
|
if (externalStorage != null && FileUtils.isWritable(externalStorage)) {
|
||||||
setExternalStorageDirectoryV19(EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE,
|
setExternalStorageDirectoryV19(EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE,
|
||||||
getExternal1AppPath().getAbsolutePath());
|
getExternal1AppPath().getAbsolutePath());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1843,7 +1822,7 @@ public class OsmandSettings {
|
||||||
int type = settingsAPI.getInt(globalPreferences, EXTERNAL_STORAGE_DIR_TYPE_V19, -1);
|
int type = settingsAPI.getInt(globalPreferences, EXTERNAL_STORAGE_DIR_TYPE_V19, -1);
|
||||||
File location = getDefaultLocationV19();
|
File location = getDefaultLocationV19();
|
||||||
if (type == -1) {
|
if (type == -1) {
|
||||||
if (isWritable(location)) {
|
if (FileUtils.isWritable(location)) {
|
||||||
if (tp != null) {
|
if (tp != null) {
|
||||||
tp.value = settingsAPI.contains(globalPreferences, EXTERNAL_STORAGE_DIR_V19) ?
|
tp.value = settingsAPI.contains(globalPreferences, EXTERNAL_STORAGE_DIR_V19) ?
|
||||||
EXTERNAL_STORAGE_TYPE_SPECIFIED :
|
EXTERNAL_STORAGE_TYPE_SPECIFIED :
|
||||||
|
@ -1881,20 +1860,6 @@ public class OsmandSettings {
|
||||||
return new File(location);
|
return new File(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isWritable(File dirToTest) {
|
|
||||||
boolean isWriteable = false;
|
|
||||||
try {
|
|
||||||
dirToTest.mkdirs();
|
|
||||||
File writeTestFile = File.createTempFile("osmand_", ".tmp", dirToTest);
|
|
||||||
isWriteable = writeTestFile.exists();
|
|
||||||
writeTestFile.delete();
|
|
||||||
} catch (IOException e) {
|
|
||||||
isWriteable = false;
|
|
||||||
}
|
|
||||||
return isWriteable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isExternalStorageDirectoryTypeSpecifiedV19() {
|
public boolean isExternalStorageDirectoryTypeSpecifiedV19() {
|
||||||
return settingsAPI.contains(globalPreferences, EXTERNAL_STORAGE_DIR_TYPE_V19);
|
return settingsAPI.contains(globalPreferences, EXTERNAL_STORAGE_DIR_TYPE_V19);
|
||||||
}
|
}
|
||||||
|
@ -2008,10 +1973,6 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object objectToShow;
|
|
||||||
private boolean editObjectToShow;
|
|
||||||
private String searchRequestToShow;
|
|
||||||
|
|
||||||
public void setSearchRequestToShow(String request) {
|
public void setSearchRequestToShow(String request) {
|
||||||
this.searchRequestToShow = request;
|
this.searchRequestToShow = request;
|
||||||
}
|
}
|
||||||
|
@ -2039,7 +2000,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMapLocationToShow(double latitude, double longitude, int zoom, PointDescription pointDescription,
|
public void setMapLocationToShow(double latitude, double longitude, int zoom, PointDescription pointDescription,
|
||||||
boolean addToHistory, Object toShow) {
|
boolean addToHistory, Object toShow) {
|
||||||
SettingsEditor edit = settingsAPI.edit(globalPreferences);
|
SettingsEditor edit = settingsAPI.edit(globalPreferences);
|
||||||
edit.putFloat(MAP_LAT_TO_SHOW, (float) latitude);
|
edit.putFloat(MAP_LAT_TO_SHOW, (float) latitude);
|
||||||
edit.putFloat(MAP_LON_TO_SHOW, (float) longitude);
|
edit.putFloat(MAP_LON_TO_SHOW, (float) longitude);
|
||||||
|
@ -2103,7 +2064,6 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final static String INTERMEDIATE_POINTS = "intermediate_points"; //$NON-NLS-1$
|
public final static String INTERMEDIATE_POINTS = "intermediate_points"; //$NON-NLS-1$
|
||||||
public final static String INTERMEDIATE_POINTS_DESCRIPTION = "intermediate_points_description"; //$NON-NLS-1$
|
public final static String INTERMEDIATE_POINTS_DESCRIPTION = "intermediate_points_description"; //$NON-NLS-1$
|
||||||
private IntermediatePointsStorage intermediatePointsStorage = new IntermediatePointsStorage();
|
|
||||||
|
|
||||||
public final static String POINT_NAVIGATE_LAT_BACKUP = "point_navigate_lat_backup"; //$NON-NLS-1$
|
public final static String POINT_NAVIGATE_LAT_BACKUP = "point_navigate_lat_backup"; //$NON-NLS-1$
|
||||||
public final static String POINT_NAVIGATE_LON_BACKUP = "point_navigate_lon_backup"; //$NON-NLS-1$
|
public final static String POINT_NAVIGATE_LON_BACKUP = "point_navigate_lon_backup"; //$NON-NLS-1$
|
||||||
|
@ -2363,7 +2323,7 @@ public class OsmandSettings {
|
||||||
public static final String QUICK_FAB_MARGIN_X_LANDSCAPE_MARGIN = "quick_fab_margin_x_landscape_margin";
|
public static final String QUICK_FAB_MARGIN_X_LANDSCAPE_MARGIN = "quick_fab_margin_x_landscape_margin";
|
||||||
public static final String QUICK_FAB_MARGIN_Y_LANDSCAPE_MARGIN = "quick_fab_margin_y_landscape_margin";
|
public static final String QUICK_FAB_MARGIN_Y_LANDSCAPE_MARGIN = "quick_fab_margin_y_landscape_margin";
|
||||||
|
|
||||||
public final CommonPreference<Boolean> QUICK_ACTION = new BooleanPreference("quick_action_state", false).makeProfile();
|
public final CommonPreference<Boolean> QUICK_ACTION = new BooleanPreference(this, "quick_action_state", false).makeProfile();
|
||||||
|
|
||||||
public final CommonPreference<String> QUICK_ACTION_LIST = new StringPreference(this, "quick_action_list", "").makeGlobal();
|
public final CommonPreference<String> QUICK_ACTION_LIST = new StringPreference(this, "quick_action_list", "").makeGlobal();
|
||||||
|
|
||||||
|
@ -2609,11 +2569,9 @@ public class OsmandSettings {
|
||||||
RENDERER.setModeDefaultValue(ApplicationMode.SKI, RendererRegistry.WINTER_SKI_RENDER);
|
RENDERER.setModeDefaultValue(ApplicationMode.SKI, RendererRegistry.WINTER_SKI_RENDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, CommonPreference<String>> customRendersProps = new LinkedHashMap<String, OsmandSettings.CommonPreference<String>>();
|
|
||||||
|
|
||||||
public CommonPreference<String> getCustomRenderProperty(String attrName) {
|
public CommonPreference<String> getCustomRenderProperty(String attrName) {
|
||||||
if (!customRendersProps.containsKey(attrName)) {
|
if (!customRendersProps.containsKey(attrName)) {
|
||||||
customRendersProps.put(attrName, new StringPreference(RENDERER_PREFERENCE_PREFIX + attrName, "").makeProfile());
|
customRendersProps.put(attrName, new StringPreference(this, RENDERER_PREFERENCE_PREFIX + attrName, "").makeProfile());
|
||||||
}
|
}
|
||||||
return customRendersProps.get(attrName);
|
return customRendersProps.get(attrName);
|
||||||
}
|
}
|
||||||
|
@ -2623,29 +2581,24 @@ public class OsmandSettings {
|
||||||
getCustomRenderProperty("defAppMode");
|
getCustomRenderProperty("defAppMode");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, CommonPreference<Boolean>> customBooleanRendersProps = new LinkedHashMap<String, OsmandSettings.CommonPreference<Boolean>>();
|
|
||||||
|
|
||||||
public CommonPreference<Boolean> getCustomRenderBooleanProperty(String attrName) {
|
public CommonPreference<Boolean> getCustomRenderBooleanProperty(String attrName) {
|
||||||
if (!customBooleanRendersProps.containsKey(attrName)) {
|
if (!customBooleanRendersProps.containsKey(attrName)) {
|
||||||
customBooleanRendersProps.put(attrName, new BooleanPreference(RENDERER_PREFERENCE_PREFIX + attrName, false).makeProfile());
|
customBooleanRendersProps.put(attrName, new BooleanPreference(this, RENDERER_PREFERENCE_PREFIX + attrName, false).makeProfile());
|
||||||
}
|
}
|
||||||
return customBooleanRendersProps.get(attrName);
|
return customBooleanRendersProps.get(attrName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, CommonPreference<String>> customRoutingProps = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
public CommonPreference<String> getCustomRoutingProperty(String attrName, String defValue) {
|
public CommonPreference<String> getCustomRoutingProperty(String attrName, String defValue) {
|
||||||
if (!customRoutingProps.containsKey(attrName)) {
|
if (!customRoutingProps.containsKey(attrName)) {
|
||||||
customRoutingProps.put(attrName, new StringPreference(ROUTING_PREFERENCE_PREFIX + attrName, defValue).makeProfile());
|
customRoutingProps.put(attrName, new StringPreference(this, ROUTING_PREFERENCE_PREFIX + attrName, defValue).makeProfile());
|
||||||
}
|
}
|
||||||
return customRoutingProps.get(attrName);
|
return customRoutingProps.get(attrName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, CommonPreference<Boolean>> customBooleanRoutingProps = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
public CommonPreference<Boolean> getCustomRoutingBooleanProperty(String attrName, boolean defaulfValue) {
|
public CommonPreference<Boolean> getCustomRoutingBooleanProperty(String attrName, boolean defaulfValue) {
|
||||||
if (!customBooleanRoutingProps.containsKey(attrName)) {
|
if (!customBooleanRoutingProps.containsKey(attrName)) {
|
||||||
customBooleanRoutingProps.put(attrName, new BooleanStringPreference(ROUTING_PREFERENCE_PREFIX + attrName, defaulfValue).makeProfile());
|
customBooleanRoutingProps.put(attrName, new BooleanStringPreference(this, ROUTING_PREFERENCE_PREFIX + attrName, defaulfValue).makeProfile());
|
||||||
}
|
}
|
||||||
return customBooleanRoutingProps.get(attrName);
|
return customBooleanRoutingProps.get(attrName);
|
||||||
}
|
}
|
||||||
|
@ -2663,9 +2616,9 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Boolean> MAP_ACTIVITY_ENABLED = new BooleanPreference(this, "map_activity_enabled", false).makeGlobal();
|
public final OsmandPreference<Boolean> MAP_ACTIVITY_ENABLED = new BooleanPreference(this, "map_activity_enabled", false).makeGlobal();
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final OsmandPreference<Boolean> SAFE_MODE = new BooleanPreference("safe_mode", false).makeGlobal();
|
public final OsmandPreference<Boolean> SAFE_MODE = new BooleanPreference(this, "safe_mode", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> PT_SAFE_MODE = new BooleanPreference("pt_safe_mode", false).makeGlobal();
|
public final OsmandPreference<Boolean> PT_SAFE_MODE = new BooleanPreference(this, "pt_safe_mode", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> NATIVE_RENDERING_FAILED = new BooleanPreference("native_rendering_failed_init", false).makeGlobal();
|
public final OsmandPreference<Boolean> NATIVE_RENDERING_FAILED = new BooleanPreference(this, "native_rendering_failed_init", false).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render",
|
public final OsmandPreference<Boolean> USE_OPENGL_RENDER = new BooleanPreference(this, "use_opengl_render",
|
||||||
false /*Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH*/
|
false /*Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH*/
|
||||||
|
@ -2741,7 +2694,7 @@ public class OsmandSettings {
|
||||||
new IntPreference(this, "FAVORITES_TAB", 0).makeGlobal().cache();
|
new IntPreference(this, "FAVORITES_TAB", 0).makeGlobal().cache();
|
||||||
|
|
||||||
public final CommonPreference<Integer> OSMAND_THEME =
|
public final CommonPreference<Integer> OSMAND_THEME =
|
||||||
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME) {
|
new IntPreference(this, "osmand_theme", OSMAND_LIGHT_THEME) {
|
||||||
@Override
|
@Override
|
||||||
public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException {
|
public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException {
|
||||||
Integer theme = parseString(json.getString(getId()));
|
Integer theme = parseString(json.getString(getId()));
|
||||||
|
@ -2792,7 +2745,6 @@ public class OsmandSettings {
|
||||||
new BooleanPreference(this, "fluorescent_overlays", false).makeGlobal().cache();
|
new BooleanPreference(this, "fluorescent_overlays", false).makeGlobal().cache();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS_V2 = new IntPreference("free_downloads_v2", 0).makeGlobal();
|
// public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS_V2 = new IntPreference("free_downloads_v2", 0).makeGlobal();
|
||||||
|
|
||||||
public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS = new IntPreference(this, NUMBER_OF_FREE_DOWNLOADS_ID, 0).makeGlobal();
|
public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS = new IntPreference(this, NUMBER_OF_FREE_DOWNLOADS_ID, 0).makeGlobal();
|
||||||
|
@ -2811,7 +2763,7 @@ public class OsmandSettings {
|
||||||
new EnumStringPreference<>(this, "rate_us_state", RateUsState.INITIAL_STATE, RateUsState.values()).makeGlobal();
|
new EnumStringPreference<>(this, "rate_us_state", RateUsState.INITIAL_STATE, RateUsState.values()).makeGlobal();
|
||||||
|
|
||||||
public final CommonPreference<String> CUSTOM_APP_MODES_KEYS =
|
public final CommonPreference<String> CUSTOM_APP_MODES_KEYS =
|
||||||
new StringPreference(this, "custom_app_modes_keys", "").makeGlobal().cache();
|
new StringPreference(this, "custom_app_modes_keys", "").makeGlobal().cache();
|
||||||
|
|
||||||
public Set<String> getCustomAppModesKeys() {
|
public Set<String> getCustomAppModesKeys() {
|
||||||
String appModesKeys = CUSTOM_APP_MODES_KEYS.get();
|
String appModesKeys = CUSTOM_APP_MODES_KEYS.get();
|
||||||
|
@ -2823,6 +2775,16 @@ public class OsmandSettings {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setQuickActions(HashMap<String, Boolean> quickActions, ApplicationMode mode) {
|
||||||
|
if (!QUICK_ACTION.isSetForMode(mode)) {
|
||||||
|
Boolean actionState = quickActions.get(mode.getStringKey());
|
||||||
|
if (actionState == null) {
|
||||||
|
actionState = QUICK_ACTION.getDefaultValue();
|
||||||
|
}
|
||||||
|
setPreference(QUICK_ACTION.getId(), actionState, mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getAppModeBeanPrefsIds() {
|
public String[] getAppModeBeanPrefsIds() {
|
||||||
return new String[]{
|
return new String[]{
|
||||||
ICON_COLOR.getId(),
|
ICON_COLOR.getId(),
|
||||||
|
@ -2871,305 +2833,4 @@ public class OsmandSettings {
|
||||||
DRIVING_REGION_AUTOMATIC
|
DRIVING_REGION_AUTOMATIC
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DayNightMode {
|
|
||||||
AUTO(R.string.daynight_mode_auto, R.drawable.ic_action_map_sunset),
|
|
||||||
DAY(R.string.daynight_mode_day, R.drawable.ic_action_map_day),
|
|
||||||
NIGHT(R.string.daynight_mode_night, R.drawable.ic_action_map_night),
|
|
||||||
SENSOR(R.string.daynight_mode_sensor, R.drawable.ic_action_map_light_sensor);
|
|
||||||
|
|
||||||
private final int key;
|
|
||||||
@DrawableRes
|
|
||||||
private final int drawableRes;
|
|
||||||
|
|
||||||
DayNightMode(@StringRes int key, @DrawableRes int drawableRes) {
|
|
||||||
this.key = key;
|
|
||||||
this.drawableRes = drawableRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toHumanString(Context ctx) {
|
|
||||||
return ctx.getString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DrawableRes
|
|
||||||
public int getIconRes() {
|
|
||||||
return drawableRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSensor() {
|
|
||||||
return this == SENSOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAuto() {
|
|
||||||
return this == AUTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDay() {
|
|
||||||
return this == DAY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNight() {
|
|
||||||
return this == NIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DayNightMode[] possibleValues(Context context) {
|
|
||||||
SensorManager mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
|
|
||||||
Sensor mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
|
|
||||||
boolean isLightSensorEnabled = mLight != null;
|
|
||||||
if (isLightSensorEnabled) {
|
|
||||||
return DayNightMode.values();
|
|
||||||
} else {
|
|
||||||
return new DayNightMode[]{AUTO, DAY, NIGHT};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public enum LayerTransparencySeekbarMode {
|
|
||||||
OVERLAY(R.string.overlay_transparency),
|
|
||||||
UNDERLAY(R.string.map_transparency),
|
|
||||||
OFF(R.string.shared_string_off),
|
|
||||||
UNDEFINED(R.string.shared_string_none);
|
|
||||||
|
|
||||||
private final int key;
|
|
||||||
|
|
||||||
LayerTransparencySeekbarMode(int key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toHumanString(Context ctx) {
|
|
||||||
return ctx.getString(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum NotesSortByMode {
|
|
||||||
BY_TYPE,
|
|
||||||
BY_DATE;
|
|
||||||
|
|
||||||
public boolean isByType() {
|
|
||||||
return this == BY_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isByDate() {
|
|
||||||
return this == BY_DATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum TracksSortByMode {
|
|
||||||
BY_DATE(R.string.sort_last_modified, R.drawable.ic_action_time_start),
|
|
||||||
BY_NAME_ASCENDING(R.string.sort_name_ascending, R.drawable.ic_action_sort_by_name_ascending),
|
|
||||||
BY_NAME_DESCENDING(R.string.sort_name_descending, R.drawable.ic_action_sort_by_name_descending);
|
|
||||||
|
|
||||||
private final int iconId;
|
|
||||||
private final int nameId;
|
|
||||||
|
|
||||||
TracksSortByMode(int nameId, int iconId) {
|
|
||||||
this.nameId = nameId;
|
|
||||||
this.iconId = iconId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isByName() {
|
|
||||||
return this == BY_NAME_ASCENDING || this == BY_NAME_DESCENDING;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isByDate() {
|
|
||||||
return this == BY_DATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
public int getNameId() {
|
|
||||||
return nameId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@DrawableRes
|
|
||||||
public int getIconId() {
|
|
||||||
return iconId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum MapMarkersMode {
|
|
||||||
TOOLBAR(R.string.shared_string_topbar),
|
|
||||||
WIDGETS(R.string.shared_string_widgets),
|
|
||||||
NONE(R.string.shared_string_none);
|
|
||||||
|
|
||||||
private final int key;
|
|
||||||
|
|
||||||
MapMarkersMode(int key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toHumanString(Context ctx) {
|
|
||||||
return ctx.getString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isToolbar() {
|
|
||||||
return this == TOOLBAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isWidgets() {
|
|
||||||
return this == WIDGETS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNone() {
|
|
||||||
return this == NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MapMarkersMode[] possibleValues(Context context) {
|
|
||||||
return new MapMarkersMode[]{TOOLBAR, WIDGETS, NONE};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SpeedConstants {
|
|
||||||
KILOMETERS_PER_HOUR(R.string.km_h, R.string.si_kmh, false),
|
|
||||||
MILES_PER_HOUR(R.string.mile_per_hour, R.string.si_mph, true),
|
|
||||||
METERS_PER_SECOND(R.string.m_s, R.string.si_m_s, false),
|
|
||||||
MINUTES_PER_MILE(R.string.min_mile, R.string.si_min_m, true),
|
|
||||||
MINUTES_PER_KILOMETER(R.string.min_km, R.string.si_min_km, false),
|
|
||||||
NAUTICALMILES_PER_HOUR(R.string.nm_h, R.string.si_nm_h, true);
|
|
||||||
|
|
||||||
public final int key;
|
|
||||||
public final int descr;
|
|
||||||
public final boolean imperial;
|
|
||||||
|
|
||||||
SpeedConstants(int key, int descr, boolean imperial) {
|
|
||||||
this.key = key;
|
|
||||||
this.descr = descr;
|
|
||||||
this.imperial = imperial;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String toHumanString(Context ctx) {
|
|
||||||
return ctx.getString(descr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toShortString(Context ctx) {
|
|
||||||
return ctx.getString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum MetricsConstants {
|
|
||||||
KILOMETERS_AND_METERS(R.string.si_km_m, "km-m"),
|
|
||||||
MILES_AND_FEET(R.string.si_mi_feet, "mi-f"),
|
|
||||||
MILES_AND_METERS(R.string.si_mi_meters, "mi-m"),
|
|
||||||
MILES_AND_YARDS(R.string.si_mi_yard, "mi-y"),
|
|
||||||
NAUTICAL_MILES(R.string.si_nm, "nm");
|
|
||||||
|
|
||||||
private final int key;
|
|
||||||
private final String ttsString;
|
|
||||||
|
|
||||||
MetricsConstants(int key, String ttsString) {
|
|
||||||
this.key = key;
|
|
||||||
this.ttsString = ttsString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toHumanString(Context ctx) {
|
|
||||||
return ctx.getString(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toTTSString() {
|
|
||||||
return ttsString;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum AngularConstants {
|
|
||||||
DEGREES(R.string.shared_string_degrees, "°"),
|
|
||||||
DEGREES360(R.string.shared_string_degrees, "°"),
|
|
||||||
MILLIRADS(R.string.shared_string_milliradians, "mil");
|
|
||||||
|
|
||||||
private final int key;
|
|
||||||
private final String unit;
|
|
||||||
|
|
||||||
AngularConstants(int key, String unit) {
|
|
||||||
this.key = key;
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toHumanString(Context ctx) {
|
|
||||||
return ctx.getString(key);
|
|
||||||
}
|
|
||||||
public String getUnitSymbol() {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum AutoZoomMap {
|
|
||||||
FARTHEST(R.string.auto_zoom_farthest, 1f, 15.5f),
|
|
||||||
FAR(R.string.auto_zoom_far, 1.4f, 17f),
|
|
||||||
CLOSE(R.string.auto_zoom_close, 2f, 19f);
|
|
||||||
public final float coefficient;
|
|
||||||
public final int name;
|
|
||||||
public final float maxZoom;
|
|
||||||
|
|
||||||
AutoZoomMap(int name, float coefficient, float maxZoom) {
|
|
||||||
this.name = name;
|
|
||||||
this.coefficient = coefficient;
|
|
||||||
this.maxZoom = maxZoom;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class represents specific for driving region
|
|
||||||
* Signs, leftHandDriving
|
|
||||||
*/
|
|
||||||
public enum DrivingRegion {
|
|
||||||
|
|
||||||
EUROPE_ASIA(R.string.driving_region_europe_asia, MetricsConstants.KILOMETERS_AND_METERS, false),
|
|
||||||
US(R.string.driving_region_us, MetricsConstants.MILES_AND_FEET, false),
|
|
||||||
CANADA(R.string.driving_region_canada, MetricsConstants.KILOMETERS_AND_METERS, false),
|
|
||||||
UK_AND_OTHERS(R.string.driving_region_uk, MetricsConstants.MILES_AND_METERS, true),
|
|
||||||
JAPAN(R.string.driving_region_japan, MetricsConstants.KILOMETERS_AND_METERS, true),
|
|
||||||
AUSTRALIA(R.string.driving_region_australia, MetricsConstants.KILOMETERS_AND_METERS, true);
|
|
||||||
|
|
||||||
public final boolean leftHandDriving;
|
|
||||||
public final MetricsConstants defMetrics;
|
|
||||||
public final int name;
|
|
||||||
|
|
||||||
DrivingRegion(int name, MetricsConstants def, boolean leftHandDriving) {
|
|
||||||
this.name = name;
|
|
||||||
defMetrics = def;
|
|
||||||
this.leftHandDriving = leftHandDriving;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAmericanTypeSigns() {
|
|
||||||
return this == OsmandSettings.DrivingRegion.AUSTRALIA ||
|
|
||||||
this == OsmandSettings.DrivingRegion.US ||
|
|
||||||
this == OsmandSettings.DrivingRegion.CANADA;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription(Context ctx) {
|
|
||||||
return ctx.getString(leftHandDriving ? R.string.left_side_navigation : R.string.right_side_navigation) +
|
|
||||||
", " +
|
|
||||||
defMetrics.toHumanString(ctx).toLowerCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum RulerMode {
|
|
||||||
FIRST,
|
|
||||||
SECOND,
|
|
||||||
EMPTY
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum WikiArticleShowImages {
|
|
||||||
ON(R.string.shared_string_on),
|
|
||||||
OFF(R.string.shared_string_off),
|
|
||||||
WIFI(R.string.shared_string_wifi_only);
|
|
||||||
|
|
||||||
public final int name;
|
|
||||||
|
|
||||||
WikiArticleShowImages(int name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum TerrainMode {
|
|
||||||
HILLSHADE,
|
|
||||||
SLOPE
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
@ -63,7 +63,7 @@ public class ChangeDataStorageBottomSheet extends BasePreferenceBottomSheet {
|
||||||
CharSequence desc = null;
|
CharSequence desc = null;
|
||||||
|
|
||||||
File currentStorageFile = new File(currentDirectory.getDirectory());
|
File currentStorageFile = new File(currentDirectory.getDirectory());
|
||||||
if ((!OsmandSettings.isWritable(currentStorageFile))) {
|
if ((!FileUtils.isWritable(currentStorageFile))) {
|
||||||
desc = String.format(getString(R.string.android_19_location_disabled), currentStorageFile.getAbsoluteFile());
|
desc = String.format(getString(R.string.android_19_location_disabled), currentStorageFile.getAbsoluteFile());
|
||||||
} else {
|
} else {
|
||||||
String from = currentDirectory.getKey().equals(MANUALLY_SPECIFIED) ? currentDirectory.getDirectory() : currentDirectory.getTitle();
|
String from = currentDirectory.getKey().equals(MANUALLY_SPECIFIED) ? currentDirectory.getDirectory() : currentDirectory.getTitle();
|
||||||
|
|
|
@ -14,6 +14,7 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import com.google.android.material.slider.Slider;
|
import com.google.android.material.slider.Slider;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -76,8 +77,8 @@ public class RecalculateRouteInDeviationBottomSheet extends BooleanPreferenceBot
|
||||||
int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
int contentPaddingSmall = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||||
int contentPadding = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
|
int contentPadding = app.getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||||
|
|
||||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||||
if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
|
if (mc == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
entryValues = new Float[]{10.f, 20.0f, 30.0f, 50.0f, 100.0f, 200.0f, 500.0f, 1000.0f, 1500.0f};
|
entryValues = new Float[]{10.f, 20.0f, 30.0f, 50.0f, 100.0f, 200.0f, 500.0f, 1000.0f, 1500.0f};
|
||||||
} else {
|
} else {
|
||||||
entryValues = new Float[]{9.1f, 18.3f, 30.5f, 45.7f, 91.5f, 183.0f, 482.0f, 965.0f, 1609.0f};
|
entryValues = new Float[]{9.1f, 18.3f, 30.5f, 45.7f, 91.5f, 183.0f, 482.0f, 965.0f, 1609.0f};
|
||||||
|
|
|
@ -23,6 +23,7 @@ import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.PreferenceViewHolder;
|
import androidx.preference.PreferenceViewHolder;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.FileUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.ProgressImplementation;
|
import net.osmand.plus.ProgressImplementation;
|
||||||
|
@ -408,7 +409,7 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
||||||
String newDirectory = newStorageDirectory.getDirectory();
|
String newDirectory = newStorageDirectory.getDirectory();
|
||||||
int type = newStorageDirectory.getType();
|
int type = newStorageDirectory.getType();
|
||||||
File newDirectoryFile = new File(newDirectory);
|
File newDirectoryFile = new File(newDirectory);
|
||||||
boolean wr = OsmandSettings.isWritable(newDirectoryFile);
|
boolean wr = FileUtils.isWritable(newDirectoryFile);
|
||||||
if (wr) {
|
if (wr) {
|
||||||
app.setExternalStorageDirectory(type, newDirectory);
|
app.setExternalStorageDirectory(type, newDirectory);
|
||||||
reloadData();
|
reloadData();
|
||||||
|
|
|
@ -22,9 +22,12 @@ import androidx.preference.PreferenceViewHolder;
|
||||||
import androidx.preference.SwitchPreferenceCompat;
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.plus.helpers.enums.AngularConstants;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
|
import net.osmand.plus.helpers.enums.SpeedConstants;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.DrivingRegion;
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
@ -186,7 +189,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupUnitsOfLengthPref() {
|
private void setupUnitsOfLengthPref() {
|
||||||
OsmandSettings.MetricsConstants[] metricsConstants = OsmandSettings.MetricsConstants.values();
|
MetricsConstants[] metricsConstants = MetricsConstants.values();
|
||||||
String[] entries = new String[metricsConstants.length];
|
String[] entries = new String[metricsConstants.length];
|
||||||
Integer[] entryValues = new Integer[metricsConstants.length];
|
Integer[] entryValues = new Integer[metricsConstants.length];
|
||||||
|
|
||||||
|
@ -208,20 +211,20 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAngularUnitsPref() {
|
private void setupAngularUnitsPref() {
|
||||||
OsmandSettings.AngularConstants[] ac = OsmandSettings.AngularConstants.values();
|
AngularConstants[] ac = AngularConstants.values();
|
||||||
String[] entries = new String[ac.length];
|
String[] entries = new String[ac.length];
|
||||||
Integer[] entryValues = new Integer[ac.length];
|
Integer[] entryValues = new Integer[ac.length];
|
||||||
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
if (ac[i] == OsmandSettings.AngularConstants.DEGREES) {
|
if (ac[i] == AngularConstants.DEGREES) {
|
||||||
entries[i] = OsmandSettings.AngularConstants.DEGREES.toHumanString(app) + " 180";
|
entries[i] = AngularConstants.DEGREES.toHumanString(app) + " 180";
|
||||||
entryValues[i] = OsmandSettings.AngularConstants.DEGREES.ordinal();
|
entryValues[i] = AngularConstants.DEGREES.ordinal();
|
||||||
} else if (ac[i] == OsmandSettings.AngularConstants.DEGREES360) {
|
} else if (ac[i] == AngularConstants.DEGREES360) {
|
||||||
entries[i] = OsmandSettings.AngularConstants.DEGREES.toHumanString(app) + " 360";
|
entries[i] = AngularConstants.DEGREES.toHumanString(app) + " 360";
|
||||||
entryValues[i] = OsmandSettings.AngularConstants.DEGREES360.ordinal();
|
entryValues[i] = AngularConstants.DEGREES360.ordinal();
|
||||||
} else {
|
} else {
|
||||||
entries[i] = ac[i].toHumanString(app);
|
entries[i] = ac[i].toHumanString(app);
|
||||||
entryValues[i] = OsmandSettings.AngularConstants.MILLIRADS.ordinal();
|
entryValues[i] = AngularConstants.MILLIRADS.ordinal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +235,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSpeedSystemPref() {
|
private void setupSpeedSystemPref() {
|
||||||
OsmandSettings.SpeedConstants[] speedConstants = OsmandSettings.SpeedConstants.values();
|
SpeedConstants[] speedConstants = SpeedConstants.values();
|
||||||
String[] entries = new String[speedConstants.length];
|
String[] entries = new String[speedConstants.length];
|
||||||
Integer[] entryValues = new Integer[speedConstants.length];
|
Integer[] entryValues = new Integer[speedConstants.length];
|
||||||
|
|
||||||
|
@ -377,14 +380,14 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
|
||||||
if (mapViewTrackingUtilities != null) {
|
if (mapViewTrackingUtilities != null) {
|
||||||
mapViewTrackingUtilities.resetDrivingRegionUpdate();
|
mapViewTrackingUtilities.resetDrivingRegionUpdate();
|
||||||
}
|
}
|
||||||
} else if (newValue instanceof OsmandSettings.DrivingRegion) {
|
} else if (newValue instanceof DrivingRegion) {
|
||||||
applyPreference(settings.DRIVING_REGION_AUTOMATIC.getId(), applyToAllProfiles, false);
|
applyPreference(settings.DRIVING_REGION_AUTOMATIC.getId(), applyToAllProfiles, false);
|
||||||
if (applyToAllProfiles) {
|
if (applyToAllProfiles) {
|
||||||
for (ApplicationMode appMode : ApplicationMode.allPossibleValues()) {
|
for (ApplicationMode appMode : ApplicationMode.allPossibleValues()) {
|
||||||
settings.DRIVING_REGION.setModeValue(appMode, (OsmandSettings.DrivingRegion) newValue);
|
settings.DRIVING_REGION.setModeValue(appMode, (DrivingRegion) newValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settings.DRIVING_REGION.setModeValue(selectedMode, (OsmandSettings.DrivingRegion) newValue);
|
settings.DRIVING_REGION.setModeValue(selectedMode, (DrivingRegion) newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateAllSettings();
|
updateAllSettings();
|
||||||
|
|
|
@ -2,8 +2,8 @@ package net.osmand.plus.settings.fragments;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.AutoZoomMap;
|
import net.osmand.plus.helpers.enums.AutoZoomMap;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||||
|
@ -78,7 +78,7 @@ public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
||||||
Float[] valuesKmh = new Float[]{0f, 5f, 7f, 10f, 15f, 20f};
|
Float[] valuesKmh = new Float[]{0f, 5f, 7f, 10f, 15f, 20f};
|
||||||
Float[] valuesMph = new Float[]{0f, 3f, 5f, 7f, 10f, 15f};
|
Float[] valuesMph = new Float[]{0f, 3f, 5f, 7f, 10f, 15f};
|
||||||
String[] names;
|
String[] names;
|
||||||
if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
|
if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
names = new String[valuesKmh.length];
|
names = new String[valuesKmh.length];
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (int i = 0; i < names.length; i++) {
|
||||||
names[i] = valuesKmh[i].intValue() + " " + getString(R.string.km_h);
|
names[i] = valuesKmh[i].intValue() + " " + getString(R.string.km_h);
|
||||||
|
@ -113,7 +113,7 @@ public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
||||||
} else {
|
} else {
|
||||||
applyPreference(settings.AUTO_ZOOM_MAP.getId(), applyToAllProfiles, true);
|
applyPreference(settings.AUTO_ZOOM_MAP.getId(), applyToAllProfiles, true);
|
||||||
applyPreference(settings.AUTO_ZOOM_MAP_SCALE.getId(),
|
applyPreference(settings.AUTO_ZOOM_MAP_SCALE.getId(),
|
||||||
applyToAllProfiles, OsmandSettings.AutoZoomMap.values()[position - 1]);
|
applyToAllProfiles, AutoZoomMap.values()[position - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,7 +37,6 @@ import net.osmand.plus.activities.SettingsBaseActivity;
|
||||||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
import net.osmand.plus.activities.SettingsNavigationActivity;
|
||||||
import net.osmand.plus.routing.RouteProvider;
|
import net.osmand.plus.routing.RouteProvider;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.settings.bottomsheets.RecalculateRouteInDeviationBottomSheet;
|
import net.osmand.plus.settings.bottomsheets.RecalculateRouteInDeviationBottomSheet;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
|
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import net.osmand.plus.activities.SettingsBaseActivity;
|
||||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.StringPreference;
|
||||||
import net.osmand.plus.settings.bottomsheets.VehicleParametersBottomSheet;
|
import net.osmand.plus.settings.bottomsheets.VehicleParametersBottomSheet;
|
||||||
import net.osmand.plus.settings.bottomsheets.VehicleSizeAssets;
|
import net.osmand.plus.settings.bottomsheets.VehicleSizeAssets;
|
||||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||||
|
@ -72,7 +72,7 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
|
||||||
parameter.getDescription());
|
parameter.getDescription());
|
||||||
String defValue = parameter.getType() == RoutingParameterType.NUMERIC
|
String defValue = parameter.getType() == RoutingParameterType.NUMERIC
|
||||||
? ROUTING_PARAMETER_NUMERIC_DEFAULT : ROUTING_PARAMETER_SYMBOLIC_DEFAULT;
|
? ROUTING_PARAMETER_NUMERIC_DEFAULT : ROUTING_PARAMETER_SYMBOLIC_DEFAULT;
|
||||||
OsmandSettings.StringPreference pref = (OsmandSettings.StringPreference) app.getSettings()
|
StringPreference pref = (StringPreference) app.getSettings()
|
||||||
.getCustomRoutingProperty(parameterId, defValue);
|
.getCustomRoutingProperty(parameterId, defValue);
|
||||||
VehicleSizeAssets assets = VehicleSizeAssets.getAssets(parameterId, routerProfile);
|
VehicleSizeAssets assets = VehicleSizeAssets.getAssets(parameterId, routerProfile);
|
||||||
Object[] values = parameter.getPossibleValues();
|
Object[] values = parameter.getPossibleValues();
|
||||||
|
|
|
@ -18,6 +18,7 @@ import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.dialogs.SpeedCamerasBottomSheet;
|
import net.osmand.plus.dialogs.SpeedCamerasBottomSheet;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -107,7 +108,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
Float[] valuesKmh = new Float[]{-10f, -7f, -5f, 0f, 5f, 7f, 10f, 15f, 20f};
|
Float[] valuesKmh = new Float[]{-10f, -7f, -5f, 0f, 5f, 7f, 10f, 15f, 20f};
|
||||||
Float[] valuesMph = new Float[]{-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f};
|
Float[] valuesMph = new Float[]{-7f, -5f, -3f, 0f, 3f, 5f, 7f, 10f, 15f};
|
||||||
String[] names;
|
String[] names;
|
||||||
if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) {
|
if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||||
names = new String[valuesKmh.length];
|
names = new String[valuesKmh.length];
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (int i = 0; i < names.length; i++) {
|
||||||
names[i] = valuesKmh[i].intValue() + " " + getString(R.string.km_h);
|
names[i] = valuesKmh[i].intValue() + " " + getString(R.string.km_h);
|
||||||
|
|
|
@ -8,7 +8,6 @@ import androidx.preference.DialogPreference;
|
||||||
import androidx.preference.PreferenceDataStore;
|
import androidx.preference.PreferenceDataStore;
|
||||||
|
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.PreferencesDataStore;
|
|
||||||
import net.osmand.plus.settings.backend.OsmAndPreferencesDataStore;
|
import net.osmand.plus.settings.backend.OsmAndPreferencesDataStore;
|
||||||
|
|
||||||
public class ListPreferenceEx extends DialogPreference {
|
public class ListPreferenceEx extends DialogPreference {
|
||||||
|
|
|
@ -21,7 +21,6 @@ import net.osmand.plus.DialogListItemAdapter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.TerrainMode;
|
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
|
|
@ -43,7 +43,6 @@ import net.osmand.plus.download.DownloadValidationManager;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.TerrainMode;
|
|
||||||
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -55,8 +54,8 @@ import java.util.List;
|
||||||
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*;
|
import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*;
|
||||||
import static net.osmand.plus.download.DownloadActivityType.HILLSHADE_FILE;
|
import static net.osmand.plus.download.DownloadActivityType.HILLSHADE_FILE;
|
||||||
import static net.osmand.plus.download.DownloadActivityType.SLOPE_FILE;
|
import static net.osmand.plus.download.DownloadActivityType.SLOPE_FILE;
|
||||||
import static net.osmand.plus.settings.backend.OsmandSettings.TerrainMode.HILLSHADE;
|
import static net.osmand.plus.srtmplugin.TerrainMode.HILLSHADE;
|
||||||
import static net.osmand.plus.settings.backend.OsmandSettings.TerrainMode.SLOPE;
|
import static net.osmand.plus.srtmplugin.TerrainMode.SLOPE;
|
||||||
import static net.osmand.plus.srtmplugin.SRTMPlugin.TERRAIN_MAX_ZOOM;
|
import static net.osmand.plus.srtmplugin.SRTMPlugin.TERRAIN_MAX_ZOOM;
|
||||||
import static net.osmand.plus.srtmplugin.SRTMPlugin.TERRAIN_MIN_ZOOM;
|
import static net.osmand.plus.srtmplugin.SRTMPlugin.TERRAIN_MIN_ZOOM;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.TerrainMode;
|
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
import net.osmand.plus.views.MapTileLayer;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static net.osmand.plus.settings.backend.OsmandSettings.TerrainMode.HILLSHADE;
|
import static net.osmand.plus.srtmplugin.TerrainMode.HILLSHADE;
|
||||||
|
|
||||||
public class TerrainLayer extends MapTileLayer {
|
public class TerrainLayer extends MapTileLayer {
|
||||||
|
|
||||||
|
|
6
OsmAnd/src/net/osmand/plus/srtmplugin/TerrainMode.java
Normal file
6
OsmAnd/src/net/osmand/plus/srtmplugin/TerrainMode.java
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package net.osmand.plus.srtmplugin;
|
||||||
|
|
||||||
|
public enum TerrainMode {
|
||||||
|
HILLSHADE,
|
||||||
|
SLOPE
|
||||||
|
}
|
|
@ -10,8 +10,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
|
|
||||||
class ShowStartFinishCard extends BaseCard {
|
class ShowStartFinishCard extends BaseCard {
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.track.CustomColorBottomSheet.ColorPickerListener;
|
import net.osmand.plus.track.CustomColorBottomSheet.ColorPickerListener;
|
||||||
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
|
import net.osmand.plus.track.SplitTrackAsyncTask.SplitTrackListener;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
|
@ -185,7 +185,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
||||||
}
|
}
|
||||||
if (color == 0) {
|
if (color == 0) {
|
||||||
RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer();
|
RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer();
|
||||||
OsmandSettings.CommonPreference<String> prefColor = app.getSettings().getCustomRenderProperty(CURRENT_TRACK_COLOR_ATTR);
|
CommonPreference<String> prefColor = app.getSettings().getCustomRenderProperty(CURRENT_TRACK_COLOR_ATTR);
|
||||||
color = GpxAppearanceAdapter.parseTrackColor(renderer, prefColor.get());
|
color = GpxAppearanceAdapter.parseTrackColor(renderer, prefColor.get());
|
||||||
}
|
}
|
||||||
trackDrawInfo.setColor(color);
|
trackDrawInfo.setColor(color);
|
||||||
|
|
|
@ -50,7 +50,7 @@ import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
|
||||||
import net.osmand.plus.render.OsmandRenderer;
|
import net.osmand.plus.render.OsmandRenderer;
|
||||||
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.track.SaveGpxAsyncTask;
|
import net.osmand.plus.track.SaveGpxAsyncTask;
|
||||||
import net.osmand.plus.track.TrackDrawInfo;
|
import net.osmand.plus.track.TrackDrawInfo;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
|
|
@ -47,7 +47,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
@ -67,9 +67,6 @@ import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
import net.osmand.plus.search.QuickSearchDialogFragment.QuickSearchType;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
import net.osmand.plus.settings.backend.OsmAndAppCustomization;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.LayerTransparencySeekbarMode;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||||
|
|
|
@ -29,10 +29,9 @@ import net.osmand.data.QuadPoint;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.helpers.enums.AngularConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.AngularConstants;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.RulerMode;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
@ -72,7 +71,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
private QuadPoint cacheCenter;
|
private QuadPoint cacheCenter;
|
||||||
private float cacheMapDensity;
|
private float cacheMapDensity;
|
||||||
private OsmandPreference<Float> mapDensity;
|
private OsmandPreference<Float> mapDensity;
|
||||||
private OsmandSettings.MetricsConstants cacheMetricSystem;
|
private MetricsConstants cacheMetricSystem;
|
||||||
private int cacheIntZoom;
|
private int cacheIntZoom;
|
||||||
private LatLon cacheCenterLatLon;
|
private LatLon cacheCenterLatLon;
|
||||||
private long cacheMultiTouchEndTime;
|
private long cacheMultiTouchEndTime;
|
||||||
|
@ -452,7 +451,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
updateCenter(tb, center);
|
updateCenter(tb, center);
|
||||||
}
|
}
|
||||||
|
|
||||||
OsmandSettings.MetricsConstants currentMetricSystem = app.getSettings().METRIC_SYSTEM.get();
|
MetricsConstants currentMetricSystem = app.getSettings().METRIC_SYSTEM.get();
|
||||||
boolean updateCache = tb.getZoom() != cacheIntZoom
|
boolean updateCache = tb.getZoom() != cacheIntZoom
|
||||||
|| !tb.getCenterLatLon().equals(cacheCenterLatLon) || mapDensity.get() != cacheMapDensity
|
|| !tb.getCenterLatLon().equals(cacheCenterLatLon) || mapDensity.get() != cacheMapDensity
|
||||||
|| cacheMetricSystem != currentMetricSystem;
|
|| cacheMetricSystem != currentMetricSystem;
|
||||||
|
|
7
OsmAnd/src/net/osmand/plus/views/layers/RulerMode.java
Normal file
7
OsmAnd/src/net/osmand/plus/views/layers/RulerMode.java
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package net.osmand.plus.views.layers;
|
||||||
|
|
||||||
|
public enum RulerMode {
|
||||||
|
FIRST,
|
||||||
|
SECOND,
|
||||||
|
EMPTY
|
||||||
|
}
|
|
@ -48,9 +48,8 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.GPSInfo;
|
import net.osmand.plus.OsmAndLocationProvider.GPSInfo;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandPreference;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.RulerMode;
|
import net.osmand.plus.views.layers.RulerMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
@ -66,8 +65,6 @@ import net.osmand.plus.routepreparationmenu.ShowAlongTheRouteBottomSheet;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult;
|
import net.osmand.plus.routing.RouteCalculationResult;
|
||||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.RulerMode;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.layers.RulerControlLayer;
|
import net.osmand.plus.views.layers.RulerControlLayer;
|
||||||
|
|
|
@ -25,8 +25,6 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.mapwidgets.widgets.AlarmWidget;
|
import net.osmand.plus.views.mapwidgets.widgets.AlarmWidget;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.helpers.enums.DrivingRegion;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.routing.AlarmInfo;
|
import net.osmand.plus.routing.AlarmInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
@ -40,7 +41,7 @@ public class AlarmWidget {
|
||||||
private int imgId;
|
private int imgId;
|
||||||
private String cachedText;
|
private String cachedText;
|
||||||
private String cachedBottomText;
|
private String cachedBottomText;
|
||||||
private OsmandSettings.DrivingRegion cachedRegion;
|
private DrivingRegion cachedRegion;
|
||||||
|
|
||||||
public AlarmWidget(final OsmandApplication app, MapActivity ma) {
|
public AlarmWidget(final OsmandApplication app, MapActivity ma) {
|
||||||
layout = ma.findViewById(R.id.map_alarm_warning);
|
layout = ma.findViewById(R.id.map_alarm_warning);
|
||||||
|
@ -81,9 +82,9 @@ public class AlarmWidget {
|
||||||
int locimgId = R.drawable.warnings_limit;
|
int locimgId = R.drawable.warnings_limit;
|
||||||
String text = "";
|
String text = "";
|
||||||
String bottomText = "";
|
String bottomText = "";
|
||||||
OsmandSettings.DrivingRegion region = settings.DRIVING_REGION.get();
|
DrivingRegion region = settings.DRIVING_REGION.get();
|
||||||
boolean americanType = region.isAmericanTypeSigns();
|
boolean americanType = region.isAmericanTypeSigns();
|
||||||
boolean isCanadianRegion = region == OsmandSettings.DrivingRegion.CANADA;
|
boolean isCanadianRegion = region == DrivingRegion.CANADA;
|
||||||
if (alarm.getType() == AlarmInfo.AlarmInfoType.SPEED_LIMIT) {
|
if (alarm.getType() == AlarmInfo.AlarmInfoType.SPEED_LIMIT) {
|
||||||
if (isCanadianRegion) {
|
if (isCanadianRegion) {
|
||||||
locimgId = R.drawable.warnings_speed_limit_ca;
|
locimgId = R.drawable.warnings_speed_limit_ca;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@ package net.osmand.plus.views.mapwidgets.widgetstates;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
|
|
||||||
public class BearingWidgetState extends WidgetState {
|
public class BearingWidgetState extends WidgetState {
|
||||||
|
|
||||||
public static final int BEARING_WIDGET_STATE_RELATIVE_BEARING = R.id.bearing_widget_state_relative_bearing;
|
public static final int BEARING_WIDGET_STATE_RELATIVE_BEARING = R.id.bearing_widget_state_relative_bearing;
|
||||||
public static final int BEARING_WIDGET_STATE_MAGNETIC_BEARING = R.id.bearing_widget_state_magnetic_bearing;
|
public static final int BEARING_WIDGET_STATE_MAGNETIC_BEARING = R.id.bearing_widget_state_magnetic_bearing;
|
||||||
|
|
||||||
private final OsmandSettings.OsmandPreference<Boolean> showRelativeBearing;
|
private final OsmandPreference<Boolean> showRelativeBearing;
|
||||||
|
|
||||||
public BearingWidgetState(OsmandApplication ctx) {
|
public BearingWidgetState(OsmandApplication ctx) {
|
||||||
super(ctx);
|
super(ctx);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package net.osmand.plus.views.mapwidgets.widgetstates;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
|
|
||||||
public class CompassRulerWidgetState extends WidgetState {
|
public class CompassRulerWidgetState extends WidgetState {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package net.osmand.plus.views.mapwidgets.widgetstates;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.settings.backend.OsmandPreference;
|
||||||
|
|
||||||
public class TimeWidgetState extends WidgetState {
|
public class TimeWidgetState extends WidgetState {
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.osmand.StateChangedListener;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.helpers.enums.MetricsConstants;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.api.AudioFocusHelper;
|
import net.osmand.plus.api.AudioFocusHelper;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.wikivoyage.WikiBaseDialogFragment;
|
import net.osmand.plus.wikivoyage.WikiBaseDialogFragment;
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ public abstract class WikiArticleBaseDialogFragment extends WikiBaseDialogFragme
|
||||||
|
|
||||||
|
|
||||||
protected void updateWebSettings() {
|
protected void updateWebSettings() {
|
||||||
OsmandSettings.WikiArticleShowImages showImages = getSettings().WIKI_ARTICLE_SHOW_IMAGES.get();
|
WikiArticleShowImages showImages = getSettings().WIKI_ARTICLE_SHOW_IMAGES.get();
|
||||||
WebSettings webSettings = contentWebView.getSettings();
|
WebSettings webSettings = contentWebView.getSettings();
|
||||||
switch (showImages) {
|
switch (showImages) {
|
||||||
case ON:
|
case ON:
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package net.osmand.plus.wikipedia;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public enum WikiArticleShowImages {
|
||||||
|
ON(R.string.shared_string_on),
|
||||||
|
OFF(R.string.shared_string_off),
|
||||||
|
WIFI(R.string.shared_string_wifi_only);
|
||||||
|
|
||||||
|
public final int name;
|
||||||
|
|
||||||
|
WikiArticleShowImages(int name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.WikiArticleShowImages;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.WikiArticleShowImages;
|
import net.osmand.plus.wikipedia.WikiArticleShowImages;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
|
@ -50,7 +50,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static net.osmand.plus.settings.backend.OsmandSettings.WikiArticleShowImages.OFF;
|
import static net.osmand.plus.wikipedia.WikiArticleShowImages.OFF;
|
||||||
|
|
||||||
|
|
||||||
public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragment {
|
public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragment {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import net.osmand.PicassoUtils;
|
||||||
import net.osmand.plus.OnDialogFragmentResultListener;
|
import net.osmand.plus.OnDialogFragmentResultListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.WikiArticleShowImages;
|
import net.osmand.plus.wikipedia.WikiArticleShowImages;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
|
Loading…
Reference in a new issue