Cleanup visibility in LatinIME (A80)
Many methods were public but could have been private: change them to private. Also, add a comment above public methods that don't come from the IMF to make it clearer why they are necessary. Change-Id: I574154b015d09c0f8542b81763f497691afdc3c1
This commit is contained in:
parent
b98414f8fd
commit
a5bb353de9
1 changed files with 23 additions and 12 deletions
|
@ -689,6 +689,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callback for the TargetApplicationGetter
|
||||||
@Override
|
@Override
|
||||||
public void onTargetApplicationKnown(final ApplicationInfo info) {
|
public void onTargetApplicationKnown(final ApplicationInfo info) {
|
||||||
mTargetApplicationInfo = info;
|
mTargetApplicationInfo = info;
|
||||||
|
@ -997,7 +998,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commitTyped(final int separatorCode) {
|
private void commitTyped(final int separatorCode) {
|
||||||
if (!mWordComposer.isComposingWord()) return;
|
if (!mWordComposer.isComposingWord()) return;
|
||||||
final CharSequence typedWord = mWordComposer.getTypedWord();
|
final CharSequence typedWord = mWordComposer.getTypedWord();
|
||||||
if (typedWord.length() > 0) {
|
if (typedWord.length() > 0) {
|
||||||
|
@ -1013,6 +1014,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
updateSuggestionsOrPredictions();
|
updateSuggestionsOrPredictions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from the KeyboardSwitcher which needs to know auto caps state to display
|
||||||
|
// the right layout.
|
||||||
public int getCurrentAutoCapsState() {
|
public int getCurrentAutoCapsState() {
|
||||||
if (!mCurrentSettings.mAutoCap) return Constants.TextUtils.CAP_MODE_OFF;
|
if (!mCurrentSettings.mAutoCap) return Constants.TextUtils.CAP_MODE_OFF;
|
||||||
|
|
||||||
|
@ -1088,6 +1091,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|| codePoint == Keyboard.CODE_CLOSING_ANGLE_BRACKET;
|
|| codePoint == Keyboard.CODE_CLOSING_ANGLE_BRACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callback for the SuggestionsView, to call when the "add to dictionary" hint is pressed.
|
||||||
@Override
|
@Override
|
||||||
public boolean addWordToUserDictionary(String word) {
|
public boolean addWordToUserDictionary(String word) {
|
||||||
mUserDictionary.addWordToUserDictionary(word, 128);
|
mUserDictionary.addWordToUserDictionary(word, 128);
|
||||||
|
@ -1285,6 +1289,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mConnection.endBatchEdit();
|
mConnection.endBatchEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from PointerTracker through the KeyboardActionListener interface
|
||||||
@Override
|
@Override
|
||||||
public void onTextInput(CharSequence text) {
|
public void onTextInput(CharSequence text) {
|
||||||
mConnection.beginBatchEdit();
|
mConnection.beginBatchEdit();
|
||||||
|
@ -1348,6 +1353,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from PointerTracker through the KeyboardActionListener interface
|
||||||
@Override
|
@Override
|
||||||
public void onCancelInput() {
|
public void onCancelInput() {
|
||||||
// User released a finger outside any key
|
// User released a finger outside any key
|
||||||
|
@ -1620,12 +1626,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
inputView.closing();
|
inputView.closing();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowingPunctuationList() {
|
// TODO: make this private
|
||||||
|
// Outside LatinIME, only used by the test suite.
|
||||||
|
/* package for tests */ boolean isShowingPunctuationList() {
|
||||||
if (mSuggestionsView == null) return false;
|
if (mSuggestionsView == null) return false;
|
||||||
return mCurrentSettings.mSuggestPuncList == mSuggestionsView.getSuggestions();
|
return mCurrentSettings.mSuggestPuncList == mSuggestionsView.getSuggestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuggestionsStripVisible() {
|
private boolean isSuggestionsStripVisible() {
|
||||||
if (mSuggestionsView == null)
|
if (mSuggestionsView == null)
|
||||||
return false;
|
return false;
|
||||||
if (mSuggestionsView.isShowingAddToDictionaryHint())
|
if (mSuggestionsView.isShowingAddToDictionaryHint())
|
||||||
|
@ -1637,7 +1645,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return mCurrentSettings.isSuggestionsRequested(mDisplayOrientation);
|
return mCurrentSettings.isSuggestionsRequested(mDisplayOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSuggestions() {
|
private void clearSuggestions() {
|
||||||
setSuggestions(SuggestedWords.EMPTY, false);
|
setSuggestions(SuggestedWords.EMPTY, false);
|
||||||
setAutoCorrectionIndicator(false);
|
setAutoCorrectionIndicator(false);
|
||||||
}
|
}
|
||||||
|
@ -1660,7 +1668,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSuggestionsOrPredictions() {
|
private void updateSuggestionsOrPredictions() {
|
||||||
mHandler.cancelUpdateSuggestionStrip();
|
mHandler.cancelUpdateSuggestionStrip();
|
||||||
|
|
||||||
// Check if we have a suggestion engine attached.
|
// Check if we have a suggestion engine attached.
|
||||||
|
@ -1778,6 +1786,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from SuggestionsView through the SuggestionsView.Listener interface
|
||||||
@Override
|
@Override
|
||||||
public void pickSuggestionManually(final int index, final CharSequence suggestion,
|
public void pickSuggestionManually(final int index, final CharSequence suggestion,
|
||||||
final int x, final int y) {
|
final int x, final int y) {
|
||||||
|
@ -1888,7 +1897,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
separatorCode, prevWord);
|
separatorCode, prevWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPunctuationSuggestions() {
|
private void setPunctuationSuggestions() {
|
||||||
if (mCurrentSettings.mBigramPredictionEnabled) {
|
if (mCurrentSettings.mBigramPredictionEnabled) {
|
||||||
clearSuggestions();
|
clearSuggestions();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1996,16 +2005,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mHandler.postUpdateSuggestionStrip();
|
mHandler.postUpdateSuggestionStrip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used by the RingCharBuffer
|
||||||
public boolean isWordSeparator(int code) {
|
public boolean isWordSeparator(int code) {
|
||||||
return mCurrentSettings.isWordSeparator(code);
|
return mCurrentSettings.isWordSeparator(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean preferCapitalization() {
|
|
||||||
return mWordComposer.isFirstCharCapitalized();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify that language or mode have been changed and toggleLanguage will update KeyboardID
|
// Notify that language or mode have been changed and toggleLanguage will update KeyboardID
|
||||||
// according to new language or mode.
|
// according to new language or mode. Called from SubtypeSwitcher.
|
||||||
public void onRefreshKeyboard() {
|
public void onRefreshKeyboard() {
|
||||||
// When the device locale is changed in SetupWizard etc., this method may get called via
|
// When the device locale is changed in SetupWizard etc., this method may get called via
|
||||||
// onConfigurationChanged before SoftInputWindow is shown.
|
// onConfigurationChanged before SoftInputWindow is shown.
|
||||||
|
@ -2022,16 +2028,20 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove this method from {@link LatinIME} and move {@link FeedbackManager} to
|
// TODO: Remove this method from {@link LatinIME} and move {@link FeedbackManager} to
|
||||||
// {@link KeyboardSwitcher}.
|
// {@link KeyboardSwitcher}. Called from KeyboardSwitcher
|
||||||
public void hapticAndAudioFeedback(final int primaryCode) {
|
public void hapticAndAudioFeedback(final int primaryCode) {
|
||||||
mFeedbackManager.hapticAndAudioFeedback(primaryCode, mKeyboardSwitcher.getKeyboardView());
|
mFeedbackManager.hapticAndAudioFeedback(primaryCode, mKeyboardSwitcher.getKeyboardView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callback called by PointerTracker through the KeyboardActionListener. This is called when a
|
||||||
|
// key is depressed; release matching call is onReleaseKey below.
|
||||||
@Override
|
@Override
|
||||||
public void onPressKey(int primaryCode) {
|
public void onPressKey(int primaryCode) {
|
||||||
mKeyboardSwitcher.onPressKey(primaryCode);
|
mKeyboardSwitcher.onPressKey(primaryCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Callback by PointerTracker through the KeyboardActionListener. This is called when a key
|
||||||
|
// is released; press matching call is onPressKey above.
|
||||||
@Override
|
@Override
|
||||||
public void onReleaseKey(int primaryCode, boolean withSliding) {
|
public void onReleaseKey(int primaryCode, boolean withSliding) {
|
||||||
mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding);
|
mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding);
|
||||||
|
@ -2076,6 +2086,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
launchSettingsClass(SettingsActivity.class);
|
launchSettingsClass(SettingsActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called from debug code only
|
||||||
public void launchDebugSettings() {
|
public void launchDebugSettings() {
|
||||||
launchSettingsClass(DebugSettingsActivity.class);
|
launchSettingsClass(DebugSettingsActivity.class);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue