Search in sources :

Example 31 with ListPreferenceEx

use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.

the class VoiceAnnouncesFragment method setupArrivalAnnouncementPref.

private void setupArrivalAnnouncementPref() {
    Float[] arrivalValues = new Float[] { 1.5f, 1f, 0.5f, 0.25f };
    String[] arrivalNames = new String[] { getString(R.string.arrival_distance_factor_early), getString(R.string.arrival_distance_factor_normally), getString(R.string.arrival_distance_factor_late), getString(R.string.arrival_distance_factor_at_last) };
    ListPreferenceEx arrivalDistanceFactor = findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
    arrivalDistanceFactor.setEntries(arrivalNames);
    arrivalDistanceFactor.setEntryValues(arrivalValues);
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx)

Example 32 with ListPreferenceEx

use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.

the class VoiceAnnouncesFragment method setupSpeedLimitExceedPref.

private void setupSpeedLimitExceedPref() {
    // array size must be equal!
    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 };
    String[] names;
    if (settings.METRIC_SYSTEM.getModeValue(getSelectedAppMode()) == MetricsConstants.KILOMETERS_AND_METERS) {
        names = new String[valuesKmh.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = valuesKmh[i].intValue() + " " + getString(R.string.km_h);
        }
    } else {
        names = new String[valuesMph.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = valuesMph[i].intValue() + " " + getString(R.string.mile_per_hour);
        }
    }
    ListPreferenceEx voiceProvider = findPreference(settings.SPEED_LIMIT_EXCEED_KMH.getId());
    voiceProvider.setEntries(names);
    voiceProvider.setEntryValues(valuesKmh);
    voiceProvider.setEnabled(settings.SPEAK_SPEED_LIMIT.getModeValue(getSelectedAppMode()));
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx)

Example 33 with ListPreferenceEx

use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.

the class GeneralProfileSettingsFragment method setupSpeedSystemPref.

private void setupSpeedSystemPref() {
    SpeedConstants[] speedConstants = SpeedConstants.values();
    String[] entries = new String[speedConstants.length];
    Integer[] entryValues = new Integer[speedConstants.length];
    for (int i = 0; i < entries.length; i++) {
        entries[i] = speedConstants[i].toHumanString(app);
        entryValues[i] = speedConstants[i].ordinal();
    }
    ListPreferenceEx speedSystem = (ListPreferenceEx) findPreference(settings.SPEED_SYSTEM.getId());
    speedSystem.setEntries(entries);
    speedSystem.setEntryValues(entryValues);
    speedSystem.setDescription(R.string.default_speed_system_descr);
    speedSystem.setIcon(getActiveIcon(R.drawable.ic_action_speed));
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpeedConstants(net.osmand.plus.settings.enums.SpeedConstants)

Example 34 with ListPreferenceEx

use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.

the class GeneralProfileSettingsFragment method setupExternalInputDevicePref.

private void setupExternalInputDevicePref() {
    ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId());
    externalInputDevice.setSummary(R.string.sett_no_ext_input);
    externalInputDevice.setEntries(new String[] { getString(R.string.sett_generic_ext_input), getString(R.string.sett_wunderlinq_ext_input), getString(R.string.sett_parrot_ext_input) });
    externalInputDevice.setEntryValues(new Integer[] { OsmandSettings.GENERIC_EXTERNAL_DEVICE, OsmandSettings.WUNDERLINQ_EXTERNAL_DEVICE, OsmandSettings.PARROT_EXTERNAL_DEVICE });
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx)

Example 35 with ListPreferenceEx

use of net.osmand.plus.settings.preferences.ListPreferenceEx in project Osmand by osmandapp.

the class GeneralProfileSettingsFragment method setupMapScreenOrientationPref.

private void setupMapScreenOrientationPref() {
    final ListPreferenceEx mapScreenOrientation = (ListPreferenceEx) findPreference(settings.MAP_SCREEN_ORIENTATION.getId());
    mapScreenOrientation.setEntries(new String[] { getString(R.string.map_orientation_portrait), getString(R.string.map_orientation_landscape), getString(R.string.map_orientation_default) });
    mapScreenOrientation.setEntryValues(new Integer[] { ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED });
    mapScreenOrientation.setIcon(getMapScreenOrientationIcon());
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx)

Aggregations

ListPreferenceEx (net.osmand.plus.settings.preferences.ListPreferenceEx)41 SpannableString (android.text.SpannableString)13 ArrayList (java.util.ArrayList)5 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)4 SpannableStringBuilder (android.text.SpannableStringBuilder)3 Camera (android.hardware.Camera)2 MultiSelectBooleanPreference (net.osmand.plus.settings.preferences.MultiSelectBooleanPreference)2 SwitchPreferenceEx (net.osmand.plus.settings.preferences.SwitchPreferenceEx)2 RoutingParameter (net.osmand.router.GeneralRouter.RoutingParameter)2 Context (android.content.Context)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 FragmentManager (androidx.fragment.app.FragmentManager)1 EditTextPreference (androidx.preference.EditTextPreference)1 Preference (androidx.preference.Preference)1 PreferenceScreen (androidx.preference.PreferenceScreen)1 Map (java.util.Map)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 BooleanPreference (net.osmand.plus.settings.backend.preferences.BooleanPreference)1 CommonPreference (net.osmand.plus.settings.backend.preferences.CommonPreference)1