mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-29 17:11:12 +01:00
Auto prefix providers, sort most used providers on top
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user