Merge "Get rid of references to BaseKeyboard in Latin-specific classes"
commit
55952c9868
|
@ -1791,7 +1791,7 @@ public class LatinIME extends InputMethodService
|
|||
|
||||
private void updateSuggestions() {
|
||||
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||
((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(null);
|
||||
inputView.getLatinKeyboard().setPreferredLetters(null);
|
||||
|
||||
// Check if we have a suggestion engine attached.
|
||||
if ((mSuggest == null || !isPredictionOn()) && !mVoiceInputHighlighted) {
|
||||
|
@ -1813,7 +1813,7 @@ public class LatinIME extends InputMethodService
|
|||
|
||||
private void showCorrections(WordAlternatives alternatives) {
|
||||
List<CharSequence> stringList = alternatives.getAlternatives();
|
||||
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setPreferredLetters(null);
|
||||
mKeyboardSwitcher.getInputView().getLatinKeyboard().setPreferredLetters(null);
|
||||
showSuggestions(stringList, alternatives.getOriginalWord(), false, false);
|
||||
}
|
||||
|
||||
|
@ -1829,7 +1829,7 @@ public class LatinIME extends InputMethodService
|
|||
|
||||
int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies();
|
||||
|
||||
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setPreferredLetters(
|
||||
mKeyboardSwitcher.getInputView().getLatinKeyboard().setPreferredLetters(
|
||||
nextLettersFrequencies);
|
||||
|
||||
boolean correctionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasMinimalCorrection();
|
||||
|
@ -2018,7 +2018,7 @@ public class LatinIME extends InputMethodService
|
|||
saveWordInHistory(suggestion);
|
||||
mPredicting = false;
|
||||
mCommittedLength = suggestion.length();
|
||||
((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(null);
|
||||
inputView.getLatinKeyboard().setPreferredLetters(null);
|
||||
// If we just corrected a word, then don't show punctuations
|
||||
if (!correcting) {
|
||||
setNextSuggestions();
|
||||
|
@ -2321,7 +2321,7 @@ public class LatinIME extends InputMethodService
|
|||
|
||||
public void onRelease(int primaryCode) {
|
||||
// Reset any drag flags in the keyboard
|
||||
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased();
|
||||
mKeyboardSwitcher.getInputView().getLatinKeyboard().keyReleased();
|
||||
//vibrate();
|
||||
final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch();
|
||||
if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) {
|
||||
|
|
|
@ -598,7 +598,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
* @see #getKeyboard()
|
||||
* @param keyboard the keyboard to display in this view
|
||||
*/
|
||||
public void setKeyboard(BaseKeyboard keyboard) {
|
||||
protected void setKeyboard(BaseKeyboard keyboard) {
|
||||
if (mKeyboard != null) {
|
||||
dismissKeyPreview();
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
|||
* @return the currently attached keyboard
|
||||
* @see #setKeyboard(BaseKeyboard)
|
||||
*/
|
||||
public BaseKeyboard getKeyboard() {
|
||||
protected BaseKeyboard getKeyboard() {
|
||||
return mKeyboard;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
public static final int KEYCODE_PREV_LANGUAGE = -105;
|
||||
public static final int KEYCODE_CAPSLOCK = -106;
|
||||
|
||||
private BaseKeyboard mPhoneKeyboard;
|
||||
private LatinKeyboard mPhoneKeyboard;
|
||||
|
||||
/** Whether we've started dropping move events because we found a big jump */
|
||||
private boolean mDroppingEvents;
|
||||
|
@ -62,13 +62,13 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public void setPhoneKeyboard(BaseKeyboard phoneKeyboard) {
|
||||
public void setPhoneKeyboard(LatinKeyboard phoneKeyboard) {
|
||||
mPhoneKeyboard = phoneKeyboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPreviewEnabled(boolean previewEnabled) {
|
||||
if (getKeyboard() == mPhoneKeyboard) {
|
||||
if (getLatinKeyboard() == mPhoneKeyboard) {
|
||||
// Phone keyboard never shows popup preview (except language switch).
|
||||
super.setPreviewEnabled(false);
|
||||
} else {
|
||||
|
@ -76,8 +76,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeyboard(BaseKeyboard k) {
|
||||
public void setLatinKeyboard(LatinKeyboard k) {
|
||||
super.setKeyboard(k);
|
||||
// One-seventh of the keyboard width seems like a reasonable threshold
|
||||
mJumpThresholdSquare = k.getMinWidth() / 7;
|
||||
|
@ -87,12 +86,21 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
setKeyboardLocal(k);
|
||||
}
|
||||
|
||||
public LatinKeyboard getLatinKeyboard() {
|
||||
BaseKeyboard keyboard = getKeyboard();
|
||||
if (keyboard instanceof LatinKeyboard) {
|
||||
return (LatinKeyboard)keyboard;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onLongPress(Key key) {
|
||||
int primaryCode = key.codes[0];
|
||||
if (primaryCode == KEYCODE_OPTIONS) {
|
||||
return invokeOnKey(KEYCODE_OPTIONS_LONGPRESS);
|
||||
} else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) {
|
||||
} else if (primaryCode == '0' && getLatinKeyboard() == mPhoneKeyboard) {
|
||||
// Long pressing on 0 in phone number keypad gives you a '+'.
|
||||
return invokeOnKey('+');
|
||||
} else {
|
||||
|
@ -109,9 +117,8 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
|
||||
@Override
|
||||
protected CharSequence adjustCase(CharSequence label) {
|
||||
BaseKeyboard keyboard = getKeyboard();
|
||||
if (keyboard instanceof LatinKeyboard
|
||||
&& ((LatinKeyboard) keyboard).isAlphaKeyboard()
|
||||
LatinKeyboard keyboard = getLatinKeyboard();
|
||||
if (keyboard.isAlphaKeyboard()
|
||||
&& keyboard.isShifted()
|
||||
&& !TextUtils.isEmpty(label) && label.length() < 3
|
||||
&& Character.isLowerCase(label.charAt(0))) {
|
||||
|
@ -121,14 +128,11 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
}
|
||||
|
||||
public boolean setShiftLocked(boolean shiftLocked) {
|
||||
BaseKeyboard keyboard = getKeyboard();
|
||||
if (keyboard instanceof LatinKeyboard) {
|
||||
((LatinKeyboard)keyboard).setShiftLocked(shiftLocked);
|
||||
LatinKeyboard keyboard = getLatinKeyboard();
|
||||
keyboard.setShiftLocked(shiftLocked);
|
||||
invalidateAllKeys();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks to see if we need to handle any sudden jumps in the pointer location
|
||||
|
@ -209,7 +213,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent me) {
|
||||
LatinKeyboard keyboard = (LatinKeyboard) getKeyboard();
|
||||
LatinKeyboard keyboard = getLatinKeyboard();
|
||||
if (DEBUG_LINE) {
|
||||
mLastX = (int) me.getX();
|
||||
mLastY = (int) me.getY();
|
||||
|
@ -258,7 +262,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
private int mLastY;
|
||||
private Paint mPaint;
|
||||
|
||||
private void setKeyboardLocal(BaseKeyboard k) {
|
||||
private void setKeyboardLocal(LatinKeyboard k) {
|
||||
if (DEBUG_AUTO_PLAY) {
|
||||
findKeys();
|
||||
if (mHandler2 == null) {
|
||||
|
@ -319,7 +323,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
|
|||
}
|
||||
|
||||
private void findKeys() {
|
||||
List<Key> keys = getKeyboard().getKeys();
|
||||
List<Key> keys = getLatinKeyboard().getKeys();
|
||||
// Get the keys on this keyboard
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
int code = keys.get(i).codes[0];
|
||||
|
|
Loading…
Reference in New Issue