diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-01-27 20:16:42 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-01-27 20:16:42 +0100 |
commit | 68d8a7cf455517c34f90d1c721aa859d1fe25225 (patch) | |
tree | d4e316de692873e8092f4de88b74839ec1edb1b5 | |
parent | b6be7415f6fe07f12d0f29b74384c144a9b66c1d (diff) |
Show toast after destroying group chat
3 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 6c2a3cfcd..f110b5fa8 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2892,11 +2892,12 @@ public class XmppConnectionService extends Service { }); } - public void destroyMuc(Conversation mSelectedConversation) { + public void destroyMuc(final Conversation mSelectedConversation) { destroyConference(mSelectedConversation, new XmppConnectionService.OnDestroyMuc() { @Override - public void OnDestroyMucSuccessful() { + public void OnDestroyMucSuccessful(int resId) { Log.d(Config.LOGTAG, "Destroy succeed"); + showErrorToastInUi(resId); } @Override @@ -2911,9 +2912,9 @@ public class XmppConnectionService extends Service { IqPacket request = this.mIqGenerator.destroyConference(conference); sendIqPacket(conference.getAccount(), request, (account, packet) -> { if (packet.getType() == IqPacket.TYPE.RESULT) { - callback.OnDestroyMucSuccessful(); + callback.OnDestroyMucSuccessful(R.string.destroy_muc_succeed); } else { - callback.OnDestroyMucFailed(R.string.failed); + callback.OnDestroyMucFailed(R.string.destroy_muc_failed); } }); } @@ -4286,7 +4287,7 @@ public class XmppConnectionService extends Service { } public interface OnDestroyMuc { - void OnDestroyMucSuccessful(); + void OnDestroyMucSuccessful(int resId); void OnDestroyMucFailed(int resId); } diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index f17380843..f0b20bfa4 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -60,7 +60,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers public void onClick(View v) { final AlertDialog.Builder DestroyMucDialog = new AlertDialog.Builder(ConferenceDetailsActivity.this); DestroyMucDialog.setNegativeButton(getString(R.string.cancel), null); - DestroyMucDialog.setTitle(getString(R.string.action_destroy_muc)); + DestroyMucDialog.setTitle(getString(R.string.destroy_muc)); DestroyMucDialog.setMessage(getString(R.string.destroy_muc_text, mConversation.getName())); DestroyMucDialog.setPositiveButton(getString(R.string.delete), (dialogInterface, i) -> { Intent intent = new Intent(xmppConnectionService, ConversationActivity.class); diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 26492d3e7..c9441f595 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -752,8 +752,9 @@ <string name="invalid_muc_nick">Invalid nickname</string> <string name="title_activity_share_via_account">Share via account</string> <string name="private_messages_are_disabled">Private messages are disabled</string> - <string name="destroy_muc">Delete conference</string> + <string name="destroy_muc">Destroy group chat</string> <string name="conference_unknown_error">You are no longer in this group chat</string> - <string name="action_destroy_muc">Destroy group chat</string> <string name="destroy_muc_text">Would you like to destroy the group chat %s? This will remove this group chat permanently.</string> + <string name="destroy_muc_succeed">Group chat successfully destroyed</string> + <string name="destroy_muc_failed">Group chat could not be destroyed</string> </resources> |