Move CandidateView into input view

Bug: 4175031
Change-Id: I95f379b9943d1dcab1dc5527b6e5ac5abd58e280
main
Tadashi G. Takaoka 2011-05-23 18:30:21 +09:00
parent 8c08a49895
commit c150acc7c8
13 changed files with 171 additions and 134 deletions

View File

@ -20,6 +20,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/candidates_container"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_width="match_parent"

View File

@ -20,6 +20,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/candidates_container"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_width="match_parent"

View File

@ -18,15 +18,21 @@
*/
-->
<com.android.inputmethod.keyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/candidates" />
<com.android.inputmethod.keyboard.LatinKeyboardView
android:id="@+id/latin_keyboard_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:background="@drawable/keyboard_background"
latin:keyBackground="@drawable/btn_keyboard_key"
/>
latin:keyBackground="@drawable/btn_keyboard_key" />
</LinearLayout>

View File

@ -18,15 +18,21 @@
*/
-->
<com.android.inputmethod.keyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/candidates" />
<com.android.inputmethod.keyboard.LatinKeyboardView
android:id="@+id/latin_keyboard_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:background="@android:color/black"
latin:keyBackground="@drawable/btn_keyboard_key3"
/>
latin:keyBackground="@drawable/btn_keyboard_key3" />
</LinearLayout>

View File

@ -18,16 +18,22 @@
*/
-->
<com.android.inputmethod.keyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/candidates" />
<com.android.inputmethod.keyboard.LatinKeyboardView
android:id="@+id/latin_keyboard_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:background="@drawable/keyboard_dark_background"
latin:keyBackground="@drawable/btn_keyboard_key_gingerbread"
latin:keyLetterStyle="bold"
/>
latin:keyLetterStyle="bold" />
</LinearLayout>

View File

@ -18,16 +18,22 @@
*/
-->
<com.android.inputmethod.keyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/candidates" />
<com.android.inputmethod.keyboard.LatinKeyboardView
android:id="@+id/latin_keyboard_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:background="@drawable/keyboard_background_holo"
latin:keyBackground="@drawable/btn_keyboard_key_honeycomb"
latin:keyPreviewLayout="@layout/key_preview_honeycomb"
latin:keyPreviewHeight="@dimen/key_preview_height_holo"
@ -36,5 +42,5 @@
latin:keyTextColorDisabled="#FF63666D"
latin:keyLetterStyle="bold"
latin:shadowColor="#00000000"
latin:shadowRadius="0.0"
/>
latin:shadowRadius="0.0" />
</LinearLayout>

View File

@ -18,21 +18,27 @@
*/
-->
<com.android.inputmethod.keyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/candidates" />
<com.android.inputmethod.keyboard.LatinKeyboardView
android:id="@+id/latin_keyboard_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:background="@drawable/keyboard_background"
latin:keyBackground="@drawable/btn_keyboard_key_stone"
latin:keyTextColor="@color/latinkeyboard_key_color_black"
latin:keyTextColorDisabled="#FF808080"
latin:shadowColor="@color/latinkeyboard_key_color_white"
latin:keyLetterStyle="bold"
latin:colorScheme="black"
latin:popupLayout="@layout/keyboard_popup_stone"
/>
latin:popupLayout="@layout/keyboard_popup_stone" />
</LinearLayout>

View File

@ -18,20 +18,26 @@
*/
-->
<com.android.inputmethod.keyboard.LatinKeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<include
layout="@layout/candidates" />
<com.android.inputmethod.keyboard.LatinKeyboardView
android:id="@+id/latin_keyboard_view"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip"
android:background="@drawable/keyboard_background"
latin:keyBackground="@drawable/btn_keyboard_key_stone"
latin:keyTextColor="@color/latinkeyboard_key_color_black"
latin:keyTextColorDisabled="#FF808080"
latin:shadowColor="@color/latinkeyboard_key_color_white"
latin:colorScheme="black"
latin:popupLayout="@layout/keyboard_popup_stone"
/>
latin:popupLayout="@layout/keyboard_popup_stone" />
</LinearLayout>

