From 1c5bdb1cca6fd997430a395ec5feaf8b4d157363 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Mon, 10 May 2021 21:39:13 +0900 Subject: [PATCH] Possible fix for Tmp detached view error. Fixes austinhuang0131/barinsta#1200 --- .../directmessages/DirectMessageInboxFragment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java index 8c693374..60a7482e 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageInboxFragment.java @@ -96,7 +96,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh } } - @SuppressLint("UnsafeExperimentalUsageError") + @SuppressLint({"UnsafeExperimentalUsageError", "UnsafeOptInUsageError"}) @Override public void onPause() { super.onPause(); @@ -176,7 +176,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh if (inboxAdapter == null) return; inboxAdapter.submitList(list, () -> { if (!scrollToTop) return; - binding.inboxList.smoothScrollToPosition(0); + binding.inboxList.post(() -> binding.inboxList.smoothScrollToPosition(0)); scrollToTop = false; }); }; @@ -204,7 +204,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh viewModel.getPendingRequestsTotal().observe(getViewLifecycleOwner(), this::attachPendingRequestsBadge); } - @SuppressLint("UnsafeExperimentalUsageError") + @SuppressLint({"UnsafeExperimentalUsageError", "UnsafeOptInUsageError"}) private void attachPendingRequestsBadge(@Nullable final Integer count) { if (pendingRequestsMenuItem == null) { final Handler handler = new Handler();