Git commit 10e43a93c92fe68f9512665e413d1cddd83e5c8c by Simon Redman.
Committed on 31/03/2018 at 22:52.
Pushed by sredman into branch 'sms-history'.
Add custom type for Message
M +37 -23 src/org/kde/kdeconnect/Helpers/SMSHelper.java
https://commits.kde.org/kdeconnect-android/10e43a93c92fe68f9512665e413d1cdd=
d83e5c8c
diff --git a/src/org/kde/kdeconnect/Helpers/SMSHelper.java b/src/org/kde/kd=
econnect/Helpers/SMSHelper.java
index 3c45011..ffbcccf 100644
--- a/src/org/kde/kdeconnect/Helpers/SMSHelper.java
+++ b/src/org/kde/kdeconnect/Helpers/SMSHelper.java
@@ -35,19 +35,6 @@ import java.util.Map;
=
public class SMSHelper {
=
- /**
- * Define the columns which are extracted from the Android SMS database
- */
- protected static final String[] smsProjection =3D new String[]{
- Telephony.Sms.ADDRESS, // Phone number of the remote
- Telephony.Sms.BODY, // Body of the message
- Telephony.Sms.DATE, // Some date associated with the messa=
ge (Received?)
- Telephony.Sms.TYPE, // Compare with Telephony.TextBasedSms=
Columns.MESSAGE_TYPE_*
- Telephony.Sms.PERSON, // Some obscure value that corresponds=
to the contact
- Telephony.Sms.READ, // Whether we have received a read rep=
ort for this message (int)
- ThreadID.lookupColumn, // Magic number which binds (message) t=
hreads
- };
-
/**
* Get the base address for the SMS content
*
@@ -98,14 +85,14 @@ public class SMSHelper {
* @param context android.content.Context running the request
* @return Mapping of thread ID to list of messages in that thread
*/
- public static Map>> getSMS(Context =
context) {
- HashMap>> toReturn =3D new Hash=
Map<>();
+ public static Map> getSMS(Context context) {
+ HashMap> toReturn =3D new HashMap<>();
=
Uri smsUri =3D getSMSUri();
=
Cursor smsCursor =3D context.getContentResolver().query(
smsUri,
- smsProjection,
+ Message.smsColumns,
null,
null,
null);
@@ -115,9 +102,9 @@ public class SMSHelper {
do {
int thread =3D smsCursor.getInt(threadColumn);
if (!toReturn.containsKey(thread)) {
- toReturn.put(new ThreadID(thread), new ArrayList