From 194b8d419b2e06441305d17918a426302383d708 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 4 Mar 2018 20:37:42 +0100 Subject: [PATCH] fix change password activity for magic created accounts --- .../services/XmppConnectionService.java | 19 +++-- .../ui/ChangePasswordActivity.java | 2 +- src/main/res/layout/activity_edit_account.xml | 70 +++++++++++-------- 3 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5a6a7af50..f2106c64a 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1859,17 +1859,14 @@ public class XmppConnectionService extends Service { public void updateAccountPasswordOnServer(final Account account, final String newPassword, final OnAccountPasswordChanged callback) { final IqPacket iq = getIqGenerator().generateSetPassword(account, newPassword); - sendIqPacket(account, iq, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(final Account account, final IqPacket packet) { - if (packet.getType() == IqPacket.TYPE.RESULT) { - account.setPassword(newPassword); - account.setOption(Account.OPTION_MAGIC_CREATE, false); - databaseBackend.updateAccount(account); - callback.onPasswordChangeSucceeded(); - } else { - callback.onPasswordChangeFailed(); - } + sendIqPacket(account, iq, (a, packet) -> { + if (packet.getType() == IqPacket.TYPE.RESULT) { + a.setPassword(newPassword); + a.setOption(Account.OPTION_MAGIC_CREATE, false); + databaseBackend.updateAccount(a); + callback.onPasswordChangeSucceeded(); + } else { + callback.onPasswordChangeFailed(); } }); } diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index ea507bf68..639ed2045 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java @@ -50,7 +50,7 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti void onBackendConnected() { this.mAccount = extractAccount(getIntent()); if (this.mAccount != null && this.mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) { - this.mCurrentPassword.setVisibility(View.GONE); + this.mCurrentPasswordLayout.setVisibility(View.GONE); } else { this.mCurrentPassword.setVisibility(View.VISIBLE); } diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index f2de294b9..052c9ca9d 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -152,41 +152,51 @@ android:layout_marginTop="@dimen/activity_vertical_margin" android:visibility="gone"> - + android:orientation="vertical"> - + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> - + -