Fix ordering of radicals by stroke count
CHANGELOG.md
13 | 13 | * Fix a crash on notification on older devices, caused by the use of a vector | |
14 | 14 | icon in the notification, which was not supported. | |
15 | 15 | * Fix default radical button size which was too small. | |
16 | + | * Fix ordering of radicals by stroke count on some devices. | |
16 | 17 | ||
17 | 18 | ### UI Fixes | |
18 | 19 |
app/src/main/java/eu/lepiller/nani/RadicalSelectorView.java
19 | 19 | import java.text.NumberFormat; | |
20 | 20 | import java.util.ArrayList; | |
21 | 21 | import java.util.Arrays; | |
22 | + | import java.util.Collections; | |
22 | 23 | import java.util.List; | |
23 | 24 | import java.util.Map; | |
24 | 25 | import java.util.Set; | |
… | |||
85 | 86 | if(radicals == null) | |
86 | 87 | return; | |
87 | 88 | ||
88 | - | for (int stroke : radicals.keySet()) { | |
89 | + | ArrayList<Integer> strokes = new ArrayList<>(radicals.keySet()); | |
90 | + | Collections.sort(strokes); | |
91 | + | for (int stroke : strokes) { | |
89 | 92 | TextView strokeView = new TextView(getContext()); | |
90 | 93 | NumberFormat nf = NumberFormat.getInstance(); | |
91 | 94 | strokeView.setText(nf.format(stroke)); |