diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-04 18:15:50 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-04 18:15:50 +0100 |
commit | 2ab35f4c9302371240184b90905d81f3238a9a46 (patch) | |
tree | 5702c01725f660789428c9072568ee1f1e930185 /src/main/java/de/pixart/messenger/ui | |
parent | 10db274762a67db07fd66af312c10c7f9b2d5e5a (diff) |
block send action while encrypting pgp message
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 3 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 7864c9e12..8175d10bc 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -2009,6 +2009,9 @@ public class ConversationActivity extends XmppActivity ).show(); } }); + if (mConversationFragment != null) { + mConversationFragment.doneSendingPgpMessage(); + } } }); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 19bee36ba..b91e90bbd 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -49,6 +49,7 @@ import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; import de.pixart.messenger.Config; import de.pixart.messenger.R; @@ -1122,6 +1123,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa mEditMessage.requestFocus(); } + public void doneSendingPgpMessage() { + mSendingPgpMessage.set(false); + } + enum SendButtonAction {TEXT, TAKE_PHOTO, SEND_LOCATION, RECORD_VOICE, CANCEL, CHOOSE_PICTURE} private int getSendButtonImageResource(SendButtonAction action, Presence.Status status) { @@ -1343,6 +1348,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa messageSent(); } + private AtomicBoolean mSendingPgpMessage = new AtomicBoolean(false); + protected void sendPgpMessage(final Message message) { final ConversationActivity activity = (ConversationActivity) getActivity(); final XmppConnectionService xmppService = activity.xmppConnectionService; @@ -1355,6 +1362,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa activity.announcePgp(conversation.getAccount(), conversation, activity.onOpenPGPKeyPublished); return; } + if (!mSendingPgpMessage.compareAndSet(false, true)) { + Log.d(Config.LOGTAG, "sending pgp message already in progress"); + } if (conversation.getMode() == Conversation.MODE_SINGLE) { if (contact.getPgpKeyId() != 0) { xmppService.getPgpEngine().hasKey(contact, @@ -1384,6 +1394,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa ).show(); } }); + mSendingPgpMessage.set(false); } }); |