diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-01 22:14:30 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-01 22:14:30 +0200 |
commit | 0c9ba838e10d75713c2b51c22fb53a8ceb2f408c (patch) | |
tree | 7c07321883a10780f031b12c90bf65ecc557f678 /src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | |
parent | 6dae9982e26a8ddcb0856f641acb247607c70143 (diff) |
finished 'Set Status Message' dialog
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index c0c74d78b..1a6129a49 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -654,6 +654,10 @@ public class DatabaseBackend extends SQLiteOpenHelper { public void insertPresenceTemplate(PresenceTemplate template) { SQLiteDatabase db = this.getWritableDatabase(); + String whereToDelete = PresenceTemplate.MESSAGE + "=?"; + String[] whereToDeleteArgs = {template.getStatusMessage()}; + db.delete(PresenceTemplate.TABELNAME, whereToDelete, whereToDeleteArgs); + db.delete(PresenceTemplate.TABELNAME, PresenceTemplate.UUID + " not in (select " + PresenceTemplate.UUID + " from " + PresenceTemplate.TABELNAME + " order by " + PresenceTemplate.LAST_USED + " desc limit 9)", null); db.insert(PresenceTemplate.TABELNAME, null, template.getContentValues()); } @@ -668,14 +672,6 @@ public class DatabaseBackend extends SQLiteOpenHelper { return templates; } - public void deletePresenceTemplate(PresenceTemplate template) { - Log.d(Config.LOGTAG, "deleting presence template with uuid " + template.getUuid()); - SQLiteDatabase db = this.getWritableDatabase(); - String where = PresenceTemplate.UUID + "=?"; - String[] whereArgs = {template.getUuid()}; - db.delete(PresenceTemplate.TABELNAME, where, whereArgs); - } - public CopyOnWriteArrayList<Conversation> getConversations(int status) { CopyOnWriteArrayList<Conversation> list = new CopyOnWriteArrayList<>(); SQLiteDatabase db = this.getReadableDatabase(); |