Merge "Cleanup unused methods"
This commit is contained in:
commit
b6313f7275
3 changed files with 4 additions and 45 deletions
|
@ -1229,7 +1229,7 @@ public class Keyboard {
|
||||||
|
|
||||||
private void endRow(Row row) {
|
private void endRow(Row row) {
|
||||||
if (mCurrentRow == null)
|
if (mCurrentRow == null)
|
||||||
throw new InflateException("orphant end row tag");
|
throw new InflateException("orphan end row tag");
|
||||||
if (mRightEdgeKey != null) {
|
if (mRightEdgeKey != null) {
|
||||||
mRightEdgeKey.markAsRightEdge(mParams);
|
mRightEdgeKey.markAsRightEdge(mParams);
|
||||||
mRightEdgeKey = null;
|
mRightEdgeKey = null;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class StringUtils {
|
||||||
return text.codePointCount(0, text.length());
|
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)
|
if (csv == null)
|
||||||
return false;
|
return false;
|
||||||
for (String option : csv.split(",")) {
|
for (String option : csv.split(",")) {
|
||||||
|
@ -129,7 +129,7 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* Remove duplicates from an array of strings.
|
* 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.
|
* in the array, removing the subsequent ones.
|
||||||
*/
|
*/
|
||||||
public static void removeDupes(final ArrayList<CharSequence> suggestions) {
|
public static void removeDupes(final ArrayList<CharSequence> suggestions) {
|
||||||
|
|
|
@ -18,11 +18,9 @@ package com.android.inputmethod.latin;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
@ -291,45 +289,6 @@ public class SubtypeSwitcher {
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.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() {
|
public boolean isShortcutImeEnabled() {
|
||||||
if (mShortcutInputMethodInfo == null) {
|
if (mShortcutInputMethodInfo == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -352,7 +311,7 @@ public class SubtypeSwitcher {
|
||||||
return false;
|
return false;
|
||||||
if (mShortcutSubtype == null)
|
if (mShortcutSubtype == null)
|
||||||
return true;
|
return true;
|
||||||
if (contains(mShortcutSubtype.getExtraValue().split(","),
|
if (mShortcutSubtype.containsExtraValueKey(
|
||||||
SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY)) {
|
SUBTYPE_EXTRAVALUE_REQUIRE_NETWORK_CONNECTIVITY)) {
|
||||||
return mIsNetworkConnected;
|
return mIsNetworkConnected;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue