Add annotation where needed

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-16 14:11:34 +02:00
parent 443cf8b227
commit cb455a7104
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -2,6 +2,8 @@
* Nextcloud Talk application * Nextcloud Talk application
* *
* @author Mario Danic * @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com> * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -33,6 +35,8 @@ import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.database.user.UserUtils; import com.nextcloud.talk.utils.database.user.UserUtils;
import com.otaliastudios.autocomplete.RecyclerViewPresenter; import com.otaliastudios.autocomplete.RecyclerViewPresenter;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -106,11 +110,12 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
.retry(3) .retry(3)
.subscribe(new Observer<MentionOverall>() { .subscribe(new Observer<MentionOverall>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(@NotNull Disposable d) {
// no actions atm
} }
@Override @Override
public void onNext(MentionOverall mentionOverall) { public void onNext(@NotNull MentionOverall mentionOverall) {
List<Mention> mentionsList = mentionOverall.getOcs().getData(); List<Mention> mentionsList = mentionOverall.getOcs().getData();
if (mentionsList.size() == 0) { if (mentionsList.size() == 0) {
@ -119,9 +124,12 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
List<AbstractFlexibleItem> internalAbstractFlexibleItemList = new ArrayList<>(); List<AbstractFlexibleItem> internalAbstractFlexibleItemList = new ArrayList<>();
for (Mention mention : mentionsList) { for (Mention mention : mentionsList) {
internalAbstractFlexibleItemList.add( internalAbstractFlexibleItemList.add(
new MentionAutocompleteItem(mention.getId(), new MentionAutocompleteItem(
mention.getLabel(), mention.getSource(), mention.getId(),
currentUser, context)); mention.getLabel(),
mention.getSource(),
currentUser,
context));
} }
if (adapter.getItemCount() != 0) { if (adapter.getItemCount() != 0) {
@ -133,18 +141,17 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
} }
@Override @Override
public void onError(Throwable e) { public void onError(@NotNull Throwable e) {
adapter.clear(); adapter.clear();
} }
@Override @Override
public void onComplete() { public void onComplete() {
// no actions atm
} }
}); });
} }
@Override @Override
public boolean onItemClick(View view, int position) { public boolean onItemClick(View view, int position) {
Mention mention = new Mention(); Mention mention = new Mention();