From 485ef3ff569c9306f940f0c827bf895310710883 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 3 Aug 2018 10:56:11 +0000 Subject: [PATCH] Allow viewing account/identity password --- .idea/misc.xml | 2 +- .../java/eu/faircode/email/FragmentAccount.java | 9 +++++---- .../eu/faircode/email/FragmentIdentity.java | 9 +++++---- app/src/main/res/layout/fragment_account.xml | 17 ++++++++++++----- app/src/main/res/layout/fragment_identity.xml | 17 ++++++++++++----- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 99202cc2..c0f68edd 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index f83ad895..886d1703 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -24,6 +24,7 @@ import android.content.Context; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.design.widget.TextInputLayout; import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.AsyncTaskLoader; @@ -63,7 +64,7 @@ public class FragmentAccount extends Fragment { private EditText etHost; private EditText etPort; private EditText etUser; - private EditText etPassword; + private TextInputLayout tilPassword; private CheckBox cbPrimary; private CheckBox cbSynchronize; private Button btnOk; @@ -96,7 +97,7 @@ public class FragmentAccount extends Fragment { etHost = view.findViewById(R.id.etHost); etPort = view.findViewById(R.id.etPort); etUser = view.findViewById(R.id.etUser); - etPassword = view.findViewById(R.id.etPassword); + tilPassword = view.findViewById(R.id.tilPassword); cbPrimary = view.findViewById(R.id.cbPrimary); cbSynchronize = view.findViewById(R.id.cbSynchronize); btnOk = view.findViewById(R.id.btnOk); @@ -138,7 +139,7 @@ public class FragmentAccount extends Fragment { args.putString("host", etHost.getText().toString()); args.putString("port", etPort.getText().toString()); args.putString("user", etUser.getText().toString()); - args.putString("password", etPassword.getText().toString()); + args.putString("password", tilPassword.getEditText().getText().toString()); args.putBoolean("primary", cbPrimary.isChecked()); args.putBoolean("synchronize", cbSynchronize.isChecked()); @@ -153,7 +154,7 @@ public class FragmentAccount extends Fragment { etHost.setText(account == null ? null : account.host); etPort.setText(account == null ? null : Long.toString(account.port)); etUser.setText(account == null ? null : account.user); - etPassword.setText(account == null ? null : account.password); + tilPassword.getEditText().setText(account == null ? null : account.password); cbPrimary.setChecked(account == null ? true : account.primary); cbSynchronize.setChecked(account == null ? true : account.synchronize); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 93986551..134fb1e7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -24,6 +24,7 @@ import android.content.Context; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.design.widget.TextInputLayout; import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.AsyncTaskLoader; @@ -64,7 +65,7 @@ public class FragmentIdentity extends Fragment { private CheckBox cbStartTls; private EditText etPort; private EditText etUser; - private EditText etPassword; + private TextInputLayout tilPassword; private CheckBox cbPrimary; private CheckBox cbSynchronize; private Button btnOk; @@ -92,7 +93,7 @@ public class FragmentIdentity extends Fragment { cbStartTls = view.findViewById(R.id.cbStartTls); etPort = view.findViewById(R.id.etPort); etUser = view.findViewById(R.id.etUser); - etPassword = view.findViewById(R.id.etPassword); + tilPassword = view.findViewById(R.id.tilPassword); cbPrimary = view.findViewById(R.id.cbPrimary); cbSynchronize = view.findViewById(R.id.cbSynchronize); btnOk = view.findViewById(R.id.btnOk); @@ -159,7 +160,7 @@ public class FragmentIdentity extends Fragment { args.putBoolean("starttls", cbStartTls.isChecked()); args.putString("port", etPort.getText().toString()); args.putString("user", etUser.getText().toString()); - args.putString("password", etPassword.getText().toString()); + args.putString("password", tilPassword.getEditText().toString()); args.putBoolean("primary", cbPrimary.isChecked()); args.putBoolean("synchronize", cbSynchronize.isChecked()); @@ -177,7 +178,7 @@ public class FragmentIdentity extends Fragment { cbStartTls.setChecked(identity == null ? false : identity.starttls); etPort.setText(identity == null ? null : Long.toString(identity.port)); etUser.setText(identity == null ? null : identity.user); - etPassword.setText(identity == null ? null : identity.password); + tilPassword.getEditText().setText(identity == null ? null : identity.password); cbPrimary.setChecked(identity == null ? true : identity.primary); cbSynchronize.setChecked(identity == null ? true : identity.synchronize); } diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index d500f15f..9b659957 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -142,14 +142,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/etUser" /> - + app:layout_constraintTop_toBottomOf="@id/tvPassword" + app:passwordToggleEnabled="true"> + + + + app:layout_constraintTop_toBottomOf="@id/tilPassword" /> + app:constraint_referenced_ids="spProvider,etName,etHost,etPort,etUser,tilPassword,cbPrimary,cbSynchronize,btnOk" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_identity.xml b/app/src/main/res/layout/fragment_identity.xml index ece187d3..aabcfd3a 100644 --- a/app/src/main/res/layout/fragment_identity.xml +++ b/app/src/main/res/layout/fragment_identity.xml @@ -194,14 +194,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/etUser" /> - + app:layout_constraintTop_toBottomOf="@id/tvPassword" + app:passwordToggleEnabled="true"> + + + + app:layout_constraintTop_toBottomOf="@id/tilPassword" /> + app:constraint_referenced_ids="etName,etEmail,spProvider,etHost,cbStartTls,etPort,etUser,tilPassword,cbPrimary,cbSynchronize,btnOk" /> \ No newline at end of file