From 94f0e866e1392076de2ca2fd54e4ef60527ec705 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 8 Aug 2018 10:31:11 +0000 Subject: [PATCH] Automatically copy account password to identity --- .../java/eu/faircode/email/FragmentIdentity.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 77b6a1fc..62110e38 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -130,6 +130,21 @@ public class FragmentIdentity extends FragmentEx { } }); + spAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int position, long id) { + EntityAccount account = (EntityAccount) adapterView.getAdapter().getItem(position); + if (account.id >= 0 && TextUtils.isEmpty(tilPassword.getEditText().getText().toString())) { + tilPassword.getEditText().setText(account.password); + tilPassword.setPasswordVisibilityToggleEnabled(false); + } + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + } + }); + spProfile.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) {