mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 11:42:15 -05:00
Merge branch 'master' into development
This commit is contained in:
commit
2b21bc13fc
@ -150,7 +150,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
+ Conversation.TABLENAME + " where " + Conversation.STATUS
|
+ Conversation.TABLENAME + " where " + Conversation.STATUS
|
||||||
+ "=" + Conversation.STATUS_AVAILABLE, null);
|
+ "=" + Conversation.STATUS_AVAILABLE, null);
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return cursor.getInt(0);
|
int count = cursor.getInt(0);
|
||||||
|
cursor.close();
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopyOnWriteArrayList<Conversation> getConversations(int status) {
|
public CopyOnWriteArrayList<Conversation> getConversations(int status) {
|
||||||
@ -163,6 +165,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
list.add(Conversation.fromCursor(cursor));
|
list.add(Conversation.fromCursor(cursor));
|
||||||
}
|
}
|
||||||
|
cursor.close();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +199,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
list.add(message);
|
list.add(message);
|
||||||
} while (cursor.moveToPrevious());
|
} while (cursor.moveToPrevious());
|
||||||
}
|
}
|
||||||
|
cursor.close();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +212,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
if (cursor.getCount() == 0)
|
if (cursor.getCount() == 0)
|
||||||
return null;
|
return null;
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return Conversation.fromCursor(cursor);
|
Conversation conversation = Conversation.fromCursor(cursor);
|
||||||
|
cursor.close();
|
||||||
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConversation(Conversation conversation) {
|
public void updateConversation(Conversation conversation) {
|
||||||
@ -320,7 +326,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return Conversation.fromCursor(cursor);
|
Conversation conversation = Conversation.fromCursor(cursor);
|
||||||
|
cursor.close();
|
||||||
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Message findMessageByUuid(String messageUuid) {
|
public Message findMessageByUuid(String messageUuid) {
|
||||||
@ -332,7 +340,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return Message.fromCursor(cursor);
|
Message message = Message.fromCursor(cursor);
|
||||||
|
cursor.close();
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account findAccountByUuid(String accountUuid) {
|
public Account findAccountByUuid(String accountUuid) {
|
||||||
@ -344,7 +354,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
return Account.fromCursor(cursor);
|
Account account = Account.fromCursor(cursor);
|
||||||
|
cursor.close();
|
||||||
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Message> getImageMessages(Conversation conversation) {
|
public List<Message> getImageMessages(Conversation conversation) {
|
||||||
@ -362,6 +374,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
|||||||
list.add(message);
|
list.add(message);
|
||||||
} while (cursor.moveToPrevious());
|
} while (cursor.moveToPrevious());
|
||||||
}
|
}
|
||||||
|
cursor.close();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user