package com.icaynia.dmxario;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.LinearLayout;

import com.icaynia.dmxario.Activity.LoginActivity;
import com.icaynia.dmxario.Activity.MainActivity;
/**
 * Created by icaynia on 2016. 12. 14..
 */

public class Splash extends AppCompatActivity implements View.OnClickListener {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        viewInitialize();

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                boolean islogin = false;
                if (!islogin) {
                    onLoginButton();
                }
                //onMainActivity();
                //finish();
            }
        }, 3000);

    }

    public void onMainActivity() {
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }

    public void onLoginActivity() {
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
    }


    public void onLoginButton() {
        LinearLayout loginBox = (LinearLayout) findViewById(R.id.login);
        loginBox.setVisibility(View.VISIBLE);
    }

    private void viewInitialize() {
        LinearLayout loginAsFacebook = (LinearLayout) findViewById(R.id.login_facebook);
        LinearLayout loginAsEmail = (LinearLayout) findViewById(R.id.login_email);

        loginAsFacebook.setOnClickListener(this);
        loginAsEmail.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.login_facebook:
                onMainActivity();
                break;
            case R.id.login_email:
                onLoginActivity();
                break;
        }
    }
}

@@ -54,16 +54,56 @@
 Intent;%0A
+import android.net.ConnectivityManager;%0A
 import a
@@ -257,16 +257,45 @@
 rLayout;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -1887,24 +1887,64 @@
 k(View v) %7B%0A
+        if (isNetworkConnected()) %7B%0A    
         swit
@@ -1956,24 +1956,28 @@
 .getId()) %7B%0A
+    
             
@@ -2018,16 +2018,20 @@
         
+    
 onMainAc
@@ -2048,39 +2048,47 @@
                 
+   
+ 
 break;%0A
+    
             case
@@ -2118,24 +2118,28 @@
             
+    
 onLoginActiv
@@ -2137,32 +2137,36 @@
 oginActivity();%0A
+    
                 
@@ -2176,22 +2176,360 @@
 ak;%0A        
-%7D
+    %7D%0A        %7D else %7B%0A            Toast.makeText(this, %22%EC%9D%B8%ED%84%B0%EB%84%B7%EC%97%90 %EC%97%B0%EA%B2%B0%EB%90%98%EC%96%B4 %EC%9E%88%EC%A7%80 %EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4. %5Cn %ED%99%95%EC%9D%B8%ED%9B%84 %EB%8B%A4%EC%8B%9C %EC%8B%9C%EB%8F%84%ED%95%B4%EC%A3%BC%EC%84%B8%EC%9A%94.%22, Toast.LENGTH_SHORT).show();%0A        %7D%0A    %7D%0A%0A    private boolean isNetworkConnected()%0A    %7B%0A        ConnectivityManager cm = (ConnectivityManager) getSystemService( this.CONNECTIVITY_SERVICE );%0A        return cm.getActiveNetworkInfo() != null;
 %0A    %7D%0A%7D%0A

Add the network connect info, When the network is not connected, it doesn't not work