aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-01-15 23:47:55 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-01-15 23:47:55 +0100
commit494a04ffb16d9967b947c96bd7c1ce2723da0db0 (patch)
treee41bfeb26cfa2d5143489e34b4eed4c325e525ec /src
parentd85854b686a886d06b4c92b6aaf80e9a3a6d9a2f (diff)
hide prepare image toasts when attaching multiple images
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 97849b6d..2f6ebe33 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -112,8 +112,6 @@ public class ConversationActivity extends XmppActivity
private ArrayAdapter<Conversation> listAdapter;
- private Toast prepareFileToast;
-
private boolean mActivityPaused = false;
private AtomicBoolean mRedirected = new AtomicBoolean(false);
private Pair<Integer, Intent> mPostponedActivityResult;
@@ -1250,6 +1248,9 @@ public class ConversationActivity extends XmppActivity
@SuppressLint("NewApi")
private static List<Uri> extractUriFromIntent(final Intent intent) {
List<Uri> uris = new ArrayList<>();
+ if (intent == null) {
+ return uris;
+ }
Uri uri = intent.getData();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && uri == null) {
ClipData clipData = intent.getClipData();
@@ -1397,17 +1398,18 @@ public class ConversationActivity extends XmppActivity
if (conversation == null) {
return;
}
- prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_file), Toast.LENGTH_LONG);
+ final Toast prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_file), Toast.LENGTH_LONG);
prepareFileToast.show();
xmppConnectionService.attachFileToConversation(conversation, uri, new UiCallback<Message>() {
@Override
public void success(Message message) {
- hidePrepareFileToast();
+ hidePrepareFileToast(prepareFileToast);
xmppConnectionService.sendMessage(message);
}
@Override
public void error(int errorCode, Message message) {
+ hidePrepareFileToast(prepareFileToast);
displayErrorDialog(errorCode);
}
@@ -1422,32 +1424,31 @@ public class ConversationActivity extends XmppActivity
if (conversation == null) {
return;
}
- prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_image), Toast.LENGTH_LONG);
+ final Toast prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_image), Toast.LENGTH_LONG);
prepareFileToast.show();
xmppConnectionService.attachImageToConversation(conversation, uri,
new UiCallback<Message>() {
@Override
- public void userInputRequried(PendingIntent pi,
- Message object) {
- hidePrepareFileToast();
+ public void userInputRequried(PendingIntent pi, Message object) {
+ hidePrepareFileToast(prepareFileToast);
}
@Override
public void success(Message message) {
- hidePrepareFileToast();
+ hidePrepareFileToast(prepareFileToast);
xmppConnectionService.sendMessage(message);
}
@Override
public void error(int error, Message message) {
- hidePrepareFileToast();
+ hidePrepareFileToast(prepareFileToast);
displayErrorDialog(error);
}
});
}
- private void hidePrepareFileToast() {
+ private void hidePrepareFileToast(final Toast prepareFileToast) {
if (prepareFileToast != null) {
runOnUiThread(new Runnable() {