package com.hyperling.carbupbeta;

import android.content.Intent;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import java.util.Timer;
import java.util.TimerTask;

//This class is simply the load screen to start Tabs.class


public class Splash extends Activity {

    private DALIH dalih;

    TextView txtStatus;

    int loadTime = 3000;
    int quickTime = 500;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        dalih = new DALIH(this);

        // Find the TextViews
        txtStatus = (TextView) findViewById(R.id.txtLoadStatus);

        // Create the TimerTask to launch main
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                startActivity(new Intent(Splash.this, Main.class));
                //startActivity(new Intent(Splash.this, Home.class));
                finish();
            }
        };

        dalih.open();
        if (dalih.getQuickLoad()){
            loadTime = quickTime;
        }
        dalih.close();

        //Create and start the timer
        Timer timer = new Timer();
        timer.schedule(timerTask, loadTime);

    }

    @Override
    protected void onResume() {
        dalih.open();
        super.onResume();
    }

    @Override
    protected void onPause() {
        dalih.close();
        super.onPause();
    }
}
