mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-02 11:26:18 +02:00
56 lines
2.6 KiB
Java
56 lines
2.6 KiB
Java
package app.revanced.integrations.tiktok.settings.preference;
|
|
|
|
import android.preference.Preference;
|
|
import android.preference.PreferenceScreen;
|
|
import androidx.annotation.NonNull;
|
|
import app.revanced.integrations.shared.settings.Setting;
|
|
import app.revanced.integrations.shared.settings.preference.AbstractPreferenceFragment;
|
|
import app.revanced.integrations.tiktok.settings.preference.categories.DownloadsPreferenceCategory;
|
|
import app.revanced.integrations.tiktok.settings.preference.categories.FeedFilterPreferenceCategory;
|
|
import app.revanced.integrations.tiktok.settings.preference.categories.IntegrationsPreferenceCategory;
|
|
import app.revanced.integrations.tiktok.settings.preference.categories.SimSpoofPreferenceCategory;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* Preference fragment for ReVanced settings
|
|
*/
|
|
@SuppressWarnings({"deprecation", "unused"})
|
|
public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
|
|
|
|
@Override
|
|
protected void syncSettingWithPreference(@NonNull @NotNull Preference pref,
|
|
@NonNull @NotNull Setting<?> setting,
|
|
boolean applySettingToPreference) {
|
|
if (pref instanceof RangeValuePreference) {
|
|
RangeValuePreference rangeValuePref = (RangeValuePreference) pref;
|
|
Setting.privateSetValueFromString(setting, rangeValuePref.getValue());
|
|
} else if (pref instanceof DownloadPathPreference) {
|
|
DownloadPathPreference downloadPathPref = (DownloadPathPreference) pref;
|
|
Setting.privateSetValueFromString(setting, downloadPathPref.getValue());
|
|
} else {
|
|
super.syncSettingWithPreference(pref, setting, applySettingToPreference);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
@SuppressWarnings("unused")
|
|
protected void initialize() {
|
|
final var context = getContext();
|
|
|
|
// Currently no resources can be compiled for TikTok (fails with aapt error).
|
|
// So all TikTok Strings are hard coded in integrations.
|
|
restartDialogTitle = "Refresh and restart";
|
|
restartDialogButtonText = "Restart";
|
|
confirmDialogTitle = "Do you wish to proceed?";
|
|
|
|
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(context);
|
|
setPreferenceScreen(preferenceScreen);
|
|
|
|
// Custom categories reference app specific Settings class.
|
|
new FeedFilterPreferenceCategory(context, preferenceScreen);
|
|
new DownloadsPreferenceCategory(context, preferenceScreen);
|
|
new SimSpoofPreferenceCategory(context, preferenceScreen);
|
|
new IntegrationsPreferenceCategory(context, preferenceScreen);
|
|
}
|
|
}
|