1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-23 07:07:30 +00:00

Possible fix for Tmp detached view error. Fixes austinhuang0131/barinsta#1200

This commit is contained in:
Ammar Githam 2021-05-10 21:39:13 +09:00
parent 3cc4f7b7bc
commit 1c5bdb1cca

View File

@ -96,7 +96,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
} }
} }
@SuppressLint("UnsafeExperimentalUsageError") @SuppressLint({"UnsafeExperimentalUsageError", "UnsafeOptInUsageError"})
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
@ -176,7 +176,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
if (inboxAdapter == null) return; if (inboxAdapter == null) return;
inboxAdapter.submitList(list, () -> { inboxAdapter.submitList(list, () -> {
if (!scrollToTop) return; if (!scrollToTop) return;
binding.inboxList.smoothScrollToPosition(0); binding.inboxList.post(() -> binding.inboxList.smoothScrollToPosition(0));
scrollToTop = false; scrollToTop = false;
}); });
}; };
@ -204,7 +204,7 @@ public class DirectMessageInboxFragment extends Fragment implements SwipeRefresh
viewModel.getPendingRequestsTotal().observe(getViewLifecycleOwner(), this::attachPendingRequestsBadge); viewModel.getPendingRequestsTotal().observe(getViewLifecycleOwner(), this::attachPendingRequestsBadge);
} }
@SuppressLint("UnsafeExperimentalUsageError") @SuppressLint({"UnsafeExperimentalUsageError", "UnsafeOptInUsageError"})
private void attachPendingRequestsBadge(@Nullable final Integer count) { private void attachPendingRequestsBadge(@Nullable final Integer count) {
if (pendingRequestsMenuItem == null) { if (pendingRequestsMenuItem == null) {
final Handler handler = new Handler(); final Handler handler = new Handler();