Messaging: Replace explicit types
Change-Id: I2165b3dec73973a2a82d8b3c7c364b5f011e597d
This commit is contained in:
@@ -72,7 +72,7 @@ public class ConversationData extends BindableData {
|
||||
* for each message.
|
||||
*/
|
||||
public List<Integer> getPositions(final String conversationId, final List<Long> ids) {
|
||||
final ArrayList<Integer> result = new ArrayList<Integer>();
|
||||
final ArrayList<Integer> result = new ArrayList<>();
|
||||
|
||||
if (ids.isEmpty()) {
|
||||
return result;
|
||||
@@ -84,7 +84,7 @@ public class ConversationData extends BindableData {
|
||||
new String [] { conversationId }));
|
||||
if (c != null) {
|
||||
try {
|
||||
final Set<Long> idsSet = new HashSet<Long>(ids);
|
||||
final Set<Long> idsSet = new HashSet<>(ids);
|
||||
if (c.moveToLast()) {
|
||||
do {
|
||||
final long messageId = c.getLong(0);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ConversationListData extends BindableData
|
||||
private static final int INDEX_BLOCKED_PARTICIPANTS_NORMALIZED_DESTINATION = 1;
|
||||
|
||||
// all blocked participants
|
||||
private final HashSet<String> mBlockedParticipants = new HashSet<String>();
|
||||
private final HashSet<String> mBlockedParticipants = new HashSet<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
||||
@@ -489,7 +489,7 @@ public class ConversationListItemData {
|
||||
return participants.get(0).getDisplayName(true);
|
||||
}
|
||||
|
||||
final ArrayList<String> participantNames = new ArrayList<String>();
|
||||
final ArrayList<String> participantNames = new ArrayList<>();
|
||||
for (final ParticipantData participant : participants) {
|
||||
// Prefer first name over full name for group conversation
|
||||
participantNames.add(participant.getDisplayName(false));
|
||||
|
||||
@@ -163,7 +163,7 @@ public class ConversationMessageData {
|
||||
|
||||
// statics to avoid unnecessary object allocation
|
||||
private static final StringBuilder sUnquoteStringBuilder = new StringBuilder();
|
||||
private static final ArrayList<String> sUnquoteResults = new ArrayList<String>();
|
||||
private static final ArrayList<String> sUnquoteResults = new ArrayList<>();
|
||||
|
||||
// this lock is used to guard access to the above statics
|
||||
private static final Object sUnquoteLock = new Object();
|
||||
@@ -281,7 +281,7 @@ public class ConversationMessageData {
|
||||
final String rawTexts,
|
||||
final int partsCount,
|
||||
final String messageId) {
|
||||
final List<MessagePartData> parts = new LinkedList<MessagePartData>();
|
||||
final List<MessagePartData> parts = new LinkedList<>();
|
||||
if (partsCount == 1) {
|
||||
parts.add(makePartData(
|
||||
rawIds,
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ConversationParticipantsData implements Iterable<ParticipantData> {
|
||||
private int mParticipantCountExcludingSelf = 0;
|
||||
|
||||
public ConversationParticipantsData() {
|
||||
mConversationParticipantsMap = new SimpleArrayMap<String, ParticipantData>();
|
||||
mConversationParticipantsMap = new SimpleArrayMap<>();
|
||||
}
|
||||
|
||||
public void bind(final Cursor cursor) {
|
||||
@@ -66,7 +66,7 @@ public class ConversationParticipantsData implements Iterable<ParticipantData> {
|
||||
|
||||
ArrayList<ParticipantData> getParticipantListExcludingSelf() {
|
||||
final ArrayList<ParticipantData> retList =
|
||||
new ArrayList<ParticipantData>(mConversationParticipantsMap.size());
|
||||
new ArrayList<>(mConversationParticipantsMap.size());
|
||||
for (int i = 0; i < mConversationParticipantsMap.size(); i++) {
|
||||
final ParticipantData participant = mConversationParticipantsMap.valueAt(i);
|
||||
if (!participant.isSelf()) {
|
||||
@@ -103,7 +103,7 @@ public class ConversationParticipantsData implements Iterable<ParticipantData> {
|
||||
@NonNull
|
||||
@Override
|
||||
public Iterator<ParticipantData> iterator() {
|
||||
return new Iterator<ParticipantData>() {
|
||||
return new Iterator<>() {
|
||||
private int mCurrentIndex = -1;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -117,9 +117,9 @@ public class DraftMessageData extends BindableData implements ReadDraftDataActio
|
||||
|
||||
public DraftMessageData(final String conversationId) {
|
||||
mConversationId = conversationId;
|
||||
mAttachments = new ArrayList<MessagePartData>();
|
||||
mAttachments = new ArrayList<>();
|
||||
mReadOnlyAttachments = Collections.unmodifiableList(mAttachments);
|
||||
mPendingAttachments = new ArrayList<PendingAttachmentData>();
|
||||
mPendingAttachments = new ArrayList<>();
|
||||
mReadOnlyPendingAttachments = Collections.unmodifiableList(mPendingAttachments);
|
||||
mListeners = new DraftMessageDataEventDispatcher();
|
||||
mMessageTextStats = new MessageTextStats();
|
||||
@@ -773,7 +773,7 @@ public class DraftMessageData extends BindableData implements ReadDraftDataActio
|
||||
mBindingId = binding.getBindingId();
|
||||
// Obtain an immutable copy of the attachment list so we can operate on it in the
|
||||
// background thread.
|
||||
mAttachmentsCopy = new ArrayList<MessagePartData>(mAttachments);
|
||||
mAttachmentsCopy = new ArrayList<>(mAttachments);
|
||||
|
||||
mCheckDraftForSendTask = this;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class MessageData implements Parcelable {
|
||||
* Create an "empty" message
|
||||
*/
|
||||
public MessageData() {
|
||||
mParts = new ArrayList<MessagePartData>();
|
||||
mParts = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static String[] getProjection() {
|
||||
@@ -846,7 +846,7 @@ public class MessageData implements Parcelable {
|
||||
mRetryStartTimestamp = in.readLong();
|
||||
|
||||
// Read parts
|
||||
mParts = new ArrayList<MessagePartData>();
|
||||
mParts = new ArrayList<>();
|
||||
final int partCount = in.readInt();
|
||||
for (int i = 0; i < partCount; i++) {
|
||||
mParts.add((MessagePartData) in.readParcelable(MessagePartData.class.getClassLoader()));
|
||||
@@ -889,7 +889,7 @@ public class MessageData implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<MessageData> CREATOR
|
||||
= new Parcelable.Creator<MessageData>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public MessageData createFromParcel(final Parcel in) {
|
||||
return new MessageData(in);
|
||||
|
||||
@@ -413,7 +413,7 @@ public class MessagePartData implements Parcelable {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<MessagePartData> CREATOR
|
||||
= new Parcelable.Creator<MessagePartData>() {
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public MessagePartData createFromParcel(final Parcel in) {
|
||||
return new MessagePartData(in);
|
||||
|
||||
@@ -45,8 +45,7 @@ import com.android.messaging.util.TextUtil;
|
||||
*/
|
||||
public class ParticipantData implements Parcelable {
|
||||
|
||||
private static final ArrayMap<Integer, String> sSubIdtoParticipantIdCache =
|
||||
new ArrayMap<Integer, String>();
|
||||
private static final ArrayMap<Integer, String> sSubIdtoParticipantIdCache = new ArrayMap<>();
|
||||
|
||||
// We always use -1 as default/invalid sub id although system may give us anything negative
|
||||
public static final int DEFAULT_SELF_SUB_ID = MmsManager.DEFAULT_SUB_ID;
|
||||
@@ -583,8 +582,7 @@ public class ParticipantData implements Parcelable {
|
||||
dest.writeString(mSubscriptionName);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ParticipantData> CREATOR
|
||||
= new Parcelable.Creator<ParticipantData>() {
|
||||
public static final Parcelable.Creator<ParticipantData> CREATOR = new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public ParticipantData createFromParcel(final Parcel in) {
|
||||
return new ParticipantData(in);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -162,15 +163,15 @@ public class PendingAttachmentData extends MessagePartData {
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<PendingAttachmentData> CREATOR
|
||||
= new Parcelable.Creator<PendingAttachmentData>() {
|
||||
@Override
|
||||
public PendingAttachmentData createFromParcel(final Parcel in) {
|
||||
return new PendingAttachmentData(in);
|
||||
}
|
||||
= new Parcelable.Creator<>() {
|
||||
@Override
|
||||
public PendingAttachmentData createFromParcel(final Parcel in) {
|
||||
return new PendingAttachmentData(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PendingAttachmentData[] newArray(final int size) {
|
||||
return new PendingAttachmentData[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public PendingAttachmentData[] newArray(final int size) {
|
||||
return new PendingAttachmentData[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SelfParticipantsData {
|
||||
private final ArrayMap<String, ParticipantData> mSelfParticipantMap;
|
||||
|
||||
public SelfParticipantsData() {
|
||||
mSelfParticipantMap = new ArrayMap<String, ParticipantData>();
|
||||
mSelfParticipantMap = new ArrayMap<>();
|
||||
}
|
||||
|
||||
public void bind(final Cursor cursor) {
|
||||
@@ -55,7 +55,7 @@ public class SelfParticipantsData {
|
||||
* @param activeOnly if set, returns active self entries only (i.e. those with SIMs plugged in).
|
||||
*/
|
||||
public List<ParticipantData> getSelfParticipants(final boolean activeOnly) {
|
||||
List<ParticipantData> list = new ArrayList<ParticipantData>();
|
||||
List<ParticipantData> list = new ArrayList<>();
|
||||
for (final ParticipantData self : mSelfParticipantMap.values()) {
|
||||
if (!activeOnly || self.isActiveSubscription()) {
|
||||
list.add(self);
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SettingsData extends BindableData implements
|
||||
|
||||
public List<SettingsItem> getSettingsItems() {
|
||||
final List<ParticipantData> selfs = mSelfParticipantsData.getSelfParticipants(true);
|
||||
final List<SettingsItem> settingsItems = new ArrayList<SettingsItem>();
|
||||
final List<SettingsItem> settingsItems = new ArrayList<>();
|
||||
// First goes the general settings, followed by per-subscription settings.
|
||||
settingsItems.add(SettingsItem.createGeneralSettingsItem(mContext));
|
||||
// For per-subscription settings, show the actual SIM name with phone number if the
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -86,7 +87,7 @@ public class SubscriptionListData {
|
||||
private final Context mContext;
|
||||
|
||||
public SubscriptionListData(final Context context) {
|
||||
mEntriesExcludingDefault = new ArrayList<SubscriptionListEntry>();
|
||||
mEntriesExcludingDefault = new ArrayList<>();
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user