package fuzion24.device.vulnerability.test.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.nowsecure.android.vts.R;

import fuzion24.device.vulnerability.util.SharedPreferencesUtils;

public class SplashScreenActivity extends Activity {

    private final int SPLASH_DISPLAY_LENGTH = 2000;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.splashscreen_layout);

        new Handler().postDelayed(new Runnable(){
            @Override
            public void run() {
                if (SharedPreferencesUtils.isTheFirstRun(SplashScreenActivity.this)) {
                    Intent mainIntent = new Intent(SplashScreenActivity.this, AppIntroActivity.class);
                    SplashScreenActivity.this.startActivity(mainIntent);
                    SplashScreenActivity.this.finish();

                    return;
                }

                Intent mainIntent = new Intent(SplashScreenActivity.this, MainActivity.class);
                SplashScreenActivity.this.startActivity(mainIntent);
                SplashScreenActivity.this.finish();

            }
        }, SPLASH_DISPLAY_LENGTH);
    }

}
