Move all Pair usage to kotlin.Pair

This commit is contained in:
Greyson Parrelli
2025-11-10 12:03:18 -05:00
parent 66f136903f
commit 2147ad29fa
20 changed files with 72 additions and 72 deletions

View File

@@ -180,7 +180,7 @@ public class AvatarHelper {
public static @NonNull OutputStream getOutputStream(@NonNull Context context, @NonNull RecipientId recipientId, boolean isSyncAvatar) throws IOException {
AttachmentSecret attachmentSecret = AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret();
File targetFile = getAvatarFile(context, recipientId, isSyncAvatar);
return ModernEncryptingPartOutputStream.createFor(attachmentSecret, targetFile, true).second;
return ModernEncryptingPartOutputStream.createFor(attachmentSecret, targetFile, true).getSecond();
}
/**

View File

@@ -3,7 +3,7 @@ package org.thoughtcrime.securesms.profiles.spoofing;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.SpannableStringBuilder;
import android.util.Pair;
import kotlin.Pair;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
@@ -45,10 +45,10 @@ class ReviewCardViewHolder extends RecyclerView.ViewHolder {
this.binding = ReviewCardBinding.bind(itemView);
this.subtextGroups = Arrays.asList(
Pair.create(binding.cardSubtextLine1, binding.cardSubtextIcon1),
Pair.create(binding.cardSubtextLine2, binding.cardSubtextIcon2),
Pair.create(binding.cardSubtextLine3, binding.cardSubtextIcon3),
Pair.create(binding.cardSubtextLine4, binding.cardSubtextIcon4)
new Pair(binding.cardSubtextLine1, binding.cardSubtextIcon1),
new Pair(binding.cardSubtextLine2, binding.cardSubtextIcon2),
new Pair(binding.cardSubtextLine3, binding.cardSubtextIcon3),
new Pair(binding.cardSubtextLine4, binding.cardSubtextIcon4)
);
itemView.findViewById(R.id.card_tap_target).setOnClickListener(unused -> {
@@ -136,21 +136,21 @@ class ReviewCardViewHolder extends RecyclerView.ViewHolder {
private void presentReviewTextRows(@NonNull List<ReviewTextRow> reviewTextRows, @NonNull Context context, @NonNull ReviewCard reviewCard) {
for (Pair<TextView, ImageView> group : subtextGroups) {
setVisibility(View.GONE, group.first, group.second);
setVisibility(View.GONE, group.getFirst(), group.getSecond());
}
for (int i = 0; i < Math.min(reviewTextRows.size(), subtextGroups.size()); i++) {
ReviewTextRow row = reviewTextRows.get(i);
Pair<TextView, ImageView> group = subtextGroups.get(i);
setVisibility(View.VISIBLE, group.first, group.second);
setVisibility(View.VISIBLE, group.getFirst(), group.getSecond());
switch (row) {
case SIGNAL_CONNECTION -> presentSignalConnection(group.first, group.second, context, reviewCard);
case PHONE_NUMBER -> presentPhoneNumber(group.first, group.second, reviewCard);
case RECENTLY_CHANGED -> presentRecentlyChanged(group.first, group.second, context, reviewCard);
case GROUPS_IN_COMMON -> presentGroupsInCommon(group.first, group.second, reviewCard);
case SYSTEM_CONTACTS -> presentSystemContacts(group.first, group.second, context, reviewCard);
case SIGNAL_CONNECTION -> presentSignalConnection(group.getFirst(), group.getSecond(), context, reviewCard);
case PHONE_NUMBER -> presentPhoneNumber(group.getFirst(), group.getSecond(), reviewCard);
case RECENTLY_CHANGED -> presentRecentlyChanged(group.getFirst(), group.getSecond(), context, reviewCard);
case GROUPS_IN_COMMON -> presentGroupsInCommon(group.getFirst(), group.getSecond(), reviewCard);
case SYSTEM_CONTACTS -> presentSystemContacts(group.getFirst(), group.getSecond(), context, reviewCard);
}
}
}

View File

@@ -1,6 +1,6 @@
package org.thoughtcrime.securesms.profiles.spoofing;
import android.util.Pair;
import kotlin.Pair;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -46,7 +46,7 @@ public class ReviewCardViewModel extends ViewModel {
LiveData<Pair<Boolean, List<ReviewRecipient>>> adminStatusAndReviewRecipients = LiveDataUtil.combineLatest(isSelfGroupAdmin, reviewRecipients, Pair::new);
this.reviewCards = LiveDataUtil.mapAsync(adminStatusAndReviewRecipients, pair -> transformReviewRecipients(pair.first, pair.second));
this.reviewCards = LiveDataUtil.mapAsync(adminStatusAndReviewRecipients, pair -> transformReviewRecipients(pair.getFirst(), pair.getSecond()));
this.reviewEvents = new SingleLiveEvent<>();
repository.loadRecipients(new OnRecipientsLoadedListener());