aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-11-23 14:26:45 +0100
committerChristian Schneppe <christian@pix-art.de>2018-11-23 14:26:45 +0100
commitcd947bd22544fcade1598420855cf981e94b5c50 (patch)
tree632fcf7f974f0684fdd80ff518ea8fc668bfe13e /src
parente8f0927a8d64f96bde5917ef12ccb6b7d1fe0f52 (diff)
make change nick toast use showToast helper method
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index fa83354c4..91b6cb698 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -24,6 +24,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
@@ -113,8 +114,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private UiCallback<Conversation> renameCallback = new UiCallback<Conversation>() {
@Override
public void success(Conversation object) {
+ displayToast(getString(R.string.your_nick_has_been_changed));
runOnUiThread(() -> {
- Toast.makeText(ConferenceDetailsActivity.this, getString(R.string.your_nick_has_been_changed), Toast.LENGTH_SHORT).show();
updateView();
});
@@ -122,7 +123,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
@Override
public void error(final int errorCode, Conversation object) {
- runOnUiThread(() -> Toast.makeText(ConferenceDetailsActivity.this, getString(errorCode), Toast.LENGTH_SHORT).show());
+ displayToast(getString(errorCode));
}
@Override
@@ -785,7 +786,13 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
private void displayToast(final String msg) {
- runOnUiThread(() -> Toast.makeText(ConferenceDetailsActivity.this, msg, Toast.LENGTH_SHORT).show());
+ runOnUiThread(() -> {
+ try {
+ Toast.makeText(ConferenceDetailsActivity.this, msg, Toast.LENGTH_SHORT).show();
+ } catch (WindowManager.BadTokenException e) {
+ Log.e(Config.LOGTAG,"unable to display toast '"+msg+"'. Activity not running");
+ }
+ });
}
public void loadAvatar(User user, ImageView imageView) {