use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class TimelineFragment method addItems.
private void addItems(List<Status> newStatuses, @Nullable String fromId) {
if (ListUtils.isEmpty(newStatuses)) {
return;
}
int end = statuses.size();
Status last = statuses.get(end - 1).getAsRightOrNull();
// types by ID anyway and we should change equals() for Status, I think, so this makes sense
if (last != null && !findStatus(newStatuses, last.getId())) {
statuses.addAll(listStatusList(newStatuses));
List<StatusViewData> newViewDatas = statuses.getPairedCopy().subList(statuses.size() - newStatuses.size(), statuses.size());
if (BuildConfig.DEBUG && newStatuses.size() != newViewDatas.size()) {
String error = String.format(Locale.getDefault(), "Incorrectly got statusViewData sublist." + " newStatuses.size == %d newViewDatas.size == %d, statuses.size == %d", newStatuses.size(), newViewDatas.size(), statuses.size());
throw new AssertionError(error);
}
if (fromId != null) {
bottomId = fromId;
}
adapter.addItems(newViewDatas);
}
}
use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class NotificationsFragment method onExpandedChange.
@Override
public void onExpandedChange(boolean expanded, int position) {
NotificationViewData.Concrete old = (NotificationViewData.Concrete) notifications.getPairedItem(position);
StatusViewData.Concrete statusViewData = new StatusViewData.Builder(old.getStatusViewData()).setIsExpanded(expanded).createStatusViewData();
NotificationViewData notificationViewData = new NotificationViewData.Concrete(old.getType(), old.getId(), old.getAccount(), statusViewData, expanded);
notifications.setPairedItem(position, notificationViewData);
adapter.updateItemWithNotify(position, notificationViewData, false);
}
Aggregations