implement "load more" placeholder

This commit is contained in:
Conny Duck 2017-11-03 22:17:31 +01:00
commit 80a10c1ac1
16 changed files with 398 additions and 95 deletions

View file

@ -1,3 +1,18 @@
/* Copyright 2017 Andrew Dawson
*
* This file is a part of Tusky.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tusky; if not,
* see <http://www.gnu.org/licenses>. */
package com.keylesspalace.tusky.util;
import android.arch.core.util.Function;
@ -19,6 +34,11 @@ public final class ViewDataUtils {
@Nullable
public static StatusViewData statusToViewData(@Nullable Status status) {
if (status == null) return null;
if(status.placeholder) {
return new StatusViewData.Builder().setId(status.id)
.setPlaceholder(true)
.createStatusViewData();
}
Status visibleStatus = status.reblog == null ? status : status.reblog;
return new StatusViewData.Builder().setId(status.id)
.setAttachments(visibleStatus.attachments)
@ -61,7 +81,7 @@ public final class ViewDataUtils {
public static NotificationViewData notificationToViewData(Notification notification) {
return new NotificationViewData(notification.type, notification.id, notification.account,
statusToViewData(notification.status));
statusToViewData(notification.status), false);
}
public static List<NotificationViewData> notificationListToViewDataList(