Merge "Remove unnecessarily getKeyFromOutputText method from Keyboard"
commit
a685fc1792
|
@ -166,15 +166,6 @@ public class Keyboard {
|
||||||
return mSortedKeys;
|
return mSortedKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key getKeyFromOutputText(final String outputText) {
|
|
||||||
for (final Key key : getSortedKeys()) {
|
|
||||||
if (outputText.equals(key.getOutputText())) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Key getKey(final int code) {
|
public Key getKey(final int code) {
|
||||||
if (code == Constants.CODE_UNSPECIFIED) {
|
if (code == Constants.CODE_UNSPECIFIED) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -29,7 +29,6 @@ import com.android.inputmethod.latin.utils.JsonUtils;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -148,9 +147,10 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
private static Key getKeyByCode(final Collection<DynamicGridKeyboard> keyboards,
|
private static Key getKeyByCode(final Collection<DynamicGridKeyboard> keyboards,
|
||||||
final int code) {
|
final int code) {
|
||||||
for (final DynamicGridKeyboard keyboard : keyboards) {
|
for (final DynamicGridKeyboard keyboard : keyboards) {
|
||||||
final Key key = keyboard.getKey(code);
|
for (final Key key : keyboard.getSortedKeys()) {
|
||||||
if (key != null) {
|
if (key.getCode() == code) {
|
||||||
return key;
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -158,10 +158,11 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
|
|
||||||
private static Key getKeyByOutputText(final Collection<DynamicGridKeyboard> keyboards,
|
private static Key getKeyByOutputText(final Collection<DynamicGridKeyboard> keyboards,
|
||||||
final String outputText) {
|
final String outputText) {
|
||||||
for (final DynamicGridKeyboard kbd : keyboards) {
|
for (final DynamicGridKeyboard keyboard : keyboards) {
|
||||||
final Key key = kbd.getKeyFromOutputText(outputText);
|
for (final Key key : keyboard.getSortedKeys()) {
|
||||||
if (key != null) {
|
if (outputText.equals(key.getOutputText())) {
|
||||||
return key;
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue