Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6862111 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Split Utils class to StringUtils, SubtypeUtils, and JniUtils"

parents 7d6d98ec cc8c8b99
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import android.view.inputmethod.InputMethodManager;
import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.latin.SubtypeUtils;

import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -163,7 +163,7 @@ public class InputMethodManagerCompatWrapper {
    private InputMethodInfoCompatWrapper getLatinImeInputMethodInfo() {
        if (TextUtils.isEmpty(mLatinImePackageName))
            return null;
        return Utils.getInputMethodInfo(mLatinImePackageName);
        return SubtypeUtils.getInputMethodInfo(mLatinImePackageName);
    }

    private static InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
@@ -260,7 +260,8 @@ public class InputMethodManagerCompatWrapper {

        // The code below are based on {@link InputMethodManager#showInputMethodMenuInternal}.

        final InputMethodInfoCompatWrapper myImi = Utils.getInputMethodInfo(mLatinImePackageName);
        final InputMethodInfoCompatWrapper myImi = SubtypeUtils.getInputMethodInfo(
                mLatinImePackageName);
        final List<InputMethodSubtypeCompatWrapper> myImsList = getEnabledInputMethodSubtypeList(
                myImi, true);
        final InputMethodSubtypeCompatWrapper currentIms = getCurrentInputMethodSubtype();
+3 −3
Original line number Diff line number Diff line
@@ -61,8 +61,8 @@ import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinIME.UIHandler;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils;

import java.util.ArrayList;
@@ -662,9 +662,9 @@ public class VoiceProxy implements VoiceInput.UiListener {

    private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo editorInfo) {
        @SuppressWarnings("deprecation")
        final boolean noMic = Utils.inPrivateImeOptions(null,
        final boolean noMic = StringUtils.inPrivateImeOptions(null,
                LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, editorInfo)
                || Utils.inPrivateImeOptions(mService.getPackageName(),
                || StringUtils.inPrivateImeOptions(mService.getPackageName(),
                        LatinIME.IME_OPTION_NO_MICROPHONE, editorInfo);
        return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext) && !noMic
                && SpeechRecognizer.isRecognitionAvailable(mService);
+12 −12
Original line number Diff line number Diff line
@@ -16,16 +16,6 @@

package com.android.inputmethod.deprecated.languageswitcher;

import com.android.inputmethod.compat.SharedPreferencesCompat;
import com.android.inputmethod.keyboard.KeyboardSet;
import com.android.inputmethod.latin.DictionaryFactory;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.Settings;
import com.android.inputmethod.latin.Utils;

import org.xmlpull.v1.XmlPullParserException;

import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
@@ -37,6 +27,16 @@ import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Pair;

import com.android.inputmethod.compat.SharedPreferencesCompat;
import com.android.inputmethod.keyboard.KeyboardSet;
import com.android.inputmethod.latin.DictionaryFactory;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.Settings;
import com.android.inputmethod.latin.StringUtils;

import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.text.Collator;
import java.util.ArrayList;
@@ -237,12 +237,12 @@ public class InputLanguageSelection extends PreferenceActivity {

            if (finalSize == 0) {
                preprocess[finalSize++] =
                        new LocaleEntry(Utils.getFullDisplayName(l, false), l);
                        new LocaleEntry(StringUtils.getFullDisplayName(l, false), l);
            } else {
                if (s.equals("zz_ZZ")) {
                    // ignore this locale
                } else {
                    final String displayName = Utils.getFullDisplayName(l, false);
                    final String displayName = StringUtils.getFullDisplayName(l, false);
                    preprocess[finalSize++] = new LocaleEntry(displayName, l);
                }
            }
+5 −5
Original line number Diff line number Diff line
@@ -16,10 +16,6 @@

package com.android.inputmethod.deprecated.voice;

import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.Utils;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -39,6 +35,10 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.SubtypeSwitcher;

import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -222,7 +222,7 @@ public class RecognitionView {
                Locale locale = SubtypeSwitcher.getInstance().getInputLocale();

                mLanguage.setVisibility(View.VISIBLE);
                mLanguage.setText(Utils.getFullDisplayName(locale, true));
                mLanguage.setText(StringUtils.getFullDisplayName(locale, true));

                mPopupLayout.setBackgroundDrawable(mListeningBorder);
                break;
+5 −5
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import com.android.inputmethod.keyboard.internal.KeyStyles;
import com.android.inputmethod.keyboard.internal.KeyStyles.KeyStyle;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.XmlParseUtils;

import org.xmlpull.v1.XmlPullParser;
@@ -293,7 +293,7 @@ public class Key {
        // Choose the first letter of the label as primary code if not specified.
        if (code == Keyboard.CODE_UNSPECIFIED && TextUtils.isEmpty(outputText)
                && !TextUtils.isEmpty(mLabel)) {
            if (Utils.codePointCount(mLabel) == 1) {
            if (StringUtils.codePointCount(mLabel) == 1) {
                // Use the first letter of the hint label if shiftedLetterActivated flag is
                // specified.
                if (hasShiftedLetterHint() && isShiftedLetterActivated()
@@ -309,7 +309,7 @@ public class Key {
                mCode = Keyboard.CODE_OUTPUT_TEXT;
            }
        } else if (code == Keyboard.CODE_UNSPECIFIED && outputText != null) {
            if (Utils.codePointCount(outputText) == 1) {
            if (StringUtils.codePointCount(outputText) == 1) {
                mCode = outputText.codePointAt(0);
                outputText = null;
            } else {
@@ -336,7 +336,7 @@ public class Key {
        if (!Keyboard.isLetterCode(code) || preserveCase) return code;
        final String text = new String(new int[] { code } , 0, 1);
        final String casedText = adjustCaseOfStringForKeyboardId(text, preserveCase, id);
        return Utils.codePointCount(casedText) == 1
        return StringUtils.codePointCount(casedText) == 1
                ? casedText.codePointAt(0) : Keyboard.CODE_UNSPECIFIED;
    }

@@ -484,7 +484,7 @@ public class Key {
    }

    public int selectTextSize(int letter, int largeLetter, int label, int hintLabel) {
        if (Utils.codePointCount(mLabel) > 1
        if (StringUtils.codePointCount(mLabel) > 1
                && (mLabelFlags & (LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO
                        | LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO)) == 0) {
            return label;
Loading