aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-11-07 13:42:13 -0800
committerTadashi G. Takaoka <takaoka@google.com>2014-12-11 01:37:44 +0000
commit2b25f674f29a4c7b3c8d70bc0fbfbdc60da131c4 (patch)
treee4fa48e0ffab497edf37b798d93966bc3c43c3ba /java/src/com/android/inputmethod/latin/RichInputMethodManager.java
parent370f129b58f0a0271fa5ef0a2c97b511e625279d (diff)
downloadlatinime-2b25f674f29a4c7b3c8d70bc0fbfbdc60da131c4.tar.gz
latinime-2b25f674f29a4c7b3c8d70bc0fbfbdc60da131c4.tar.xz
latinime-2b25f674f29a4c7b3c8d70bc0fbfbdc60da131c4.zip
Add NetworkConnectivityUtils class
Change-Id: I7bd71f1d4ef0fc0fe21ddfd9f3e11463f53ac4e7
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputMethodManager.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputMethodManager.java21
1 files changed, 2 insertions, 19 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
index 462121789..bc700c0b7 100644
--- a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
+++ b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java
@@ -20,11 +20,8 @@ import static com.android.inputmethod.latin.common.Constants.Subtype.KEYBOARD_MO
import static com.android.inputmethod.latin.common.Constants.Subtype.ExtraValue.REQ_NETWORK_CONNECTIVITY;
import android.content.Context;
-import android.content.Intent;
import android.content.SharedPreferences;
import android.inputmethodservice.InputMethodService;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Build;
import android.os.IBinder;
@@ -36,10 +33,10 @@ import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
-import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.latin.settings.AdditionalFeaturesSettingUtils;
import com.android.inputmethod.latin.settings.Settings;
import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
+import com.android.inputmethod.latin.utils.NetworkConnectivityUtils;
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
import java.util.Collections;
@@ -72,7 +69,6 @@ public class RichInputMethodManager {
private RichInputMethodSubtype mCurrentRichInputMethodSubtype;
private InputMethodInfo mShortcutInputMethodInfo;
private InputMethodSubtype mShortcutSubtype;
- private boolean mIsNetworkConnected;
final HashMap<InputMethodInfo, List<InputMethodSubtype>>
mSubtypeListCacheWithImplicitlySelectedSubtypes = new HashMap<>();
final HashMap<InputMethodInfo, List<InputMethodSubtype>>
@@ -116,11 +112,6 @@ public class RichInputMethodManager {
// Initialize the current input method subtype and the shortcut IME.
refreshSubtypeCaches();
-
- final ConnectivityManager connectivityManager =
- (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- final NetworkInfo info = connectivityManager.getActiveNetworkInfo();
- mIsNetworkConnected = (info != null && info.isConnected());
}
public InputMethodSubtype[] getAdditionalSubtypes() {
@@ -591,16 +582,8 @@ public class RichInputMethodManager {
return true;
}
if (mShortcutSubtype.containsExtraValueKey(REQ_NETWORK_CONNECTIVITY)) {
- return mIsNetworkConnected;
+ return NetworkConnectivityUtils.isNetworkConnected();
}
return true;
}
-
- public void onNetworkStateChanged(final Intent intent) {
- final boolean noConnection = intent.getBooleanExtra(
- ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
- mIsNetworkConnected = !noConnection;
-
- KeyboardSwitcher.getInstance().onNetworkStateChanged();
- }
}