diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-05-27 20:05:40 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-05-27 20:05:40 +0200 |
commit | 29bd1103c0546f601f203d7a0ca4c18550335f73 (patch) | |
tree | 451e387aa088c27d8858c7bb0388f226a562f68e /src/main/java/eu/siacs/conversations/ui | |
parent | a241ab66de50ad7fada548bdec1877b4b564f878 (diff) |
refactored toasts shown when adhoc creating mucs
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index c7fa2d288..a9b9beb72 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1122,6 +1122,8 @@ public class ConversationActivity extends XmppActivity if (mPendingConferenceInvite != null) { mPendingConferenceInvite.execute(this); + mToast = Toast.makeText(this, R.string.creating_conference,Toast.LENGTH_LONG); + mToast.show(); mPendingConferenceInvite = null; } diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index a136259d1..5dfa50832 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -117,6 +117,20 @@ public abstract class XmppActivity extends Activity { protected int mTheme; protected boolean mUsingEnterKey = false; + protected Toast mToast; + + protected void hideToast() { + if (mToast != null) { + mToast.cancel(); + } + } + + protected void replaceToast(String msg) { + hideToast(); + mToast = Toast.makeText(this, msg ,Toast.LENGTH_LONG); + mToast.show(); + } + protected Runnable onOpenPGPKeyPublished = new Runnable() { @Override public void run() { @@ -940,19 +954,22 @@ public abstract class XmppActivity extends Activity { mPendingConferenceInvite = ConferenceInvite.parse(data); if (xmppConnectionServiceBound && mPendingConferenceInvite != null) { mPendingConferenceInvite.execute(this); + mToast = Toast.makeText(this, R.string.creating_conference,Toast.LENGTH_LONG); + mToast.show(); mPendingConferenceInvite = null; } } } + private UiCallback<Conversation> adhocCallback = new UiCallback<Conversation>() { @Override public void success(final Conversation conversation) { - switchToConversation(conversation); runOnUiThread(new Runnable() { @Override public void run() { - Toast.makeText(XmppActivity.this,R.string.conference_created,Toast.LENGTH_LONG).show(); + switchToConversation(conversation); + hideToast(); } }); } @@ -962,7 +979,7 @@ public abstract class XmppActivity extends Activity { runOnUiThread(new Runnable() { @Override public void run() { - Toast.makeText(XmppActivity.this,errorCode,Toast.LENGTH_LONG).show(); + replaceToast(getString(errorCode)); } }); } |