mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Setup improvements
This commit is contained in:
parent
96df682541
commit
6e66ddcd53
2 changed files with 26 additions and 11 deletions
|
@ -730,12 +730,15 @@ public class FragmentAccount extends FragmentEx {
|
|||
|
||||
if (savedInstanceState == null) {
|
||||
if (account != null) {
|
||||
for (int pos = 2; pos < providers.size(); pos++)
|
||||
if (providers.get(pos).imap_host.equals(account.host)) {
|
||||
for (int pos = 2; pos < providers.size(); pos++) {
|
||||
Provider provider = providers.get(pos);
|
||||
if (provider.imap_host.equals(account.host) &&
|
||||
provider.imap_port == account.port) {
|
||||
spProvider.setTag(pos);
|
||||
spProvider.setSelection(pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
etHost.setText(account.host);
|
||||
etPort.setText(Long.toString(account.port));
|
||||
}
|
||||
|
|
|
@ -119,6 +119,8 @@ public class FragmentIdentity extends FragmentEx {
|
|||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
btnAdvanced.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
|
||||
if (position == 0)
|
||||
grpAdvanced.setVisibility(View.GONE);
|
||||
tilPassword.setPasswordVisibilityToggleEnabled(position == 0);
|
||||
btnSave.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
@ -130,18 +132,28 @@ public class FragmentIdentity extends FragmentEx {
|
|||
EntityAccount account = (EntityAccount) adapterView.getAdapter().getItem(position);
|
||||
|
||||
// Select associated provider
|
||||
for (int pos = 1; pos < spProvider.getAdapter().getCount(); pos++) {
|
||||
Provider provider = (Provider) spProvider.getItemAtPosition(pos);
|
||||
if (provider.imap_host.equals(account.host) && provider.imap_port == account.port) {
|
||||
spProvider.setSelection(pos);
|
||||
if (position == 0)
|
||||
spProvider.setSelection(0);
|
||||
else {
|
||||
boolean found = false;
|
||||
for (int pos = 1; pos < spProvider.getAdapter().getCount(); pos++) {
|
||||
Provider provider = (Provider) spProvider.getItemAtPosition(pos);
|
||||
if (provider.imap_host.equals(account.host) &&
|
||||
provider.imap_port == account.port) {
|
||||
found = true;
|
||||
|
||||
// This is needed because the spinner might be invisible
|
||||
etHost.setText(provider.smtp_host);
|
||||
etPort.setText(Integer.toString(provider.smtp_port));
|
||||
cbStartTls.setChecked(provider.starttls);
|
||||
spProvider.setSelection(pos);
|
||||
|
||||
break;
|
||||
// This is needed because the spinner might be invisible
|
||||
etHost.setText(provider.smtp_host);
|
||||
etPort.setText(Integer.toString(provider.smtp_port));
|
||||
cbStartTls.setChecked(provider.starttls);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
grpAdvanced.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
// Copy account user name
|
||||
|
|
Loading…
Reference in a new issue