aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-07-09 12:54:42 +0900
committerJean Chalard <jchalard@google.com>2012-07-10 18:05:15 +0900
commita5bb353de92a6a6d010ba1695b9dd22b3a617b77 (patch)
treec8ba781be0b8c45db81bb9ed981b506fdf0fae3c /java/src
parentb98414f8fd80db409cc0021ebea0e1492846d7a4 (diff)
downloadlatinime-a5bb353de92a6a6d010ba1695b9dd22b3a617b77.tar.gz
latinime-a5bb353de92a6a6d010ba1695b9dd22b3a617b77.tar.xz
latinime-a5bb353de92a6a6d010ba1695b9dd22b3a617b77.zip
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
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java35
1 files changed, 23 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 5ee539cc8..47e721fad 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -689,6 +689,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
}
+ // Callback for the TargetApplicationGetter
@Override
public void onTargetApplicationKnown(final ApplicationInfo info) {
mTargetApplicationInfo = info;
@@ -997,7 +998,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
}
- public void commitTyped(final int separatorCode) {
+ private void commitTyped(final int separatorCode) {
if (!mWordComposer.isComposingWord()) return;
final CharSequence typedWord = mWordComposer.getTypedWord();
if (typedWord.length() > 0) {
@@ -1013,6 +1014,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
updateSuggestionsOrPredictions();
}
+ // Called from the KeyboardSwitcher which needs to know auto caps state to display
+ // the right layout.
public int getCurrentAutoCapsState() {
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;
}
+ // Callback for the SuggestionsView, to call when the "add to dictionary" hint is pressed.
@Override
public boolean addWordToUserDictionary(String word) {
mUserDictionary.addWordToUserDictionary(word, 128);
@@ -1285,6 +1289,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mConnection.endBatchEdit();
}
+ // Called from PointerTracker through the KeyboardActionListener interface
@Override
public void onTextInput(CharSequence text) {
mConnection.beginBatchEdit();
@@ -1348,6 +1353,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
+ // Called from PointerTracker through the KeyboardActionListener interface
@Override
public void onCancelInput() {
// User released a finger outside any key
@@ -1620,12 +1626,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
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;
return mCurrentSettings.mSuggestPuncList == mSuggestionsView.getSuggestions();
}
- public boolean isSuggestionsStripVisible() {
+ private boolean isSuggestionsStripVisible() {
if (mSuggestionsView == null)
return false;
if (mSuggestionsView.isShowingAddToDictionaryHint())
@@ -1637,7 +1645,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return mCurrentSettings.isSuggestionsRequested(mDisplayOrientation);
}
- public void clearSuggestions() {
+ private void clearSuggestions() {
setSuggestions(SuggestedWords.EMPTY, false);
setAutoCorrectionIndicator(false);
}
@@ -1660,7 +1668,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
}
- public void updateSuggestionsOrPredictions() {
+ private void updateSuggestionsOrPredictions() {
mHandler.cancelUpdateSuggestionStrip();
// 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
public void pickSuggestionManually(final int index, final CharSequence suggestion,
final int x, final int y) {
@@ -1888,7 +1897,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
separatorCode, prevWord);
}
- public void setPunctuationSuggestions() {
+ private void setPunctuationSuggestions() {
if (mCurrentSettings.mBigramPredictionEnabled) {
clearSuggestions();
} else {
@@ -1996,16 +2005,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mHandler.postUpdateSuggestionStrip();
}
+ // Used by the RingCharBuffer
public boolean isWordSeparator(int code) {
return mCurrentSettings.isWordSeparator(code);
}
- public boolean preferCapitalization() {
- return mWordComposer.isFirstCharCapitalized();
- }
-
// 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() {
// When the device locale is changed in SetupWizard etc., this method may get called via
// 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
- // {@link KeyboardSwitcher}.
+ // {@link KeyboardSwitcher}. Called from KeyboardSwitcher
public void hapticAndAudioFeedback(final int primaryCode) {
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
public void onPressKey(int 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
public void onReleaseKey(int primaryCode, boolean withSliding) {
mKeyboardSwitcher.onReleaseKey(primaryCode, withSliding);
@@ -2076,6 +2086,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
launchSettingsClass(SettingsActivity.class);
}
+ // Called from debug code only
public void launchDebugSettings() {
launchSettingsClass(DebugSettingsActivity.class);
}