package com.socks.jiandan.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by zhaokaiqiang on 15/4/22.
 */
public class NetWorkUtil {

	/**
	 * 判断当前网络是否已连接
	 *
	 * @param context
	 * @return
	 */
	public static boolean isNetWorkConnected(Context context) {
		boolean result;
		ConnectivityManager cm = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo netInfo = cm.getActiveNetworkInfo();
		if (netInfo != null && netInfo.isConnected()) {
			result = true;
		} else {
			result = false;
		}
		return result;
	}


	/**
	 * 判断当前的网络连接方式是否为WIFI
	 *
	 * @param context
	 * @return
	 */
	public static boolean isWifiConnected(Context context) {
		ConnectivityManager connectivityManager = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo wifiNetworkInfo = connectivityManager
				.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
		if (wifiNetworkInfo.isConnected()) {
			return true;
		}
		return false;
	}

}

@@ -510,20 +510,25 @@
 fo();%0A%09%09
-if (
+result = 
 netInfo 
@@ -563,64 +563,11 @@
 ed()
-)
  %7B%0A
-%09%09%09result = true;%0A%09%09%7D else %7B%0A%09%09%09result = false;%0A%09%09%7D%0A
 %09%09re
@@ -947,12 +947,15 @@
 ;%0A%09%09
-if (
+return 
 wifi
@@ -983,46 +983,8 @@
 ed()
-) %7B%0A%09%09%09return true;%0A%09%09%7D%0A%09%09return false
 ;%0A%09%7D

modify some code