Messaging: Let there be lambdas

Change-Id: Iee1fc46c92ea9159abb10d92d34baee937bdee0c
This commit is contained in:
Michael W
2024-12-26 14:55:12 +01:00
parent c1b4aa4dfe
commit d43b6ff1c4
84 changed files with 991 additions and 1697 deletions
@@ -627,21 +627,18 @@ public class ConversationData extends BindableData {
}
if (ContactUtil.hasReadContactsPermission()) {
SafeAsyncTask.executeOnThreadPool(new Runnable() {
@Override
public void run() {
final DataUsageStatUpdater updater = new DataUsageStatUpdater(
Factory.get().getApplicationContext());
try {
if (!phones.isEmpty()) {
updater.updateWithPhoneNumber(phones);
}
if (!emails.isEmpty()) {
updater.updateWithAddress(emails);
}
} catch (final SQLiteFullException ex) {
LogUtil.w(TAG, "Unable to update contact", ex);
SafeAsyncTask.executeOnThreadPool(() -> {
final DataUsageStatUpdater updater = new DataUsageStatUpdater(
Factory.get().getApplicationContext());
try {
if (!phones.isEmpty()) {
updater.updateWithPhoneNumber(phones);
}
if (!emails.isEmpty()) {
updater.updateWithAddress(emails);
}
} catch (final SQLiteFullException ex) {
LogUtil.w(TAG, "Unable to update contact", ex);
}
});
}
@@ -445,13 +445,9 @@ public class MessagePartData implements Parcelable {
public void destroyAsync() {
final Uri contentUri = shouldDestroy();
if (contentUri != null) {
SafeAsyncTask.executeOnThreadPool(new Runnable() {
@Override
public void run() {
SafeAsyncTask.executeOnThreadPool(() ->
Factory.get().getApplicationContext().getContentResolver().delete(
contentUri, null, null);
}
});
contentUri, null, 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.
@@ -20,7 +21,6 @@ import android.database.Cursor;
import androidx.collection.ArrayMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -61,15 +61,11 @@ public class SelfParticipantsData {
list.add(self);
}
}
Collections.sort(
list,
new Comparator() {
public int compare(Object o1, Object o2) {
int slotId1 = ((ParticipantData) o1).getSlotId();
int slotId2 = ((ParticipantData) o2).getSlotId();
return slotId1 > slotId2 ? 1 : -1;
}
});
list.sort((Comparator) (o1, o2) -> {
int slotId1 = ((ParticipantData) o1).getSlotId();
int slotId2 = ((ParticipantData) o2).getSlotId();
return slotId1 > slotId2 ? 1 : -1;
});
return list;
}