am c6452f25
: Merge "Remove reference to string.english_ime_name"
* commit 'c6452f2569448aee841ad70baaa27c660a753aff': Remove reference to string.english_ime_name
This commit is contained in:
commit
3d0fee4e09
3 changed files with 15 additions and 11 deletions
|
@ -61,13 +61,14 @@ public final class KeyboardTextsSet {
|
|||
}
|
||||
}
|
||||
|
||||
public void loadStringResources(Context context) {
|
||||
loadStringResourcesInternal(context, RESOURCE_NAMES, R.string.english_ime_name);
|
||||
public void loadStringResources(final Context context) {
|
||||
final int referenceId = context.getApplicationInfo().labelRes;
|
||||
loadStringResourcesInternal(context, RESOURCE_NAMES, referenceId);
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
void loadStringResourcesInternal(Context context, final String[] resourceNames,
|
||||
int referenceId) {
|
||||
void loadStringResourcesInternal(final Context context, final String[] resourceNames,
|
||||
final int referenceId) {
|
||||
final Resources res = context.getResources();
|
||||
final String packageName = res.getResourcePackageName(referenceId);
|
||||
for (final String resName : resourceNames) {
|
||||
|
|
|
@ -56,7 +56,8 @@ public class KeySpecParserCsvTests extends InstrumentationTestCase {
|
|||
return names.toArray(new String[names.size()]);
|
||||
}
|
||||
|
||||
private static void assertArrayEquals(String message, Object[] expected, Object[] actual) {
|
||||
private static void assertArrayEquals(final String message, final Object[] expected,
|
||||
final Object[] actual) {
|
||||
if (expected == actual) {
|
||||
return;
|
||||
}
|
||||
|
@ -74,14 +75,15 @@ public class KeySpecParserCsvTests extends InstrumentationTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private void assertTextArray(String message, String value, String ... expectedArray) {
|
||||
private void assertTextArray(final String message, final String value,
|
||||
final String ... expectedArray) {
|
||||
final String resolvedActual = KeySpecParser.resolveTextReference(value, mTextsSet);
|
||||
final String[] actual = StringUtils.parseCsvString(resolvedActual);
|
||||
final String[] expected = (expectedArray.length == 0) ? null : expectedArray;
|
||||
assertArrayEquals(message, expected, actual);
|
||||
}
|
||||
|
||||
private void assertError(String message, String value, String ... expected) {
|
||||
private void assertError(final String message, final String value, final String ... expected) {
|
||||
try {
|
||||
assertTextArray(message, value, expected);
|
||||
fail(message);
|
||||
|
|
|
@ -61,13 +61,14 @@ public final class KeyboardTextsSet {
|
|||
}
|
||||
}
|
||||
|
||||
public void loadStringResources(Context context) {
|
||||
loadStringResourcesInternal(context, RESOURCE_NAMES, R.string.english_ime_name);
|
||||
public void loadStringResources(final Context context) {
|
||||
final int referenceId = context.getApplicationInfo().labelRes;
|
||||
loadStringResourcesInternal(context, RESOURCE_NAMES, referenceId);
|
||||
}
|
||||
|
||||
@UsedForTesting
|
||||
void loadStringResourcesInternal(Context context, final String[] resourceNames,
|
||||
int referenceId) {
|
||||
void loadStringResourcesInternal(final Context context, final String[] resourceNames,
|
||||
final int referenceId) {
|
||||
final Resources res = context.getResources();
|
||||
final String packageName = res.getResourcePackageName(referenceId);
|
||||
for (final String resName : resourceNames) {
|
||||
|
|
Loading…
Reference in a new issue