1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05:49 +01:00

Settings: properly check the input type flag

Fixes a bug where latitude/longitude could be made empty
This commit is contained in:
Andreas Shimokawa 2016-07-05 23:14:48 +02:00
parent 94cc1a883a
commit 903890067d

View File

@ -44,7 +44,7 @@ public abstract class AbstractSettingsActivity extends PreferenceActivity {
@Override @Override
public boolean onPreferenceChange(Preference preference, Object value) { public boolean onPreferenceChange(Preference preference, Object value) {
if (preference instanceof EditTextPreference) { if (preference instanceof EditTextPreference) {
if (((EditTextPreference) preference).getEditText().getKeyListener().getInputType() == InputType.TYPE_CLASS_NUMBER) { if ((((EditTextPreference) preference).getEditText().getKeyListener().getInputType() & InputType.TYPE_CLASS_NUMBER) != 0) {
if ("".equals(String.valueOf(value))) { if ("".equals(String.valueOf(value))) {
// reject empty numeric input // reject empty numeric input
return false; return false;