Merge pull request #810 from devemux86/param

Fix ListPreference in RoutingParameterDialog
This commit is contained in:
afischerdev 2025-07-07 12:37:54 +02:00 committed by GitHub
commit faaa7bf70d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);