Skip to content

Commit

Permalink
fix(spotbugs): Improve spotbugs scoring
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Scherzinger <[email protected]>
  • Loading branch information
AndyScherzinger committed Nov 7, 2024
1 parent cabd248 commit 3ac1b18
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ private void processParticipantList(List<Participant> participants) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,33 @@ public void onSubscribe(@NonNull Disposable d) {

@Override
public void onNext(@NonNull MentionOverall mentionOverall) {
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 (mentionOverall.getOcs() != null) {
List<Mention> mentionsList = mentionOverall.getOcs().getData();

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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {

themeViews();
setupCurrentUser(user);
setupListeners(user);
setupListeners();
setupAdapter();
prepareViews();
}
Expand Down Expand Up @@ -220,7 +220,7 @@ private void addAccountToSwitcherList(
adapter.updateDataSet(userItems, false);
}

private void setupListeners(User user) {
private void setupListeners() {
// Creating listeners for quick-actions
binding.currentAccount.getRoot().setOnClickListener(v -> dismiss());

Expand All @@ -240,7 +240,7 @@ private void setupListeners(User user) {
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 {
Expand Down

0 comments on commit 3ac1b18

Please sign in to comment.