Browse Source

Sort providers on name

main
M66B 6 years ago
parent
commit
30a2b5ee31
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      app/src/main/java/eu/faircode/email/Provider.java

+ 14
- 0
app/src/main/java/eu/faircode/email/Provider.java View File

@ -25,8 +25,12 @@ import android.util.Log;
import org.xmlpull.v1.XmlPullParser;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
public class Provider {
public String name;
@ -77,6 +81,16 @@ public class Provider {
} catch (Throwable ex) {
Log.e(Helper.TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
final Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
Collections.sort(result, new Comparator<Provider>() {
@Override
public int compare(Provider p1, Provider p2) {
return collator.compare(p1.name, p2.name);
}
});
return result;
}


Loading…
Cancel
Save