aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/persistance
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-21 19:51:03 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-21 19:51:03 +0200
commit77da0c6b5d3d6925c8018c1eb57fb26d102a937d (patch)
treeef392c79f3ad3df6de361ded98ab9d377965a371 /src/eu/siacs/conversations/persistance
parentfc6a16c31b56a1249fb28b4f90018bca4207dab7 (diff)
allow images to be opened with gallary app
Diffstat (limited to 'src/eu/siacs/conversations/persistance')
-rw-r--r--src/eu/siacs/conversations/persistance/DatabaseBackend.java34
-rw-r--r--src/eu/siacs/conversations/persistance/FileBackend.java3
2 files changed, 35 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
index c8c974de..5a34dac6 100644
--- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -305,11 +305,43 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getWritableDatabase();
String[] args = { uuid };
Cursor cursor = db.query(Contact.TABLENAME, null, Contact.UUID + "=?", args, null, null, null);
- if (cursor.getCount() == 0)
+ if (cursor.getCount() == 0) {
return null;
+ }
cursor.moveToFirst();
return Contact.fromCursor(cursor);
}
+ public Conversation findConversationByUuid(String conversationUuid) {
+ SQLiteDatabase db = this.getReadableDatabase();
+ String[] selectionArgs = { conversationUuid };
+ Cursor cursor = db.query(Conversation.TABLENAME, null, Conversation.UUID + "=?", selectionArgs, null, null, null);
+ if (cursor.getCount() == 0) {
+ return null;
+ }
+ cursor.moveToFirst();
+ return Conversation.fromCursor(cursor);
+ }
+
+ public Message findMessageByUuid(String messageUuid) {
+ SQLiteDatabase db = this.getReadableDatabase();
+ String[] selectionArgs = { messageUuid };
+ Cursor cursor = db.query(Message.TABLENAME, null, Message.UUID + "=?", selectionArgs, null, null, null);
+ if (cursor.getCount() == 0) {
+ return null;
+ }
+ cursor.moveToFirst();
+ return Message.fromCursor(cursor);
+ }
+ public Account findAccountByUuid(String accountUuid) {
+ SQLiteDatabase db = this.getReadableDatabase();
+ String[] selectionArgs = { accountUuid };
+ Cursor cursor = db.query(Account.TABLENAME, null, Account.UUID + "=?", selectionArgs, null, null, null);
+ if (cursor.getCount() == 0) {
+ return null;
+ }
+ cursor.moveToFirst();
+ return Account.fromCursor(cursor);
+ }
}
diff --git a/src/eu/siacs/conversations/persistance/FileBackend.java b/src/eu/siacs/conversations/persistance/FileBackend.java
index 307a9e2c..d830652d 100644
--- a/src/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/eu/siacs/conversations/persistance/FileBackend.java
@@ -14,8 +14,10 @@ import android.net.Uri;
import android.util.Log;
import android.util.LruCache;
+import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
+import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xmpp.jingle.JingleFile;
public class FileBackend {
@@ -27,7 +29,6 @@ public class FileBackend {
public FileBackend(Context context) {
this.context = context;
-
int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
int cacheSize = maxMemory / 8;
thumbnailCache = new LruCache<String, Bitmap>(cacheSize) {