am 94027c72: Use Locale.ROOT for locale neutral operations
* commit '94027c7201a376107a35ec78cd21db1905662601': Use Locale.ROOT for locale neutral operationsmain
commit
5b41f31183
|
@ -144,7 +144,7 @@ public final class LocaleUtils {
|
||||||
public static String getMatchLevelSortedString(final int matchLevel) {
|
public static String getMatchLevelSortedString(final int matchLevel) {
|
||||||
// This works because the match levels are 0~99 (actually 0~30)
|
// This works because the match levels are 0~99 (actually 0~30)
|
||||||
// Ideally this should use a number of digits equals to the 1og10 of the greater matchLevel
|
// Ideally this should use a number of digits equals to the 1og10 of the greater matchLevel
|
||||||
return String.format("%02d", MATCH_LEVEL_MAX - matchLevel);
|
return String.format(Locale.ROOT, "%02d", MATCH_LEVEL_MAX - matchLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -453,7 +453,7 @@ public class Key implements Comparable<Key> {
|
||||||
} else {
|
} else {
|
||||||
label = "/" + mLabel;
|
label = "/" + mLabel;
|
||||||
}
|
}
|
||||||
return String.format("%s%s %d,%d %dx%d %s/%s/%s",
|
return String.format(Locale.ROOT, "%s%s %d,%d %dx%d %s/%s/%s",
|
||||||
Constants.printableCode(mCode), label, mX, mY, mWidth, mHeight, mHintLabel,
|
Constants.printableCode(mCode), label, mX, mY, mWidth, mHeight, mHintLabel,
|
||||||
KeyboardIconsSet.getIconName(mIconId), backgroundName(mBackgroundType));
|
KeyboardIconsSet.getIconName(mIconId), backgroundName(mBackgroundType));
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ public final class KeyboardId {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final String orientation = (mOrientation == Configuration.ORIENTATION_PORTRAIT)
|
final String orientation = (mOrientation == Configuration.ORIENTATION_PORTRAIT)
|
||||||
? "port" : "land";
|
? "port" : "land";
|
||||||
return String.format("[%s %s:%s %s:%dx%d %s %s %s%s%s%s%s%s%s%s%s]",
|
return String.format(Locale.ROOT, "[%s %s:%s %s:%dx%d %s %s %s%s%s%s%s%s%s%s%s]",
|
||||||
elementIdToName(mElementId),
|
elementIdToName(mElementId),
|
||||||
mLocale,
|
mLocale,
|
||||||
mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
|
mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
|
||||||
|
|
|
@ -148,7 +148,7 @@ public final class LocaleUtils {
|
||||||
public static String getMatchLevelSortedString(int matchLevel) {
|
public static String getMatchLevelSortedString(int matchLevel) {
|
||||||
// This works because the match levels are 0~99 (actually 0~30)
|
// This works because the match levels are 0~99 (actually 0~30)
|
||||||
// Ideally this should use a number of digits equals to the 1og10 of the greater matchLevel
|
// Ideally this should use a number of digits equals to the 1og10 of the greater matchLevel
|
||||||
return String.format("%02d", MATCH_LEVEL_MAX - matchLevel);
|
return String.format(Locale.ROOT, "%02d", MATCH_LEVEL_MAX - matchLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -379,7 +379,8 @@ public final class Suggest {
|
||||||
typedWord, cur.toString(), cur.mScore);
|
typedWord, cur.toString(), cur.mScore);
|
||||||
final String scoreInfoString;
|
final String scoreInfoString;
|
||||||
if (normalizedScore > 0) {
|
if (normalizedScore > 0) {
|
||||||
scoreInfoString = String.format("%d (%4.2f)", cur.mScore, normalizedScore);
|
scoreInfoString = String.format(
|
||||||
|
Locale.ROOT, "%d (%4.2f)", cur.mScore, normalizedScore);
|
||||||
} else {
|
} else {
|
||||||
scoreInfoString = Integer.toString(cur.mScore);
|
scoreInfoString = Integer.toString(cur.mScore);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
|
|
||||||
private static final String CODE_SETTINGS = "!code/key_settings";
|
private static final String CODE_SETTINGS = "!code/key_settings";
|
||||||
private static final String ICON_SETTINGS = "!icon/settings_key";
|
private static final String ICON_SETTINGS = "!icon/settings_key";
|
||||||
private static final String CODE_SETTINGS_UPPERCASE = CODE_SETTINGS.toUpperCase();
|
private static final String CODE_SETTINGS_UPPERCASE = CODE_SETTINGS.toUpperCase(Locale.ROOT);
|
||||||
private static final String ICON_SETTINGS_UPPERCASE = ICON_SETTINGS.toUpperCase();
|
private static final String ICON_SETTINGS_UPPERCASE = ICON_SETTINGS.toUpperCase(Locale.ROOT);
|
||||||
private static final String CODE_NON_EXISTING = "!code/non_existing";
|
private static final String CODE_NON_EXISTING = "!code/non_existing";
|
||||||
private static final String ICON_NON_EXISTING = "!icon/non_existing";
|
private static final String ICON_NON_EXISTING = "!icon/non_existing";
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
new String[] { null, "a", "b", "c" }, true);
|
new String[] { null, "a", "b", "c" }, true);
|
||||||
// Upper case specification will not work.
|
// Upper case specification will not work.
|
||||||
assertGetBooleanValue("HAS LABEL", HAS_LABEL,
|
assertGetBooleanValue("HAS LABEL", HAS_LABEL,
|
||||||
new String[] { HAS_LABEL.toUpperCase(), "a", "b", "c" },
|
new String[] { HAS_LABEL.toUpperCase(Locale.ROOT), "a", "b", "c" },
|
||||||
new String[] { "!HASLABEL!", "a", "b", "c" }, false);
|
new String[] { "!HASLABEL!", "a", "b", "c" }, false);
|
||||||
|
|
||||||
assertGetBooleanValue("No has label", HAS_LABEL,
|
assertGetBooleanValue("No has label", HAS_LABEL,
|
||||||
|
@ -600,13 +600,13 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
// Upper case specification will not work.
|
// Upper case specification will not work.
|
||||||
assertGetBooleanValue("Multiple has label", HAS_LABEL,
|
assertGetBooleanValue("Multiple has label", HAS_LABEL,
|
||||||
new String[] {
|
new String[] {
|
||||||
"a", HAS_LABEL.toUpperCase(), "b", "c", HAS_LABEL, "d" },
|
"a", HAS_LABEL.toUpperCase(Locale.ROOT), "b", "c", HAS_LABEL, "d" },
|
||||||
new String[] {
|
new String[] {
|
||||||
"a", "!HASLABEL!", "b", "c", null, "d" }, true);
|
"a", "!HASLABEL!", "b", "c", null, "d" }, true);
|
||||||
// Upper case specification will not work.
|
// Upper case specification will not work.
|
||||||
assertGetBooleanValue("Multiple has label with needs dividers", HAS_LABEL,
|
assertGetBooleanValue("Multiple has label with needs dividers", HAS_LABEL,
|
||||||
new String[] {
|
new String[] {
|
||||||
"a", HAS_LABEL, "b", NEEDS_DIVIDER, HAS_LABEL.toUpperCase(), "d" },
|
"a", HAS_LABEL, "b", NEEDS_DIVIDER, HAS_LABEL.toUpperCase(Locale.ROOT), "d" },
|
||||||
new String[] {
|
new String[] {
|
||||||
"a", null, "b", NEEDS_DIVIDER, "!HASLABEL!", "d" }, true);
|
"a", null, "b", NEEDS_DIVIDER, "!HASLABEL!", "d" }, true);
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
new String[] { null, "a", "b", "c" }, 3);
|
new String[] { null, "a", "b", "c" }, 3);
|
||||||
// Upper case specification will not work.
|
// Upper case specification will not work.
|
||||||
assertGetIntValue("FIXED COLUMN ORDER 3", FIXED_COLUMN_ORDER, -1,
|
assertGetIntValue("FIXED COLUMN ORDER 3", FIXED_COLUMN_ORDER, -1,
|
||||||
new String[] { FIXED_COLUMN_ORDER.toUpperCase() + "3", "a", "b", "c" },
|
new String[] { FIXED_COLUMN_ORDER.toUpperCase(Locale.ROOT) + "3", "a", "b", "c" },
|
||||||
new String[] { "!FIXEDCOLUMNORDER!3", "a", "b", "c" }, -1);
|
new String[] { "!FIXEDCOLUMNORDER!3", "a", "b", "c" }, -1);
|
||||||
|
|
||||||
assertGetIntValue("No fixed column order", FIXED_COLUMN_ORDER, -1,
|
assertGetIntValue("No fixed column order", FIXED_COLUMN_ORDER, -1,
|
||||||
|
@ -641,7 +641,7 @@ public class KeySpecParserTests extends AndroidTestCase {
|
||||||
// Upper case specification will not work.
|
// Upper case specification will not work.
|
||||||
assertGetIntValue("Multiple fixed column order 5,3 with has label", FIXED_COLUMN_ORDER, -1,
|
assertGetIntValue("Multiple fixed column order 5,3 with has label", FIXED_COLUMN_ORDER, -1,
|
||||||
new String[] {
|
new String[] {
|
||||||
FIXED_COLUMN_ORDER.toUpperCase() + "5", HAS_LABEL, "a",
|
FIXED_COLUMN_ORDER.toUpperCase(Locale.ROOT) + "5", HAS_LABEL, "a",
|
||||||
FIXED_COLUMN_ORDER + "3", "b" },
|
FIXED_COLUMN_ORDER + "3", "b" },
|
||||||
new String[] { "!FIXEDCOLUMNORDER!5", HAS_LABEL, "a", null, "b" }, 3);
|
new String[] { "!FIXEDCOLUMNORDER!5", HAS_LABEL, "a", null, "b" }, 3);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue