Add preference and UI

This commit is contained in:
Dima-1 2020-06-25 12:53:34 +03:00
parent 0499cbfd19
commit 0c0233fc63
4 changed files with 20 additions and 0 deletions

View file

@ -11,6 +11,8 @@
Thx - Hardy
-->
<string name="use_volume_buttons_as_zoom">Volume buttons as zoom</string>
<string name="use_volume_buttons_as_zoom_descr">Enable to control the map zoom level with device volume buttons.</string>
<string name="app_mode_inline_skates">Inline skates</string>
<string name="speed_cameras_removed_descr">This device doesn\'t have speed cameras.</string>
<string name="shared_string_uninstall_and_restart">Uninstall and Restart</string>

View file

@ -82,6 +82,14 @@
android:layout="@layout/preference_category_with_descr"
android:title="@string/shared_string_other" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="use_volume_buttons_as_zoom"
android:layout="@layout/preference_with_descr_dialog_and_switch"
android:summaryOff="@string/shared_string_disabled"
android:summaryOn="@string/shared_string_enabled"
android:title="@string/use_volume_buttons_as_zoom"
tools:icon="@drawable/ic_action_zoom_volume_buttons" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="use_kalman_filter_compass"
android:layout="@layout/preference_with_descr_dialog_and_switch"

View file

@ -1884,6 +1884,7 @@ public class OsmandSettings {
// 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_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("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> DO_NOT_SHOW_STARTUP_MESSAGES = new BooleanPreference("do_not_show_startup_messages", false).makeGlobal().cache();
public final OsmandPreference<Boolean> SHOW_DOWNLOAD_MAP_DIALOG = new BooleanPreference("show_download_map_dialog", true).makeGlobal().cache();

View file

@ -54,6 +54,7 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
setupAngularUnitsPref();
setupSpeedSystemPref();
setupVolumeButtonsAsZoom();
setupKalmanFilterPref();
setupMagneticFieldSensorPref();
setupMapEmptyStateAllowedPref();
@ -224,6 +225,14 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment impleme
speedSystem.setIcon(getActiveIcon(R.drawable.ic_action_speed));
}
private void setupVolumeButtonsAsZoom() {
SwitchPreferenceEx volumeButtonsPref = (SwitchPreferenceEx) findPreference(settings.USE_VOLUME_BUTTONS_AS_ZOOM.getId());
volumeButtonsPref.setTitle(getString(R.string.use_volume_buttons_as_zoom));
volumeButtonsPref.setDescription(getString(R.string.use_volume_buttons_as_zoom_descr));
Drawable icon = getPersistentPrefIcon(R.drawable.ic_action_zoom_volume_buttons);
volumeButtonsPref.setIcon(icon);
}
private void setupKalmanFilterPref() {
SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId());
kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass));