mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 21:24:34 +00:00
Sort providers on name
This commit is contained in:
parent
a78fb6ba91
commit
30a2b5ee31
1 changed files with 14 additions and 0 deletions
|
@ -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…
Reference in a new issue