mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-08 08:26:09 +00:00
Cleanup a little bit SmsDataProvider
This commit is contained in:
parent
58ef25883c
commit
0e71ca5fa1
@ -204,9 +204,8 @@ public class SmsFetcher {
|
||||
String colName;
|
||||
for (int idx = 0; idx < c.getColumnCount(); idx++) {
|
||||
colName = c.getColumnName(idx);
|
||||
|
||||
// Id column is must be an integer
|
||||
switch (colName) {
|
||||
// Id column is must be an integer
|
||||
case "_id":
|
||||
case "type":
|
||||
entry.put(colName, c.getInt(idx));
|
||||
|
@ -46,36 +46,21 @@ public class SmsDataProvider extends ContentProvider {
|
||||
);
|
||||
}
|
||||
|
||||
public Cursor query(String mailBox, String selection) {
|
||||
return query(Uri.parse(mailBox),
|
||||
new String[] { "read", "date", "address", "seen", "body", "_id", "type", },
|
||||
selection, null, null
|
||||
);
|
||||
}
|
||||
|
||||
public Cursor queryNonExistingMessages(String mailBox, String existingIds) {
|
||||
if (!existingIds.isEmpty()) {
|
||||
return query(mailBox, "_id NOT IN (" + existingIds + ")");
|
||||
return query(Uri.parse(mailBox),
|
||||
new String[] { "read", "date", "address", "seen", "body", "_id", "type", },
|
||||
"_id NOT IN (" + existingIds + ")", null, null
|
||||
);
|
||||
}
|
||||
|
||||
return query(mailBox);
|
||||
}
|
||||
|
||||
public Cursor queryMessagesSinceDate(String mailBox, Long sinceDate) {
|
||||
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(_context);
|
||||
Integer bulkLimit = prefs.getSyncBulkLimit();
|
||||
String bulkStr = "";
|
||||
if (bulkLimit > 0) {
|
||||
bulkStr = "LIMIT " + bulkLimit.toString();
|
||||
}
|
||||
|
||||
return query(mailBox, "date > ?", new String[] { sinceDate.toString() });
|
||||
}
|
||||
|
||||
public Cursor query(String mailBox, String selection, String[] selectionArgs) {
|
||||
return query(Uri.parse(mailBox),
|
||||
new String[] { "read", "date", "address", "seen", "body", "_id", "type", },
|
||||
selection, selectionArgs, null
|
||||
"date > ?", new String[] { sinceDate.toString() }, null
|
||||
);
|
||||
}
|
||||
|
||||
@ -84,6 +69,7 @@ public class SmsDataProvider extends ContentProvider {
|
||||
String[] selectionArgs, String sortOrder) {
|
||||
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(_context);
|
||||
Integer bulkLimit = prefs.getSyncBulkLimit();
|
||||
//Integer senderMinSize = prefs.getMinPhoneNumberCharsToSync();
|
||||
if (bulkLimit > 0) {
|
||||
if (sortOrder == null)
|
||||
sortOrder = "_id ";
|
||||
|
Loading…
x
Reference in New Issue
Block a user