From 03d5aa8aebedbcb1ac8211d56cb951097f8f3d81 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 20 Nov 2018 21:33:43 +0100 Subject: [PATCH] show 'show password' toggle for all magically created accounts. make quicksy accounts magically created --- .../crypto/axolotl/XmppAxolotlMessage.java | 2 +- .../conversations/ui/EditAccountActivity.java | 16 +++++++++++----- src/main/res/layout/activity_edit_account.xml | 2 ++ src/main/res/values/attrs.xml | 1 + src/main/res/values/themes.xml | 2 ++ .../services/QuickConversationsService.java | 1 + 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java index 2c5da6414..f4cfa6b3f 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java @@ -165,7 +165,7 @@ public class XmppAxolotlMessage { private static byte[] generateIv() { SecureRandom random = new SecureRandom(); - byte[] iv = new byte[16]; + byte[] iv = new byte[12]; random.nextBytes(iv); return iv; } diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index eeecf0635..52e58e5a0 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -60,6 +60,7 @@ import eu.siacs.conversations.ui.adapter.PresenceTemplateAdapter; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.SoftKeyboardUtils; +import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.utils.SignupUtils; @@ -893,17 +894,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.binding.accountJid.setEnabled(editable); this.binding.accountJid.setFocusable(editable); this.binding.accountJid.setFocusableInTouchMode(editable); + this.binding.accountJid.setCursorVisible(editable); final String displayName = mAccount.getDisplayName(); updateDisplayName(displayName); - if (mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) { - this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(true); - } else { - this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(false); - } + final boolean tooglePassword = mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY); + final boolean editPassword = !mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || (!mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && QuickConversationsService.isConversations()); + + this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(tooglePassword); + + this.binding.accountPassword.setFocusable(editPassword); + this.binding.accountPassword.setFocusableInTouchMode(editPassword); + this.binding.accountPassword.setCursorVisible(editPassword); + this.binding.accountPassword.setEnabled(editPassword); if (!mInitMode) { this.binding.avater.setVisibility(View.VISIBLE); diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 90d2b7502..6df02e12d 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -67,6 +67,7 @@ android:layout_height="wrap_content" android:imeOptions="actionNext" android:inputType="textEmailAddress" + android:textColor="?attr/edit_text_color" style="@style/Widget.Conversations.EditText"/> @@ -88,6 +89,7 @@ android:layout_alignParentTop="true" android:hint="@string/password" android:inputType="textPassword" + android:textColor="?attr/edit_text_color" style="@style/Widget.Conversations.EditText"/> diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 627b3a970..7fbeaf5b3 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -15,6 +15,7 @@ + diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 054a66e83..5532817e9 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -13,6 +13,7 @@ @color/red_a700 @color/green600 @color/red800 + @color/black87 @drawable/search_background_light @drawable/no_results_background_light @@ -128,6 +129,7 @@ @color/green500 @color/red500 + @color/white @color/white diff --git a/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java b/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java index 595f88a6c..d5db6d436 100644 --- a/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java +++ b/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java @@ -169,6 +169,7 @@ public class QuickConversationsService extends AbstractQuickConversationsService } account = new Account(jid, CryptoHelper.createPassword(new SecureRandom())); account.setOption(Account.OPTION_DISABLED, true); + account.setOption(Account.OPTION_MAGIC_CREATE, true); account.setOption(Account.OPTION_UNVERIFIED, true); service.createAccount(account); }