fix(spotbugs): Improve spotbugs scoring

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2024-11-07 15:42:58 +01:00
parent cabd248e13
commit 3ac1b18d3d
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
3 changed files with 29 additions and 24 deletions

View file

@ -86,8 +86,8 @@ public class CallParticipantList {
callParticipants.remove(callParticipant.getSessionId());
// No need to copy it, as it will be no longer used.
callParticipant.setInCall(Participant.InCallFlags.DISCONNECTED);
left.add(callParticipant);
}
left.addAll(knownCallParticipantsNotFound);
if (!joined.isEmpty() || !updated.isEmpty() || !left.isEmpty()) {
callParticipantListNotifier.notifyChanged(joined, updated, left, unchanged);

View file

@ -126,28 +126,33 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
@Override
public void onNext(@NonNull MentionOverall mentionOverall) {
List<Mention> mentionsList = mentionOverall.getOcs().getData();
if (mentionOverall.getOcs() != null) {
List<Mention> mentionsList = mentionOverall.getOcs().getData();
if (mentionsList.size() == 0) {
adapter.clear();
} else {
List<AbstractFlexibleItem> internalAbstractFlexibleItemList =
new ArrayList<>(mentionsList.size());
for (Mention mention : mentionsList) {
internalAbstractFlexibleItemList.add(
new MentionAutocompleteItem(
mention,
currentUser,
context,
roomToken,
viewThemeUtils));
if (mentionsList != null) {
if (mentionsList.isEmpty()) {
adapter.clear();
} else {
List<AbstractFlexibleItem> internalAbstractFlexibleItemList =
new ArrayList<>(mentionsList.size());
for (Mention mention : mentionsList) {
internalAbstractFlexibleItemList.add(
new MentionAutocompleteItem(
mention,
currentUser,
context,
roomToken,
viewThemeUtils));
}
if (adapter.getItemCount() != 0) {
adapter.clear();
}
adapter.updateDataSet(internalAbstractFlexibleItemList);
}
}
if (adapter.getItemCount() != 0) {
adapter.clear();
}
adapter.updateDataSet(internalAbstractFlexibleItemList);
}
}

View file

@ -109,7 +109,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
themeViews();
setupCurrentUser(user);
setupListeners(user);
setupListeners();
setupAdapter();
prepareViews();
}
@ -220,7 +220,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
adapter.updateDataSet(userItems, false);
}
private void setupListeners(User user) {
private void setupListeners() {
// Creating listeners for quick-actions
binding.currentAccount.getRoot().setOnClickListener(v -> dismiss());
@ -240,7 +240,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
binding.setStatus.setOnClickListener(v -> {
dismiss();
if (status != null) {
if (status != null && getActivity() != null) {
SetStatusDialogFragment setStatusDialog = SetStatusDialogFragment.newInstance(status);
setStatusDialog.show(getActivity().getSupportFragmentManager(), "fragment_set_status");
} else {