mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
reformat code
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c55403c023
commit
4a75108557
@ -131,54 +131,54 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
|
|||||||
ApiUtils.getCredentials(currentUser.getUsername(), currentUser.getToken()),
|
ApiUtils.getCredentials(currentUser.getUsername(), currentUser.getToken()),
|
||||||
ApiUtils.getUrlForMentionSuggestions(chatApiVersion, currentUser.getBaseUrl(), roomToken),
|
ApiUtils.getUrlForMentionSuggestions(chatApiVersion, currentUser.getBaseUrl(), roomToken),
|
||||||
queryString, 5, queryMap)
|
queryString, 5, queryMap)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.retry(3)
|
.retry(3)
|
||||||
.subscribe(new Observer<MentionOverall>() {
|
.subscribe(new Observer<MentionOverall>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NonNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
// no actions atm
|
// no actions atm
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NonNull MentionOverall mentionOverall) {
|
public void onNext(@NonNull MentionOverall mentionOverall) {
|
||||||
List<Mention> mentionsList = mentionOverall.getOcs().getData();
|
List<Mention> mentionsList = mentionOverall.getOcs().getData();
|
||||||
|
|
||||||
if (mentionsList.size() == 0) {
|
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 (adapter.getItemCount() != 0) {
|
|
||||||
adapter.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
adapter.updateDataSet(internalAbstractFlexibleItemList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("LongLogTag")
|
|
||||||
@Override
|
|
||||||
public void onError(@NonNull Throwable e) {
|
|
||||||
adapter.clear();
|
adapter.clear();
|
||||||
Log.e(TAG, "failed to get MentionAutocompleteSuggestions", e);
|
} else {
|
||||||
}
|
List<AbstractFlexibleItem> internalAbstractFlexibleItemList =
|
||||||
|
new ArrayList<>(mentionsList.size());
|
||||||
|
for (Mention mention : mentionsList) {
|
||||||
|
internalAbstractFlexibleItemList.add(
|
||||||
|
new MentionAutocompleteItem(
|
||||||
|
mention,
|
||||||
|
currentUser,
|
||||||
|
context,
|
||||||
|
roomToken,
|
||||||
|
viewThemeUtils));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (adapter.getItemCount() != 0) {
|
||||||
public void onComplete() {
|
adapter.clear();
|
||||||
// no actions atm
|
}
|
||||||
|
|
||||||
|
adapter.updateDataSet(internalAbstractFlexibleItemList);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
@SuppressLint("LongLogTag")
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
adapter.clear();
|
||||||
|
Log.e(TAG, "failed to get MentionAutocompleteSuggestions", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
// no actions atm
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -187,7 +187,7 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
|
|||||||
MentionAutocompleteItem mentionAutocompleteItem = (MentionAutocompleteItem) adapter.getItem(position);
|
MentionAutocompleteItem mentionAutocompleteItem = (MentionAutocompleteItem) adapter.getItem(position);
|
||||||
if (mentionAutocompleteItem != null) {
|
if (mentionAutocompleteItem != null) {
|
||||||
String mentionId = mentionAutocompleteItem.getMentionId();
|
String mentionId = mentionAutocompleteItem.getMentionId();
|
||||||
if(mentionId != null) {
|
if (mentionId != null) {
|
||||||
mention.setMentionId(mentionId);
|
mention.setMentionId(mentionId);
|
||||||
}
|
}
|
||||||
mention.setId(mentionAutocompleteItem.getObjectId());
|
mention.setId(mentionAutocompleteItem.getObjectId());
|
||||||
|
Loading…
Reference in New Issue
Block a user