Search in sources :

Example 1 with ListPreferenceEx

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

the class MonitoringSettingsFragment method setupTrackStorageDirectoryPref.

private void setupTrackStorageDirectoryPref() {
    Integer[] entryValues = new Integer[] { REC_DIRECTORY, MONTHLY_DIRECTORY };
    String[] entries = new String[entryValues.length];
    entries[0] = getString(R.string.store_tracks_in_rec_directory);
    entries[1] = getString(R.string.store_tracks_in_monthly_directories);
    // entries[2] = getString(R.string.store_tracks_in_daily_directories);
    ListPreferenceEx trackStorageDirectory = (ListPreferenceEx) findPreference(settings.TRACK_STORAGE_DIRECTORY.getId());
    trackStorageDirectory.setEntries(entries);
    trackStorageDirectory.setEntryValues(entryValues);
    trackStorageDirectory.setDescription(R.string.track_storage_directory_descrp);
    trackStorageDirectory.setIcon(getActiveIcon(R.drawable.ic_action_folder));
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpannableString(android.text.SpannableString)

Example 2 with ListPreferenceEx

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

the class MonitoringSettingsFragment method setupSaveGlobalTrackIntervalPref.

private void setupSaveGlobalTrackIntervalPref() {
    HashMap<Object, String> entry = getTimeValues();
    ListPreferenceEx saveTrackInterval = (ListPreferenceEx) findPreference(settings.SAVE_GLOBAL_TRACK_INTERVAL.getId());
    saveTrackInterval.setEntries(entry.values().toArray(new String[0]));
    saveTrackInterval.setEntryValues(entry.keySet().toArray());
    ApplicationMode selectedAppMode = getSelectedAppMode();
    saveTrackInterval.setValue(settings.SAVE_GLOBAL_TRACK_INTERVAL.getModeValue(selectedAppMode));
    saveTrackInterval.setIcon(getActiveIcon(R.drawable.ic_action_time_span));
    saveTrackInterval.setDescription(R.string.save_global_track_interval_descr);
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpannableString(android.text.SpannableString) ApplicationMode(net.osmand.plus.settings.backend.ApplicationMode)

Example 3 with ListPreferenceEx

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

the class MonitoringSettingsFragment method setupSaveTrackIntervalPref.

private void setupSaveTrackIntervalPref() {
    HashMap<Object, String> entry = getTimeValues();
    ListPreferenceEx saveTrackInterval = (ListPreferenceEx) findPreference(settings.SAVE_TRACK_INTERVAL.getId());
    saveTrackInterval.setEntries(entry.values().toArray(new String[0]));
    saveTrackInterval.setEntryValues(entry.keySet().toArray());
    saveTrackInterval.setIcon(getActiveIcon(R.drawable.ic_action_time_span));
    saveTrackInterval.setDescription(R.string.save_track_interval_descr);
    saveTrackInterval.setVisible(settings.SAVE_TRACK_TO_GPX.getModeValue(getSelectedAppMode()));
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpannableString(android.text.SpannableString)

Example 4 with ListPreferenceEx

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

the class MonitoringSettingsFragment method setupSaveTrackMinDistancePref.

private void setupSaveTrackMinDistancePref() {
    Float[] entryValues = new Float[] { 0.f, 2.0f, 5.0f, 10.0f, 20.0f, 30.0f, 50.0f };
    String[] entries = new String[entryValues.length];
    entries[0] = getString(R.string.shared_string_not_selected);
    for (int i = 1; i < entryValues.length; i++) {
        entries[i] = entryValues[i].intValue() + " " + getString(R.string.m);
    }
    ListPreferenceEx saveTrackMinDistance = (ListPreferenceEx) findPreference(settings.SAVE_TRACK_MIN_DISTANCE.getId());
    saveTrackMinDistance.setEntries(entries);
    saveTrackMinDistance.setEntryValues(entryValues);
    SpannableStringBuilder stringBuilder = new SpannableStringBuilder(getString(R.string.monitoring_min_distance_descr));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_distance_descr_side_effect));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_distance_descr_recommendation));
    saveTrackMinDistance.setDescription(stringBuilder.toString());
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpannableString(android.text.SpannableString) SpannableStringBuilder(android.text.SpannableStringBuilder)

Example 5 with ListPreferenceEx

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

the class MonitoringSettingsFragment method setupSaveTrackMinSpeedPref.

private void setupSaveTrackMinSpeedPref() {
    Float[] entryValues = new Float[] { 0.f, 0.000001f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
    String[] entries = new String[entryValues.length];
    entries[0] = getString(R.string.shared_string_not_selected);
    // This option for the GPS chipset motion detection
    entries[1] = "> 0";
    for (int i = 2; i < entryValues.length; i++) {
        entries[i] = entryValues[i].intValue() + " " + getString(R.string.km_h);
        entryValues[i] = entryValues[i] / 3.6f;
    }
    ListPreferenceEx saveTrackMinSpeed = (ListPreferenceEx) findPreference(settings.SAVE_TRACK_MIN_SPEED.getId());
    saveTrackMinSpeed.setEntries(entries);
    saveTrackMinSpeed.setEntryValues(entryValues);
    SpannableStringBuilder stringBuilder = new SpannableStringBuilder(getString(R.string.monitoring_min_speed_descr));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_speed_descr_side_effect));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_speed_descr_recommendation));
    stringBuilder.append("\n");
    stringBuilder.append(getString(R.string.monitoring_min_speed_descr_remark));
    saveTrackMinSpeed.setDescription(stringBuilder.toString());
}
Also used : ListPreferenceEx(net.osmand.plus.settings.preferences.ListPreferenceEx) SpannableString(android.text.SpannableString) SpannableStringBuilder(android.text.SpannableStringBuilder)

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