Skip to content

Commit

Permalink
Fix memory leaks and add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiGr committed Aug 29, 2023
1 parent 25cf917 commit 8654788
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/org/schabi/newpipe/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,23 @@ protected void onRestoreInstanceState(@NonNull final Bundle savedInstanceState)
// Init
//////////////////////////////////////////////////////////////////////////*/

/**
* This method is called in {@link #onViewCreated(View, Bundle)} to initialize the views.
* <br/>
* {@link #initListeners()} is called after this method to initialize the corresponding
* listeners.
* @param rootView
* @param savedInstanceState
*/
protected void initViews(final View rootView, final Bundle savedInstanceState) {
}

/**
* Initialize the listeners for this fragment.
* <br/>
* This method is called after {@link #initViews(View, Bundle)}
* in {@link #onViewCreated(View, Bundle)}.
*/
protected void initListeners() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public void onDestroyView() {
if (errorPanelHelper != null) {
errorPanelHelper.dispose();
}
emptyStateView = null;
emptyStateMessageView = null;
}

protected void onRetryButtonClicked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ public void onDestroy() {
}
}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}

/*//////////////////////////////////////////////////////////////////////////
// Menu
//////////////////////////////////////////////////////////////////////////*/
Expand Down

0 comments on commit 8654788

Please sign in to comment.