aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-02-17 11:48:30 +0900
committerTadashi G. Takaoka <takaoka@google.com>2014-02-17 15:38:43 +0900
commitce78a2d8ab7630cff509c2b21b4b11abd8db4795 (patch)
tree2ebdb48df1ae68ca8c33ce6d5aff96cf21e92041 /java/src/com/android/inputmethod
parent95d16561e0e6c38dbd99c893f09c5dbe9d4a465d (diff)
downloadlatinime-ce78a2d8ab7630cff509c2b21b4b11abd8db4795.tar.gz
latinime-ce78a2d8ab7630cff509c2b21b4b11abd8db4795.tar.xz
latinime-ce78a2d8ab7630cff509c2b21b4b11abd8db4795.zip
Don't show important notice on password field
Bug: 10587358 Change-Id: Ieff7960e5e2b8609fddeb173af578a5d9b2c4d98
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/latin/InputAttributes.java7
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java10
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java8
-rw-r--r--java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java14
4 files changed, 27 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java
index b01bc4ba5..01c17f2f2 100644
--- a/java/src/com/android/inputmethod/latin/InputAttributes.java
+++ b/java/src/com/android/inputmethod/latin/InputAttributes.java
@@ -31,6 +31,7 @@ public final class InputAttributes {
final public String mTargetApplicationPackageName;
final public boolean mInputTypeNoAutoCorrect;
+ final public boolean mIsPasswordField;
final public boolean mIsSettingsSuggestionStripOn;
final public boolean mApplicationSpecifiedCompletionOn;
final public boolean mShouldInsertSpacesAutomatically;
@@ -56,6 +57,7 @@ public final class InputAttributes {
Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x"
+ " imeOptions=0x%08x", inputType, editorInfo.imeOptions));
}
+ mIsPasswordField = false;
mIsSettingsSuggestionStripOn = false;
mInputTypeNoAutoCorrect = false;
mApplicationSpecifiedCompletionOn = false;
@@ -71,10 +73,11 @@ public final class InputAttributes {
final boolean flagAutoComplete =
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
+ mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType)
+ || InputTypeUtils.isVisiblePasswordInputType(inputType);
// TODO: Have a helper method in InputTypeUtils
// Make sure that passwords are not displayed in {@link SuggestionStripView}.
- if (InputTypeUtils.isPasswordInputType(inputType)
- || InputTypeUtils.isVisiblePasswordInputType(inputType)
+ if (mIsPasswordField
|| InputTypeUtils.isEmailVariation(variation)
|| InputType.TYPE_TEXT_VARIATION_URI == variation
|| InputType.TYPE_TEXT_VARIATION_FILTER == variation
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d1125afcc..399e588ba 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1319,10 +1319,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return false;
if (mSuggestionStripView.isShowingAddToDictionaryHint())
return true;
- if (ImportantNoticeUtils.hasNewImportantNoticeAndNotInSetupWizard(this))
- return true;
if (null == currentSettings)
return false;
+ if (ImportantNoticeUtils.shouldShowImportantNotice(this, currentSettings.mInputAttributes))
+ return true;
if (!currentSettings.isSuggestionStripVisible())
return false;
if (currentSettings.isApplicationSpecifiedCompletionsOn())
@@ -1351,11 +1351,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void setSuggestedWords(final SuggestedWords suggestedWords, final boolean shouldShow) {
mInputLogic.setSuggestedWords(suggestedWords);
if (mSuggestionStripView != null) {
+ final SettingsValues currentSettings = mSettings.getCurrent();
final boolean showSuggestions;
if (SuggestedWords.EMPTY == suggestedWords
|| suggestedWords.isPunctuationSuggestions()
- || !mSettings.getCurrent().isSuggestionsRequested()) {
- showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle();
+ || !currentSettings.isSuggestionsRequested()) {
+ showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle(
+ currentSettings.mInputAttributes);
} else {
showSuggestions = true;
}
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index cf0a7a2aa..2d36f5730 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -39,11 +39,13 @@ import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.keyboard.MoreKeysPanel;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.Constants;
+import com.android.inputmethod.latin.InputAttributes;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.define.ProductionFlag;
+import com.android.inputmethod.latin.settings.Settings;
import com.android.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionsListener;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
@@ -226,8 +228,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
// This method checks if we should show the important notice (checks on permanent storage if
// it has been shown once already or not, and if in the setup wizard). If applicable, it shows
// the notice. In all cases, it returns true if it was shown, false otherwise.
- public boolean maybeShowImportantNoticeTitle() {
- if (!ImportantNoticeUtils.hasNewImportantNoticeAndNotInSetupWizard(getContext())) {
+ public boolean maybeShowImportantNoticeTitle(final InputAttributes inputAttributes) {
+ if (!ImportantNoticeUtils.shouldShowImportantNotice(getContext(), inputAttributes)) {
return false;
}
final int width = getWidth();
@@ -431,6 +433,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
// Called by the framework when the size is known. Show the important notice if applicable.
// This may be overriden by showing suggestions later, if applicable.
- maybeShowImportantNoticeTitle();
+ maybeShowImportantNoticeTitle(Settings.getInstance().getCurrent().mInputAttributes);
}
}
diff --git a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
index 604c36488..50a942382 100644
--- a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java
@@ -22,6 +22,7 @@ import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
+import com.android.inputmethod.latin.InputAttributes;
import com.android.inputmethod.latin.R;
public final class ImportantNoticeUtils {
@@ -62,11 +63,18 @@ public final class ImportantNoticeUtils {
return context.getResources().getInteger(R.integer.config_important_notice_version);
}
- public static boolean hasNewImportantNoticeAndNotInSetupWizard(final Context context) {
+ private static boolean hasNewImportantNotice(final Context context) {
final SharedPreferences prefs = getImportantNoticePreferences(context);
final int lastVersion = prefs.getInt(KEY_IMPORTANT_NOTICE_VERSION, 0);
- return getCurrentImportantNoticeVersion(context) > lastVersion
- && !isInSystemSetupWizard(context);
+ return getCurrentImportantNoticeVersion(context) > lastVersion;
+ }
+
+ public static boolean shouldShowImportantNotice(final Context context,
+ final InputAttributes inputAttributes) {
+ if (inputAttributes == null || inputAttributes.mIsPasswordField) {
+ return false;
+ }
+ return hasNewImportantNotice(context) && !isInSystemSetupWizard(context);
}
public static void updateLastImportantNoticeVersion(final Context context) {