use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class TimelineFragment method onContentHiddenChange.
@Override
public void onContentHiddenChange(boolean isShowing, int position) {
StatusViewData newViewData = new StatusViewData.Builder(((StatusViewData.Concrete) statuses.getPairedItem(position))).setIsShowingSensitiveContent(isShowing).createStatusViewData();
statuses.setPairedItem(position, newViewData);
adapter.changeItem(position, newViewData, false);
}
use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class TimelineFragment method onFetchTimelineFailure.
private void onFetchTimelineFailure(Exception exception, FetchEnd fetchEnd, int position) {
swipeRefreshLayout.setRefreshing(false);
if (fetchEnd == FetchEnd.MIDDLE && !statuses.get(position).isRight()) {
StatusViewData newViewData = new StatusViewData.Placeholder(false);
statuses.setPairedItem(position, newViewData);
adapter.changeItem(position, newViewData, true);
}
Log.e(TAG, "Fetch Failure: " + exception.getMessage());
fulfillAnyQueuedFetches(fetchEnd);
}
use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class TimelineFragment method onFavourite.
@Override
public void onFavourite(final boolean favourite, final int position) {
final Status status = statuses.get(position).getAsRight();
timelineCases.favouriteWithCallback(status, favourite, new Callback<Status>() {
@Override
public void onResponse(@NonNull Call<Status> call, @NonNull Response<Status> response) {
if (response.isSuccessful()) {
status.setFavourited(favourite);
if (status.getReblog() != null) {
status.getReblog().setFavourited(favourite);
}
Pair<StatusViewData.Concrete, Integer> actual = findStatusAndPosition(position, status);
if (actual == null)
return;
StatusViewData newViewData = new StatusViewData.Builder(actual.first).setFavourited(favourite).createStatusViewData();
statuses.setPairedItem(actual.second, newViewData);
adapter.changeItem(actual.second, newViewData, false);
}
}
@Override
public void onFailure(@NonNull Call<Status> call, @NonNull Throwable t) {
Log.d(TAG, "Failed to favourite status " + status.getId(), t);
}
});
}
use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class TimelineFragment method onExpandedChange.
@Override
public void onExpandedChange(boolean expanded, int position) {
StatusViewData newViewData = new StatusViewData.Builder(((StatusViewData.Concrete) statuses.getPairedItem(position))).setIsExpanded(expanded).createStatusViewData();
statuses.setPairedItem(position, newViewData);
adapter.changeItem(position, newViewData, false);
}
use of com.keylesspalace.tusky.viewdata.StatusViewData in project Tusky by tuskyapp.
the class NotificationsFragment method onContentHiddenChange.
@Override
public void onContentHiddenChange(boolean isShowing, int position) {
NotificationViewData.Concrete old = (NotificationViewData.Concrete) notifications.getPairedItem(position);
StatusViewData.Concrete statusViewData = new StatusViewData.Builder(old.getStatusViewData()).setIsShowingSensitiveContent(isShowing).createStatusViewData();
NotificationViewData notificationViewData = new NotificationViewData.Concrete(old.getType(), old.getId(), old.getAccount(), statusViewData, old.isExpanded());
notifications.setPairedItem(position, notificationViewData);
adapter.updateItemWithNotify(position, notificationViewData, false);
}
Aggregations