cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject cordova-plugin-network-information git commit: Solved toLowerCase issue with Locale.US
Date Tue, 28 Jul 2015 17:58:41 GMT
Repository: cordova-plugin-network-information
Updated Branches:
  refs/heads/master 0464a9774 -> c40e579c5


Solved toLowerCase issue with Locale.US

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/commit/c40e579c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/tree/c40e579c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/diff/c40e579c

Branch: refs/heads/master
Commit: c40e579c5aa4e77a4695040b44ce3aa427429a1e
Parents: 0464a97
Author: Can Tecim <can.tecim@gmail.com>
Authored: Sun Jul 26 21:11:52 2015 +0300
Committer: Can Tecim <can.tecim@gmail.com>
Committed: Sun Jul 26 21:11:52 2015 +0300

----------------------------------------------------------------------
 src/android/NetworkManager.java | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/c40e579c/src/android/NetworkManager.java
----------------------------------------------------------------------
diff --git a/src/android/NetworkManager.java b/src/android/NetworkManager.java
index 4c85dda..d4cde23 100755
--- a/src/android/NetworkManager.java
+++ b/src/android/NetworkManager.java
@@ -35,6 +35,8 @@ import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.util.Log;
 
+import java.util.Locale;
+
 public class NetworkManager extends CordovaPlugin {
 
     public static int NOT_REACHABLE = 0;
@@ -233,28 +235,30 @@ public class NetworkManager extends CordovaPlugin {
         if (info != null) {
             String type = info.getTypeName();
 
-            if (type.toLowerCase().equals(WIFI)) {
+            Log.d("CordovaNetworkManager", "toLower : " + type.toLowerCase());
+            Log.d("CordovaNetworkManager", "wifi : " + WIFI);
+            if (type.toLowerCase(Locale.US).equals(WIFI)) {
                 return TYPE_WIFI;
             }
-            else if (type.toLowerCase().equals(MOBILE) || type.toLowerCase().equals(CELLULAR))
{
+            else if (type.toLowerCase(Locale.US).equals(MOBILE) || type.toLowerCase(Locale.US).equals(CELLULAR))
{
                 type = info.getSubtypeName();
-                if (type.toLowerCase().equals(GSM) ||
-                        type.toLowerCase().equals(GPRS) ||
-                        type.toLowerCase().equals(EDGE)) {
+                if (type.toLowerCase(Locale.US).equals(GSM) ||
+                        type.toLowerCase(Locale.US).equals(GPRS) ||
+                        type.toLowerCase(Locale.US).equals(EDGE)) {
                     return TYPE_2G;
                 }
-                else if (type.toLowerCase().startsWith(CDMA) ||
-                        type.toLowerCase().equals(UMTS) ||
-                        type.toLowerCase().equals(ONEXRTT) ||
-                        type.toLowerCase().equals(EHRPD) ||
-                        type.toLowerCase().equals(HSUPA) ||
-                        type.toLowerCase().equals(HSDPA) ||
-                        type.toLowerCase().equals(HSPA)) {
+                else if (type.toLowerCase(Locale.US).startsWith(CDMA) ||
+                        type.toLowerCase(Locale.US).equals(UMTS) ||
+                        type.toLowerCase(Locale.US).equals(ONEXRTT) ||
+                        type.toLowerCase(Locale.US).equals(EHRPD) ||
+                        type.toLowerCase(Locale.US).equals(HSUPA) ||
+                        type.toLowerCase(Locale.US).equals(HSDPA) ||
+                        type.toLowerCase(Locale.US).equals(HSPA)) {
                     return TYPE_3G;
                 }
-                else if (type.toLowerCase().equals(LTE) ||
-                        type.toLowerCase().equals(UMB) ||
-                        type.toLowerCase().equals(HSPA_PLUS)) {
+                else if (type.toLowerCase(Locale.US).equals(LTE) ||
+                        type.toLowerCase(Locale.US).equals(UMB) ||
+                        type.toLowerCase(Locale.US).equals(HSPA_PLUS)) {
                     return TYPE_4G;
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message