package com.github.tuxdude.yani.network;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.widget.Toast;

import com.github.tuxdude.yani.utils.Logger;

public class NetworkBroadcastListener extends BroadcastReceiver {

    private static NetworkBroadcastListener instance = null;

    @Override
    public void onReceive(Context context, Intent intent) {
        Logger.trace();
        if (intent.getAction().equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
            Toast.makeText(context, "Airplane Mode Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Airplane Mode Changed");
        }
        else if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
            Toast.makeText(context, "Wifi State Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Wifi State Changed");
        }
        else if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
            Toast.makeText(context, "Network State Changed!", Toast.LENGTH_LONG).show();
            Logger.d("Network State Changed");
        }
        else {
            Logger.d("Unhandled intent: " + intent.getAction().toString());
        }
    }

    private NetworkBroadcastListener() {
        // Empty constructor
    }

    public static NetworkBroadcastListener getInstance() {
        if (instance == null) {
            instance = new NetworkBroadcastListener();
        }
        return instance;
    }
}

@@ -562,32 +562,34 @@
 ) %7B%0A            
+//
 Toast.makeText(c
@@ -641,32 +641,32 @@
 H_LONG).show();%0A
-
             Logg
@@ -795,32 +795,34 @@
 ) %7B%0A            
+//
 Toast.makeText(c
@@ -1013,32 +1013,32 @@
 NGED_ACTION)) %7B%0A
-
             Toas
@@ -1033,16 +1033,18 @@
         
+//
 Toast.ma

Disable toasts for network broadcast events.