mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 21:57:19 +00:00
Auto prefix providers, sort most used providers on top
This commit is contained in:
parent
c391f9c9f7
commit
fd74c7e659
3 changed files with 14 additions and 2 deletions
|
@ -247,6 +247,7 @@ public class FragmentAccount extends FragmentEx {
|
|||
tilPassword.getEditText().setText(null);
|
||||
|
||||
etName.setText(position > 1 ? provider.name : null);
|
||||
etPrefix.setText(provider.prefix);
|
||||
|
||||
grpFolders.setVisibility(View.GONE);
|
||||
btnSave.setVisibility(View.GONE);
|
||||
|
|
|
@ -34,8 +34,10 @@ import java.util.Locale;
|
|||
|
||||
public class Provider {
|
||||
public String name;
|
||||
public int order;
|
||||
public String link;
|
||||
public String type;
|
||||
public String prefix;
|
||||
public String imap_host;
|
||||
public boolean imap_starttls;
|
||||
public int imap_port;
|
||||
|
@ -63,8 +65,10 @@ public class Provider {
|
|||
else if ("provider".equals(xml.getName())) {
|
||||
provider = new Provider();
|
||||
provider.name = xml.getAttributeValue(null, "name");
|
||||
provider.order = xml.getAttributeIntValue(null, "order", Integer.MAX_VALUE);
|
||||
provider.link = xml.getAttributeValue(null, "link");
|
||||
provider.type = xml.getAttributeValue(null, "type");
|
||||
provider.prefix = xml.getAttributeValue(null, "prefix");
|
||||
} else if ("imap".equals(xml.getName())) {
|
||||
provider.imap_host = xml.getAttributeValue(null, "host");
|
||||
provider.imap_port = xml.getAttributeIntValue(null, "port", 0);
|
||||
|
@ -93,7 +97,11 @@ public class Provider {
|
|||
Collections.sort(result, new Comparator<Provider>() {
|
||||
@Override
|
||||
public int compare(Provider p1, Provider p2) {
|
||||
return collator.compare(p1.name, p2.name);
|
||||
int o = Integer.compare(p1.order, p2.order);
|
||||
if (o == 0)
|
||||
return collator.compare(p1.name, p2.name);
|
||||
else
|
||||
return o;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
<provider
|
||||
name="Gmail"
|
||||
link="https://support.google.com/mail/answer/7126229"
|
||||
order="1"
|
||||
prefix="[Gmail]"
|
||||
type="com.google">
|
||||
<imap
|
||||
host="imap.gmail.com"
|
||||
|
@ -15,7 +17,8 @@
|
|||
</provider>
|
||||
<provider
|
||||
name="Outlook"
|
||||
link="https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040">
|
||||
link="https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040"
|
||||
order="2">
|
||||
<imap
|
||||
host="imap-mail.outlook.com"
|
||||
port="993"
|
||||
|
|
Loading…
Reference in a new issue