Merge "Update language to comply with Android’s inclusive language guidance" am: 4eb192212f
Original change: https://android-review.googlesource.com/c/platform/packages/inputmethods/LatinIME/+/1371236 Change-Id: Ie132872cad36f2fa2b28eec2be7b4bb148e55d7fmain
commit
a2695d0ca6
|
@ -38,7 +38,7 @@
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_settings" />
|
latin:keyboardLayout="@xml/key_styles_settings" />
|
||||||
<!-- Functional key styles -->
|
<!-- Functional key styles -->
|
||||||
<!-- Base style for shift key. A single space is used for dummy label in moreKeys. -->
|
<!-- Base style for shift key. A single space is used for base label in moreKeys. -->
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="baseForShiftKeyStyle"
|
latin:styleName="baseForShiftKeyStyle"
|
||||||
latin:keyActionFlags="noKeyPreview"
|
latin:keyActionFlags="noKeyPreview"
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/key_styles_settings" />
|
latin:keyboardLayout="@xml/key_styles_settings" />
|
||||||
<!-- Functional key styles -->
|
<!-- Functional key styles -->
|
||||||
<!-- Base style for shift key. A single space is used for dummy label in moreKeys. -->
|
<!-- Base style for shift key. A single space is used for base label in moreKeys. -->
|
||||||
<key-style
|
<key-style
|
||||||
latin:styleName="baseForShiftKeyStyle"
|
latin:styleName="baseForShiftKeyStyle"
|
||||||
latin:keyActionFlags="noKeyPreview"
|
latin:keyActionFlags="noKeyPreview"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
android:title="@string/settings_screen_accounts">
|
android:title="@string/settings_screen_accounts">
|
||||||
|
|
||||||
<!-- This preference is a dummy view of the underlying preference.
|
<!-- This preference is a fake view of the underlying preference.
|
||||||
This isn't persisted and the summary/title is refreshed by the fragment
|
This isn't persisted and the summary/title is refreshed by the fragment
|
||||||
after inspecting the underlying account preference. -->
|
after inspecting the underlying account preference. -->
|
||||||
<Preference
|
<Preference
|
||||||
|
|
|
@ -870,7 +870,7 @@ public class MetadataDbHelper extends SQLiteOpenHelper {
|
||||||
*/
|
*/
|
||||||
public static void updateClientInfo(final Context context, final String clientId,
|
public static void updateClientInfo(final Context context, final String clientId,
|
||||||
final ContentValues values) {
|
final ContentValues values) {
|
||||||
// Sanity check the content values
|
// Validity check the content values
|
||||||
final String valuesClientId = values.getAsString(CLIENT_CLIENT_ID_COLUMN);
|
final String valuesClientId = values.getAsString(CLIENT_CLIENT_ID_COLUMN);
|
||||||
final String valuesMetadataUri = values.getAsString(CLIENT_METADATA_URI_COLUMN);
|
final String valuesMetadataUri = values.getAsString(CLIENT_METADATA_URI_COLUMN);
|
||||||
final String valuesMetadataAdditionalId =
|
final String valuesMetadataAdditionalId =
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class Event {
|
||||||
mSuggestedWordInfo = suggestedWordInfo;
|
mSuggestedWordInfo = suggestedWordInfo;
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
mNextEvent = next;
|
mNextEvent = next;
|
||||||
// Sanity checks
|
// Validity checks
|
||||||
// mSuggestedWordInfo is non-null if and only if the type is SUGGESTION_PICKED
|
// mSuggestedWordInfo is non-null if and only if the type is SUGGESTION_PICKED
|
||||||
if (EVENT_TYPE_SUGGESTION_PICKED == mEventType) {
|
if (EVENT_TYPE_SUGGESTION_PICKED == mEventType) {
|
||||||
if (null == mSuggestedWordInfo) {
|
if (null == mSuggestedWordInfo) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class KeyboardView extends View {
|
||||||
private static final float MAX_LABEL_RATIO = 0.90f;
|
private static final float MAX_LABEL_RATIO = 0.90f;
|
||||||
|
|
||||||
// Main keyboard
|
// Main keyboard
|
||||||
// TODO: Consider having a dummy keyboard object to make this @Nonnull
|
// TODO: Consider having a base keyboard object to make this @Nonnull
|
||||||
@Nullable
|
@Nullable
|
||||||
private Keyboard mKeyboard;
|
private Keyboard mKeyboard;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
|
@ -60,7 +60,7 @@ public final class KeyboardTextsTable {
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
// Sanity check.
|
// Validity check.
|
||||||
if (index >= 0 && index < TEXTS_DEFAULT.length) {
|
if (index >= 0 && index < TEXTS_DEFAULT.length) {
|
||||||
return TEXTS_DEFAULT[index];
|
return TEXTS_DEFAULT[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,8 +196,8 @@ final public class BinaryDictionaryGetter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ## HACK ## we prevent usage of a dictionary before version 18. The reason for this is, since
|
// ## HACK ## we prevent usage of a dictionary before version 18. The reason for this is, since
|
||||||
// those do not include whitelist entries, the new code with an old version of the dictionary
|
// those do not include allowlist entries, the new code with an old version of the dictionary
|
||||||
// would lose whitelist functionality.
|
// would lose allowlist functionality.
|
||||||
private static boolean hackCanUseDictionaryFile(final File file) {
|
private static boolean hackCanUseDictionaryFile(final File file) {
|
||||||
if (!SHOULD_USE_DICT_VERSION) {
|
if (!SHOULD_USE_DICT_VERSION) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -211,7 +211,7 @@ final public class BinaryDictionaryGetter {
|
||||||
// No version in the options : the format is unexpected
|
// No version in the options : the format is unexpected
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Version 18 is the first one to include the whitelist
|
// Version 18 is the first one to include the allowlist.
|
||||||
// Obviously this is a big ## HACK ##
|
// Obviously this is a big ## HACK ##
|
||||||
return Integer.parseInt(version) >= 18;
|
return Integer.parseInt(version) >= 18;
|
||||||
} catch (java.io.FileNotFoundException e) {
|
} catch (java.io.FileNotFoundException e) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public final class InputAttributes {
|
||||||
|| InputTypeUtils.isVisiblePasswordInputType(inputType);
|
|| InputTypeUtils.isVisiblePasswordInputType(inputType);
|
||||||
if (inputClass != InputType.TYPE_CLASS_TEXT) {
|
if (inputClass != InputType.TYPE_CLASS_TEXT) {
|
||||||
// If we are not looking at a TYPE_CLASS_TEXT field, the following strange
|
// If we are not looking at a TYPE_CLASS_TEXT field, the following strange
|
||||||
// cases may arise, so we do a couple sanity checks for them. If it's a
|
// cases may arise, so we do a couple validity checks for them. If it's a
|
||||||
// TYPE_CLASS_TEXT field, these special cases cannot happen, by construction
|
// TYPE_CLASS_TEXT field, these special cases cannot happen, by construction
|
||||||
// of the flags.
|
// of the flags.
|
||||||
if (null == editorInfo) {
|
if (null == editorInfo) {
|
||||||
|
|
|
@ -174,35 +174,35 @@ public class RichInputMethodSubtype {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dummy no language QWERTY subtype. See {@link R.xml.method}.
|
// Placeholer for no language QWERTY subtype. See {@link R.xml.method}.
|
||||||
private static final int SUBTYPE_ID_OF_DUMMY_NO_LANGUAGE_SUBTYPE = 0xdde0bfd3;
|
private static final int SUBTYPE_ID_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE = 0xdde0bfd3;
|
||||||
private static final String EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE =
|
private static final String EXTRA_VALUE_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE =
|
||||||
"KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
|
"KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
|
||||||
+ "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
|
+ "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
|
||||||
+ "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
|
+ "," + Constants.Subtype.ExtraValue.ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE
|
||||||
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final RichInputMethodSubtype DUMMY_NO_LANGUAGE_SUBTYPE =
|
private static final RichInputMethodSubtype PLACEHOLDER_NO_LANGUAGE_SUBTYPE =
|
||||||
new RichInputMethodSubtype(InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
new RichInputMethodSubtype(InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
||||||
R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
|
R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
|
||||||
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
||||||
EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE,
|
EXTRA_VALUE_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE,
|
||||||
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */,
|
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */,
|
||||||
SUBTYPE_ID_OF_DUMMY_NO_LANGUAGE_SUBTYPE));
|
SUBTYPE_ID_OF_PLACEHOLDER_NO_LANGUAGE_SUBTYPE));
|
||||||
// Caveat: We probably should remove this when we add an Emoji subtype in {@link R.xml.method}.
|
// Caveat: We probably should remove this when we add an Emoji subtype in {@link R.xml.method}.
|
||||||
// Dummy Emoji subtype. See {@link R.xml.method}.
|
// Dummy Emoji subtype. See {@link R.xml.method}.
|
||||||
private static final int SUBTYPE_ID_OF_DUMMY_EMOJI_SUBTYPE = 0xd78b2ed0;
|
private static final int SUBTYPE_ID_OF_PLACEHOLDER_EMOJI_SUBTYPE = 0xd78b2ed0;
|
||||||
private static final String EXTRA_VALUE_OF_DUMMY_EMOJI_SUBTYPE =
|
private static final String EXTRA_VALUE_OF_PLACEHOLDER_EMOJI_SUBTYPE =
|
||||||
"KeyboardLayoutSet=" + SubtypeLocaleUtils.EMOJI
|
"KeyboardLayoutSet=" + SubtypeLocaleUtils.EMOJI
|
||||||
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final RichInputMethodSubtype DUMMY_EMOJI_SUBTYPE = new RichInputMethodSubtype(
|
private static final RichInputMethodSubtype PLACEHOLDER_EMOJI_SUBTYPE = new RichInputMethodSubtype(
|
||||||
InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
||||||
R.string.subtype_emoji, R.drawable.ic_ime_switcher_dark,
|
R.string.subtype_emoji, R.drawable.ic_ime_switcher_dark,
|
||||||
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
||||||
EXTRA_VALUE_OF_DUMMY_EMOJI_SUBTYPE,
|
EXTRA_VALUE_OF_PLACEHOLDER_EMOJI_SUBTYPE,
|
||||||
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */,
|
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */,
|
||||||
SUBTYPE_ID_OF_DUMMY_EMOJI_SUBTYPE));
|
SUBTYPE_ID_OF_PLACEHOLDER_EMOJI_SUBTYPE));
|
||||||
private static RichInputMethodSubtype sNoLanguageSubtype;
|
private static RichInputMethodSubtype sNoLanguageSubtype;
|
||||||
private static RichInputMethodSubtype sEmojiSubtype;
|
private static RichInputMethodSubtype sEmojiSubtype;
|
||||||
|
|
||||||
|
@ -223,8 +223,8 @@ public class RichInputMethodSubtype {
|
||||||
}
|
}
|
||||||
Log.w(TAG, "Can't find any language with QWERTY subtype");
|
Log.w(TAG, "Can't find any language with QWERTY subtype");
|
||||||
Log.w(TAG, "No input method subtype found; returning dummy subtype: "
|
Log.w(TAG, "No input method subtype found; returning dummy subtype: "
|
||||||
+ DUMMY_NO_LANGUAGE_SUBTYPE);
|
+ PLACEHOLDER_NO_LANGUAGE_SUBTYPE);
|
||||||
return DUMMY_NO_LANGUAGE_SUBTYPE;
|
return PLACEHOLDER_NO_LANGUAGE_SUBTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -244,7 +244,7 @@ public class RichInputMethodSubtype {
|
||||||
}
|
}
|
||||||
Log.w(TAG, "Can't find emoji subtype");
|
Log.w(TAG, "Can't find emoji subtype");
|
||||||
Log.w(TAG, "No input method subtype found; returning dummy subtype: "
|
Log.w(TAG, "No input method subtype found; returning dummy subtype: "
|
||||||
+ DUMMY_EMOJI_SUBTYPE);
|
+ PLACEHOLDER_EMOJI_SUBTYPE);
|
||||||
return DUMMY_EMOJI_SUBTYPE;
|
return PLACEHOLDER_EMOJI_SUBTYPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package com.android.inputmethod.latin.about;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy class of AboutPreferences. Never use this.
|
* Placeholer class of AboutPreferences. Never use this.
|
||||||
*/
|
*/
|
||||||
public final class AboutPreferences extends Fragment {
|
public final class AboutPreferences extends Fragment {
|
||||||
private AboutPreferences() {
|
private AboutPreferences() {
|
||||||
|
|
|
@ -805,7 +805,7 @@ public final class InputLogic {
|
||||||
if (SpaceState.PHANTOM == inputTransaction.mSpaceState
|
if (SpaceState.PHANTOM == inputTransaction.mSpaceState
|
||||||
&& !settingsValues.isWordConnector(codePoint)) {
|
&& !settingsValues.isWordConnector(codePoint)) {
|
||||||
if (isComposingWord) {
|
if (isComposingWord) {
|
||||||
// Sanity check
|
// Validity check
|
||||||
throw new RuntimeException("Should not be composing here");
|
throw new RuntimeException("Should not be composing here");
|
||||||
}
|
}
|
||||||
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
|
||||||
|
@ -1370,7 +1370,7 @@ public final class InputLogic {
|
||||||
* @return whether it's fine to apply the transformation after this code point.
|
* @return whether it's fine to apply the transformation after this code point.
|
||||||
*/
|
*/
|
||||||
private static boolean canBeFollowedByDoubleSpacePeriod(final int codePoint) {
|
private static boolean canBeFollowedByDoubleSpacePeriod(final int codePoint) {
|
||||||
// TODO: This should probably be a blacklist rather than a whitelist.
|
// TODO: This should probably be a denylist rather than a allowlist.
|
||||||
// TODO: This should probably be language-dependant...
|
// TODO: This should probably be language-dependant...
|
||||||
return Character.isLetterOrDigit(codePoint)
|
return Character.isLetterOrDigit(codePoint)
|
||||||
|| codePoint == Constants.CODE_SINGLE_QUOTE
|
|| codePoint == Constants.CODE_SINGLE_QUOTE
|
||||||
|
|
|
@ -330,7 +330,7 @@ final class CustomInputStylePreference extends DialogPreference
|
||||||
R.array.predefined_layouts);
|
R.array.predefined_layouts);
|
||||||
// TODO: Should filter out already existing combinations of locale and layout.
|
// TODO: Should filter out already existing combinations of locale and layout.
|
||||||
for (final String layout : predefinedKeyboardLayoutSet) {
|
for (final String layout : predefinedKeyboardLayoutSet) {
|
||||||
// This is a dummy subtype with NO_LANGUAGE, only for display.
|
// This is a placeholder for a subtype with NO_LANGUAGE, only for display.
|
||||||
final InputMethodSubtype subtype =
|
final InputMethodSubtype subtype =
|
||||||
AdditionalSubtypeUtils.createDummyAdditionalSubtype(
|
AdditionalSubtypeUtils.createDummyAdditionalSubtype(
|
||||||
SubtypeLocaleUtils.NO_LANGUAGE, layout);
|
SubtypeLocaleUtils.NO_LANGUAGE, layout);
|
||||||
|
|
|
@ -194,10 +194,10 @@ public final class CapsModeUtils {
|
||||||
// English is a special case in that "American typography" rules, which are the most common
|
// English is a special case in that "American typography" rules, which are the most common
|
||||||
// in English, state that a sentence terminator immediately following a quotation mark
|
// in English, state that a sentence terminator immediately following a quotation mark
|
||||||
// should be swapped with it and de-duplicated (included in the quotation mark),
|
// should be swapped with it and de-duplicated (included in the quotation mark),
|
||||||
// e.g. <<Did he say, "let's go home?">>
|
// e.g. <<Did they say, "let's go home?">>
|
||||||
// No other language has such a rule as far as I know, instead putting inside the quotation
|
// No other language has such a rule as far as I know, instead putting inside the quotation
|
||||||
// mark as the exact thing quoted and handling the surrounding punctuation independently,
|
// mark as the exact thing quoted and handling the surrounding punctuation independently,
|
||||||
// e.g. <<Did he say, "let's go home"?>>
|
// e.g. <<Did they say, "let's go home"?>>
|
||||||
if (spacingAndPunctuations.mUsesAmericanTypography) {
|
if (spacingAndPunctuations.mUsesAmericanTypography) {
|
||||||
for (; j > 0; j--) {
|
for (; j > 0; j--) {
|
||||||
// Here we look to go over any closing punctuation. This is because in dominant
|
// Here we look to go over any closing punctuation. This is because in dominant
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class RecapitalizeStatus {
|
||||||
private static final int[] EMPTY_STORTED_SEPARATORS = {};
|
private static final int[] EMPTY_STORTED_SEPARATORS = {};
|
||||||
|
|
||||||
public RecapitalizeStatus() {
|
public RecapitalizeStatus() {
|
||||||
// By default, initialize with dummy values that won't match any real recapitalize.
|
// By default, initialize with fake values that won't match any real recapitalize.
|
||||||
start(-1, -1, "", Locale.getDefault(), EMPTY_STORTED_SEPARATORS);
|
start(-1, -1, "", Locale.getDefault(), EMPTY_STORTED_SEPARATORS);
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue