Dispose loaders before setting controller to null

This commit is contained in:
ByteHamster 2020-07-27 13:16:23 +02:00
parent 4ddee03214
commit 426be4d226
3 changed files with 10 additions and 19 deletions

View File

@ -93,17 +93,12 @@ public class ChaptersFragment extends Fragment {
}
@Override
public void onDestroyView() {
super.onDestroyView();
public void onStop() {
super.onStop();
if (disposable != null) {
disposable.dispose();
}
}
@Override
public void onStop() {
super.onStop();
controller.release();
controller = null;
EventBus.getDefault().unregister(this);

View File

@ -128,6 +128,10 @@ public class CoverFragment extends Fragment {
@Override
public void onStop() {
super.onStop();
if (disposable != null) {
disposable.dispose();
}
controller.release();
controller = null;
EventBus.getDefault().unregister(this);
@ -203,15 +207,6 @@ public class CoverFragment extends Fragment {
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (disposable != null) {
disposable.dispose();
}
}
void onPlayPause() {
if (controller == null) {
return;

View File

@ -66,9 +66,6 @@ public class ItemDescriptionFragment extends Fragment {
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "Fragment destroyed");
if (webViewLoader != null) {
webViewLoader.dispose();
}
if (webvDescription != null) {
webvDescription.removeAllViews();
webvDescription.destroy();
@ -168,6 +165,10 @@ public class ItemDescriptionFragment extends Fragment {
@Override
public void onStop() {
super.onStop();
if (webViewLoader != null) {
webViewLoader.dispose();
}
controller.release();
controller = null;
}