From b01bca74fd3fcd818d4085e9259d66a3069e8214 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 20 Sep 2021 09:54:42 +0200 Subject: [PATCH] fix some linter warnings --- .../siacs/conversations/ui/ManageAccountActivity.java | 1 + .../eu/siacs/conversations/ui/WelcomeActivity.java | 1 + .../siacs/conversations/ui/ConversationFragment.java | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java index c1ee451be..6aecf4b26 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -228,6 +228,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults.length > 0) { if (allGranted(grantResults)) { switch (requestCode) { diff --git a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java index 8f652ce8e..9f3252ac1 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java @@ -201,6 +201,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); UriHandlerActivity.onRequestPermissionResult(this, requestCode, grantResults); if (grantResults.length > 0) { if (allGranted(grantResults)) { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5828ee221..9ad7caed5 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1579,6 +1579,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } if (writeGranted(grantResults, permissions)) { if (activity != null && activity.xmppConnectionService != null) { + activity.xmppConnectionService.getBitmapCache().evictAll(); activity.xmppConnectionService.restartFileObserver(); } refresh(); @@ -1617,9 +1618,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke @SuppressLint("InflateParams") protected void clearHistoryDialog(final Conversation conversation) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity()); builder.setTitle(getString(R.string.clear_conversation_history)); - final View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_clear_history, null); + final View dialogView = requireActivity().getLayoutInflater().inflate(R.layout.dialog_clear_history, null); final CheckBox endConversationCheckBox = dialogView.findViewById(R.id.end_conversation_checkbox); builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), null); @@ -1637,7 +1638,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } protected void muteConversationDialog(final Conversation conversation) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity()); builder.setTitle(R.string.disable_notifications); final int[] durations = getResources().getIntArray(R.array.mute_options_durations); final CharSequence[] labels = new CharSequence[durations.length]; @@ -1653,13 +1654,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (durations[which] == -1) { till = Long.MAX_VALUE; } else { - till = System.currentTimeMillis() + (durations[which] * 1000); + till = System.currentTimeMillis() + (durations[which] * 1000L); } conversation.setMutedTill(till); activity.xmppConnectionService.updateConversation(conversation); activity.onConversationsListItemUpdated(); refresh(); - getActivity().invalidateOptionsMenu(); + requireActivity().invalidateOptionsMenu(); }); builder.create().show(); }