From eb1be4f51492c093efe52a47d5d98207dec5f7a1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 10 Jul 2022 17:46:14 +0200 Subject: [PATCH] Some fixes --- .../app/fedilab/android/activities/ContextActivity.java | 6 ------ .../app/fedilab/android/activities/DraftActivity.java | 6 ------ .../app/fedilab/android/activities/MediaActivity.java | 1 - .../app/fedilab/android/activities/SettingsActivity.java | 9 --------- .../fedilab/android/ui/fragment/media/FragmentMedia.java | 5 ++--- .../fragment/timeline/FragmentMastodonNotification.java | 2 +- 6 files changed, 3 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/activities/ContextActivity.java b/app/src/main/java/app/fedilab/android/activities/ContextActivity.java index 533ba40f0..61732dcfb 100644 --- a/app/src/main/java/app/fedilab/android/activities/ContextActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ContextActivity.java @@ -168,10 +168,4 @@ public class ContextActivity extends BaseActivity { return true; } - @Override - protected void onDestroy() { - super.onDestroy(); - binding = null; - currentFragment = null; - } } \ No newline at end of file diff --git a/app/src/main/java/app/fedilab/android/activities/DraftActivity.java b/app/src/main/java/app/fedilab/android/activities/DraftActivity.java index cfbb235bf..bcf6585f3 100644 --- a/app/src/main/java/app/fedilab/android/activities/DraftActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/DraftActivity.java @@ -205,12 +205,6 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr } } - @Override - public void onDestroy() { - super.onDestroy(); - binding.lvStatus.setAdapter(null); - binding = null; - } @Override public void onAllDeleted() { diff --git a/app/src/main/java/app/fedilab/android/activities/MediaActivity.java b/app/src/main/java/app/fedilab/android/activities/MediaActivity.java index ca275b439..2fe067f2d 100644 --- a/app/src/main/java/app/fedilab/android/activities/MediaActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/MediaActivity.java @@ -294,7 +294,6 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface { @Override public void onDestroy() { - binding = null; unregisterReceiver(onDownloadComplete); super.onDestroy(); } diff --git a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java index e6502caa8..6bd43a2b3 100644 --- a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java @@ -156,15 +156,6 @@ public class SettingsActivity extends BaseActivity { } - @Override - protected void onDestroy() { - super.onDestroy(); - if (currentFragment != null) { - currentFragment.onDestroy(); - } - binding = null; - - } @Override public boolean onOptionsItemSelected(MenuItem item) { diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMedia.java b/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMedia.java index 08fee2707..3395cd594 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMedia.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/media/FragmentMedia.java @@ -122,7 +122,7 @@ public class FragmentMedia extends Fragment { binding.mediaPicture.setVisibility(View.VISIBLE); binding.mediaPicture.setTransitionName(attachment.url); - if (Helper.isValidContextForGlide(requireActivity())) { + if (Helper.isValidContextForGlide(requireActivity()) && isAdded()) { Glide.with(requireActivity()) .asBitmap() .dontTransform() @@ -142,7 +142,7 @@ public class FragmentMedia extends Fragment { binding.mediaPicture.setVisibility(View.VISIBLE); binding.pbarInf.setIndeterminate(true); binding.loader.setVisibility(View.VISIBLE); - if (Helper.isValidContextForGlide(requireActivity())) { + if (Helper.isValidContextForGlide(requireActivity()) && isAdded()) { Glide.with(requireActivity()) .asBitmap() .dontTransform() @@ -312,7 +312,6 @@ public class FragmentMedia extends Fragment { timer.cancel(); timer = null; } - binding = null; } @Override diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java index bd7a50e46..e17d319aa 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java @@ -494,8 +494,8 @@ public class FragmentMastodonNotification extends Fragment implements Notificati } }).start(); } - super.onDestroyView(); LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(receive_action); + super.onDestroyView(); } @Override