package com.hyphenate.chatuidemo.ui;

import android.content.Intent;
import android.os.Bundle;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chatuidemo.call.VideoCallActivity;
import com.hyphenate.chatuidemo.call.VoiceCallActivity;
import com.hyphenate.chatuidemo.sign.SignInActivity;
import com.hyphenate.util.EasyUtils;

/**
 * Created by lzan13 on 2016/11/14.
 */

public class SplashActivity extends BaseActivity {
    private static final int sleepTime = 2000;

    @Override protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        if (EMClient.getInstance().isLoggedInBefore()) {
            String topActivityName =
                    EasyUtils.getTopActivityName(EMClient.getInstance().getContext());
            if (topActivityName != null && (topActivityName.equals(
                    VideoCallActivity.class.getName()) || topActivityName.equals(
                    VoiceCallActivity.class.getName()))) {
                // nop
                // avoid main screen overlap Calling Activity
            } else {
                //enter main screen
                startActivity(new Intent(SplashActivity.this, MainActivity.class));
            }
            finish();
        } else {
            try {
                Thread.sleep(sleepTime);
            } catch (InterruptedException e) {
            }
            startActivity(new Intent(SplashActivity.this, SignInActivity.class));
            finish();
        }
    }
}

@@ -160,176 +160,27 @@
 emo.
-call.VideoCallActivity;%0Aimport com.hyphenate.chatuidemo.call.VoiceCallActivity;%0Aimport com.hyphenate.chatuidemo.sign.SignInActivity;%0Aimport com.hyphenate.util.EasyUtils
+sign.SignInActivity
 ;%0A%0A/
@@ -278,16 +278,18 @@
 y %7B%0A    
+//
 private 
@@ -468,487 +468,8 @@
 ) %7B%0A
-            String topActivityName =%0A                    EasyUtils.getTopActivityName(EMClient.getInstance().getContext());%0A            if (topActivityName != null && (topActivityName.equals(%0A                    VideoCallActivity.class.getName()) %7C%7C topActivityName.equals(%0A                    VoiceCallActivity.class.getName()))) %7B%0A                // nop%0A                // avoid main screen overlap Calling Activity%0A            %7D else %7B%0A                //enter main screen%0A    
     
@@ -544,30 +544,16 @@
 lass));%0A
-            %7D%0A
         
@@ -595,16 +595,18 @@
         
+//
 try %7B%0A  
@@ -611,24 +611,26 @@
             
+//
     Thread.s
@@ -658,16 +658,18 @@
         
+//
 %7D catch 
@@ -703,24 +703,26 @@
             
+//
 %7D%0A          

remove the sleep time