mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Implement new bottom fragment UX for multiforward.
This commit is contained in:
committed by
Cody Henthorne
parent
561cca5208
commit
dc1e56de4e
@@ -158,6 +158,10 @@ public final class MultiShareArgs implements Parcelable {
|
||||
}
|
||||
|
||||
public Builder buildUpon() {
|
||||
return buildUpon(shareContactAndThreads);
|
||||
}
|
||||
|
||||
public Builder buildUpon(@NonNull Set<ShareContactAndThread> shareContactAndThreads) {
|
||||
return new Builder(shareContactAndThreads).asBorderless(borderless)
|
||||
.asViewOnce(viewOnce)
|
||||
.withDataType(dataType)
|
||||
|
||||
@@ -50,11 +50,11 @@ public final class MultiShareSender {
|
||||
|
||||
@MainThread
|
||||
public static void send(@NonNull MultiShareArgs multiShareArgs, @NonNull Consumer<MultiShareSendResultCollection> results) {
|
||||
SimpleTask.run(() -> sendInternal(multiShareArgs), results::accept);
|
||||
SimpleTask.run(() -> sendSync(multiShareArgs), results::accept);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private static MultiShareSendResultCollection sendInternal(@NonNull MultiShareArgs multiShareArgs) {
|
||||
public static MultiShareSendResultCollection sendSync(@NonNull MultiShareArgs multiShareArgs) {
|
||||
Context context = ApplicationDependencies.getApplication();
|
||||
boolean isMmsEnabled = Util.isMmsCapable(context);
|
||||
String message = multiShareArgs.getDraftText();
|
||||
@@ -199,6 +199,10 @@ public final class MultiShareSender {
|
||||
public boolean containsFailures() {
|
||||
return Stream.of(results).anyMatch(result -> result.type != MultiShareSendResult.Type.SUCCESS);
|
||||
}
|
||||
|
||||
public boolean containsOnlyFailures() {
|
||||
return Stream.of(results).allMatch(result -> result.type != MultiShareSendResult.Type.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MultiShareSendResult {
|
||||
|
||||
@@ -8,11 +8,11 @@ import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
final class ShareContact {
|
||||
public final class ShareContact {
|
||||
private final Optional<RecipientId> recipientId;
|
||||
private final String number;
|
||||
|
||||
ShareContact(@NonNull Optional<RecipientId> recipientId, @Nullable String number) {
|
||||
public ShareContact(@NonNull Optional<RecipientId> recipientId, @Nullable String number) {
|
||||
this.recipientId = recipientId;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public final class ShareContactAndThread implements Parcelable {
|
||||
private final long threadId;
|
||||
private final boolean forceSms;
|
||||
|
||||
ShareContactAndThread(@NonNull RecipientId recipientId, long threadId, boolean forceSms) {
|
||||
public ShareContactAndThread(@NonNull RecipientId recipientId, long threadId, boolean forceSms) {
|
||||
this.recipientId = recipientId;
|
||||
this.threadId = threadId;
|
||||
this.forceSms = forceSms;
|
||||
|
||||
@@ -3,8 +3,8 @@ package org.thoughtcrime.securesms.sharing;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.MappingAdapter;
|
||||
|
||||
class ShareSelectionAdapter extends MappingAdapter {
|
||||
ShareSelectionAdapter() {
|
||||
public class ShareSelectionAdapter extends MappingAdapter {
|
||||
public ShareSelectionAdapter() {
|
||||
registerFactory(ShareSelectionMappingModel.class,
|
||||
ShareSelectionViewHolder.createFactory(R.layout.share_contact_selection_item));
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.MappingModel;
|
||||
|
||||
class ShareSelectionMappingModel implements MappingModel<ShareSelectionMappingModel> {
|
||||
public class ShareSelectionMappingModel implements MappingModel<ShareSelectionMappingModel> {
|
||||
|
||||
private final ShareContact shareContact;
|
||||
private final boolean isFirst;
|
||||
|
||||
ShareSelectionMappingModel(@NonNull ShareContact shareContact, boolean isFirst) {
|
||||
public ShareSelectionMappingModel(@NonNull ShareContact shareContact, boolean isFirst) {
|
||||
this.shareContact = shareContact;
|
||||
this.isFirst = isFirst;
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class ShareSelectionMappingModel implements MappingModel<ShareSelectionMappingMo
|
||||
.transform(Recipient::resolved)
|
||||
.transform(recipient -> recipient.isSelf() ? context.getString(R.string.note_to_self)
|
||||
: recipient.getShortDisplayNameIncludingUsername(context))
|
||||
.or(shareContact.getNumber());
|
||||
.or(shareContact::getNumber);
|
||||
|
||||
return isFirst ? name : context.getString(R.string.ShareActivity__comma_s, name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user