aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTianjie Xu2017-01-13 17:13:38 -0600
committerandroid-build-merger2017-01-13 17:13:38 -0600
commit86a820cb42b296bfcb50c678b9b057d6560861c3 (patch)
treefb6890e2a56e5fac3af1dbf14bcedc17e92c9de9 /tools
parent9b85a44355896c965b00d94f2839c54be9863398 (diff)
parentf92c313723413bbb782aadcc1327d5eac1c492ed (diff)
downloadplatform-bootable-recovery-86a820cb42b296bfcb50c678b9b057d6560861c3.tar.gz
platform-bootable-recovery-86a820cb42b296bfcb50c678b9b057d6560861c3.tar.xz
platform-bootable-recovery-86a820cb42b296bfcb50c678b9b057d6560861c3.zip
Merge "Update background text images in recovery" am: f0af02fea6 am: 19e4f627d8 am: e05674f93e
am: f92c313723 Change-Id: I36ab3a5d46758ef45854efd16dcf8285166d1dc4
Diffstat (limited to 'tools')
-rw-r--r--tools/recovery_l10n/src/com/android/recovery_l10n/Main.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java b/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java
index ac94bde1..30d45f6a 100644
--- a/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java
+++ b/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java
@@ -38,6 +38,7 @@ import java.io.FileOutputStream;
38import java.io.IOException; 38import java.io.IOException;
39import java.util.ArrayList; 39import java.util.ArrayList;
40import java.util.Arrays; 40import java.util.Arrays;
41import java.util.Comparator;
41import java.util.HashMap; 42import java.util.HashMap;
42import java.util.Locale; 43import java.util.Locale;
43 44
@@ -148,11 +149,28 @@ public class Main extends Activity {
148 mText = (TextView) findViewById(R.id.text); 149 mText = (TextView) findViewById(R.id.text);
149 150
150 String[] localeNames = getAssets().getLocales(); 151 String[] localeNames = getAssets().getLocales();
151 Arrays.sort(localeNames); 152 Arrays.sort(localeNames, new Comparator<String>() {
153 // Override the string comparator so that en is sorted behind en_US.
154 // As a result, en_US will be matched first in recovery.
155 @Override
156 public int compare(String s1, String s2) {
157 if (s1.equals(s2)) {
158 return 0;
159 } else if (s1.startsWith(s2)) {
160 return -1;
161 } else if (s2.startsWith(s1)) {
162 return 1;
163 }
164 return s1.compareTo(s2);
165 }
166 });
167
152 ArrayList<Locale> locales = new ArrayList<Locale>(); 168 ArrayList<Locale> locales = new ArrayList<Locale>();
153 for (String localeName : localeNames) { 169 for (String localeName : localeNames) {
154 Log.i(TAG, "locale = " + localeName); 170 Log.i(TAG, "locale = " + localeName);
155 locales.add(Locale.forLanguageTag(localeName)); 171 if (!localeName.isEmpty()) {
172 locales.add(Locale.forLanguageTag(localeName));
173 }
156 } 174 }
157 175
158 final Runnable seq = buildSequence(locales.toArray(new Locale[0])); 176 final Runnable seq = buildSequence(locales.toArray(new Locale[0]));