BluetoothLeSensorPreference was not adhering to configured default value.

This commit is contained in:
Dennis Guse
2026-02-04 19:01:11 +01:00
parent 0b849c3d55
commit d75472ef11
@@ -10,6 +10,7 @@ import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.ParcelUuid;
import android.text.TextUtils;
@@ -18,6 +19,7 @@ import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.DialogPreference;
import androidx.preference.PreferenceDialogFragmentCompat;
@@ -80,6 +82,12 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
}
}
@Nullable
@Override
protected Object onGetDefaultValue(@NonNull TypedArray a, int index) {
return a.getString(index);
}
@Override
protected void onSetInitialValue(Object defaultValue) {
setValue(getPersistedString((String) defaultValue));