mirror of
				https://github.com/nerzhul/ownCloud-SMS-App.git
				synced 2025-10-28 00:49:00 +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; |                     String colName; | ||||||
| 					for (int idx = 0; idx < c.getColumnCount(); idx++) { | 					for (int idx = 0; idx < c.getColumnCount(); idx++) { | ||||||
| 						colName = c.getColumnName(idx); | 						colName = c.getColumnName(idx); | ||||||
| 						 |  | ||||||
| 						// Id column is must be an integer |  | ||||||
|                         switch (colName) { |                         switch (colName) { | ||||||
|  |                             // Id column is must be an integer | ||||||
|                             case "_id": |                             case "_id": | ||||||
|                             case "type": |                             case "type": | ||||||
|                                 entry.put(colName, c.getInt(idx)); |                                 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) { | 	public Cursor queryNonExistingMessages(String mailBox, String existingIds) { | ||||||
| 		if (!existingIds.isEmpty()) { | 		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); | 		return query(mailBox); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|     public Cursor queryMessagesSinceDate(String mailBox, Long sinceDate) { |     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), |         return query(Uri.parse(mailBox), | ||||||
|                 new String[] { "read", "date", "address", "seen", "body", "_id", "type", }, |                 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) { | 			String[] selectionArgs, String sortOrder) { | ||||||
|         OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(_context); |         OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(_context); | ||||||
|         Integer bulkLimit = prefs.getSyncBulkLimit(); |         Integer bulkLimit = prefs.getSyncBulkLimit(); | ||||||
|  |         //Integer senderMinSize = prefs.getMinPhoneNumberCharsToSync(); | ||||||
|         if (bulkLimit > 0) { |         if (bulkLimit > 0) { | ||||||
|             if (sortOrder == null) |             if (sortOrder == null) | ||||||
|                 sortOrder = "_id "; |                 sortOrder = "_id "; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user