mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Add Constants class to hold public constants
This change also gets rid of compiler warnings about "deprecations". Change-Id: Id9b83483c453a81ebac34b684656db05e3599657
This commit is contained in:
parent
c27fe6253c
commit
1cb08acaf3
@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.inputmethod.keyboard;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET;
|
||||
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@ -23,7 +25,6 @@ import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
import com.android.inputmethod.compat.EditorInfoCompatUtils;
|
||||
import com.android.inputmethod.latin.InputTypeUtils;
|
||||
import com.android.inputmethod.latin.LatinIME;
|
||||
import com.android.inputmethod.latin.SubtypeLocale;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -184,7 +185,7 @@ public class KeyboardId {
|
||||
return String.format("[%s %s:%s %s%d %s %s %s%s%s%s%s%s%s%s]",
|
||||
elementIdToName(mElementId),
|
||||
mLocale,
|
||||
mSubtype.getExtraValueOf(LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET),
|
||||
mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
|
||||
(mOrientation == 1 ? "port" : "land"), mWidth,
|
||||
modeName(mMode),
|
||||
imeAction(),
|
||||
|
@ -16,6 +16,12 @@
|
||||
|
||||
package com.android.inputmethod.keyboard;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.FORCE_ASCII;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_SETTINGS_KEY;
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.ASCII_CAPABLE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
@ -31,7 +37,6 @@ import com.android.inputmethod.compat.EditorInfoCompatUtils;
|
||||
import com.android.inputmethod.keyboard.KeyboardLayoutSet.Params.ElementParams;
|
||||
import com.android.inputmethod.latin.InputAttributes;
|
||||
import com.android.inputmethod.latin.InputTypeUtils;
|
||||
import com.android.inputmethod.latin.LatinIME;
|
||||
import com.android.inputmethod.latin.LatinImeLogger;
|
||||
import com.android.inputmethod.latin.R;
|
||||
import com.android.inputmethod.latin.SubtypeLocale;
|
||||
@ -230,7 +235,7 @@ public class KeyboardLayoutSet {
|
||||
params.mMode = getKeyboardMode(editorInfo);
|
||||
params.mEditorInfo = (editorInfo != null) ? editorInfo : EMPTY_EDITOR_INFO;
|
||||
params.mNoSettingsKey = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, LatinIME.IME_OPTION_NO_SETTINGS_KEY, mEditorInfo);
|
||||
mPackageName, NO_SETTINGS_KEY, mEditorInfo);
|
||||
}
|
||||
|
||||
public Builder setScreenGeometry(int orientation, int widthPixels) {
|
||||
@ -240,10 +245,10 @@ public class KeyboardLayoutSet {
|
||||
}
|
||||
|
||||
public Builder setSubtype(InputMethodSubtype subtype) {
|
||||
final boolean asciiCapable = subtype.containsExtraValueKey(
|
||||
LatinIME.SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE);
|
||||
final boolean asciiCapable = subtype.containsExtraValueKey(ASCII_CAPABLE);
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean deprecatedForceAscii = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, LatinIME.IME_OPTION_FORCE_ASCII, mEditorInfo);
|
||||
mPackageName, FORCE_ASCII, mEditorInfo);
|
||||
final boolean forceAscii = EditorInfoCompatUtils.hasFlagForceAscii(
|
||||
mParams.mEditorInfo.imeOptions)
|
||||
|| deprecatedForceAscii;
|
||||
@ -260,9 +265,9 @@ public class KeyboardLayoutSet {
|
||||
boolean languageSwitchKeyEnabled) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
|
||||
null, LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, mEditorInfo);
|
||||
null, NO_MICROPHONE_COMPAT, mEditorInfo);
|
||||
final boolean noMicrophone = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, LatinIME.IME_OPTION_NO_MICROPHONE, mEditorInfo)
|
||||
mPackageName, NO_MICROPHONE, mEditorInfo)
|
||||
|| deprecatedNoMicrophone;
|
||||
mParams.mVoiceKeyEnabled = voiceKeyEnabled && !noMicrophone;
|
||||
mParams.mVoiceKeyOnMain = voiceKeyOnMain;
|
||||
|
@ -159,7 +159,7 @@ public class KeySpecParser {
|
||||
return parseEscape(moreKeySpec.substring(end + /* LABEL_END */1));
|
||||
}
|
||||
|
||||
private static String getOutputText(String moreKeySpec) {
|
||||
static String getOutputText(String moreKeySpec) {
|
||||
if (hasCode(moreKeySpec)) {
|
||||
return null;
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class KeySpecParser {
|
||||
return (StringUtils.codePointCount(label) == 1) ? null : label;
|
||||
}
|
||||
|
||||
private static int getCode(String moreKeySpec, KeyboardCodesSet codesSet) {
|
||||
static int getCode(String moreKeySpec, KeyboardCodesSet codesSet) {
|
||||
if (hasCode(moreKeySpec)) {
|
||||
final int end = indexOfLabelEnd(moreKeySpec, 0);
|
||||
if (indexOfLabelEnd(moreKeySpec, end + 1) >= 0) {
|
||||
@ -219,7 +219,7 @@ public class KeySpecParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static int getIconId(String moreKeySpec) {
|
||||
static int getIconId(String moreKeySpec) {
|
||||
if (hasIcon(moreKeySpec)) {
|
||||
final int end = moreKeySpec.indexOf(LABEL_END, PREFIX_ICON.length());
|
||||
final String name = moreKeySpec.substring(PREFIX_ICON.length(), end);
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE;
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.IS_ADDITIONAL_SUBTYPE;
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET;
|
||||
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -30,9 +34,6 @@ public class AdditionalSubtype {
|
||||
AZERTY
|
||||
};
|
||||
|
||||
private static final String SUBTYPE_MODE_KEYBOARD = "keyboard";
|
||||
private static final String SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE = "isAdditionalSubtype";
|
||||
|
||||
// Keyboard layout to subtype name resource id map.
|
||||
private static final HashMap<String, Integer> sKeyboardLayoutToNameIdsMap =
|
||||
new HashMap<String, Integer>();
|
||||
@ -48,7 +49,7 @@ public class AdditionalSubtype {
|
||||
}
|
||||
|
||||
public static boolean isAdditionalSubtype(InputMethodSubtype subtype) {
|
||||
return subtype.containsExtraValueKey(SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE);
|
||||
return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
|
||||
}
|
||||
|
||||
private static final String LOCALE_AND_LAYOUT_SEPARATOR = ":";
|
||||
@ -56,25 +57,22 @@ public class AdditionalSubtype {
|
||||
|
||||
public static InputMethodSubtype createAdditionalSubtype(
|
||||
String localeString, String keyboardLayoutSetName, String extraValue) {
|
||||
final String layoutExtraValue = LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET + "="
|
||||
+ keyboardLayoutSetName;
|
||||
final String layoutExtraValue = KEYBOARD_LAYOUT_SET + "=" + keyboardLayoutSetName;
|
||||
final String filteredExtraValue = StringUtils.appendToCsvIfNotExists(
|
||||
SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE, extraValue);
|
||||
IS_ADDITIONAL_SUBTYPE, extraValue);
|
||||
Integer nameId = sKeyboardLayoutToNameIdsMap.get(keyboardLayoutSetName);
|
||||
if (nameId == null) nameId = R.string.subtype_generic;
|
||||
return new InputMethodSubtype(nameId, R.drawable.ic_subtype_keyboard,
|
||||
localeString, SUBTYPE_MODE_KEYBOARD,
|
||||
localeString, KEYBOARD_MODE,
|
||||
layoutExtraValue + "," + filteredExtraValue, false, false);
|
||||
}
|
||||
|
||||
public static String getPrefSubtype(InputMethodSubtype subtype) {
|
||||
final String localeString = subtype.getLocale();
|
||||
final String keyboardLayoutSetName = SubtypeLocale.getKeyboardLayoutSetName(subtype);
|
||||
final String layoutExtraValue = LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET + "="
|
||||
+ keyboardLayoutSetName;
|
||||
final String layoutExtraValue = KEYBOARD_LAYOUT_SET + "=" + keyboardLayoutSetName;
|
||||
final String extraValue = StringUtils.removeFromCsvIfExists(layoutExtraValue,
|
||||
StringUtils.removeFromCsvIfExists(SUBTYPE_EXTRA_VALUE_IS_ADDITIONAL_SUBTYPE,
|
||||
subtype.getExtraValue()));
|
||||
StringUtils.removeFromCsvIfExists(IS_ADDITIONAL_SUBTYPE, subtype.getExtraValue()));
|
||||
final String basePrefSubtype = localeString + LOCALE_AND_LAYOUT_SEPARATOR
|
||||
+ keyboardLayoutSetName;
|
||||
return extraValue.isEmpty() ? basePrefSubtype
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.ASCII_CAPABLE;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@ -88,7 +90,7 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||
final int count = imi.getSubtypeCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final InputMethodSubtype subtype = imi.getSubtypeAt(i);
|
||||
if (subtype.containsExtraValueKey(LatinIME.SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE)) {
|
||||
if (subtype.containsExtraValueKey(ASCII_CAPABLE)) {
|
||||
items.add(createItem(context, subtype.getLocale()));
|
||||
}
|
||||
}
|
||||
@ -223,7 +225,7 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||
final KeyboardLayoutSetItem layout =
|
||||
(KeyboardLayoutSetItem) mKeyboardLayoutSetSpinner.getSelectedItem();
|
||||
final InputMethodSubtype subtype = AdditionalSubtype.createAdditionalSubtype(
|
||||
locale.first, layout.first, LatinIME.SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE);
|
||||
locale.first, layout.first, ASCII_CAPABLE);
|
||||
setSubtype(subtype);
|
||||
notifyChanged();
|
||||
break;
|
||||
|
103
java/src/com/android/inputmethod/latin/Constants.java
Normal file
103
java/src/com/android/inputmethod/latin/Constants.java
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
|
||||
public final class Constants {
|
||||
public static final class ImeOption {
|
||||
/**
|
||||
* The private IME option used to indicate that no microphone should be shown for a given
|
||||
* text field. For instance, this is specified by the search dialog when the dialog is
|
||||
* already showing a voice search button.
|
||||
*
|
||||
* @deprecated Use {@link ImeOption#NO_MICROPHONE} with package name prefixed.
|
||||
*/
|
||||
@SuppressWarnings("dep-ann")
|
||||
public static final String NO_MICROPHONE_COMPAT = "nm";
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that no microphone should be shown for a given
|
||||
* text field. For instance, this is specified by the search dialog when the dialog is
|
||||
* already showing a voice search button.
|
||||
*/
|
||||
public static final String NO_MICROPHONE = "noMicrophoneKey";
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that no settings key should be shown for a given
|
||||
* text field.
|
||||
*/
|
||||
public static final String NO_SETTINGS_KEY = "noSettingsKey";
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that the given text field needs ASCII code points
|
||||
* input.
|
||||
*
|
||||
* @deprecated Use {@link EditorInfo#IME_FLAG_FORCE_ASCII}.
|
||||
*/
|
||||
@SuppressWarnings("dep-ann")
|
||||
public static final String FORCE_ASCII = "forceAscii";
|
||||
|
||||
private ImeOption() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Subtype {
|
||||
/**
|
||||
* The subtype mode used to indicate that the subtype is a keyboard.
|
||||
*/
|
||||
public static final String KEYBOARD_MODE = "keyboard";
|
||||
|
||||
public static final class ExtraValue {
|
||||
/**
|
||||
* The subtype extra value used to indicate that the subtype keyboard layout set name.
|
||||
*/
|
||||
public static final String KEYBOARD_LAYOUT_SET = "KeyboardLayoutSet";
|
||||
|
||||
/**
|
||||
* The subtype extra value used to indicate that the subtype keyboard layout is capable
|
||||
* for typing ASCII characters.
|
||||
*/
|
||||
public static final String ASCII_CAPABLE = "AsciiCapable";
|
||||
|
||||
/**
|
||||
* The subtype extra value used to indicate that the subtype require network connection
|
||||
* to work.
|
||||
*/
|
||||
public static final String REQ_NETWORK_CONNECTIVITY = "requireNetworkConnectivity";
|
||||
|
||||
/**
|
||||
* The subtype extra value used to indicate that the subtype is additional subtype
|
||||
* that the user defined. This extra value is private to LatinIME.
|
||||
*/
|
||||
public static final String IS_ADDITIONAL_SUBTYPE = "isAdditionalSubtype";
|
||||
|
||||
private ExtraValue() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
}
|
||||
|
||||
private Subtype() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
}
|
||||
|
||||
private Constants() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
}
|
@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -131,7 +133,7 @@ public class ImfUtils {
|
||||
// both explicitly and implicitly enabled input method subtype.
|
||||
// (The current IME should be LatinIME.)
|
||||
for (InputMethodSubtype subtype : subtypes) {
|
||||
if (SubtypeSwitcher.KEYBOARD_MODE.equals(subtype.getMode())) {
|
||||
if (KEYBOARD_MODE.equals(subtype.getMode())) {
|
||||
++keyboardCount;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.FORCE_ASCII;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@ -81,49 +85,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
private static final boolean TRACE = false;
|
||||
private static boolean DEBUG;
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that no microphone should be
|
||||
* shown for a given text field. For instance, this is specified by the
|
||||
* search dialog when the dialog is already showing a voice search button.
|
||||
*
|
||||
* @deprecated Use {@link LatinIME#IME_OPTION_NO_MICROPHONE} with package name prefixed.
|
||||
*/
|
||||
@SuppressWarnings("dep-ann")
|
||||
public static final String IME_OPTION_NO_MICROPHONE_COMPAT = "nm";
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that no microphone should be
|
||||
* shown for a given text field. For instance, this is specified by the
|
||||
* search dialog when the dialog is already showing a voice search button.
|
||||
*/
|
||||
public static final String IME_OPTION_NO_MICROPHONE = "noMicrophoneKey";
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that no settings key should be
|
||||
* shown for a given text field.
|
||||
*/
|
||||
public static final String IME_OPTION_NO_SETTINGS_KEY = "noSettingsKey";
|
||||
|
||||
/**
|
||||
* The private IME option used to indicate that the given text field needs
|
||||
* ASCII code points input.
|
||||
*
|
||||
* @deprecated Use {@link EditorInfo#IME_FLAG_FORCE_ASCII}.
|
||||
*/
|
||||
@SuppressWarnings("dep-ann")
|
||||
public static final String IME_OPTION_FORCE_ASCII = "forceAscii";
|
||||
|
||||
/**
|
||||
* The subtype extra value used to indicate that the subtype keyboard layout set name.
|
||||
*/
|
||||
public static final String SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET = "KeyboardLayoutSet";
|
||||
|
||||
/**
|
||||
* The subtype extra value used to indicate that the subtype keyboard layout is capable for
|
||||
* typing ASCII characters.
|
||||
*/
|
||||
public static final String SUBTYPE_EXTRA_VALUE_ASCII_CAPABLE = "AsciiCapable";
|
||||
|
||||
private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100;
|
||||
|
||||
// How many continuous deletes at which to start deleting at a higher speed.
|
||||
@ -649,6 +610,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
super.onStartInput(editorInfo, restarting);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void onStartInputViewInternal(EditorInfo editorInfo, boolean restarting) {
|
||||
super.onStartInputView(editorInfo, restarting);
|
||||
final KeyboardSwitcher switcher = mKeyboardSwitcher;
|
||||
@ -669,14 +631,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||
ResearchLogger.latinIME_onStartInputViewInternal(editorInfo);
|
||||
}
|
||||
if (InputAttributes.inPrivateImeOptions(
|
||||
null, IME_OPTION_NO_MICROPHONE_COMPAT, editorInfo)) {
|
||||
if (InputAttributes.inPrivateImeOptions(null, NO_MICROPHONE_COMPAT, editorInfo)) {
|
||||
Log.w(TAG, "Deprecated private IME option specified: "
|
||||
+ editorInfo.privateImeOptions);
|
||||
Log.w(TAG, "Use " + getPackageName() + "." + IME_OPTION_NO_MICROPHONE + " instead");
|
||||
Log.w(TAG, "Use " + getPackageName() + "." + NO_MICROPHONE + " instead");
|
||||
}
|
||||
if (InputAttributes.inPrivateImeOptions(
|
||||
getPackageName(), IME_OPTION_FORCE_ASCII, editorInfo)) {
|
||||
if (InputAttributes.inPrivateImeOptions(getPackageName(), FORCE_ASCII, editorInfo)) {
|
||||
Log.w(TAG, "Deprecated private IME option specified: "
|
||||
+ editorInfo.privateImeOptions);
|
||||
Log.w(TAG, "Use EditorInfo.IME_FLAG_FORCE_ASCII flag instead");
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
@ -117,8 +119,7 @@ public class SubtypeLocale {
|
||||
}
|
||||
|
||||
public static String getKeyboardLayoutSetName(InputMethodSubtype subtype) {
|
||||
final String keyboardLayoutSet = subtype.getExtraValueOf(
|
||||
LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LAYOUT_SET);
|
||||
final String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
|
||||
// TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
|
||||
// fixed.
|
||||
if (keyboardLayoutSet == null) {
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE;
|
||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.REQ_NETWORK_CONNECTIVITY;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
@ -42,11 +45,7 @@ public class SubtypeSwitcher {
|
||||
private static boolean DBG = LatinImeLogger.sDBG;
|
||||
private static final String TAG = SubtypeSwitcher.class.getSimpleName();
|
||||
|
||||
public static final String KEYBOARD_MODE = "keyboard";
|
||||
private static final char LOCALE_SEPARATOR = '_';
|
||||
private static final String SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY =
|
||||
"requireNetworkConnectivity";
|
||||
|
||||
private final TextUtils.SimpleStringSplitter mLocaleSplitter =
|
||||
new TextUtils.SimpleStringSplitter(LOCALE_SEPARATOR);
|
||||
|
||||
@ -309,8 +308,7 @@ public class SubtypeSwitcher {
|
||||
return false;
|
||||
if (mShortcutSubtype == null)
|
||||
return true;
|
||||
if (mShortcutSubtype.containsExtraValueKey(
|
||||
SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY)) {
|
||||
if (mShortcutSubtype.containsExtraValueKey(REQ_NETWORK_CONNECTIVITY)) {
|
||||
return mIsNetworkConnected;
|
||||
}
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user