aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/Constants.java5
-rw-r--r--java/src/com/android/inputmethod/latin/InputView.java32
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java30
3 files changed, 32 insertions, 35 deletions
diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java
index 6d67bdb04..8aec03f71 100644
--- a/java/src/com/android/inputmethod/latin/Constants.java
+++ b/java/src/com/android/inputmethod/latin/Constants.java
@@ -187,7 +187,7 @@ public final class Constants {
public static final int CODE_ACTION_NEXT = -8;
public static final int CODE_ACTION_PREVIOUS = -9;
public static final int CODE_LANGUAGE_SWITCH = -10;
- public static final int CODE_RESEARCH = -11;
+ public static final int CODE_EMOJI = -11;
public static final int CODE_SHIFT_ENTER = -12;
// Code value representing the code is not specified.
public static final int CODE_UNSPECIFIED = -13;
@@ -208,10 +208,11 @@ public final class Constants {
case CODE_ACTION_NEXT: return "actionNext";
case CODE_ACTION_PREVIOUS: return "actionPrevious";
case CODE_LANGUAGE_SWITCH: return "languageSwitch";
+ case CODE_EMOJI: return "emoji";
+ case CODE_SHIFT_ENTER: return "shiftEnter";
case CODE_UNSPECIFIED: return "unspec";
case CODE_TAB: return "tab";
case CODE_ENTER: return "enter";
- case CODE_RESEARCH: return "research";
default:
if (code < CODE_SPACE) return String.format("'\\u%02x'", code);
if (code < 0x100) return String.format("'%c'", code);
diff --git a/java/src/com/android/inputmethod/latin/InputView.java b/java/src/com/android/inputmethod/latin/InputView.java
index 5359c8185..81ccf83d8 100644
--- a/java/src/com/android/inputmethod/latin/InputView.java
+++ b/java/src/com/android/inputmethod/latin/InputView.java
@@ -24,7 +24,7 @@ import android.view.View;
import android.widget.LinearLayout;
public final class InputView extends LinearLayout {
- private View mSuggestionStripContainer;
+ private View mSuggestionStripView;
private View mKeyboardView;
private int mKeyboardTopPadding;
@@ -33,33 +33,29 @@ public final class InputView extends LinearLayout {
private final Rect mEventForwardingRect = new Rect();
private final Rect mEventReceivingRect = new Rect();
- public InputView(Context context, AttributeSet attrs) {
+ public InputView(final Context context, final AttributeSet attrs) {
super(context, attrs, 0);
}
- public void setKeyboardGeometry(int keyboardTopPadding) {
+ public void setKeyboardGeometry(final int keyboardTopPadding) {
mKeyboardTopPadding = keyboardTopPadding;
}
@Override
protected void onFinishInflate() {
- mSuggestionStripContainer = findViewById(R.id.suggestions_container);
+ mSuggestionStripView = findViewById(R.id.suggestion_strip_view);
mKeyboardView = findViewById(R.id.keyboard_view);
}
@Override
- public boolean dispatchTouchEvent(MotionEvent me) {
- if (mSuggestionStripContainer.getVisibility() == VISIBLE
- && mKeyboardView.getVisibility() == VISIBLE
- && forwardTouchEvent(me)) {
- return true;
+ public boolean dispatchTouchEvent(final MotionEvent me) {
+ if (mSuggestionStripView.getVisibility() != VISIBLE
+ || mKeyboardView.getVisibility() != VISIBLE) {
+ return super.dispatchTouchEvent(me);
}
- return super.dispatchTouchEvent(me);
- }
- // The touch events that hit the top padding of keyboard should be forwarded to
- // {@link SuggestionStripView}.
- private boolean forwardTouchEvent(MotionEvent me) {
+ // The touch events that hit the top padding of keyboard should be forwarded to
+ // {@link SuggestionStripView}.
final Rect rect = mInputViewRect;
this.getGlobalVisibleRect(rect);
final int x = (int)me.getX() + rect.left;
@@ -68,7 +64,7 @@ public final class InputView extends LinearLayout {
final Rect forwardingRect = mEventForwardingRect;
mKeyboardView.getGlobalVisibleRect(forwardingRect);
if (!mIsForwardingEvent && !forwardingRect.contains(x, y)) {
- return false;
+ return super.dispatchTouchEvent(me);
}
final int forwardingLimitY = forwardingRect.top + mKeyboardTopPadding;
@@ -93,11 +89,11 @@ public final class InputView extends LinearLayout {
}
if (!sendToTarget) {
- return false;
+ return super.dispatchTouchEvent(me);
}
final Rect receivingRect = mEventReceivingRect;
- mSuggestionStripContainer.getGlobalVisibleRect(receivingRect);
+ mSuggestionStripView.getGlobalVisibleRect(receivingRect);
final int translatedX = x - receivingRect.left;
final int translatedY;
if (y < forwardingLimitY) {
@@ -107,7 +103,7 @@ public final class InputView extends LinearLayout {
translatedY = y - receivingRect.top;
}
me.setLocation(translatedX, translatedY);
- mSuggestionStripContainer.dispatchTouchEvent(me);
+ mSuggestionStripView.dispatchTouchEvent(me);
return true;
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 719c7c81f..d970bca5e 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -152,7 +152,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private View mExtractArea;
private View mKeyPreviewBackingView;
- private View mSuggestionsContainer;
private SuggestionStripView mSuggestionStripView;
// Never null
private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY;
@@ -667,7 +666,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mExtractArea = getWindow().getWindow().getDecorView()
.findViewById(android.R.id.extractArea);
mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing);
- mSuggestionsContainer = view.findViewById(R.id.suggestions_container);
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
if (mSuggestionStripView != null)
mSuggestionStripView.setListener(this, view);
@@ -1111,17 +1109,17 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void setSuggestionStripShownInternal(final boolean shown,
final boolean needsInputViewShown) {
// TODO: Modify this if we support suggestions with hard keyboard
- if (onEvaluateInputViewShown() && mSuggestionsContainer != null) {
+ if (onEvaluateInputViewShown() && mSuggestionStripView != null) {
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
final boolean inputViewShown = (mainKeyboardView != null)
? mainKeyboardView.isShown() : false;
final boolean shouldShowSuggestions = shown
&& (needsInputViewShown ? inputViewShown : true);
if (isFullscreenMode()) {
- mSuggestionsContainer.setVisibility(
+ mSuggestionStripView.setVisibility(
shouldShowSuggestions ? View.VISIBLE : View.GONE);
} else {
- mSuggestionsContainer.setVisibility(
+ mSuggestionStripView.setVisibility(
shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE);
}
}
@@ -1142,7 +1140,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return 0;
}
final int keyboardHeight = mainKeyboardView.getHeight();
- final int suggestionsHeight = mSuggestionsContainer.getHeight();
+ final int suggestionsHeight = mSuggestionStripView.getHeight();
final int displayHeight = getResources().getDisplayMetrics().heightPixels;
final Rect rect = new Rect();
mKeyPreviewBackingView.getWindowVisibleDisplayFrame(rect);
@@ -1160,7 +1158,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onComputeInsets(final InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
- if (mainKeyboardView == null || mSuggestionsContainer == null) {
+ if (mainKeyboardView == null || mSuggestionStripView == null) {
return;
}
final int adjustedBackingHeight = getAdjustedBackingViewHeight();
@@ -1170,13 +1168,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// be considered.
// See {@link android.inputmethodservice.InputMethodService#onComputeInsets}.
final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0;
- final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0
- : mSuggestionsContainer.getHeight();
+ final int suggestionsHeight = (mSuggestionStripView.getVisibility() == View.GONE) ? 0
+ : mSuggestionStripView.getHeight();
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
int visibleTopY = extraHeight;
// Need to set touchable region only if input view is being shown
if (mainKeyboardView.isShown()) {
- if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
+ if (mSuggestionStripView.getVisibility() == View.VISIBLE) {
visibleTopY -= suggestionsHeight;
}
final int touchY = mainKeyboardView.isShowingMoreKeysPanel() ? 0 : visibleTopY;
@@ -1512,10 +1510,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
case Constants.CODE_LANGUAGE_SWITCH:
handleLanguageSwitchKey();
break;
- case Constants.CODE_RESEARCH:
- if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
- ResearchLogger.getInstance().onResearchKeySelected(this);
- }
+ case Constants.CODE_EMOJI:
+ // TODO: Implement emoji keyboard switch.
break;
case Constants.CODE_ENTER:
final EditorInfo editorInfo = getCurrentInputEditorInfo();
@@ -1608,6 +1604,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
resetComposingState(true /* alsoResetLastComposedWord */);
}
mHandler.postUpdateSuggestionStrip();
+ if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS
+ && ResearchLogger.RESEARCH_KEY_OUTPUT_TEXT.equals(rawText)) {
+ ResearchLogger.getInstance().onResearchKeySelected(this);
+ return;
+ }
final String text = specificTldProcessingOnTextInput(rawText);
if (SPACE_STATE_PHANTOM == mSpaceState) {
promotePhantomSpace();
@@ -1639,7 +1640,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
final int wordComposerSize = mWordComposer.size();
// Since isComposingWord() is true, the size is at least 1.
- final int lastChar = mWordComposer.getCodeBeforeCursor();
if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
// If we are in the middle of a recorrection, we need to commit the recorrection
// first so that we can insert the batch input at the current cursor position.