mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 19:04:39 -05:00
sync androidx.preference method signatures with extensions-lib
This commit is contained in:
@@ -9,7 +9,7 @@ package androidx.preference;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class CheckBoxPreference extends Preference {
|
public class CheckBoxPreference extends TwoStatePreference {
|
||||||
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/CheckBoxPreference.java
|
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/CheckBoxPreference.java
|
||||||
|
|
||||||
public CheckBoxPreference(Context context) {
|
public CheckBoxPreference(Context context) {
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public abstract class DialogPreference extends Preference {
|
||||||
|
private CharSequence dialogTitle;
|
||||||
|
private CharSequence dialogMessage;
|
||||||
|
|
||||||
|
public DialogPreference(Context context) { super(context); }
|
||||||
|
|
||||||
|
public CharSequence getDialogTitle() {
|
||||||
|
return dialogTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogTitle(CharSequence dialogTitle) {
|
||||||
|
this.dialogTitle = dialogTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CharSequence getDialogMessage() {
|
||||||
|
return dialogMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogMessage(CharSequence dialogMessage) {
|
||||||
|
this.dialogMessage = dialogMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,12 +13,10 @@ import android.content.Context;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
public class EditTextPreference extends Preference {
|
public class EditTextPreference extends DialogPreference {
|
||||||
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/EditTextPreference.java
|
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/EditTextPreference.java
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
private CharSequence dialogTitle;
|
|
||||||
private CharSequence dialogMessage;
|
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private OnBindEditTextListener onBindEditTextListener;
|
private OnBindEditTextListener onBindEditTextListener;
|
||||||
@@ -27,22 +25,6 @@ public class EditTextPreference extends Preference {
|
|||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getDialogTitle() {
|
|
||||||
return dialogTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDialogTitle(CharSequence dialogTitle) {
|
|
||||||
this.dialogTitle = dialogTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CharSequence getDialogMessage() {
|
|
||||||
return dialogMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDialogMessage(CharSequence dialogMessage) {
|
|
||||||
this.dialogMessage = dialogMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ package androidx.preference;
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.annotation.ArrayRes;
|
|
||||||
|
|
||||||
public class ListPreference extends Preference {
|
public class ListPreference extends Preference {
|
||||||
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/ListPreference.java
|
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/ListPreference.java
|
||||||
@@ -28,9 +27,7 @@ public class ListPreference extends Preference {
|
|||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntries(@ArrayRes int entriesResId) {
|
public int findIndexOfValue(String value) { throw new RuntimeException("Stub!"); }
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public CharSequence[] getEntryValues() {
|
public CharSequence[] getEntryValues() {
|
||||||
return entryValues;
|
return entryValues;
|
||||||
@@ -40,7 +37,9 @@ public class ListPreference extends Preference {
|
|||||||
this.entryValues = entryValues;
|
this.entryValues = entryValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntryValues(@ArrayRes int entryValuesResId) {
|
public void setValueIndex(int index) { throw new RuntimeException("Stub!"); }
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
public String getValue() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setValue(String value) { throw new RuntimeException("Stub!"); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class MultiSelectListPreference extends DialogPreference {
|
||||||
|
|
||||||
|
public MultiSelectListPreference(Context context) { super(context); }
|
||||||
|
|
||||||
|
public void setEntries(CharSequence[] entries) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
|
||||||
|
public CharSequence[] getEntries() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setEntryValues(CharSequence[] entryValues) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public CharSequence[] getEntryValues() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setValues(Set<String> values) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public Set<String> getValues() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public int findIndexOfValue(String value) { throw new RuntimeException("Stub!"); }
|
||||||
|
}
|
||||||
@@ -10,7 +10,9 @@ package androidx.preference;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
/** A minimal implementation of androidx.preference.Preference */
|
/**
|
||||||
|
* A minimal implementation of androidx.preference.Preference
|
||||||
|
*/
|
||||||
public class Preference {
|
public class Preference {
|
||||||
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/Preference.java
|
// 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.
|
// Note: `Preference` doesn't actually hold or persist the value, `OnPreferenceChangeListener` is called and it's up to the extension to persist it.
|
||||||
@@ -34,12 +36,12 @@ public class Preference {
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey() {
|
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
||||||
return key;
|
this.onChangeListener = onPreferenceChangeListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(String key) {
|
public void setOnPreferenceClickListener(OnPreferenceClickListener onPreferenceClickListener) {
|
||||||
this.key = key;
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getTitle() {
|
public CharSequence getTitle() {
|
||||||
@@ -58,12 +60,20 @@ public class Preference {
|
|||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultValue(Object defaultValue) {
|
public void setEnabled(boolean enabled) {
|
||||||
this.defaultValue = defaultValue;
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener) {
|
public String getKey() {
|
||||||
this.onChangeListener = onPreferenceChangeListener;
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(Object defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean callChangeListener(Object newValue) {
|
public boolean callChangeListener(Object newValue) {
|
||||||
@@ -82,4 +92,7 @@ public class Preference {
|
|||||||
boolean onPreferenceChange(Preference preference, Object newValue);
|
boolean onPreferenceChange(Preference preference, Object newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnPreferenceClickListener {
|
||||||
|
boolean onPreferenceClick(Preference preference);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PreferenceScreen extends Preference {
|
public class PreferenceScreen extends Preference {
|
||||||
|
// Tachidesk API
|
||||||
private List<Preference> preferences = new LinkedList<>();
|
private List<Preference> preferences = new LinkedList<>();
|
||||||
|
|
||||||
|
|
||||||
public PreferenceScreen(Context context) {
|
public PreferenceScreen(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@ public class PreferenceScreen extends Preference {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tachidesk API
|
||||||
public List<Preference> getPreferences(){
|
public List<Preference> getPreferences(){
|
||||||
return preferences;
|
return preferences;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class SwitchPreferenceCompat extends Preference {
|
||||||
|
// reference: https://android.googlesource.com/platform/frameworks/support/+/996971f962fcd554339a7cb2859cef9ca89dbcb7/preference/preference/src/main/java/androidx/preference/CheckBoxPreference.java
|
||||||
|
|
||||||
|
public SwitchPreferenceCompat(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package androidx.preference;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class TwoStatePreference extends Preference {
|
||||||
|
|
||||||
|
public TwoStatePreference(Context context) { super(context); }
|
||||||
|
|
||||||
|
public boolean isChecked() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setChecked(boolean checked) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public CharSequence getSummaryOn() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setSummaryOn(CharSequence summary) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public CharSequence getSummaryOff() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setSummaryOff(CharSequence summary) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public boolean getDisableDependentsState() { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
public void setDisableDependentsState(boolean disableDependentsState) { throw new RuntimeException("Stub!"); }
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user