diff --git a/app/src/main/java/org/schabi/newpipe/BaseFragment.java b/app/src/main/java/org/schabi/newpipe/BaseFragment.java index 19a99009b..5dde2a747 100644 --- a/app/src/main/java/org/schabi/newpipe/BaseFragment.java +++ b/app/src/main/java/org/schabi/newpipe/BaseFragment.java @@ -80,9 +80,29 @@ public abstract class BaseFragment extends Fragment { // Init //////////////////////////////////////////////////////////////////////////*/ + /** + * This method is called in {@link #onViewCreated(View, Bundle)} to initialize the views. + * + *
+ * {@link #initListeners()} is called after this method to initialize the corresponding + * listeners. + *
+ * @param rootView The inflated view for this fragment + * (provided by {@link #onViewCreated(View, Bundle)}) + * @param savedInstanceState The saved state of this fragment + * (provided by {@link #onViewCreated(View, Bundle)}) + */ protected void initViews(final View rootView, final Bundle savedInstanceState) { } + /** + * Initialize the listeners for this fragment. + * + *+ * This method is called after {@link #initViews(View, Bundle)} + * in {@link #onViewCreated(View, Bundle)}. + *
+ */ protected void initListeners() { } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java index 85603d337..a3d3d8b60 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java @@ -80,6 +80,8 @@ public abstract class BaseStateFragment extends BaseFragment implements ViewC if (errorPanelHelper != null) { errorPanelHelper.dispose(); } + emptyStateView = null; + emptyStateMessageView = null; } protected void onRetryButtonClicked() { diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java index e1b61ea7c..023642955 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java @@ -139,6 +139,12 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte } } + @Override + public void onDestroyView() { + super.onDestroyView(); + binding = null; + } + /*////////////////////////////////////////////////////////////////////////// // Menu //////////////////////////////////////////////////////////////////////////*/ diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index da1eba225..dda4326e9 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -115,6 +115,11 @@ class SubscriptionFragment : BaseStateFragment