diff --git a/OsmAnd/res/xml/monitoring_settings.xml b/OsmAnd/res/xml/monitoring_settings.xml index 993ea0ea10..11be7c48ef 100644 --- a/OsmAnd/res/xml/monitoring_settings.xml +++ b/OsmAnd/res/xml/monitoring_settings.xml @@ -65,6 +65,13 @@ android:summaryOn="@string/shared_string_enabled" android:title="@string/disable_recording_once_app_killed" /> + + @@ -76,6 +83,18 @@ tools:icon="@drawable/ic_action_folder" tools:summary="Not selected" /> + + + + soundIcons = new HashMap(); - private List pluginPreferences = new ArrayList<>(); - public AccessibilityPlugin(OsmandApplication app) { this.app = app; - pluginPreferences.add(app.getSettings().ACCESSIBILITY_MODE); - pluginPreferences.add(app.getSettings().SPEECH_RATE); - pluginPreferences.add(app.getSettings().ACCESSIBILITY_SMART_AUTOANNOUNCE); - pluginPreferences.add(app.getSettings().ACCESSIBILITY_AUTOANNOUNCE_PERIOD); - pluginPreferences.add(app.getSettings().DISABLE_OFFROUTE_RECALC); - pluginPreferences.add(app.getSettings().DISABLE_WRONG_DIRECTION_RECALC); - pluginPreferences.add(app.getSettings().DIRECTION_STYLE); - pluginPreferences.add(app.getSettings().DIRECTION_AUDIO_FEEDBACK); - pluginPreferences.add(app.getSettings().DIRECTION_HAPTIC_FEEDBACK); + OsmandSettings settings = app.getSettings(); + pluginPreferences.add(settings.ACCESSIBILITY_MODE); + pluginPreferences.add(settings.SPEECH_RATE); + pluginPreferences.add(settings.ACCESSIBILITY_SMART_AUTOANNOUNCE); + pluginPreferences.add(settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD); + pluginPreferences.add(settings.DISABLE_OFFROUTE_RECALC); + pluginPreferences.add(settings.DISABLE_WRONG_DIRECTION_RECALC); + pluginPreferences.add(settings.DIRECTION_STYLE); + pluginPreferences.add(settings.DIRECTION_AUDIO_FEEDBACK); + pluginPreferences.add(settings.DIRECTION_HAPTIC_FEEDBACK); } @Override @@ -80,11 +76,6 @@ public class AccessibilityPlugin extends OsmandPlugin { return AccessibilitySettingsFragment.class; } - @Override - public List getPreferences() { - return pluginPreferences; - } - @Override public String getPrefsDescription() { return app.getString(R.string.accessibility_prefs_descr); @@ -108,12 +99,6 @@ public class AccessibilityPlugin extends OsmandPlugin { return R.drawable.ic_plugin_accessibility; } - private OsmandSettings.CommonPreference registerBooleanAccessibilityPreference(OsmandApplication app, String prefId, boolean defValue) { - OsmandSettings.CommonPreference preference = app.getSettings().registerBooleanAccessibilityPreference(prefId, defValue); - pluginPreferences.add(preference); - return preference; - } - public void playSoundIcon(int iconId) { if ((sounds != null) && soundIcons.containsKey(iconId)) { int sound = soundIcons.get(iconId); diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 0ffa9daafa..a5094f2361 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -641,6 +641,12 @@ public abstract class OsmandPlugin { return preference; } + private OsmandSettings.CommonPreference registerBooleanAccessibilityPreference(OsmandApplication app, String prefId, boolean defValue) { + OsmandSettings.CommonPreference preference = app.getSettings().registerBooleanAccessibilityPreference(prefId, defValue); + pluginPreferences.add(preference); + return preference; + } + protected OsmandSettings.CommonPreference registerStringPreference(OsmandApplication app, String prefId, String defValue) { OsmandSettings.CommonPreference preference = app.getSettings().registerStringPreference(prefId, defValue); pluginPreferences.add(preference); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 63f636b106..8ca4160364 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -43,8 +43,10 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements setupSaveTrackMinSpeedPref(); setupAutoSplitRecordingPref(); setupDisableRecordingOnceAppKilledPref(); + setupSaveHeadingToGpxPref(); setupTrackStorageDirectoryPref(); + setupShowTripRecNotificationPref(); setupLiveMonitoringPref(); setupOpenNotesDescrPref(); @@ -136,6 +138,17 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements disableRecordingOnceAppKilled.setDescription(getString(R.string.disable_recording_once_app_killed_descrp)); } + private void setupSaveHeadingToGpxPref() { + SwitchPreferenceEx saveHeadingToGpx = (SwitchPreferenceEx) findPreference(settings.SAVE_HEADING_TO_GPX.getId()); + saveHeadingToGpx.setDescription(getString(R.string.save_heading_descr)); + } + + private void setupShowTripRecNotificationPref() { + SwitchPreferenceEx showTripRecNotification = (SwitchPreferenceEx) findPreference(settings.SHOW_TRIP_REC_NOTIFICATION.getId()); + showTripRecNotification.setDescription(getString(R.string.trip_rec_notification_settings)); + showTripRecNotification.setIcon(getContentIcon(R.drawable.ic_action_notification)); + } + private void setupTrackStorageDirectoryPref() { Integer[] entryValues = new Integer[] {REC_DIRECTORY, MONTHLY_DIRECTORY, DAILY_DIRECTORY}; String[] entries = new String[entryValues.length]; diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 7a4aacb035..d680cc1d50 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -63,6 +63,16 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { final List am = ApplicationMode.allPossibleValues(); ApplicationMode.regWidgetVisibility("monitoring", am.toArray(new ApplicationMode[am.size()])); settings = app.getSettings(); + pluginPreferences.add(settings.SAVE_TRACK_TO_GPX); + pluginPreferences.add(settings.SAVE_TRACK_INTERVAL); + pluginPreferences.add(settings.SAVE_TRACK_MIN_DISTANCE); + pluginPreferences.add(settings.SAVE_TRACK_PRECISION); + pluginPreferences.add(settings.AUTO_SPLIT_RECORDING); + pluginPreferences.add(settings.DISABLE_RECORDING_ONCE_APP_KILLED); + pluginPreferences.add(settings.SAVE_HEADING_TO_GPX); + pluginPreferences.add(settings.SHOW_TRIP_REC_NOTIFICATION); + pluginPreferences.add(settings.TRACK_STORAGE_DIRECTORY); + pluginPreferences.add(settings.LIVE_MONITORING); } @Override