package com.hesiii.i_hear;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.os.Handler;

import com.google.firebase.auth.FirebaseAuth;
import com.hesiii.i_hear.Activities.HomeActivity;
import com.hesiii.i_hear.Activities.SignUpActivity;

public class MainActivity extends AppCompatActivity {

    private FirebaseAuth auth;

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

        // Define the colors
        int topLeftColor = Color.parseColor("#738FCE");
        int topRightColor = Color.parseColor("#865FBF");
        int centerColor = Color.parseColor("#8366C1");
        int bottomLeftColor = Color.parseColor("#865FBF");
        int bottomRightColor = Color.parseColor("#992FB0");

        // Create a gradient drawable
        GradientDrawable gradientDrawable = new GradientDrawable(
                GradientDrawable.Orientation.TL_BR,
                new int[]{topLeftColor, topRightColor, centerColor, bottomLeftColor, bottomRightColor}
        );

        auth = FirebaseAuth.getInstance();

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                if (auth.getCurrentUser() != null) {

                    startActivity(new Intent(MainActivity.this, HomeActivity.class));

                } else {

                    startActivity(new Intent(MainActivity.this, SignUpActivity.class));

                }

                finishAffinity();

            }
        }, 3000);

    }



}