package com.maxml.timer.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.widget.Toast;

public class NetworkStatus {
	private static final String LOG_TAG = "NetworkStatus";
	private static final String INTERNET_AVAILABLE = "Internet available!";
	private static final String INTERNET_NOT_AVAILABLE = "Internet NOT availablle!";
	private static boolean isConnected = false;

	public static boolean isNetworkAvailable(Context context) {
		ConnectivityManager connectivity = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		if (connectivity != null) {
			NetworkInfo[] info = connectivity.getAllNetworkInfo();
			if (info != null) {
				for (int i = 0; i < info.length; i++) {
					if (info[i].getState() == NetworkInfo.State.CONNECTED) {
						if (!isConnected) {
							isConnected = true;
						}
						Log.v(LOG_TAG, "Now you are connected to Internet!");
						Toast.makeText(context, INTERNET_AVAILABLE,
								Toast.LENGTH_SHORT).show();
						return true;
					}
				}
			}
		}
		Log.v(LOG_TAG, "You are not connected to Internet!");
		Toast.makeText(context, INTERNET_NOT_AVAILABLE, Toast.LENGTH_SHORT)
				.show();
		isConnected = false;
		return false;
	}

}

@@ -24,16 +24,48 @@
 .util;%0A%0A
+import android.app.AlertDialog;%0A
 import a
@@ -1020,16 +1020,17 @@
 net!%22);%0A
+%0A
 %09%09%09%09%09%09To
@@ -1073,26 +1073,24 @@
 ABLE,%0A%09%09%09%09%09%09
-%09%09
 Toast.LENGTH
@@ -1105,16 +1105,227 @@
 show();%0A
+//%09%09%09%09%09%09AlertDialog.Builder availablle = new AlertDialog.Builder(%0A//%09%09%09%09%09%09%09%09context);%0A//%09%09%09%09%09%09availablle.setMessage(INTERNET_AVAILABLE);%0A//%09%09%09%09%09%09availablle.setCancelable(true);%0A//%09%09%09%09%09%09availablle.show();%0A%09%09%09%09%09%09%0A
 %09%09%09%09%09%09re
@@ -1415,16 +1415,19 @@
 t!%22);%0A%09%09
+// 
 Toast.ma
@@ -1488,18 +1488,204 @@
 HORT)%0A%09%09
-%09%09
+// .show();%0A%09%09AlertDialog.Builder notAvailablle = new AlertDialog.Builder(context);%0A%09%09notAvailablle.setMessage(INTERNET_NOT_AVAILABLE);%0A%09%09notAvailablle.setCancelable(true);%0A%09%09notAvailablle
 .show();
@@ -1685,16 +1685,17 @@
 show();%0A
+%0A
 %09%09isConn

fix NetworkStatus