summaryrefslogtreecommitdiffstats
path: root/tools/recovery_l10n
diff options
context:
space:
mode:
Diffstat (limited to 'tools/recovery_l10n')
-rw-r--r--tools/recovery_l10n/README.md3
-rw-r--r--tools/recovery_l10n/src/com/android/recovery_l10n/Main.java22
2 files changed, 23 insertions, 2 deletions
diff --git a/tools/recovery_l10n/README.md b/tools/recovery_l10n/README.md
index 1554f6618..e9e85d65f 100644
--- a/tools/recovery_l10n/README.md
+++ b/tools/recovery_l10n/README.md
@@ -8,6 +8,9 @@
* For example, we can use Nexus 5 to generate the text images under
res-xxhdpi.
+ * We can set up the maximum width of the final png image in res/layout/main.xml
+ Currently, the image width is 1200px for xxxhdpi, 900px for xxhdpi and
+ 480px for xhdpi/hdpi/mdpi.
* When using the emulator, make sure the NDK version matches the current
repository. Otherwise, the app may not work properly.
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 ac94bde1c..30d45f6ae 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;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
@@ -148,11 +149,28 @@ public class Main extends Activity {
mText = (TextView) findViewById(R.id.text);
String[] localeNames = getAssets().getLocales();
- Arrays.sort(localeNames);
+ Arrays.sort(localeNames, new Comparator<String>() {
+ // Override the string comparator so that en is sorted behind en_US.
+ // As a result, en_US will be matched first in recovery.
+ @Override
+ public int compare(String s1, String s2) {
+ if (s1.equals(s2)) {
+ return 0;
+ } else if (s1.startsWith(s2)) {
+ return -1;
+ } else if (s2.startsWith(s1)) {
+ return 1;
+ }
+ return s1.compareTo(s2);
+ }
+ });
+
ArrayList<Locale> locales = new ArrayList<Locale>();
for (String localeName : localeNames) {
Log.i(TAG, "locale = " + localeName);
- locales.add(Locale.forLanguageTag(localeName));
+ if (!localeName.isEmpty()) {
+ locales.add(Locale.forLanguageTag(localeName));
+ }
}
final Runnable seq = buildSequence(locales.toArray(new Locale[0]));