Fixed widget folder sort order

pull/180/head
M66B 5 years ago
parent 2d926628dd
commit 3093503590

@ -34,9 +34,12 @@ import android.widget.Spinner;
import androidx.constraintlayout.widget.Group;
import androidx.preference.PreferenceManager;
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 ActivityWidgetUnified extends ActivityBase {
private int appWidgetId;
@ -153,8 +156,19 @@ public class ActivityWidgetUnified extends ActivityBase {
DB db = DB.getInstance(context);
List<TupleFolderEx> folders = db.folder().getFoldersEx(account);
if (folders != null && folders.size() > 0)
Collections.sort(folders, folders.get(0).getComparator(context));
if (folders != null) {
final Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
Collections.sort(folders, new Comparator<TupleFolderEx>() {
@Override
public int compare(TupleFolderEx o1, TupleFolderEx o2) {
return collator.compare(o1.name, o2.name);
}
});
}
return folders;
}

Loading…
Cancel
Save