use of forpdateam.ru.forpda.api.mentions.models.MentionsData in project ForPDA by RadiationX.
the class Mentions method getMentions.
public MentionsData getMentions(int st) throws Exception {
MentionsData data = new MentionsData();
NetworkResponse response = Api.getWebClient().get("https://4pda.ru/forum/index.php?act=mentions&st=".concat(Integer.toString(st)));
Matcher matcher = mentionsPattern.matcher(response.getBody());
while (matcher.find()) {
MentionItem item = new MentionItem();
item.setState(matcher.group(1).equals("read") ? MentionItem.STATE_READ : MentionItem.STATE_UNREAD);
item.setType(matcher.group(2).equalsIgnoreCase("Форум") ? MentionItem.TYPE_TOPIC : MentionItem.TYPE_NEWS);
item.setLink(matcher.group(3));
item.setTitle(ApiUtils.fromHtml(matcher.group(4)));
item.setDesc(ApiUtils.fromHtml(matcher.group(5)));
item.setDate(matcher.group(6));
item.setNick(ApiUtils.fromHtml(matcher.group(7)));
data.addItem(item);
}
data.setPagination(Pagination.parseForum(response.getBody()));
return data;
}
use of forpdateam.ru.forpda.api.mentions.models.MentionsData in project ForPDA by RadiationX.
the class MentionsPresenter method getMentions.
@Override
public void getMentions(int st) {
view.setRefreshing(true);
subscribe(RxApi.Mentions().getMentions(st), data -> {
view.setRefreshing(false);
view.showMentions(data);
}, new MentionsData(), v -> getMentions(st));
}
Aggregations