show error toasts on ui thread

This commit is contained in:
Daniel Gultsch 2016-06-24 13:36:06 +02:00
parent d2ca0c7fe8
commit 78e3afc1af
1 changed files with 18 additions and 5 deletions

View File

@ -1464,13 +1464,20 @@ public class ConversationActivity extends XmppActivity
} }
@Override @Override
public void error(int errorCode, Message message) { public void error(final int errorCode, Message message) {
hidePrepareFileToast(prepareFileToast);
runOnUiThread(new Runnable() {
@Override
public void run() {
replaceToast(getString(errorCode)); replaceToast(getString(errorCode));
} }
});
}
@Override @Override
public void userInputRequried(PendingIntent pi, Message message) { public void userInputRequried(PendingIntent pi, Message message) {
hidePrepareFileToast(prepareFileToast);
} }
}); });
} }
@ -1496,11 +1503,17 @@ public class ConversationActivity extends XmppActivity
} }
@Override @Override
public void error(int error, Message message) { public void error(final int error, Message message) {
hidePrepareFileToast(prepareFileToast);
runOnUiThread(new Runnable() {
@Override
public void run() {
replaceToast(getString(error)); replaceToast(getString(error));
} }
}); });
} }
});
}
private void hidePrepareFileToast(final Toast prepareFileToast) { private void hidePrepareFileToast(final Toast prepareFileToast) {
if (prepareFileToast != null) { if (prepareFileToast != null) {