mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-06 22:15:43 +01:00
committed by
jeffrey-signal
parent
8c1cc03c6f
commit
b57d922cdf
+8
-8
@@ -10,8 +10,8 @@ import androidx.lifecycle.Transformations;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.groups.ui.GroupMemberEntry;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
@@ -58,7 +58,7 @@ public final class AddGroupDetailsViewModel extends ViewModel {
|
||||
sameGroups = Transformations.switchMap(members, memberList -> {
|
||||
MutableLiveData<List<Recipient>> result = new MutableLiveData<>(Collections.emptyList());
|
||||
if (!memberList.isEmpty()) {
|
||||
Set<RecipientId> memberIds = Stream.of(memberList)
|
||||
Set<RecipientId> memberIds = memberList.stream()
|
||||
.map(member -> member.getMember().getId())
|
||||
.collect(Collectors.toSet());
|
||||
repository.getGroupsWithSameMembers(memberIds, result::postValue);
|
||||
@@ -118,7 +118,7 @@ public final class AddGroupDetailsViewModel extends ViewModel {
|
||||
|
||||
void create() {
|
||||
List<GroupMemberEntry.NewGroupCandidate> members = Objects.requireNonNull(this.members.getValue());
|
||||
Set<RecipientId> memberIds = Stream.of(members).map(member -> member.getMember().getId()).collect(Collectors.toSet());
|
||||
Set<RecipientId> memberIds = members.stream().map(member -> member.getMember().getId()).collect(Collectors.toSet());
|
||||
byte[] avatarBytes = avatar.getValue();
|
||||
String groupName = name.getValue();
|
||||
Integer disappearingTimer = disappearingMessagesTimer.getValue();
|
||||
@@ -136,13 +136,13 @@ public final class AddGroupDetailsViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
private static @NonNull List<GroupMemberEntry.NewGroupCandidate> filterDeletedMembers(@NonNull List<GroupMemberEntry.NewGroupCandidate> members, @NonNull Set<RecipientId> deleted) {
|
||||
return Stream.of(members)
|
||||
.filterNot(member -> deleted.contains(member.getMember().getId()))
|
||||
.toList();
|
||||
return members.stream()
|
||||
.filter(member -> !deleted.contains(member.getMember().getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static boolean isAnyForcedSms(@NonNull List<GroupMemberEntry.NewGroupCandidate> members) {
|
||||
return Stream.of(members)
|
||||
return members.stream()
|
||||
.anyMatch(member -> !member.getMember().isRegistered());
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ import android.content.Intent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.PendingIntentFlags;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
@@ -43,7 +41,7 @@ public class AlarmManagerScheduler implements Scheduler {
|
||||
|
||||
@Override
|
||||
public void schedule(long delay, @NonNull List<Constraint> constraints) {
|
||||
if (delay > 0 && Stream.of(constraints).allMatch(Constraint::isMet)) {
|
||||
if (delay > 0 && constraints.stream().allMatch(Constraint::isMet)) {
|
||||
setUniqueAlarm(application, System.currentTimeMillis() + delay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ import android.graphics.RectF;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Detects faces with the built in Android face detection.
|
||||
@@ -50,7 +50,7 @@ final class AndroidFaceDetector implements FaceDetector {
|
||||
return Stream.of(faces)
|
||||
.limit(foundFaces)
|
||||
.map(AndroidFaceDetector::faceToFace)
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
} finally {
|
||||
if (createBitmap) {
|
||||
bitmap.recycle();
|
||||
|
||||
@@ -14,8 +14,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.DimensionUnit;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -28,6 +26,8 @@ import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPrefere
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.thoughtcrime.securesms.util.ConversationUtil.CONVERSATION_SUPPORT_VERSION;
|
||||
|
||||
/**
|
||||
|
||||
+8
-9
@@ -2,9 +2,6 @@ package org.thoughtcrime.securesms.payments.history;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
@@ -18,6 +15,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -72,7 +71,7 @@ public final class BlockTransactionReconstructionTests {
|
||||
TransactionReconstruction estimate = TransactionReconstruction.estimateBlockLevelActivity(spentTransactionOutputs.getMoney(), unspentTransactionOutputs.getMoney());
|
||||
|
||||
assertEquals(expectedReceivedTransactions.getMoney(), toValueList(estimate.received()));
|
||||
assertTrue(Stream.of(estimate.received()).allMatch(t -> t.getDirection() == Direction.RECEIVED));
|
||||
assertTrue(estimate.received().stream().allMatch(t -> t.getDirection() == Direction.RECEIVED));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,7 +79,7 @@ public final class BlockTransactionReconstructionTests {
|
||||
TransactionReconstruction estimate = TransactionReconstruction.estimateBlockLevelActivity(spentTransactionOutputs.getMoney(), unspentTransactionOutputs.getMoney());
|
||||
|
||||
assertEquals(expectedSentTransactions.getMoney(), toValueList(estimate.sent()));
|
||||
assertTrue(Stream.of(estimate.sent()).allMatch(t -> t.getDirection() == Direction.SENT));
|
||||
assertTrue(estimate.sent().stream().allMatch(t -> t.getDirection() == Direction.SENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -115,7 +114,7 @@ public final class BlockTransactionReconstructionTests {
|
||||
}
|
||||
|
||||
private static @NonNull List<TransactionReconstruction.Transaction> sort(@NonNull List<TransactionReconstruction.Transaction> transactions) {
|
||||
return Stream.of(transactions)
|
||||
return transactions.stream()
|
||||
.sorted((o1, o2) -> {
|
||||
if (o1.getDirection() != o2.getDirection()) {
|
||||
if (o1.getDirection() == Direction.RECEIVED) {
|
||||
@@ -130,13 +129,13 @@ public final class BlockTransactionReconstructionTests {
|
||||
}
|
||||
|
||||
private static List<Money.MobileCoin> toValueList(List<TransactionReconstruction.Transaction> received) {
|
||||
return Stream.of(received)
|
||||
return received.stream()
|
||||
.map(TransactionReconstruction.Transaction::getValue)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static List<Money.MobileCoin> toValueListWithDirection(List<TransactionReconstruction.Transaction> received) {
|
||||
return Stream.of(received)
|
||||
return received.stream()
|
||||
.map(TransactionReconstruction.Transaction::getValueWithDirection)
|
||||
.toList();
|
||||
}
|
||||
@@ -159,7 +158,7 @@ public final class BlockTransactionReconstructionTests {
|
||||
|
||||
@Override
|
||||
public @NonNull String toString() {
|
||||
return "[" + Stream.of(money)
|
||||
return "[" + money.stream()
|
||||
.map(f -> f.toString(MONEY_FORMATTER))
|
||||
.collect(Collectors.joining(", ")) +
|
||||
"]";
|
||||
|
||||
Reference in New Issue
Block a user