From 62dd8f35c06fa493bfec138ab9428269acf6a8ca Mon Sep 17 00:00:00 2001 From: d8ahazard Date: Mon, 12 Sep 2016 14:40:15 -0500 Subject: [PATCH] Add custom comparator for Repos (sort them alphabetically) Now they come out in a nice alphabetized list... --- .../java/com/topjohnwu/magisk/module/RepoHelper.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java b/app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java index 25d342728..fb66ef709 100644 --- a/app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java +++ b/app/src/main/java/com/topjohnwu/magisk/module/RepoHelper.java @@ -19,6 +19,8 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.Map; @@ -51,6 +53,7 @@ public class RepoHelper { BuildFromCache(); } + Collections.sort(repos, new CustomComparator()); return repos; } @@ -205,6 +208,12 @@ public class RepoHelper { public void taskCompletionResult(String result); } + public class CustomComparator implements Comparator { + @Override + public int compare(Repo o1, Repo o2) { + return o1.getName().compareTo(o2.getName()); + } + } }