From d783cec97084a12873ca62b5fcd64620056ec01b Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 19 Nov 2016 23:07:54 +0100 Subject: reformat code --- .../messenger/crypto/PgpDecryptionService.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java') diff --git a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java index ffa853fda..4b0e78764 100644 --- a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java +++ b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java @@ -28,9 +28,9 @@ public class PgpDecryptionService { private final XmppConnectionService mXmppConnectionService; private OpenPgpApi openPgpApi = null; - protected final ArrayDeque messages = new ArrayDeque(); + protected final ArrayDeque messages = new ArrayDeque(); protected final HashSet pendingNotifications = new HashSet<>(); - Message currentMessage; + Message currentMessage; private PendingIntent pendingIntent; @@ -38,7 +38,7 @@ public class PgpDecryptionService { this.mXmppConnectionService = service; } - public synchronized boolean decrypt(final Message message, boolean notify) { + public synchronized boolean decrypt(final Message message, boolean notify) { messages.add(message); if (notify && pendingIntent == null) { pendingNotifications.add(message); @@ -48,10 +48,10 @@ public class PgpDecryptionService { continueDecryption(); return notify; } - } + } public synchronized void decrypt(final List list) { - for(Message message : list) { + for (Message message : list) { if (message.getEncryption() == Message.ENCRYPTION_PGP) { messages.add(message); } @@ -69,19 +69,19 @@ public class PgpDecryptionService { this.pendingNotifications.remove(message); } - protected synchronized void decryptNext() { - if (pendingIntent == null + protected synchronized void decryptNext() { + if (pendingIntent == null && getOpenPgpApi() != null - && (currentMessage = messages.poll()) != null) { - new Thread(new Runnable() { + && (currentMessage = messages.poll()) != null) { + new Thread(new Runnable() { @Override public void run() { executeApi(currentMessage); decryptNext(); } }).start(); - } - } + } + } public synchronized void continueDecryption(boolean resetPending) { if (resetPending) { @@ -200,7 +200,7 @@ public class PgpDecryptionService { if (pendingIntent == null) { return false; } else { - for(Message message : messages) { + for (Message message : messages) { if (message.getConversation() == conversation) { return true; } -- cgit v1.2.3