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

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

Merge "Cleanup unused methods"

parents 7540fd00 a4c7733c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1229,7 +1229,7 @@ public class Keyboard {

        private void endRow(Row row) {
            if (mCurrentRow == null)
                throw new InflateException("orphant end row tag");
                throw new InflateException("orphan end row tag");
            if (mRightEdgeKey != null) {
                mRightEdgeKey.markAsRightEdge(mParams);
                mRightEdgeKey = null;
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class StringUtils {
        return text.codePointCount(0, text.length());
    }

    public static boolean containsInCsv(String key, String csv) {
    private static boolean containsInCsv(String key, String csv) {
        if (csv == null)
            return false;
        for (String option : csv.split(",")) {
@@ -129,7 +129,7 @@ public class StringUtils {
    /**
     * Remove duplicates from an array of strings.
     *
     * This method will always keep the first occurence of all strings at their position
     * This method will always keep the first occurrence of all strings at their position
     * in the array, removing the subsequent ones.
     */
    public static void removeDupes(final ArrayList<CharSequence> suggestions) {
+1 −42
Original line number Diff line number Diff line
@@ -18,11 +18,9 @@ package com.android.inputmethod.latin;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
@@ -291,45 +289,6 @@ public class SubtypeSwitcher {
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }

    public Drawable getShortcutIcon() {
        return getSubtypeIcon(mShortcutInputMethodInfo, mShortcutSubtype);
    }

    private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) {
        final PackageManager pm = mService.getPackageManager();
        if (imi != null) {
            final String imiPackageName = imi.getPackageName();
            if (DBG) {
                Log.d(TAG, "Update icons of IME: " + imiPackageName + ","
                        + KeyboardLayoutSet.getKeyboardLayoutSetLocaleString(subtype) + ","
                        + subtype.getMode());
            }
            if (subtype != null) {
                return pm.getDrawable(imiPackageName, subtype.getIconResId(),
                        imi.getServiceInfo().applicationInfo);
            } else if (imi.getSubtypeCount() > 0 && imi.getSubtypeAt(0) != null) {
                return pm.getDrawable(imiPackageName,
                        imi.getSubtypeAt(0).getIconResId(),
                        imi.getServiceInfo().applicationInfo);
            } else {
                try {
                    return pm.getApplicationInfo(imiPackageName, 0).loadIcon(pm);
                } catch (PackageManager.NameNotFoundException e) {
                    Log.w(TAG, "IME can't be found: " + imiPackageName);
                }
            }
        }
        return null;
    }

    private static boolean contains(String[] hay, String needle) {
        for (String element : hay) {
            if (element.equals(needle))
                return true;
        }
        return false;
    }

    public boolean isShortcutImeEnabled() {
        if (mShortcutInputMethodInfo == null) {
            return false;
@@ -352,7 +311,7 @@ public class SubtypeSwitcher {
            return false;
        if (mShortcutSubtype == null)
            return true;
        if (contains(mShortcutSubtype.getExtraValue().split(","),
        if (mShortcutSubtype.containsExtraValueKey(
                SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY)) {
            return mIsNetworkConnected;
        }