diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index c88aa57c55..414d8e7e6d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -128,7 +128,18 @@ public class FragmentIdentity extends FragmentEx { @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())) { + + for (int pos = 1; pos < providers.size(); pos++) + if (providers.get(pos).imap_host.equals(account.host) && + providers.get(pos).imap_port == account.port) { + spProfile.setSelection(pos); + break; + } + + if (position > 0 && TextUtils.isEmpty(etUser.getText())) + etUser.setText(account.user); + + if (position > 0 && TextUtils.isEmpty(tilPassword.getEditText().getText())) { tilPassword.getEditText().setText(account.password); tilPassword.setPasswordVisibilityToggleEnabled(false); } @@ -242,8 +253,6 @@ public class FragmentIdentity extends FragmentEx { } try { - ServiceSynchronize.stop(getContext(), "identity"); - DB db = DB.getInstance(getContext()); try { db.beginTransaction(); diff --git a/app/src/main/res/layout/fragment_identity.xml b/app/src/main/res/layout/fragment_identity.xml index a39185e99f..bc477822ad 100644 --- a/app/src/main/res/layout/fragment_identity.xml +++ b/app/src/main/res/layout/fragment_identity.xml @@ -272,9 +272,10 @@ android:id="@+id/ibDelete" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="12dp" android:src="@drawable/baseline_delete_24" - app:layout_constraintBottom_toBottomOf="@id/btnSave" - app:layout_constraintEnd_toEndOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/cbPrimary" />