use of net.osmand.plus.views.SeekBarPreference in project Osmand by osmandapp.
the class SettingsBaseActivity method registerSeekBarPreference.
public void registerSeekBarPreference(OsmandPreference<Integer> b, PreferenceScreen screen) {
SeekBarPreference p = (SeekBarPreference) screen.findPreference(b.getId());
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
seekBarPreferences.put(b.getId(), b);
}
use of net.osmand.plus.views.SeekBarPreference in project Osmand by osmandapp.
the class SettingsBaseActivity method updateAllSettings.
public void updateAllSettings() {
for (OsmandPreference<Boolean> b : booleanPreferences.values()) {
CheckBoxPreference pref = (CheckBoxPreference) screenPreferences.get(b.getId());
pref.setChecked(b.get());
}
for (OsmandPreference<Integer> b : seekBarPreferences.values()) {
SeekBarPreference pref = (SeekBarPreference) screenPreferences.get(b.getId());
pref.setValue(b.get());
}
for (OsmandPreference<?> p : listPreferences.values()) {
ListPreference listPref = (ListPreference) screenPreferences.get(p.getId());
Map<String, ?> prefValues = listPrefValues.get(p.getId());
String[] entryValues = new String[prefValues.size()];
String[] entries = new String[prefValues.size()];
int i = 0;
for (Entry<String, ?> e : prefValues.entrySet()) {
entries[i] = e.getKey();
// case of null
entryValues[i] = e.getValue() + "";
i++;
}
listPref.setEntries(entries);
listPref.setEntryValues(entryValues);
listPref.setValue(p.get() + "");
}
for (OsmandPreference<String> s : editTextPreferences.values()) {
EditTextPreference pref = (EditTextPreference) screenPreferences.get(s.getId());
pref.setText(s.get());
}
}
use of net.osmand.plus.views.SeekBarPreference in project Osmand by osmandapp.
the class SettingsBaseActivity method createSeekBarPreference.
public SeekBarPreference createSeekBarPreference(OsmandPreference<Integer> b, int title, int summary, int dialogTextId, int defValue, int maxValue) {
SeekBarPreference p = new SeekBarPreference(this, dialogTextId, defValue, maxValue);
p.setTitle(title);
p.setKey(b.getId());
p.setSummary(summary);
p.setOnPreferenceChangeListener(this);
screenPreferences.put(b.getId(), p);
seekBarPreferences.put(b.getId(), b);
return p;
}
use of net.osmand.plus.views.SeekBarPreference in project Osmand by osmandapp.
the class SettingsRasterMapsActivity method addOverlayPrefs.
@SuppressWarnings("unused")
private void addOverlayPrefs(PreferenceScreen grp, OnPreferenceChangeListener listener) {
PreferenceCategory cat;
cat = new PreferenceCategory(this);
cat.setTitle(R.string.pref_overlay);
grp.addPreference(cat);
overlayPreference = new ListPreference(this);
overlayPreference.setSummary(R.string.map_overlay_descr);
overlayPreference.setTitle(R.string.map_overlay);
overlayPreference.setOnPreferenceChangeListener(listener);
cat.addPreference(overlayPreference);
underlayPreference = new ListPreference(this);
underlayPreference.setSummary(R.string.map_underlay_descr);
underlayPreference.setTitle(R.string.map_underlay);
underlayPreference.setOnPreferenceChangeListener(listener);
cat.addPreference(underlayPreference);
SeekBarPreference sp = createSeekBarPreference(settings.MAP_OVERLAY_TRANSPARENCY, R.string.overlay_transparency, R.string.overlay_transparency_descr, R.string.modify_transparency, 0, 255);
cat.addPreference(sp);
sp = createSeekBarPreference(settings.MAP_TRANSPARENCY, R.string.map_transparency, R.string.map_transparency_descr, R.string.modify_transparency, 0, 255);
cat.addPreference(sp);
}
Aggregations