From 641cd7366ccea0b767378b829cbae451ddf5f5af Mon Sep 17 00:00:00 2001 From: evermind Date: Thu, 4 Apr 2024 08:17:50 +0200 Subject: [PATCH] BraveNewPipe: Inherit from this class instead of {@link BasePreferenceFragment} to manipulate config options. If you have a fork and flavors and want to alter some config options use this class especially overwrite the {@link #manipulateCreatedPreferenceOptions()} in which you can manipulate --- .../settings/BraveBasePreferenceFragment.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/src/main/java/org/schabi/newpipe/settings/BraveBasePreferenceFragment.java diff --git a/app/src/main/java/org/schabi/newpipe/settings/BraveBasePreferenceFragment.java b/app/src/main/java/org/schabi/newpipe/settings/BraveBasePreferenceFragment.java new file mode 100644 index 000000000..928cfadd3 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/settings/BraveBasePreferenceFragment.java @@ -0,0 +1,35 @@ +package org.schabi.newpipe.settings; + +import android.os.Bundle; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + + +/** + * Inherit from this class instead of {@link BasePreferenceFragment} to manipulate config options. + *

+ * If you have a fork and flavors and want to alter some config options use this class especially + * overwrite the {@link #manipulateCreatedPreferenceOptions()} in which you can manipulate + */ +public abstract class BraveBasePreferenceFragment extends BasePreferenceFragment { + + /** + * After creation of this settings fragment you may want to manipulate + * some settings. + *

+ * Eg. if you've some flavor's and want them to have different options + * here is a good place to manipulate them programmatically. + */ + protected void manipulateCreatedPreferenceOptions() { + } + + @Override + public void onViewCreated( + @NonNull final View rootView, + @Nullable final Bundle savedInstanceState) { + super.onViewCreated(rootView, savedInstanceState); + manipulateCreatedPreferenceOptions(); + } +}