Esempio n. 1
0
 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;
 }
Esempio n. 2
0
  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());
    }

    reloadVoiceListPreference(getPreferenceScreen());

    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();
        entryValues[i] = e.getValue() + ""; // case of null
        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());
    }

    OsmandPlugin.onSettingsActivityUpdate(this);

    updateApplicationDirTextAndSummary();

    //		applicationModePreference.setTitle(getString(R.string.settings_preset) + "  ["
    //				+ osmandSettings.APPLICATION_MODE.get().toHumanString(this) + "]");
    routerServicePreference.setSummary(
        getString(R.string.router_service_descr)
            + "  ["
            + osmandSettings.ROUTER_SERVICE.get()
            + "]");
  }
Esempio n. 3
0
  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());
    }

    reloadVoiceListPreference(getPreferenceScreen());

    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();
        entryValues[i] = e.getValue() + ""; // case of null
        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());
    }

    // Specific properties
    routeServiceEnabled.setChecked(getMyApplication().getNavigationService() != null);

    updateTileSourceSummary();

    updateApplicationDirTextAndSummary();
  }
Esempio n. 4
0
 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);
 }