fix some linter warnings

This commit is contained in:
Daniel Gultsch 2021-09-20 09:54:42 +02:00
parent bfc8668803
commit b01bca74fd
3 changed files with 8 additions and 5 deletions

View File

@ -228,6 +228,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults.length > 0) { if (grantResults.length > 0) {
if (allGranted(grantResults)) { if (allGranted(grantResults)) {
switch (requestCode) { switch (requestCode) {

View File

@ -201,6 +201,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
UriHandlerActivity.onRequestPermissionResult(this, requestCode, grantResults); UriHandlerActivity.onRequestPermissionResult(this, requestCode, grantResults);
if (grantResults.length > 0) { if (grantResults.length > 0) {
if (allGranted(grantResults)) { if (allGranted(grantResults)) {

View File

@ -1579,6 +1579,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} }
if (writeGranted(grantResults, permissions)) { if (writeGranted(grantResults, permissions)) {
if (activity != null && activity.xmppConnectionService != null) { if (activity != null && activity.xmppConnectionService != null) {
activity.xmppConnectionService.getBitmapCache().evictAll();
activity.xmppConnectionService.restartFileObserver(); activity.xmppConnectionService.restartFileObserver();
} }
refresh(); refresh();
@ -1617,9 +1618,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
protected void clearHistoryDialog(final Conversation conversation) { 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)); 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); final CheckBox endConversationCheckBox = dialogView.findViewById(R.id.end_conversation_checkbox);
builder.setView(dialogView); builder.setView(dialogView);
builder.setNegativeButton(getString(R.string.cancel), null); 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) { 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); builder.setTitle(R.string.disable_notifications);
final int[] durations = getResources().getIntArray(R.array.mute_options_durations); final int[] durations = getResources().getIntArray(R.array.mute_options_durations);
final CharSequence[] labels = new CharSequence[durations.length]; final CharSequence[] labels = new CharSequence[durations.length];
@ -1653,13 +1654,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (durations[which] == -1) { if (durations[which] == -1) {
till = Long.MAX_VALUE; till = Long.MAX_VALUE;
} else { } else {
till = System.currentTimeMillis() + (durations[which] * 1000); till = System.currentTimeMillis() + (durations[which] * 1000L);
} }
conversation.setMutedTill(till); conversation.setMutedTill(till);
activity.xmppConnectionService.updateConversation(conversation); activity.xmppConnectionService.updateConversation(conversation);
activity.onConversationsListItemUpdated(); activity.onConversationsListItemUpdated();
refresh(); refresh();
getActivity().invalidateOptionsMenu(); requireActivity().invalidateOptionsMenu();
}); });
builder.create().show(); builder.create().show();
} }