hiding the prepare image toast after error or success

This commit is contained in:
Daniel Gultsch 2014-05-14 18:43:58 +02:00
parent 08a26d2772
commit ca7e24c30d
2 changed files with 15 additions and 3 deletions

View file

@ -384,7 +384,6 @@ public class ConversationActivity extends XmppActivity {
@Override @Override
public void error(int error) { public void error(int error) {
displayErrorDialog(error); displayErrorDialog(error);
} }
}); });
} else { } else {
@ -728,22 +727,37 @@ public class ConversationActivity extends XmppActivity {
@Override @Override
public void userInputRequried(PendingIntent pi) { public void userInputRequried(PendingIntent pi) {
hidePrepareImageToast();
ConversationActivity.this.runIntent(pi, ConversationActivity.REQUEST_SEND_PGP_IMAGE); ConversationActivity.this.runIntent(pi, ConversationActivity.REQUEST_SEND_PGP_IMAGE);
} }
@Override @Override
public void success() { public void success() {
sendPendingImageMessage(); sendPendingImageMessage();
hidePrepareImageToast();
} }
@Override @Override
public void error(int error) { public void error(int error) {
hidePrepareImageToast();
pendingMessage = null; pendingMessage = null;
displayErrorDialog(error); displayErrorDialog(error);
} }
}); });
} }
private void hidePrepareImageToast() {
if (prepareImageToast!=null) {
runOnUiThread(new Runnable() {
@Override
public void run() {
prepareImageToast.cancel();
}
});
}
}
private void sendPendingImageMessage() { private void sendPendingImageMessage() {
pendingMessage.getConversation().getMessages().add(pendingMessage); pendingMessage.getConversation().getMessages().add(pendingMessage);
xmppConnectionService.databaseBackend.createMessage(pendingMessage); xmppConnectionService.databaseBackend.createMessage(pendingMessage);

View file

@ -1,7 +1,5 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import java.nio.channels.AlreadyConnectedException;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;