package shts.jp.android.nogifeed.utils;

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

public class NetworkUtils {

    private NetworkUtils() {}

    /**
     * Check network enable.
     * @param context application context.
     * @return if true network enabled.
     */
    public static boolean enableNetwork(Context context) {
        if (NetworkUtils.isAirplaneModeOn(context)) {
            return false;
        }
        return NetworkUtils.isConnected(context);
    }

    /**
     * Whether be able to network.
     *
     * @param context
     * @return Return true if network is enable.
     */
    public static boolean isConnected(Context context){
        ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();
        if( ni != null ){
            return cm.getActiveNetworkInfo().isConnected();
        }
        return false;
    }

    /**
     * Gets the state of Airplane Mode.
     *
     * @param context
     * @return Return true if airplane mode.
     */
    public static boolean isAirplaneModeOn(Context context) {

        return Settings.System.getInt(context.getContentResolver(),
                Settings.System.AIRPLANE_MODE_ON, 0) != 0;

    }

}

@@ -173,16 +173,64 @@
 tings;%0A%0A
+import shts.jp.android.nogifeed.common.Logger;%0A%0A
 public c
@@ -464,24 +464,26 @@
  context) %7B%0A
+//
         if (
@@ -524,16 +524,18 @@
 ext)) %7B%0A
+//
         
@@ -548,24 +548,26 @@
 turn false;%0A
+//
         %7D%0A  

delete air plane mode judgement