mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-18 01:32:34 +01:00
refine extension preferences API
This commit is contained in:
@@ -20,6 +20,7 @@ public class Preference {
|
||||
|
||||
private String key;
|
||||
private CharSequence title;
|
||||
private CharSequence summary;
|
||||
private Object defaultValue;
|
||||
|
||||
@JsonIgnore
|
||||
@@ -41,14 +42,26 @@ public class Preference {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public void setDefaultValue(Object defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public CharSequence getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(CharSequence title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public CharSequence getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(CharSequence summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
|
||||
public void setDefaultValue(Object defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
||||
this.onChangeListener = onPreferenceChangeListener;
|
||||
}
|
||||
@@ -61,6 +74,10 @@ public class Preference {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String getDefaultValueType() {
|
||||
return defaultValue.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public interface OnPreferenceChangeListener {
|
||||
boolean onPreferenceChange(Preference preference, Object newValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user