mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-19 02:02:37 +01:00
convert EditTextPreference to json successfully
This commit is contained in:
@@ -8,18 +8,22 @@ package androidx.preference;
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import android.content.Context;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/** A minimal implementation of androidx.preference.Preference */
|
||||
public class Preference {
|
||||
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/Preference.java
|
||||
// Note: `Preference` doesn't actually hold or persist the value, `OnPreferenceChangeListener` is called and it's up to the extension to persist it.
|
||||
|
||||
@JsonIgnore
|
||||
protected Context context;
|
||||
|
||||
private String key;
|
||||
private CharSequence title;
|
||||
private Object defaultValue;
|
||||
private OnPreferenceChangeListener onChangeListener;
|
||||
|
||||
@JsonIgnore
|
||||
public OnPreferenceChangeListener onChangeListener;
|
||||
|
||||
public Preference(Context context) {
|
||||
this.context = context;
|
||||
@@ -29,7 +33,6 @@ public class Preference {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
@@ -54,6 +57,10 @@ public class Preference {
|
||||
return onChangeListener == null || onChangeListener.onPreferenceChange(this, newValue);
|
||||
}
|
||||
|
||||
public Object getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public interface OnPreferenceChangeListener {
|
||||
boolean onPreferenceChange(Preference preference, Object newValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user