View File

@ -536,7 +536,7 @@ public class VoiceProxy implements VoiceInput.UiListener {
((ViewGroup) p).removeView(v);
}
View keyboardView = KeyboardSwitcher.getInstance().getInputView();
View keyboardView = KeyboardSwitcher.getInstance().getKeyboardView();
// The full height of the keyboard is difficult to calculate
// as the dimension is expressed in "mm" and not in "pixel"
@ -691,7 +691,7 @@ public class VoiceProxy implements VoiceInput.UiListener {
if (mSubtypeSwitcher.isVoiceMode() && windowToken != null) {
// Close keyboard view if it is been shown.
if (KeyboardSwitcher.getInstance().isInputViewShown())
KeyboardSwitcher.getInstance().getInputView().purgeKeyboardAndClosing();
KeyboardSwitcher.getInstance().getKeyboardView().purgeKeyboardAndClosing();
startListening(false, windowToken);
}
// If we have no token, onAttachedToWindow will take care of showing dialog and start

View File

@ -57,6 +57,6 @@ public class RecorrectionSuggestionEntries {
private static SuggestedWords.Builder getTypedSuggestions(
Suggest suggest, KeyboardSwitcher keyboardSwitcher, WordComposer word) {
return suggest.getSuggestedWordBuilder(keyboardSwitcher.getInputView(), word, null);
return suggest.getSuggestedWordBuilder(keyboardSwitcher.getKeyboardView(), word, null);
}
}

View File

@ -16,6 +16,15 @@
package com.android.inputmethod.keyboard;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
@ -24,13 +33,6 @@ import com.android.inputmethod.latin.Settings;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.Utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
import android.view.InflateException;
import android.view.inputmethod.EditorInfo;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Locale;
@ -54,7 +56,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private SubtypeSwitcher mSubtypeSwitcher;
private SharedPreferences mPrefs;
private LatinKeyboardView mInputView;
private View mInputView;
private LatinKeyboardView mKeyboardView;
private LatinIME mInputMethodService;
// TODO: Combine these key state objects with auto mode switch state.
@ -143,7 +146,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private void loadKeyboardInternal(EditorInfo attribute, boolean voiceButtonEnabled,
boolean voiceButtonOnPrimary, boolean isSymbols) {
if (mInputView == null) return;
if (mKeyboardView == null) return;
mAttribute = attribute;
mVoiceKeyEnabled = voiceButtonEnabled;
@ -178,11 +181,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
private void setKeyboard(final Keyboard newKeyboard) {
final Keyboard oldKeyboard = mInputView.getKeyboard();
mInputView.setKeyboard(newKeyboard);
final Keyboard oldKeyboard = mKeyboardView.getKeyboard();
mKeyboardView.setKeyboard(newKeyboard);
mCurrentId = newKeyboard.mId;
final Resources res = mInputMethodService.getResources();
mInputView.setKeyPreviewPopupEnabled(
mKeyboardView.setKeyPreviewPopupEnabled(
Settings.Values.isKeyPreviewPopupEnabled(mPrefs, res),
Settings.Values.getKeyPreviewPopupDismissDelay(mPrefs, res));
final boolean localeChanged = (oldKeyboard == null)
@ -291,18 +294,18 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public boolean isInputViewShown() {
return mInputView != null && mInputView.isShown();
return mKeyboardView != null && mKeyboardView.isShown();
}
public boolean isKeyboardAvailable() {
if (mInputView != null)
return mInputView.getKeyboard() != null;
if (mKeyboardView != null)
return mKeyboardView.getKeyboard() != null;
return false;
}
public LatinKeyboard getLatinKeyboard() {
if (mInputView != null) {
final Keyboard keyboard = mInputView.getKeyboard();
if (mKeyboardView != null) {
final Keyboard keyboard = mKeyboardView.getKeyboard();
if (keyboard instanceof LatinKeyboard)
return (LatinKeyboard)keyboard;
}
@ -355,7 +358,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
latinKeyboard.setShiftLocked(false);
}
if (latinKeyboard.setShifted(shifted)) {
mInputView.invalidateAllKeys();
mKeyboardView.invalidateAllKeys();
}
}
}
@ -363,7 +366,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private void setShiftLocked(boolean shiftLocked) {
LatinKeyboard latinKeyboard = getLatinKeyboard();
if (latinKeyboard != null && latinKeyboard.setShiftLocked(shiftLocked)) {
mInputView.invalidateAllKeys();
mKeyboardView.invalidateAllKeys();
}
}
@ -405,7 +408,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
LatinKeyboard latinKeyboard = getLatinKeyboard();
if (latinKeyboard != null) {
latinKeyboard.setAutomaticTemporaryUpperCase();
mInputView.invalidateAllKeys();
mKeyboardView.invalidateAllKeys();
}
}
@ -500,7 +503,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
// To be able to turn off caps lock by "double tap" on shift key, we should ignore
// the second tap of the "double tap" from now for a while because we just have
// already turned off caps lock above.
mInputView.startIgnoringDoubleTap();
mKeyboardView.startIgnoringDoubleTap();
} else if (isShiftedOrShiftLocked() && shiftKeyState.isPressingOnShifted()
&& !withSliding) {
// Shift has been pressed without chording while shifted state.
@ -589,11 +592,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public boolean isVibrateAndSoundFeedbackRequired() {
return mInputView == null || !mInputView.isInSlidingKeyInput();
return mKeyboardView == null || !mKeyboardView.isInSlidingKeyInput();
}
private int getPointerCount() {
return mInputView == null ? 0 : mInputView.getPointerCount();
return mKeyboardView == null ? 0 : mKeyboardView.getPointerCount();
}
private void toggleKeyboardMode() {
@ -606,7 +609,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public boolean hasDistinctMultitouch() {
return mInputView != null && mInputView.hasDistinctMultitouch();
return mKeyboardView != null && mKeyboardView.hasDistinctMultitouch();
}
private static boolean isSpaceCharacter(int c) {
@ -703,20 +706,20 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
}
public LatinKeyboardView getInputView() {
return mInputView;
public LatinKeyboardView getKeyboardView() {
return mKeyboardView;
}
public LatinKeyboardView onCreateInputView() {
public View onCreateInputView() {
createInputViewInternal(mLayoutId, true);
return mInputView;
}
private void createInputViewInternal(int newLayout, boolean forceReset) {
int layoutId = newLayout;
if (mLayoutId != layoutId || mInputView == null || forceReset) {
if (mInputView != null) {
mInputView.closing();
if (mLayoutId != layoutId || mKeyboardView == null || forceReset) {
if (mKeyboardView != null) {
mKeyboardView.closing();
}
if (KEYBOARD_THEMES.length <= layoutId) {
layoutId = Integer.valueOf(sConfigDefaultKeyboardThemeId);
@ -726,8 +729,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
boolean tryGC = true;
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try {
mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater(
).inflate(KEYBOARD_THEMES[layoutId], null);
mInputView = LayoutInflater.from(mInputMethodService).inflate(
KEYBOARD_THEMES[layoutId], null);
tryGC = false;
} catch (OutOfMemoryError e) {
Log.w(TAG, "load keyboard failed: " + e);
@ -739,7 +742,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mLayoutId + "," + layoutId, e);
}
}
mInputView.setOnKeyboardActionListener(mInputMethodService);
mKeyboardView = (LatinKeyboardView)mInputView.findViewById(R.id.latin_keyboard_view);
mKeyboardView.setOnKeyboardActionListener(mInputMethodService);
mLayoutId = layoutId;
}
}
@ -748,8 +752,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputMethodService.mHandler.post(new Runnable() {
@Override
public void run() {
if (mInputView != null) {
mInputMethodService.setInputView(mInputView);
if (mKeyboardView != null) {
mInputMethodService.setInputView(mKeyboardView);
}
mInputMethodService.updateInputViewShown();
}
@ -772,13 +776,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
private int getColorScheme() {
return (mInputView != null)
? mInputView.getColorScheme() : KeyboardView.COLOR_SCHEME_WHITE;
return (mKeyboardView != null)
? mKeyboardView.getColorScheme() : KeyboardView.COLOR_SCHEME_WHITE;
}
public void onAutoCorrectionStateChanged(boolean isAutoCorrection) {
if (isAutoCorrection != mIsAutoCorrectionActive) {
LatinKeyboardView keyboardView = getInputView();
LatinKeyboardView keyboardView = getKeyboardView();
mIsAutoCorrectionActive = isAutoCorrection;
keyboardView.invalidateKey(((LatinKeyboard) keyboardView.getKeyboard())
.onAutoCorrectionStateChanged(isAutoCorrection));

View File

@ -16,22 +16,6 @@
package com.android.inputmethod.latin;
import com.android.inputmethod.compat.CompatUtils;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.compat.InputConnectionCompatUtils;
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import com.android.inputmethod.compat.InputMethodServiceCompatWrapper;
import com.android.inputmethod.compat.InputTypeCompatUtils;
import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
import com.android.inputmethod.deprecated.VoiceProxy;
import com.android.inputmethod.deprecated.recorrection.Recorrection;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -59,7 +43,6 @@ import android.util.PrintWriterPrinter;
import android.util.Printer;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
@ -69,7 +52,22 @@ import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.InputConnection;
import android.widget.LinearLayout;
import com.android.inputmethod.compat.CompatUtils;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.compat.InputConnectionCompatUtils;
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import com.android.inputmethod.compat.InputMethodServiceCompatWrapper;
import com.android.inputmethod.compat.InputTypeCompatUtils;
import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
import com.android.inputmethod.deprecated.VoiceProxy;
import com.android.inputmethod.deprecated.recorrection.Recorrection;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@ -217,7 +215,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void handleMessage(Message msg) {
final KeyboardSwitcher switcher = mKeyboardSwitcher;
final LatinKeyboardView inputView = switcher.getInputView();
final LatinKeyboardView inputView = switcher.getKeyboardView();
switch (msg.what) {
case MSG_UPDATE_SUGGESTIONS:
updateSuggestions();
@ -307,7 +305,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public void startDisplayLanguageOnSpacebar(boolean localeChanged) {
removeMessages(MSG_FADEOUT_LANGUAGE_ON_SPACEBAR);
removeMessages(MSG_DISMISS_LANGUAGE_ON_SPACEBAR);
final LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
final LatinKeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null) {
final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard();
// The language is always displayed when the delay is negative.
@ -483,25 +481,23 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public View onCreateInputView() {
return mKeyboardSwitcher.onCreateInputView();
final View inputView = mKeyboardSwitcher.onCreateInputView();
mCandidateViewContainer = inputView.findViewById(R.id.candidates_container);
mCandidateView = (CandidateView) inputView.findViewById(R.id.candidates);
mCandidateStripHeight = (int)mResources.getDimension(R.dimen.candidate_strip_height);
return inputView;
}
@Override
public View onCreateCandidatesView() {
LayoutInflater inflater = getLayoutInflater();
LinearLayout container = (LinearLayout)inflater.inflate(R.layout.candidates, null);
mCandidateViewContainer = container;
mCandidateStripHeight = (int)mResources.getDimension(R.dimen.candidate_strip_height);
mCandidateView = (CandidateView) container.findViewById(R.id.candidates);
mCandidateView.setService(this);
setCandidatesViewShown(true);
return container;
public void setCandidatesView(View view) {
// To ensure that CandidatesView will never be set.
return;
}
@Override
public void onStartInputView(EditorInfo attribute, boolean restarting) {
final KeyboardSwitcher switcher = mKeyboardSwitcher;
LatinKeyboardView inputView = switcher.getInputView();
LatinKeyboardView inputView = switcher.getKeyboardView();
if (DEBUG) {
Log.d(TAG, "onStartInputView: " + inputView);
@ -550,7 +546,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
switcher.updateShiftState();
}
setCandidatesViewShownInternal(isCandidateStripVisible(), false /* needsInputViewShown */ );
setSuggestionStripShownInternal(isCandidateStripVisible(), /* needsInputViewShown */ false);
// Delay updating suggestions because keyboard input view may not be shown at this point.
mHandler.postUpdateSuggestions();
@ -626,7 +622,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onWindowHidden() {
super.onWindowHidden();
KeyboardView inputView = mKeyboardSwitcher.getInputView();
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null) inputView.closing();
}
@ -639,7 +635,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mVoiceProxy.flushVoiceInputLogs(mConfigurationChanging);
KeyboardView inputView = mKeyboardSwitcher.getInputView();
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null) inputView.closing();
if (mAutoDictionary != null) mAutoDictionary.flushPendingWrites();
if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites();
@ -648,7 +644,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onFinishInputView(boolean finishingInput) {
super.onFinishInputView(finishingInput);
KeyboardView inputView = mKeyboardSwitcher.getInputView();
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null) inputView.setForeground(false);
// Remove pending messages related to update suggestions
mHandler.cancelUpdateSuggestions();
@ -804,11 +800,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// When in fullscreen mode, show completions generated by the application
setSuggestions(builder.build());
mBestWord = null;
setCandidatesViewShown(true);
setSuggestionStripShown(true);
}
}
private void setCandidatesViewShownInternal(boolean shown, boolean needsInputViewShown) {
private void setSuggestionStripShownInternal(boolean shown, boolean needsInputViewShown) {
// TODO: Modify this if we support candidates with hard keyboard
if (onEvaluateInputViewShown()) {
final boolean shouldShowCandidates = shown
@ -816,26 +812,25 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (isExtractViewShown()) {
// No need to have extra space to show the key preview.
mCandidateViewContainer.setMinimumHeight(0);
super.setCandidatesViewShown(shouldShowCandidates);
mCandidateViewContainer.setVisibility(
shouldShowCandidates ? View.VISIBLE : View.GONE);
} else {
// We must control the visibility of the suggestion strip in order to avoid clipped
// key previews, even when we don't show the suggestion strip.
mCandidateViewContainer.setVisibility(
shouldShowCandidates ? View.VISIBLE : View.INVISIBLE);
super.setCandidatesViewShown(true);
}
}
}
@Override
public void setCandidatesViewShown(boolean shown) {
setCandidatesViewShownInternal(shown, true /* needsInputViewShown */ );
private void setSuggestionStripShown(boolean shown) {
setSuggestionStripShownInternal(shown, /* needsInputViewShown */true);
}
@Override
public void onComputeInsets(InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
final KeyboardView inputView = mKeyboardSwitcher.getInputView();
final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView == null)
return;
final int containerHeight = mCandidateViewContainer.getHeight();
@ -877,8 +872,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (event.getRepeatCount() == 0 && mKeyboardSwitcher.getInputView() != null) {
if (mKeyboardSwitcher.getInputView().handleBack()) {
if (event.getRepeatCount() == 0 && mKeyboardSwitcher.getKeyboardView() != null) {
if (mKeyboardSwitcher.getKeyboardView().handleBack()) {
return true;
}
}
@ -1365,7 +1360,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
commitTyped(getCurrentInputConnection());
mVoiceProxy.handleClose();
requestHideSelf(0);
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
LatinKeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null)
inputView.closing();
}
@ -1401,7 +1396,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (DEBUG) {
Log.d(TAG, "Switch to keyboard view.");
}
View v = mKeyboardSwitcher.getInputView();
View v = mKeyboardSwitcher.getKeyboardView();
if (v != null) {
// Confirms that the keyboard view doesn't have parent view.
ViewParent p = v.getParent();
@ -1410,7 +1405,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
setInputView(v);
}
setCandidatesViewShown(isCandidateStripVisible());
setSuggestionStripShown(isCandidateStripVisible());
updateInputViewShown();
mHandler.postUpdateSuggestions();
}
@ -1452,7 +1447,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
CharSequence prevWord = EditingUtils.getPreviousWord(getCurrentInputConnection(),
mSettingsValues.mWordSeparators);
SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(
mKeyboardSwitcher.getInputView(), word, prevWord);
mKeyboardSwitcher.getKeyboardView(), word, prevWord);
boolean correctionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasAutoCorrection();
final CharSequence typedWord = word.getTypedWord();
@ -1501,7 +1496,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} else {
mBestWord = null;
}
setCandidatesViewShown(isCandidateStripVisible());
setSuggestionStripShown(isCandidateStripVisible());
}
private boolean pickDefaultSuggestion(int separatorCode) {
@ -1664,7 +1659,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(),
mSettingsValues.mWordSeparators);
SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(
mKeyboardSwitcher.getInputView(), sEmptyWordComposer, prevWord);
mKeyboardSwitcher.getKeyboardView(), sEmptyWordComposer, prevWord);
if (builder.size() > 0) {
// Explicitly supply an empty typed word (the no-second-arg version of
@ -1677,7 +1672,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public void setPunctuationSuggestions() {
setSuggestions(mSettingsValues.mSuggestPuncList);
setCandidatesViewShown(isCandidateStripVisible());
setSuggestionStripShown(isCandidateStripVisible());
}
private void addToAutoAndUserBigramDictionaries(CharSequence suggestion, int frequencyDelta) {
@ -1886,7 +1881,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// if mAudioManager is null, we don't have the ringer state yet
// mAudioManager will be set by updateRingerMode
if (mAudioManager == null) {
if (mKeyboardSwitcher.getInputView() != null) {
if (mKeyboardSwitcher.getKeyboardView() != null) {
updateRingerMode();
}
}
@ -1913,7 +1908,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (!mSettingsValues.mVibrateOn) {
return;
}
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
LatinKeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null) {
inputView.performHapticFeedback(
HapticFeedbackConstants.KEYBOARD_TAP,
@ -2037,7 +2032,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private void showOptionsMenuInternal(CharSequence title, CharSequence[] items,
DialogInterface.OnClickListener listener) {
final IBinder windowToken = mKeyboardSwitcher.getInputView().getWindowToken();
final IBinder windowToken = mKeyboardSwitcher.getKeyboardView().getWindowToken();
if (windowToken == null) return;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);

View File

@ -413,7 +413,7 @@ public class SubtypeSwitcher {
final KeyboardSwitcher switcher = KeyboardSwitcher.getInstance();
final LatinKeyboard keyboard = switcher.getLatinKeyboard();
if (keyboard != null) {
keyboard.updateShortcutKey(isShortcutImeReady(), switcher.getInputView());
keyboard.updateShortcutKey(isShortcutImeReady(), switcher.getKeyboardView());
}
}
@ -503,7 +503,7 @@ public class SubtypeSwitcher {
private void triggerVoiceIME() {
if (!mService.isInputViewShown()) return;
VoiceProxy.getInstance().startListening(false,
KeyboardSwitcher.getInstance().getInputView().getWindowToken());
KeyboardSwitcher.getInstance().getKeyboardView().getWindowToken());
}
//////////////////////////////////////