Machine translation of posts (#4307)
This commit is contained in:
parent
80982d061e
commit
fbb22799dc
38 changed files with 1912 additions and 180 deletions
|
|
@ -109,6 +109,7 @@ import at.connyduck.sparkbutton.helpers.Utils;
|
|||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
import kotlinx.coroutines.Job;
|
||||
|
||||
public class NotificationsFragment extends SFragment implements
|
||||
|
|
@ -408,6 +409,12 @@ public class NotificationsFragment extends SFragment implements
|
|||
sendFetchNotificationsRequest(null, topId, FetchEnd.TOP, -1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Function2<Boolean, Integer, Unit> getOnMoreTranslate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReply(int position) {
|
||||
super.reply(notifications.get(position).asRight().getStatus());
|
||||
|
|
@ -490,7 +497,7 @@ public class NotificationsFragment extends SFragment implements
|
|||
@Override
|
||||
public void onMore(@NonNull View view, int position) {
|
||||
Notification notification = notifications.get(position).asRight();
|
||||
super.more(notification.getStatus(), view, position);
|
||||
super.more(notification.getStatus(), view, position, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -525,10 +532,6 @@ public class NotificationsFragment extends SFragment implements
|
|||
updateViewDataAt(position, (vd) -> vd.copyWithShowingContent(isShowing));
|
||||
}
|
||||
|
||||
private void setPinForStatus(String statusId, boolean pinned) {
|
||||
updateStatus(statusId, status -> status.copyWithPinned(pinned));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore(int position) {
|
||||
// Check bounds before accessing list,
|
||||
|
|
@ -555,6 +558,11 @@ public class NotificationsFragment extends SFragment implements
|
|||
updateViewDataAt(position, (vd) -> vd.copyWithCollapsed(isCollapsed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUntranslate(int position) {
|
||||
// not needed
|
||||
}
|
||||
|
||||
private void updateStatus(String statusId, Function<Status, Status> mapper) {
|
||||
int index = CollectionsKt.indexOfFirst(this.notifications, (s) -> s.isRight() &&
|
||||
s.asRight().getStatus() != null &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue