Fix ListPreference in RoutingParameterDialog
This commit is contained in:
parent
1642b4f5ba
commit
efcfc59d1b
1 changed files with 8 additions and 5 deletions
|
|
@ -377,8 +377,8 @@ public class RoutingParameterDialog extends AppCompatActivity {
|
||||||
for (String tmp : sa) {
|
for (String tmp : sa) {
|
||||||
// Add the name and address to the ListPreference enties and entyValues
|
// Add the name and address to the ListPreference enties and entyValues
|
||||||
//L.v("AFTrack", "device: "+device.getName() + " -- " + device.getAddress());
|
//L.v("AFTrack", "device: "+device.getName() + " -- " + device.getAddress());
|
||||||
entryValues[i] = "" + i;
|
|
||||||
entries[i] = tmp.trim();
|
entries[i] = tmp.trim();
|
||||||
|
entryValues[i] = entries[i].split("=")[0].trim();
|
||||||
if (entryValues[i].equals(s)) ii = i;
|
if (entryValues[i].equals(s)) ii = i;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
@ -394,11 +394,14 @@ public class RoutingParameterDialog extends AppCompatActivity {
|
||||||
listPref.setSummary(p.description);
|
listPref.setSummary(p.description);
|
||||||
listPref.setOnPreferenceChangeListener((Preference preference, Object newValue) -> {
|
listPref.setOnPreferenceChangeListener((Preference preference, Object newValue) -> {
|
||||||
p.value = (String) newValue;
|
p.value = (String) newValue;
|
||||||
int iii = Integer.decode(p.value);
|
for (int iii = 0; iii < entryValues.length; iii++) {
|
||||||
listPref.setTitle(p.name + ": " + entries[iii]);
|
String entryValue = entryValues[iii];
|
||||||
|
if (entryValue.equals(p.value)) {
|
||||||
|
listPref.setTitle(p.name + ": " + entries[iii]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gpsPrefCat.addPreference(listPref);
|
gpsPrefCat.addPreference(listPref);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue