From 2acf510ea97666919ac066a2bf312f47a386ac56 Mon Sep 17 00:00:00 2001 From: "M. Dietrich" Date: Mon, 1 Sep 2014 10:40:45 +0200 Subject: optimize string operations a bit --- src/eu/siacs/conversations/crypto/PgpEngine.java | 4 ++-- src/eu/siacs/conversations/entities/Message.java | 8 ++++---- src/eu/siacs/conversations/persistance/DatabaseBackend.java | 4 ++-- src/eu/siacs/conversations/persistance/FileBackend.java | 2 +- src/eu/siacs/conversations/xml/Element.java | 4 ++-- src/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java | 4 ++-- src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java | 8 ++++---- src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java | 6 +++--- src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java | 6 +++--- src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java | 2 +- src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java | 2 +- .../siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/eu') diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java index 47b1a0cb..430aaf99 100644 --- a/src/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/eu/siacs/conversations/crypto/PgpEngine.java @@ -106,8 +106,8 @@ public class PgpEngine { outputFile.getAbsolutePath(), options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; - message.setBody("" + outputFile.getSize() + "," - + imageWidth + "," + imageHeight); + message.setBody(Long.toString(outputFile.getSize()) + ',' + + imageWidth + ',' + imageHeight); message.setEncryption(Message.ENCRYPTION_DECRYPTED); PgpEngine.this.mXmppConnectionService .updateMessage(message); diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index 84aac4f5..f36ffa90 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -150,13 +150,13 @@ public class Message extends AbstractEntity { public String getReadableBody(Context context) { if ((encryption == ENCRYPTION_PGP) && (type == TYPE_TEXT)) { - return "" + context.getText(R.string.encrypted_message_received); + return context.getText(R.string.encrypted_message_received).toString(); } else if ((encryption == ENCRYPTION_OTR) && (type == TYPE_IMAGE)) { - return "" + context.getText(R.string.encrypted_image_received); + return context.getText(R.string.encrypted_image_received).toString(); } else if (encryption == ENCRYPTION_DECRYPTION_FAILED) { - return "" + context.getText(R.string.decryption_failed); + return context.getText(R.string.decryption_failed).toString(); } else if (type == TYPE_IMAGE) { - return "" + context.getText(R.string.image_file); + return context.getText(R.string.image_file).toString(); } else { return body.trim(); } diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java index 22871a9e..2a403fab 100644 --- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -137,7 +137,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { public CopyOnWriteArrayList getConversations(int status) { CopyOnWriteArrayList list = new CopyOnWriteArrayList(); SQLiteDatabase db = this.getReadableDatabase(); - String[] selectionArgs = { "" + status }; + String[] selectionArgs = { Integer.toString(status) }; Cursor cursor = db.rawQuery("select * from " + Conversation.TABLENAME + " where " + Conversation.STATUS + " = ? order by " + Conversation.CREATED + " desc", selectionArgs); @@ -163,7 +163,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + "=?", selectionArgs, null, null, Message.TIME_SENT + " DESC", String.valueOf(limit)); } else { - String[] selectionArgs = { conversation.getUuid(), "" + timestamp }; + String[] selectionArgs = { conversation.getUuid(), Long.toString(timestamp) }; cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION + "=? and " + Message.TIME_SENT + "