Messaging: Replace explicit types

Change-Id: I2165b3dec73973a2a82d8b3c7c364b5f011e597d
This commit is contained in:
Michael W
2024-12-26 15:54:37 +01:00
parent 9538179c75
commit 0069df879a
124 changed files with 278 additions and 277 deletions
@@ -114,8 +114,7 @@ class DownloadRequest extends MmsRequest {
return false;
}
public static final Parcelable.Creator<DownloadRequest> CREATOR
= new Parcelable.Creator<DownloadRequest>() {
public static final Parcelable.Creator<DownloadRequest> CREATOR = new Parcelable.Creator<>() {
public DownloadRequest createFromParcel(Parcel in) {
return new DownloadRequest(in);
}
+1 -2
View File
@@ -145,8 +145,7 @@ class SendRequest extends MmsRequest {
return null;
}
public static final Parcelable.Creator<SendRequest> CREATOR
= new Parcelable.Creator<SendRequest>() {
public static final Parcelable.Creator<SendRequest> CREATOR = new Parcelable.Creator<>() {
public SendRequest createFromParcel(Parcel in) {
return new SendRequest(in);
}
@@ -122,8 +122,8 @@ public class CharacterSets {
static {
// Create the HashMaps.
MIBENUM_TO_NAME_MAP = new HashMap<Integer, String>();
NAME_TO_MIBENUM_MAP = new HashMap<String, Integer>();
MIBENUM_TO_NAME_MAP = new HashMap<>();
NAME_TO_MIBENUM_MAP = new HashMap<>();
assert(MIBENUM_NUMBERS.length == MIME_NAMES.length);
int count = MIBENUM_NUMBERS.length - 1;
for(int i = 0; i <= count; i++) {
@@ -78,10 +78,10 @@ public class ContentType {
public static final String APP_DRM_CONTENT = "application/vnd.oma.drm.content";
public static final String APP_DRM_MESSAGE = "application/vnd.oma.drm.message";
private static final ArrayList<String> sSupportedContentTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedImageTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedAudioTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedVideoTypes = new ArrayList<String>();
private static final ArrayList<String> sSupportedContentTypes = new ArrayList<>();
private static final ArrayList<String> sSupportedImageTypes = new ArrayList<>();
private static final ArrayList<String> sSupportedAudioTypes = new ArrayList<>();
private static final ArrayList<String> sSupportedVideoTypes = new ArrayList<>();
static {
sSupportedContentTypes.add(TEXT_PLAIN);
@@ -230,7 +230,7 @@ public class EncodedStringValue implements Cloneable {
public static EncodedStringValue[] extract(String src) {
String[] values = src.split(";");
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
ArrayList<EncodedStringValue> list = new ArrayList<>();
for (int i = 0; i < values.length; i++) {
if (values[i].length() > 0) {
list.add(new EncodedStringValue(values[i]));
+5 -5
View File
@@ -34,12 +34,12 @@ public class PduBody {
* Constructor.
*/
public PduBody() {
mParts = new Vector<PduPart>();
mParts = new Vector<>();
mPartMapByContentId = new HashMap<String, PduPart>();
mPartMapByContentLocation = new HashMap<String, PduPart>();
mPartMapByName = new HashMap<String, PduPart>();
mPartMapByFileName = new HashMap<String, PduPart>();
mPartMapByContentId = new HashMap<>();
mPartMapByContentLocation = new HashMap<>();
mPartMapByName = new HashMap<>();
mPartMapByFileName = new HashMap<>();
}
private void putPartToMaps(PduPart part) {
@@ -327,7 +327,7 @@ public class PduHeaders {
* Constructor of PduHeaders.
*/
public PduHeaders() {
mHeaderMap = new HashMap<Integer, Object>();
mHeaderMap = new HashMap<>();
}
/**
@@ -633,7 +633,7 @@ public class PduHeaders {
throw new RuntimeException("Invalid header field!");
}
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
ArrayList<EncodedStringValue> list = new ArrayList<>();
for (int i = 0; i < value.length; i++) {
list.add(value[i]);
}
@@ -665,7 +665,7 @@ public class PduHeaders {
ArrayList<EncodedStringValue> list =
(ArrayList<EncodedStringValue>) mHeaderMap.get(field);
if (null == list) {
list = new ArrayList<EncodedStringValue>();
list = new ArrayList<>();
}
list.add(value);
mHeaderMap.put(field, list);
@@ -779,8 +779,7 @@ public class PduParser {
}
case PduHeaders.CONTENT_TYPE: {
HashMap<Integer, Object> map =
new HashMap<Integer, Object>();
HashMap<Integer, Object> map = new HashMap<>();
byte[] contentType =
parseContentType(pduDataStream, map);
@@ -849,7 +848,7 @@ public class PduParser {
}
/* parse part's content-type */
HashMap<Integer, Object> map = new HashMap<Integer, Object>();
HashMap<Integer, Object> map = new HashMap<>();
byte[] contentType = parseContentType(pduDataStream, map);
if (null != contentType) {
part.setContentType(contentType);
+1 -1
View File
@@ -126,7 +126,7 @@ public class PduPart {
* Empty Constructor.
*/
public PduPart() {
mPartHeader = new HashMap<Integer, Object>();
mPartHeader = new HashMap<>();
}
/**
+1 -1
View File
@@ -92,7 +92,7 @@ class FactoryImpl extends Factory {
factory.mUIIntents = new UIIntentsImpl();
factory.mContactContentObserver = new ContactContentObserver();
factory.mMediaUtil = new MediaUtilImpl();
factory.mSubscriptionPrefs = new SparseArray<BugleSubscriptionPrefs>();
factory.mSubscriptionPrefs = new SparseArray<>();
factory.mCarrierConfigValuesLoader = new BugleCarrierConfigValuesLoader(applicationContext);
if (OsUtil.hasRequiredPermissions()) {
@@ -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.
@@ -87,7 +88,7 @@ public class BitmapPool implements MemoryCache {
Assert.isTrue(!TextUtils.isEmpty(name));
mPoolName = name;
mMaxSize = maxSize;
mPool = new SparseArray<SingleSizePool>();
mPool = new SparseArray<>();
}
@Override
@@ -67,7 +67,7 @@ public class BugleDatabaseOperations {
// Global cache of phone numbers -> participant id mapping since this call is expensive.
private static final ArrayMap<String, String> sNormalizedPhoneNumberToParticipantIdCache =
new ArrayMap<String, String>();
new ArrayMap<>();
/**
* Convert list of recipient strings (email/phone number) into list of ConversationParticipants
@@ -78,8 +78,7 @@ public class BugleDatabaseOperations {
static ArrayList<ParticipantData> getConversationParticipantsFromRecipients(
final List<String> recipients, final int refSubId) {
// Generate a list of partially formed participants
final ArrayList<ParticipantData> participants = new
ArrayList<ParticipantData>();
final ArrayList<ParticipantData> participants = new ArrayList<>();
if (recipients != null) {
for (final String recipient : recipients) {
@@ -98,7 +97,7 @@ public class BugleDatabaseOperations {
Assert.isNotMainThread();
if (participants.size() > 0) {
// First remove redundant phone numbers
final HashSet<String> recipients = new HashSet<String>();
final HashSet<String> recipients = new HashSet<>();
for (int i = participants.size() - 1; i >= 0; i--) {
final String recipient = participants.get(i).getNormalizedDestination();
if (!recipients.contains(recipient)) {
@@ -141,7 +140,7 @@ public class BugleDatabaseOperations {
final List<ParticipantData> participants) {
Assert.isNotMainThread();
// First find the thread id for this list of participants.
final ArrayList<String> recipients = new ArrayList<String>();
final ArrayList<String> recipients = new ArrayList<>();
for (final ParticipantData participant : participants) {
recipients.add(participant.getSendDestination());
@@ -854,7 +853,7 @@ public class BugleDatabaseOperations {
final ArrayList<ParticipantData> participants =
getParticipantsForConversation(dbWrapper, conversationId);
final ArrayList<String> recipients = new ArrayList<String>();
final ArrayList<String> recipients = new ArrayList<>();
for (final ParticipantData participant : participants) {
recipients.add(participant.getSendDestination());
}
@@ -913,8 +912,7 @@ public class BugleDatabaseOperations {
public static ArrayList<ParticipantData> getParticipantsForConversation(
final DatabaseWrapper dbWrapper, final String conversationId) {
Assert.isNotMainThread();
final ArrayList<ParticipantData> participants =
new ArrayList<ParticipantData>();
final ArrayList<ParticipantData> participants = new ArrayList<>();
try (Cursor cursor = dbWrapper.query(DatabaseHelper.PARTICIPANTS_TABLE,
ParticipantData.ParticipantsQuery.PROJECTION,
ParticipantColumns._ID + " IN ( " + "SELECT "
@@ -1684,7 +1682,7 @@ public class BugleDatabaseOperations {
private static HashSet<String> getConversationsForParticipants(
final ArrayList<String> participantIds) {
final DatabaseWrapper db = DataModel.get().getDatabase();
final HashSet<String> conversationIds = new HashSet<String>();
final HashSet<String> conversationIds = new HashSet<>();
final String selection = ConversationParticipantsColumns.PARTICIPANT_ID + "=?";
for (final String participantId : participantIds) {
@@ -1734,7 +1732,7 @@ public class BugleDatabaseOperations {
@DoesNotRunOnMainThread
public static void refreshConversationsForParticipant(final String participantId) {
Assert.isNotMainThread();
final ArrayList<String> participantList = new ArrayList<String>(1);
final ArrayList<String> participantList = new ArrayList<>(1);
participantList.add(participantId);
refreshConversationsForParticipants(participantList);
}
@@ -1764,7 +1762,7 @@ public class BugleDatabaseOperations {
final String rowKey, final String rowId, final ContentValues values) {
Assert.isNotMainThread();
final StringBuilder sb = new StringBuilder();
final ArrayList<String> whereValues = new ArrayList<String>(values.size() + 1);
final ArrayList<String> whereValues = new ArrayList<>(values.size() + 1);
whereValues.add(rowId);
for (final String key : values.keySet()) {
@@ -119,8 +119,7 @@ public class BugleNotifications {
private static final String WEARABLE_COMPANION_APP_PACKAGE = "com.google.android.wearable.app";
private static final Set<NotificationState> sPendingNotifications =
new HashSet<NotificationState>();
private static final Set<NotificationState> sPendingNotifications = new HashSet<>();
private static int sWearableImageWidth;
private static int sWearableImageHeight;
@@ -134,8 +133,7 @@ public class BugleNotifications {
// sLastMessageDingTime is a map between a conversation id and a time. It's used to keep track
// of the time we last dinged a message for this conversation. When messages are coming in
// at flurry, we don't want to over-ding the user.
private static final SimpleArrayMap<String, Long> sLastMessageDingTime =
new SimpleArrayMap<String, Long>();
private static final SimpleArrayMap<String, Long> sLastMessageDingTime = new SimpleArrayMap<>();
private static int sTimeBetweenDingsMs;
/**
@@ -57,7 +57,7 @@ public class DatabaseWrapper {
// track transaction on a per thread basis
private static final ThreadLocal<Stack<TransactionData>> sTransactionDepth =
ThreadLocal.withInitial(() -> new Stack<TransactionData>());
ThreadLocal.withInitial(() -> new Stack<>());
private static final String[] sFormatStrings = new String[] {
"took %d ms to %s",
@@ -69,7 +69,7 @@ public class DatabaseWrapper {
mLog = LogUtil.isLoggable(LogUtil.BUGLE_DATABASE_PERF_TAG, LogUtil.VERBOSE);
mDatabase = db;
mContext = context;
mCompiledStatements = new SparseArray<SQLiteStatement>();
mCompiledStatements = new SparseArray<>();
}
public SQLiteStatement getStatementInTransaction(final int index, final String statement) {
@@ -86,8 +86,7 @@ public class FrequentContactsCursorBuilder {
// First, go through the frequents cursor and take note of all lookup keys and their
// corresponding rank in the frequents list.
final SimpleArrayMap<String, Integer> lookupKeyToRankMap =
new SimpleArrayMap<String, Integer>();
final SimpleArrayMap<String, Integer> lookupKeyToRankMap = new SimpleArrayMap<>();
int oldPosition = mFrequentContactsCursor.getPosition();
int rank = 0;
mFrequentContactsCursor.moveToPosition(-1);
@@ -102,8 +101,7 @@ public class FrequentContactsCursorBuilder {
// (multiple phone numbers etc.) and store that in an array list. Since the all
// contacts list only contains phone contacts, this step will ensure that we filter
// out any invalid/email contacts in the frequents list.
final ArrayList<Object[]> rows =
new ArrayList<Object[]>(mFrequentContactsCursor.getCount());
final ArrayList<Object[]> rows = new ArrayList<>(mFrequentContactsCursor.getCount());
oldPosition = mAllContactsCursor.getPosition();
mAllContactsCursor.moveToPosition(-1);
while (mAllContactsCursor.moveToNext()) {
@@ -44,8 +44,7 @@ import java.util.List;
public class MediaScratchFileProvider extends FileProvider {
private static final String TAG = LogUtil.BUGLE_TAG;
private static final SimpleArrayMap<Uri, String> sUriToDisplayNameMap =
new SimpleArrayMap<Uri, String>();
private static final SimpleArrayMap<Uri, String> sUriToDisplayNameMap = new SimpleArrayMap<>();
@VisibleForTesting
public static final String AUTHORITY =
@@ -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.
@@ -25,7 +26,7 @@ import java.util.HashSet;
* is memory pressure provide a callback to reclaim the memory in the caches.
*/
public class MemoryCacheManager {
private final HashSet<MemoryCache> mMemoryCaches = new HashSet<MemoryCache>();
private final HashSet<MemoryCache> mMemoryCaches = new HashSet<>();
private final Object mMemoryCacheLock = new Object();
public static MemoryCacheManager get() {
@@ -226,7 +226,7 @@ public abstract class MessageNotificationState extends NotificationState {
mIncludeEmailAddress = includeEmailAddress;
mReceivedTimestamp = receivedTimestamp;
mSelfParticipantId = selfParticipantId;
mLineInfos = new ArrayList<NotificationLineInfo>();
mLineInfos = new ArrayList<>();
mTotalMessageCount = 0;
mAvatarUri = avatarUri;
mContactUri = contactUri;
@@ -340,8 +340,7 @@ public abstract class MessageNotificationState extends NotificationState {
*/
public static class MultiConversationNotificationState extends MessageNotificationState {
public final List<MessageNotificationState>
mChildren = new ArrayList<MessageNotificationState>();
public final List<MessageNotificationState> mChildren = new ArrayList<>();
public MultiConversationNotificationState(
final ConversationInfoList convList, final MessageNotificationState state) {
@@ -618,7 +617,7 @@ public abstract class MessageNotificationState extends NotificationState {
final Iterator<ParticipantData> iter = participantsData.iterator();
final HashMap<String, Integer> firstNames = new HashMap<String, Integer>();
final HashMap<String, Integer> firstNames = new HashMap<>();
boolean seenSelf = false;
while (iter.hasNext()) {
final ParticipantData participant = iter.next();
@@ -1040,13 +1039,13 @@ public abstract class MessageNotificationState extends NotificationState {
// For now, only show avatars for notifications for a single conversation.
if (convInfo.mAvatarUri != null) {
if (state.mParticipantAvatarsUris == null) {
state.mParticipantAvatarsUris = new ArrayList<Uri>(1);
state.mParticipantAvatarsUris = new ArrayList<>(1);
}
state.mParticipantAvatarsUris.add(convInfo.mAvatarUri);
}
if (convInfo.mContactUri != null) {
if (state.mParticipantContactUris == null) {
state.mParticipantContactUris = new ArrayList<Uri>(1);
state.mParticipantContactUris = new ArrayList<>(1);
}
state.mParticipantContactUris.add(convInfo.mContactUri);
}
@@ -1160,11 +1159,11 @@ public abstract class MessageNotificationState extends NotificationState {
if (messageDataCursor != null) {
final MessageData messageData = new MessageData();
final HashSet<String> conversationsWithFailedMessages = new HashSet<String>();
final HashSet<String> conversationsWithFailedMessages = new HashSet<>();
// track row ids in case we want to display something that requires this
// information
final ArrayList<Integer> failedMessages = new ArrayList<Integer>();
final ArrayList<Integer> failedMessages = new ArrayList<>();
int cursorPosition = -1;
final long when = 0;
@@ -71,7 +71,7 @@ public abstract class NotificationState {
NotificationState(final ConversationIdSet conversationIds) {
mConversationIds = conversationIds;
mPeople = new HashSet<String>();
mPeople = new HashSet<>();
}
/**
@@ -234,7 +234,7 @@ public class ParticipantRefresh {
refreshSelfParticipantList();
}
final ArrayList<String> changedParticipants = new ArrayList<String>();
final ArrayList<String> changedParticipants = new ArrayList<>();
String selection = null;
String[] selectionArgs = null;
@@ -306,7 +306,7 @@ public class ParticipantRefresh {
private static Set<Integer> getExistingSubIds() {
final DatabaseWrapper db = DataModel.get().getDatabase();
final HashSet<Integer> existingSubIds = new HashSet<Integer>();
final HashSet<Integer> existingSubIds = new HashSet<>();
try (Cursor cursor = db.query(DatabaseHelper.PARTICIPANTS_TABLE,
ParticipantsQuery.PROJECTION,
@@ -346,7 +346,7 @@ public class ParticipantRefresh {
final List<SubscriptionInfo> subInfoRecords =
PhoneUtils.getDefault().getActiveSubscriptionInfoList();
final ArrayMap<Integer, SubscriptionInfo> activeSubscriptionIdToRecordMap =
new ArrayMap<Integer, SubscriptionInfo>();
new ArrayMap<>();
db.beginTransaction();
final Set<Integer> existingSubIds = getExistingSubIds();
@@ -603,7 +603,7 @@ public class ParticipantRefresh {
*/
private static List<String> getInactiveSelfParticipantIds() {
final DatabaseWrapper db = DataModel.get().getDatabase();
final List<String> inactiveSelf = new ArrayList<String>();
final List<String> inactiveSelf = new ArrayList<>();
final String selection = ParticipantColumns.SIM_SLOT_ID + "=? AND " +
SELF_PARTICIPANTS_CLAUSE;
@@ -628,7 +628,7 @@ public class ParticipantRefresh {
*/
private static List<String> getConversationsWithSelfParticipantIds(final List<String> selfIds) {
final DatabaseWrapper db = DataModel.get().getDatabase();
final List<String> conversationIds = new ArrayList<String>();
final List<String> conversationIds = new ArrayList<>();
Cursor cursor = null;
try {
@@ -365,12 +365,10 @@ public class SyncManager {
public static class ThreadInfoCache {
// Cache of thread->conversationId map
private final LongSparseArray<String> mThreadToConversationId =
new LongSparseArray<String>();
private final LongSparseArray<String> mThreadToConversationId = new LongSparseArray<>();
// Cache of thread->recipients map
private final LongSparseArray<List<String>> mThreadToRecipients =
new LongSparseArray<List<String>>();
private final LongSparseArray<List<String>> mThreadToRecipients = new LongSparseArray<>();
// Remember the conversation ids that need to be archived
private final HashSet<String> mArchivedConversations = new HashSet<>();
@@ -47,7 +47,7 @@ public abstract class Action implements Parcelable {
protected final Bundle actionParameters;
// This does not get written to the parcel
private final List<Action> mBackgroundActions = new LinkedList<Action>();
private final List<Action> mBackgroundActions = new LinkedList<>();
/**
* Process the action locally - runs on action service thread.
@@ -413,8 +413,7 @@ public class ActionMonitor {
* Map of action monitors indexed by actionKey
*/
@VisibleForTesting
static final SimpleArrayMap<String, ActionMonitor> sActionMonitors =
new SimpleArrayMap<String, ActionMonitor>();
static final SimpleArrayMap<String, ActionMonitor> sActionMonitors = new SimpleArrayMap<>();
/**
* Insert new monitor into map
@@ -188,7 +188,7 @@ public class DeleteConversationAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<DeleteConversationAction> CREATOR
= new Parcelable.Creator<DeleteConversationAction>() {
= new Parcelable.Creator<>() {
@Override
public DeleteConversationAction createFromParcel(final Parcel in) {
return new DeleteConversationAction(in);
@@ -119,7 +119,7 @@ public class DeleteMessageAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<DeleteMessageAction> CREATOR
= new Parcelable.Creator<DeleteMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public DeleteMessageAction createFromParcel(final Parcel in) {
return new DeleteMessageAction(in);
@@ -327,8 +327,7 @@ public class DownloadMmsAction extends Action implements Parcelable {
super(in);
}
public static final Parcelable.Creator<DownloadMmsAction> CREATOR
= new Parcelable.Creator<DownloadMmsAction>() {
public static final Parcelable.Creator<DownloadMmsAction> CREATOR = new Parcelable.Creator<>() {
@Override
public DownloadMmsAction createFromParcel(final Parcel in) {
return new DownloadMmsAction(in);
@@ -97,7 +97,7 @@ public class FixupMessageStatusOnStartupAction extends Action implements Parcela
}
public static final Parcelable.Creator<FixupMessageStatusOnStartupAction> CREATOR
= new Parcelable.Creator<FixupMessageStatusOnStartupAction>() {
= new Parcelable.Creator<>() {
@Override
public FixupMessageStatusOnStartupAction createFromParcel(final Parcel in) {
return new FixupMessageStatusOnStartupAction(in);
@@ -157,7 +157,7 @@ public class GetOrCreateConversationAction extends Action implements Parcelable
}
public static final Parcelable.Creator<GetOrCreateConversationAction> CREATOR
= new Parcelable.Creator<GetOrCreateConversationAction>() {
= new Parcelable.Creator<>() {
@Override
public GetOrCreateConversationAction createFromParcel(final Parcel in) {
return new GetOrCreateConversationAction(in);
@@ -463,7 +463,7 @@ public class InsertNewMessageAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<InsertNewMessageAction> CREATOR
= new Parcelable.Creator<InsertNewMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public InsertNewMessageAction createFromParcel(final Parcel in) {
return new InsertNewMessageAction(in);
@@ -96,8 +96,7 @@ public class MarkAsReadAction extends Action implements Parcelable {
super(in);
}
public static final Parcelable.Creator<MarkAsReadAction> CREATOR
= new Parcelable.Creator<MarkAsReadAction>() {
public static final Parcelable.Creator<MarkAsReadAction> CREATOR = new Parcelable.Creator<>() {
@Override
public MarkAsReadAction createFromParcel(final Parcel in) {
return new MarkAsReadAction(in);
@@ -109,8 +109,7 @@ public class MarkAsSeenAction extends Action implements Parcelable {
super(in);
}
public static final Parcelable.Creator<MarkAsSeenAction> CREATOR
= new Parcelable.Creator<MarkAsSeenAction>() {
public static final Parcelable.Creator<MarkAsSeenAction> CREATOR = new Parcelable.Creator<>() {
@Override
public MarkAsSeenAction createFromParcel(final Parcel in) {
return new MarkAsSeenAction(in);
@@ -106,7 +106,7 @@ public class ProcessDeliveryReportAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<ProcessDeliveryReportAction> CREATOR
= new Parcelable.Creator<ProcessDeliveryReportAction>() {
= new Parcelable.Creator<>() {
@Override
public ProcessDeliveryReportAction createFromParcel(final Parcel in) {
return new ProcessDeliveryReportAction(in);
@@ -565,7 +565,7 @@ public class ProcessDownloadedMmsAction extends Action {
}
public static final Parcelable.Creator<ProcessDownloadedMmsAction> CREATOR
= new Parcelable.Creator<ProcessDownloadedMmsAction>() {
= new Parcelable.Creator<>() {
@Override
public ProcessDownloadedMmsAction createFromParcel(final Parcel in) {
return new ProcessDownloadedMmsAction(in);
@@ -457,7 +457,7 @@ public class ProcessPendingMessagesAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<ProcessPendingMessagesAction> CREATOR
= new Parcelable.Creator<ProcessPendingMessagesAction>() {
= new Parcelable.Creator<>() {
@Override
public ProcessPendingMessagesAction createFromParcel(final Parcel in) {
return new ProcessPendingMessagesAction(in);
@@ -296,7 +296,7 @@ public class ProcessSentMessageAction extends Action {
}
public static final Parcelable.Creator<ProcessSentMessageAction> CREATOR
= new Parcelable.Creator<ProcessSentMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public ProcessSentMessageAction createFromParcel(final Parcel in) {
return new ProcessSentMessageAction(in);
@@ -150,7 +150,7 @@ public class ReadDraftDataAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<ReadDraftDataAction> CREATOR
= new Parcelable.Creator<ReadDraftDataAction>() {
= new Parcelable.Creator<>() {
@Override
public ReadDraftDataAction createFromParcel(final Parcel in) {
return new ReadDraftDataAction(in);
@@ -181,7 +181,7 @@ public class ReceiveMmsMessageAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<ReceiveMmsMessageAction> CREATOR
= new Parcelable.Creator<ReceiveMmsMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public ReceiveMmsMessageAction createFromParcel(final Parcel in) {
return new ReceiveMmsMessageAction(in);
@@ -184,7 +184,7 @@ public class ReceiveSmsMessageAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<ReceiveSmsMessageAction> CREATOR
= new Parcelable.Creator<ReceiveSmsMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public ReceiveSmsMessageAction createFromParcel(final Parcel in) {
return new ReceiveSmsMessageAction(in);
@@ -115,7 +115,7 @@ public class RedownloadMmsAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<RedownloadMmsAction> CREATOR
= new Parcelable.Creator<RedownloadMmsAction>() {
= new Parcelable.Creator<>() {
@Override
public RedownloadMmsAction createFromParcel(final Parcel in) {
return new RedownloadMmsAction(in);
@@ -115,7 +115,7 @@ public class ResendMessageAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<ResendMessageAction> CREATOR
= new Parcelable.Creator<ResendMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public ResendMessageAction createFromParcel(final Parcel in) {
return new ResendMessageAction(in);
@@ -435,8 +435,7 @@ public class SendMessageAction extends Action implements Parcelable {
super(in);
}
public static final Parcelable.Creator<SendMessageAction> CREATOR
= new Parcelable.Creator<SendMessageAction>() {
public static final Parcelable.Creator<SendMessageAction> CREATOR = new Parcelable.Creator<>() {
@Override
public SendMessageAction createFromParcel(final Parcel in) {
return new SendMessageAction(in);
@@ -73,7 +73,7 @@ class SyncMessageBatch {
mMmsToAdd = mmsToAdd;
mMessagesToDelete = messagesToDelete;
mCache = cache;
mConversationsToUpdate = new HashSet<String>();
mConversationsToUpdate = new HashSet<>();
}
void updateLocalDatabase() {
@@ -221,12 +221,11 @@ public class SyncMessagesAction extends Action implements Parcelable {
cache.clear();
// Sms messages to store
final ArrayList<SmsMessage> smsToAdd = new ArrayList<SmsMessage>();
final ArrayList<SmsMessage> smsToAdd = new ArrayList<>();
// Mms messages to store
final LongSparseArray<MmsMessage> mmsToAdd = new LongSparseArray<MmsMessage>();
final LongSparseArray<MmsMessage> mmsToAdd = new LongSparseArray<>();
// List of local SMS/MMS to remove
final ArrayList<LocalDatabaseMessage> messagesToDelete =
new ArrayList<LocalDatabaseMessage>();
final ArrayList<LocalDatabaseMessage> messagesToDelete = new ArrayList<>();
long lastTimestampMillis = SYNC_FAILED;
if (syncManager.isSyncing(upperBoundTimeMillis)) {
@@ -242,7 +241,7 @@ public class SyncMessagesAction extends Action implements Parcelable {
// If comparison succeeds bundle up the changes for processing in ActionService
if (lastTimestampMillis > SYNC_FAILED) {
final ArrayList<MmsMessage> mmsToAddList = new ArrayList<MmsMessage>();
final ArrayList<MmsMessage> mmsToAddList = new ArrayList<>();
for (int i = 0; i < mmsToAdd.size(); i++) {
final MmsMessage mms = mmsToAdd.valueAt(i);
mmsToAddList.add(mms);
@@ -610,7 +609,7 @@ public class SyncMessagesAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<SyncMessagesAction> CREATOR
= new Parcelable.Creator<SyncMessagesAction>() {
= new Parcelable.Creator<>() {
@Override
public SyncMessagesAction createFromParcel(final Parcel in) {
return new SyncMessagesAction(in);
@@ -77,7 +77,7 @@ public class UpdateConversationArchiveStatusAction extends Action {
}
public static final Parcelable.Creator<UpdateConversationArchiveStatusAction> CREATOR
= new Parcelable.Creator<UpdateConversationArchiveStatusAction>() {
= new Parcelable.Creator<>() {
@Override
public UpdateConversationArchiveStatusAction createFromParcel(final Parcel in) {
return new UpdateConversationArchiveStatusAction(in);
@@ -132,7 +132,7 @@ public class UpdateDestinationBlockedAction extends Action {
}
public static final Parcelable.Creator<UpdateDestinationBlockedAction> CREATOR
= new Parcelable.Creator<UpdateDestinationBlockedAction>() {
= new Parcelable.Creator<>() {
@Override
public UpdateDestinationBlockedAction createFromParcel(final Parcel in) {
return new UpdateDestinationBlockedAction(in);
@@ -47,7 +47,7 @@ public class UpdateMessageNotificationAction extends Action {
}
public static final Parcelable.Creator<UpdateMessageNotificationAction> CREATOR
= new Parcelable.Creator<UpdateMessageNotificationAction>() {
= new Parcelable.Creator<>() {
@Override
public UpdateMessageNotificationAction createFromParcel(final Parcel in) {
return new UpdateMessageNotificationAction(in);
@@ -87,7 +87,7 @@ public class UpdateMessagePartSizeAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<UpdateMessagePartSizeAction> CREATOR
= new Parcelable.Creator<UpdateMessagePartSizeAction>() {
= new Parcelable.Creator<>() {
@Override
public UpdateMessagePartSizeAction createFromParcel(final Parcel in) {
return new UpdateMessagePartSizeAction(in);
@@ -88,7 +88,7 @@ public class WriteDraftMessageAction extends Action implements Parcelable {
}
public static final Parcelable.Creator<WriteDraftMessageAction> CREATOR
= new Parcelable.Creator<WriteDraftMessageAction>() {
= new Parcelable.Creator<>() {
@Override
public WriteDraftMessageAction createFromParcel(final Parcel in) {
return new WriteDraftMessageAction(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.
@@ -33,7 +34,7 @@ public abstract class BindingBase<T extends BindableData> {
* Creates a new exclusively owned binding for the owner object.
*/
public static <T extends BindableData> Binding<T> createBinding(final Object owner) {
return new Binding<T>(owner);
return new Binding<>(owner);
}
/**
@@ -43,7 +44,7 @@ public abstract class BindingBase<T extends BindableData> {
*/
public static <T extends BindableData> ImmutableBindingRef<T> createBindingReference(
final BindingBase<T> srcBinding) {
return new ImmutableBindingRef<T>(srcBinding);
return new ImmutableBindingRef<>(srcBinding);
}
/**
@@ -52,7 +53,7 @@ public abstract class BindingBase<T extends BindableData> {
*/
public static <T extends BindableData> DetachableBinding<T> createDetachableBinding(
final Object owner) {
return new DetachableBinding<T>(owner);
return new DetachableBinding<>(owner);
}
public abstract T getData();
@@ -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;
}
@@ -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.
@@ -31,7 +32,7 @@ class AsyncMediaRequestWrapper<T extends RefCountedMediaResource> extends Bindab
public static <T extends RefCountedMediaResource> AsyncMediaRequestWrapper<T>
createWith(final MediaRequest<T> wrappedRequest,
final MediaResourceLoadListener<T> listener) {
return new AsyncMediaRequestWrapper<T>(listener, wrappedRequest);
return new AsyncMediaRequestWrapper<>(listener, wrappedRequest);
}
private final MediaRequest<T> mWrappedRequest;
@@ -71,4 +72,4 @@ class AsyncMediaRequestWrapper<T extends RefCountedMediaResource> extends Bindab
public MediaRequestDescriptor<T> getDescriptor() {
return mWrappedRequest.getDescriptor();
}
}
}
@@ -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.
@@ -44,7 +45,7 @@ public class AvatarGroupRequestDescriptor extends CompositeImageRequestDescripto
final int desiredWidth, final int desiredHeight) {
final List<String> participantUriStrings = AvatarUriUtil.getGroupParticipantUris(uri);
final List<AvatarRequestDescriptor> avatarDescriptors =
new ArrayList<AvatarRequestDescriptor>(participantUriStrings.size());
new ArrayList<>(participantUriStrings.size());
for (final String uriString : participantUriStrings) {
final AvatarRequestDescriptor descriptor = new AvatarRequestDescriptor(
Uri.parse(uriString), desiredWidth, desiredHeight);
@@ -55,7 +56,7 @@ public class AvatarGroupRequestDescriptor extends CompositeImageRequestDescripto
@Override
public CompositeImageRequest<?> buildBatchImageRequest(final Context context) {
return new CompositeImageRequest<AvatarGroupRequestDescriptor>(context, this);
return new CompositeImageRequest<>(context, this);
}
@Override
@@ -59,13 +59,13 @@ public class CustomVCardEntryConstructor implements VCardInterpreter {
/**
* Represents current stack of VCardEntry. Used to support nested vCard (vCard 2.1).
*/
private final List<CustomVCardEntry> mEntryStack = new ArrayList<CustomVCardEntry>();
private final List<CustomVCardEntry> mEntryStack = new ArrayList<>();
private CustomVCardEntry mCurrentEntry;
private final int mVCardType;
private final Account mAccount;
private final List<EntryHandler> mEntryHandlers = new ArrayList<EntryHandler>();
private final List<EntryHandler> mEntryHandlers = new ArrayList<>();
public CustomVCardEntryConstructor() {
this(VCardConfig.VCARD_TYPE_V21_GENERIC, null);
@@ -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.
@@ -33,7 +34,7 @@ public abstract class MediaCacheManager implements MemoryCache {
protected final SparseArray<MediaCache<?>> mCaches;
public MediaCacheManager() {
mCaches = new SparseArray<MediaCache<?>>();
mCaches = new SparseArray<>();
MemoryCacheManager.get().registerMemoryCache(this);
}
@@ -66,4 +67,4 @@ public abstract class MediaCacheManager implements MemoryCache {
}
protected abstract MediaCache<?> createMediaCacheById(final int id);
}
}
@@ -233,8 +233,7 @@ public class MediaResourceManager {
}
// We don't use SafeAsyncTask here since it enforces the shared thread pool executor
// whereas we want a dedicated thread pool executor.
AsyncTask<Void, Void, MediaLoadingResult<T>> mediaLoadingTask =
new AsyncTask<Void, Void, MediaLoadingResult<T>>() {
AsyncTask<Void, Void, MediaLoadingResult<T>> mediaLoadingTask = new AsyncTask<>() {
private Exception mException;
@Override
@@ -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.
@@ -118,7 +119,7 @@ public class PoolableImageCache extends MediaCache<ImageResource> {
private final SparseArray<LinkedList<ImageResource>> mImageListSparseArray;
public ReusableImageResourcePool() {
mImageListSparseArray = new SparseArray<LinkedList<ImageResource>>();
mImageListSparseArray = new SparseArray<>();
}
/**
@@ -232,7 +233,7 @@ public class PoolableImageCache extends MediaCache<ImageResource> {
Assert.isTrue(poolKey != INVALID_POOL_KEY);
LinkedList<ImageResource> imageList = mImageListSparseArray.get(poolKey);
if (imageList == null) {
imageList = new LinkedList<ImageResource>();
imageList = new LinkedList<>();
mImageListSparseArray.put(poolKey, imageList);
}
imageList.addLast(imageResource);
@@ -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.
@@ -48,7 +49,7 @@ public abstract class RefCountedMediaResource {
// to find out where each ref change happens.
private static final boolean DEBUG = false;
private static final String TAG = "bugle_media_ref_history";
private final ArrayList<String> mRefHistory = new ArrayList<String>();
private final ArrayList<String> mRefHistory = new ArrayList<>();
// A lock that guards access to shared members in this class (and all its subclasses).
private final ReentrantLock mLock = new ReentrantLock();
@@ -161,4 +162,4 @@ public abstract class RefCountedMediaResource {
public abstract int getMediaSize();
protected abstract void close();
}
}
@@ -83,9 +83,9 @@ public class UriImageRequestDescriptor extends ImageRequestDescriptor {
@Override
public MediaRequest<ImageResource> buildSyncMediaRequest(final Context context) {
if (uri == null || UriUtil.isLocalUri(uri)) {
return new UriImageRequest<UriImageRequestDescriptor>(context, this);
return new UriImageRequest<>(context, this);
} else {
return new NetworkUriImageRequest<UriImageRequestDescriptor>(context, this);
return new NetworkUriImageRequest<>(context, this);
}
}
}
@@ -71,7 +71,7 @@ public class VCardRequest implements MediaRequest<VCardResource> {
VCardRequest(final Context context, final VCardRequestDescriptor descriptor) {
mDescriptor = descriptor;
mContext = context;
mLoadedVCards = new ArrayList<VCardResourceEntry>();
mLoadedVCards = new ArrayList<>();
}
@Override
@@ -163,7 +163,7 @@ public class VCardResourceEntry {
final VCardEntry vcard) {
final Resources resources = Factory.get().getApplicationContext().getResources();
final List<VCardResourceEntry.VCardResourceEntryDestinationItem> retList =
new ArrayList<VCardResourceEntry.VCardResourceEntryDestinationItem>();
new ArrayList<>();
if (vcard.getPhoneList() != null) {
for (final PhoneData phone : vcard.getPhoneList()) {
final Intent intent = new Intent(Intent.ACTION_DIAL);
@@ -264,7 +264,7 @@ public class VCardResourceEntry {
if (vcard.getNotes() != null) {
for (final NoteData note : vcard.getNotes()) {
final ArrayMap<String, String> curChildMap = new ArrayMap<String, String>();
final ArrayMap<String, String> curChildMap = new ArrayMap<>();
if (TextUtils.isGraphic(note.getNote())){
retList.add(new VCardResourceEntryDestinationItem(note.getNote(),
resources.getString(R.string.vcard_detail_notes_label), null));
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 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.
@@ -402,8 +403,8 @@ public class CharacterSets {
static {
// Create the HashMaps.
MIBENUM_TO_NAME_MAP = new SparseArray<String>();
NAME_TO_MIBENUM_MAP = new SimpleArrayMap<String, Integer>();
MIBENUM_TO_NAME_MAP = new SparseArray<>();
NAME_TO_MIBENUM_MAP = new SimpleArrayMap<>();
assert (MIBENUM_NUMBERS.length == MIME_NAMES.length);
final int count = MIBENUM_NUMBERS.length - 1;
for (int i = 0; i <= count; i++) {
@@ -245,7 +245,7 @@ public class EncodedStringValue implements Cloneable {
public static EncodedStringValue[] extract(String src) {
String[] values = src.split(";");
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
ArrayList<EncodedStringValue> list = new ArrayList<>();
for (int i = 0; i < values.length; i++) {
if (values[i].length() > 0) {
list.add(new EncodedStringValue(values[i]));
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 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.
@@ -26,7 +27,7 @@ public class PduBody {
* Constructor.
*/
public PduBody() {
mParts = new Vector<PduPart>();
mParts = new Vector<>();
}
/**
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 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.
@@ -120,7 +121,7 @@ public class PduComposer {
private static SimpleArrayMap<String, Integer> mContentTypeMap = null;
static {
mContentTypeMap = new SimpleArrayMap<String, Integer>();
mContentTypeMap = new SimpleArrayMap<>();
int i;
for (i = 0; i < PduContentTypes.contentTypes.length; i++) {
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007 Esmertec AG.
* Copyright (C) 2007 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.
@@ -346,7 +347,7 @@ public class PduHeaders {
* Constructor of PduHeaders.
*/
public PduHeaders() {
mHeaderMap = new SparseArray<Object>();
mHeaderMap = new SparseArray<>();
}
/**
@@ -652,7 +653,7 @@ public class PduHeaders {
throw new RuntimeException("Invalid header field!");
}
ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
ArrayList<EncodedStringValue> list = new ArrayList<>();
for (int i = 0; i < value.length; i++) {
list.add(value[i]);
}
@@ -684,7 +685,7 @@ public class PduHeaders {
ArrayList<EncodedStringValue> list =
(ArrayList<EncodedStringValue>) mHeaderMap.get(field);
if (null == list) {
list = new ArrayList<EncodedStringValue>();
list = new ArrayList<>();
}
list.add(value);
mHeaderMap.put(field, list);
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 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.
@@ -811,7 +812,7 @@ public class PduParser {
}
case PduHeaders.CONTENT_TYPE: {
SparseArray<Object> map = new SparseArray<Object>();
SparseArray<Object> map = new SparseArray<>();
byte[] contentType =
parseContentType(pduDataStream, map);
@@ -882,7 +883,7 @@ public class PduParser {
}
/* parse part's content-type */
SparseArray<Object> map = new SparseArray<Object>();
SparseArray<Object> map = new SparseArray<>();
byte[] contentType = parseContentType(pduDataStream, map);
if (null != contentType) {
part.setContentType(contentType);
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007-2008 Esmertec AG.
* Copyright (C) 2007-2008 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.
@@ -123,7 +124,7 @@ public class PduPart {
* Empty Constructor.
*/
public PduPart() {
mPartHeader = new SparseArray<Object>();
mPartHeader = new SparseArray<>();
}
/**
@@ -213,7 +213,7 @@ public class PduPersister {
private static final SparseArray<String> LONG_COLUMN_NAME_MAP;
static {
MESSAGE_BOX_MAP = new SimpleArrayMap<Uri, Integer>();
MESSAGE_BOX_MAP = new SimpleArrayMap<>();
MESSAGE_BOX_MAP.put(Mms.Inbox.CONTENT_URI, Mms.MESSAGE_BOX_INBOX);
MESSAGE_BOX_MAP.put(Mms.Sent.CONTENT_URI, Mms.MESSAGE_BOX_SENT);
MESSAGE_BOX_MAP.put(Mms.Draft.CONTENT_URI, Mms.MESSAGE_BOX_DRAFTS);
@@ -223,7 +223,7 @@ public class PduPersister {
CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT_CHARSET);
CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT_CHARSET);
CHARSET_COLUMN_NAME_MAP = new SparseArray<String>();
CHARSET_COLUMN_NAME_MAP = new SparseArray<>();
CHARSET_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT_CHARSET);
CHARSET_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT_CHARSET);
@@ -232,7 +232,7 @@ public class PduPersister {
ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT);
ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT);
ENCODED_STRING_COLUMN_NAME_MAP = new SparseArray<String>();
ENCODED_STRING_COLUMN_NAME_MAP = new SparseArray<>();
ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT);
ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT);
@@ -245,7 +245,7 @@ public class PduPersister {
TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RESPONSE_TEXT, PDU_COLUMN_RESPONSE_TEXT);
TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.TRANSACTION_ID, PDU_COLUMN_TRANSACTION_ID);
TEXT_STRING_COLUMN_NAME_MAP = new SparseArray<String>();
TEXT_STRING_COLUMN_NAME_MAP = new SparseArray<>();
TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_LOCATION, Mms.CONTENT_LOCATION);
TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_TYPE, Mms.CONTENT_TYPE);
TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_CLASS, Mms.MESSAGE_CLASS);
@@ -266,7 +266,7 @@ public class PduPersister {
OCTET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_STATUS, PDU_COLUMN_RETRIEVE_STATUS);
OCTET_COLUMN_INDEX_MAP.put(PduHeaders.STATUS, PDU_COLUMN_STATUS);
OCTET_COLUMN_NAME_MAP = new SparseArray<String>();
OCTET_COLUMN_NAME_MAP = new SparseArray<>();
OCTET_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_CLASS, Mms.CONTENT_CLASS);
OCTET_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_REPORT, Mms.DELIVERY_REPORT);
OCTET_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_TYPE, Mms.MESSAGE_TYPE);
@@ -285,7 +285,7 @@ public class PduPersister {
LONG_COLUMN_INDEX_MAP.put(PduHeaders.EXPIRY, PDU_COLUMN_EXPIRY);
LONG_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_SIZE, PDU_COLUMN_MESSAGE_SIZE);
LONG_COLUMN_NAME_MAP = new SparseArray<String>();
LONG_COLUMN_NAME_MAP = new SparseArray<>();
LONG_COLUMN_NAME_MAP.put(PduHeaders.DATE, Mms.DATE);
LONG_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_TIME, Mms.DELIVERY_TIME);
LONG_COLUMN_NAME_MAP.put(PduHeaders.EXPIRY, Mms.EXPIRY);
@@ -1135,7 +1135,7 @@ public class PduPersister {
}
final PduHeaders headers = sendReq.getPduHeaders();
final HashSet<String> recipients = new HashSet<String>();
final HashSet<String> recipients = new HashSet<>();
for (final int addrType : ADDRESS_FIELDS) {
EncodedStringValue[] array = null;
if (addrType == PduHeaders.FROM) {
@@ -1233,8 +1233,8 @@ public class PduPersister {
PDU_CACHE_INSTANCE.setUpdating(uri, true);
}
final ArrayList<PduPart> toBeCreated = new ArrayList<PduPart>();
final ArrayMap<Uri, PduPart> toBeUpdated = new ArrayMap<Uri, PduPart>();
final ArrayList<PduPart> toBeCreated = new ArrayList<>();
final ArrayMap<Uri, PduPart> toBeUpdated = new ArrayMap<>();
final int partsNum = body.getPartsNum();
final StringBuilder filter = new StringBuilder().append('(');
@@ -1376,7 +1376,7 @@ public class PduPersister {
}
final SparseArray<EncodedStringValue[]> addressMap =
new SparseArray<EncodedStringValue[]>(ADDRESS_FIELDS.length);
new SparseArray<>(ADDRESS_FIELDS.length);
// Save address information.
for (final int addrType : ADDRESS_FIELDS) {
EncodedStringValue[] array = null;
@@ -1392,7 +1392,7 @@ public class PduPersister {
addressMap.put(addrType, array);
}
final HashSet<String> recipients = new HashSet<String>();
final HashSet<String> recipients = new HashSet<>();
final int msgType = pdu.getMessageType();
// Here we only allocate thread ID for M-Notification.ind,
// M-Retrieve.conf and M-Send.req.
@@ -1553,7 +1553,7 @@ public class PduPersister {
final SparseArray<EncodedStringValue[]> addressMap, final String selfNumber) {
final EncodedStringValue[] arrayTo = addressMap.get(PduHeaders.TO);
final EncodedStringValue[] arrayCc = addressMap.get(PduHeaders.CC);
final ArrayList<String> numbers = new ArrayList<String>();
final ArrayList<String> numbers = new ArrayList<>();
if (arrayTo != null) {
for (final EncodedStringValue v : arrayTo) {
if (v != null) {
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2008 Esmertec AG.
* Copyright (C) 2008 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.
@@ -29,7 +30,7 @@ public abstract class AbstractCache<K, V> {
private final SimpleArrayMap<K, CacheEntry<V>> mCacheMap;
protected AbstractCache() {
mCacheMap = new SimpleArrayMap<K, CacheEntry<V>>();
mCacheMap = new SimpleArrayMap<>();
}
public boolean put(K key, V value) {
@@ -47,7 +48,7 @@ public abstract class AbstractCache<K, V> {
}
if (key != null) {
CacheEntry<V> cacheEntry = new CacheEntry<V>();
CacheEntry<V> cacheEntry = new CacheEntry<>();
cacheEntry.value = value;
mCacheMap.put(key, cacheEntry);
@@ -65,7 +65,7 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
URI_MATCHER.addURI("mms-sms", "conversations", MMS_CONVERSATION);
URI_MATCHER.addURI("mms-sms", "conversations/#", MMS_CONVERSATION_ID);
MATCH_TO_MSGBOX_ID_MAP = new SparseArray<Integer>();
MATCH_TO_MSGBOX_ID_MAP = new SparseArray<>();
MATCH_TO_MSGBOX_ID_MAP.put(MMS_INBOX, Mms.MESSAGE_BOX_INBOX);
MATCH_TO_MSGBOX_ID_MAP.put(MMS_SENT, Mms.MESSAGE_BOX_SENT);
MATCH_TO_MSGBOX_ID_MAP.put(MMS_DRAFTS, Mms.MESSAGE_BOX_DRAFTS);
@@ -77,9 +77,9 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
private final HashSet<Uri> mUpdating;
private PduCache() {
mMessageBoxes = new SparseArray<HashSet<Uri>>();
mThreads = new SimpleArrayMap<Long, HashSet<Uri>>();
mUpdating = new HashSet<Uri>();
mMessageBoxes = new SparseArray<>();
mThreads = new SimpleArrayMap<>();
mUpdating = new HashSet<>();
}
public static synchronized PduCache getInstance() {
@@ -97,14 +97,14 @@ public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
int msgBoxId = entry.getMessageBox();
HashSet<Uri> msgBox = mMessageBoxes.get(msgBoxId);
if (msgBox == null) {
msgBox = new HashSet<Uri>();
msgBox = new HashSet<>();
mMessageBoxes.put(msgBoxId, msgBox);
}
long threadId = entry.getThreadId();
HashSet<Uri> thread = mThreads.get(threadId);
if (thread == null) {
thread = new HashSet<Uri>();
thread = new HashSet<>();
mThreads.put(threadId, thread);
}
@@ -218,8 +218,7 @@ public class DatabaseMessages {
mBody = in.readString();
}
public static final Parcelable.Creator<SmsMessage> CREATOR
= new Parcelable.Creator<SmsMessage>() {
public static final Parcelable.Creator<SmsMessage> CREATOR = new Parcelable.Creator<>() {
@Override
public SmsMessage createFromParcel(final Parcel in) {
return new SmsMessage(in);
@@ -488,15 +487,14 @@ public class DatabaseMessages {
mRetrieveStatus = in.readInt();
final int nParts = in.readInt();
mParts = new ArrayList<MmsPart>();
mParts = new ArrayList<>();
mPartsProcessed = false;
for (int i = 0; i < nParts; i++) {
mParts.add((MmsPart) in.readParcelable(getClass().getClassLoader()));
}
}
public static final Parcelable.Creator<MmsMessage> CREATOR
= new Parcelable.Creator<MmsMessage>() {
public static final Parcelable.Creator<MmsMessage> CREATOR = new Parcelable.Creator<>() {
@Override
public MmsMessage createFromParcel(final Parcel in) {
return new MmsMessage(in);
@@ -822,8 +820,7 @@ public class DatabaseMessages {
mSize = in.readLong();
}
public static final Parcelable.Creator<MmsPart> CREATOR
= new Parcelable.Creator<MmsPart>() {
public static final Parcelable.Creator<MmsPart> CREATOR = new Parcelable.Creator<>() {
@Override
public MmsPart createFromParcel(final Parcel in) {
return new MmsPart(in);
@@ -905,7 +902,7 @@ public class DatabaseMessages {
}
public static final Parcelable.Creator<LocalDatabaseMessage> CREATOR
= new Parcelable.Creator<LocalDatabaseMessage>() {
= new Parcelable.Creator<>() {
@Override
public LocalDatabaseMessage createFromParcel(final Parcel in) {
return new LocalDatabaseMessage(in);
@@ -163,7 +163,7 @@ public class MmsSmsUtils {
* messages.
*/
public static long getOrCreateThreadId(final Context context, final String recipient) {
final Set<String> recipients = new HashSet<String>();
final Set<String> recipients = new HashSet<>();
recipients.add(recipient);
return getOrCreateThreadId(context, recipients);
+3 -3
View File
@@ -763,7 +763,7 @@ public class MmsUtils {
Uri.parse("content://mms-sms/canonical-address");
private static List<String> getAddresses(final Context context, final String spaceSepIds) {
final List<String> numbers = new ArrayList<String>();
final List<String> numbers = new ArrayList<>();
final String[] ids = spaceSepIds.split(" ");
for (final String id : ids) {
long longId;
@@ -813,7 +813,7 @@ public class MmsUtils {
// Get telephony SMS thread ID
public static long getOrCreateSmsThreadId(final Context context, final String dest) {
// use destinations to determine threadId
final Set<String> recipients = new HashSet<String>();
final Set<String> recipients = new HashSet<>();
recipients.add(dest);
try {
return MmsSmsUtils.Threads.getOrCreateThreadId(context, recipients);
@@ -829,7 +829,7 @@ public class MmsUtils {
return -1;
}
// use destinations to determine threadId
final Set<String> recipients = new HashSet<String>(dests);
final Set<String> recipients = new HashSet<>(dests);
try {
return MmsSmsUtils.Threads.getOrCreateThreadId(context, recipients);
} catch (final IllegalArgumentException e) {
+3 -3
View File
@@ -62,7 +62,7 @@ public class SmsSender {
* A map for pending sms messages. The key is the random request UUID.
*/
private static final ConcurrentHashMap<Uri, SendResult> sPendingMessageMap =
new ConcurrentHashMap<Uri, SendResult>();
new ConcurrentHashMap<>();
private static final Random RANDOM = new Random();
@@ -256,8 +256,8 @@ public class SmsSender {
Assert.notNull(context);
final SmsManager smsManager = PhoneUtils.get(subId).getSmsManager();
final int messageCount = messages.size();
final ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>(messageCount);
final ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>(messageCount);
final ArrayList<PendingIntent> deliveryIntents = new ArrayList<>(messageCount);
final ArrayList<PendingIntent> sentIntents = new ArrayList<>(messageCount);
for (int i = 0; i < messageCount; i++) {
// Make pending intents different for each message part
final int partId = (messageCount <= 1 ? 0 : i + 1);
@@ -417,7 +417,7 @@ public class AsyncImageView extends ImageView implements MediaResourceLoadListen
private final HashSet<AsyncImageView> mAttachedViews;
public AsyncImageViewDelayLoader() {
mAttachedViews = new HashSet<AsyncImageView>();
mAttachedViews = new HashSet<>();
}
private void registerView(final AsyncImageView view) {
@@ -119,7 +119,7 @@ public class ClassZeroActivity extends Activity {
requestWindowFeature(Window.FEATURE_NO_TITLE);
if (mMessageQueue == null) {
mMessageQueue = new ArrayList<ContentValues>();
mMessageQueue = new ArrayList<>();
}
if (!queueMsgFromIntent(getIntent())) {
return;
@@ -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.
@@ -103,7 +104,7 @@ public class LineWrapLayout extends ViewGroup {
int currLineHeight = 0;
// Do a dry-run first to get the line heights.
final ArrayList<Integer> lineHeights = new ArrayList<Integer>();
final ArrayList<Integer> lineHeights = new ArrayList<>();
for (int i = 0; i < childCount; i++) {
View currChild = getChildAt(i);
if (currChild.getVisibility() == GONE) {
@@ -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.
@@ -158,13 +159,13 @@ public class MultiAttachmentLayout extends FrameLayout {
public MultiAttachmentLayout(final Context context, final AttributeSet attrs) {
super(context, attrs);
mPreviewViews = new ArrayList<ViewWrapper>();
mPreviewViews = new ArrayList<>();
}
public void bindAttachments(final Iterable<MessagePartData> attachments,
final Rect transitionRect, final int count) {
final ArrayList<ViewWrapper> previousViews = mPreviewViews;
mPreviewViews = new ArrayList<ViewWrapper>();
mPreviewViews = new ArrayList<>();
removeView(mPlusTextView);
mPlusTextView = null;
+2 -3
View File
@@ -118,8 +118,7 @@ public class SnackBar {
}
public static class Builder {
private static final List<SnackBarInteraction> NO_INTERACTIONS =
new ArrayList<SnackBarInteraction>();
private static final List<SnackBarInteraction> NO_INTERACTIONS = new ArrayList<>();
private final Context mContext;
private final SnackBarManager mSnackBarManager;
@@ -213,7 +212,7 @@ public class SnackBar {
mPlacement = builder.mPlacement;
mParentView = builder.mParentView;
if (builder.mInteractions == null) {
mInteractions = new ArrayList<SnackBarInteraction>();
mInteractions = new ArrayList<>();
} else {
mInteractions = builder.mInteractions;
}
@@ -122,7 +122,7 @@ public class SettingsActivity extends BugleActionBarActivity {
*/
private class SettingsListAdapter extends ArrayAdapter<SettingsItem> {
public SettingsListAdapter(final Context context) {
super(context, R.layout.settings_item_view, new ArrayList<SettingsItem>());
super(context, R.layout.settings_item_view, new ArrayList<>());
}
public void setSettingsItems(final List<SettingsItem> newList) {
@@ -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.
@@ -157,12 +158,12 @@ public class AttachmentGridView extends GridView implements
}
}
public static final Parcelable.Creator<SavedState> CREATOR =
new Parcelable.Creator<SavedState>() {
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<>() {
@Override
public SavedState createFromParcel(final Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(final int size) {
return new SavedState[size];
@@ -310,7 +310,7 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
final RecipientMatchCallback callback) {
final int addressesSize = Math.min(
RecipientAlternatesAdapter.MAX_LOOKUPS, inAddresses.size());
final HashSet<String> addresses = new HashSet<String>();
final HashSet<String> addresses = new HashSet<>();
for (int i = 0; i < addressesSize; i++) {
final Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(inAddresses.get(i).toLowerCase());
addresses.add(tokens.length > 0 ? tokens[0].getAddress() : inAddresses.get(i));
@@ -259,8 +259,7 @@ public class ContactRecipientAutoCompleteView extends RecipientEditTextView {
public ArrayList<ParticipantData> getRecipientParticipantDataForConversationCreation() {
final DrawableRecipientChip[] recips = getText()
.getSpans(0, getText().length(), DrawableRecipientChip.class);
final ArrayList<ParticipantData> contacts =
new ArrayList<ParticipantData>(recips.length);
final ArrayList<ParticipantData> contacts = new ArrayList<>(recips.length);
for (final DrawableRecipientChip recipient : recips) {
final RecipientEntry entry = recipient.getEntry();
if (entry != null && entry.isValid() && entry.getDestination() != null &&
@@ -277,7 +276,7 @@ public class ContactRecipientAutoCompleteView extends RecipientEditTextView {
* consumer with determining quickly whether a contact is currently selected.
*/
public Set<String> getSelectedDestinations() {
Set<String> set = new HashSet<String>();
Set<String> set = new HashSet<>();
final DrawableRecipientChip[] recips = getText()
.getSpans(0, getText().length(), DrawableRecipientChip.class);
@@ -67,7 +67,7 @@ public class ContactRecipientPhotoManager implements PhotoManager {
new AvatarRequestDescriptor(avatarUri, mIconSize, mIconSize);
final BindableMediaRequest<ImageResource> req = descriptor.buildAsyncMediaRequest(
mContext,
new MediaResourceLoadListener<ImageResource>() {
new MediaResourceLoadListener<>() {
@Override
public void onMediaResourceLoaded(final MediaRequest<ImageResource> request,
final ImageResource resource, final boolean isCached) {
@@ -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.
@@ -111,7 +112,7 @@ public class ContactSectionIndexer implements SectionIndexer {
}
this.mSections = sections;
mSectionStartingPositions = new ArrayList<Integer>(counts.length);
mSectionStartingPositions = new ArrayList<>(counts.length);
int position = 0;
for (int i = 0; i < counts.length; i++) {
if (TextUtils.isEmpty(mSections[i])) {
@@ -131,8 +132,8 @@ public class ContactSectionIndexer implements SectionIndexer {
// The result is stored into two arrays, one for the section header (i.e. the first
// character), and one for the starting position, which is guaranteed to be sorted in
// ascending order.
final ArrayList<String> sections = new ArrayList<String>();
mSectionStartingPositions = new ArrayList<Integer>();
final ArrayList<String> sections = new ArrayList<>();
mSectionStartingPositions = new ArrayList<>();
if (cursor != null) {
cursor.moveToPosition(-1);
int currentPosition = 0;
@@ -655,7 +655,7 @@ public class ComposeMessageView extends LinearLayout
mBinding.getData().hasAttachments();
final List<MessagePartData> attachments =
new ArrayList<MessagePartData>(draftMessageData.getReadOnlyAttachments());
new ArrayList<>(draftMessageData.getReadOnlyAttachments());
if (draftMessageData.getIsMms()) { // MMS case
if (draftMessageData.hasAttachments()) {
if (hasAttachmentsChanged) {
@@ -276,7 +276,7 @@ public class ConversationActivityUiState implements Parcelable, Cloneable {
}
public static final Parcelable.Creator<ConversationActivityUiState> CREATOR
= new Parcelable.Creator<ConversationActivityUiState>() {
= new Parcelable.Creator<>() {
@Override
public ConversationActivityUiState createFromParcel(final Parcel in) {
return new ConversationActivityUiState(in);
@@ -508,7 +508,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(manager);
mRecyclerView.setItemAnimator(new DefaultItemAnimator() {
private final List<ViewHolder> mAddAnimations = new ArrayList<ViewHolder>();
private final List<ViewHolder> mAddAnimations = new ArrayList<>();
private PopupTransitionAnimation mPopupTransitionAnimation;
@Override

Some files were not shown because too many files have changed in this diff Show More