package w.soulofpluto.camera;

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

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/*
 Create by Ramesh Babu
 
 */
 public class SplashActivity extends AppCompatActivity{
     PreferenceManager preferenceManager;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState){
        setContentView(R.layout.activity_splash);
        preferenceManager = new PreferenceManager(this);
        splashMethod();
        super.onCreate(savedInstanceState);
    }
    public void splashMethod(){
        Handler handler = new Handler();
        Runnable runnable = new Runnable(){
            @Override
            public void run(){
                // TODO Auto-generated method stub
                /*startActivity(new Intent(SplashActivity.this, MainActivity.class));
                finish();*/
                if(preferenceManager.isLogged()){
                    startActivity(new Intent(SplashActivity.this, MainActivity.class));
                    finish();
                }else{
                    startActivity(new Intent(SplashActivity.this, LoginActivity.class));
                    finish();
                }
            }
        };
        handler.postDelayed(runnable, 2500);
    }
}
