package com.example.punyaria;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Handler;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.os.Bundle;

public class SplashScreenActivity extends AppCompatActivity {

    private static int SPLASH_TIMEOUT = 2000; // Waktu delay splash screen dalam milidetik

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

        // Inisialisasi ImageView dan animasi
        ImageView logoCenter = findViewById(R.id.logoImageViewCenter);
        Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.translate_up);

        // Mulai animasi
        logoCenter.startAnimation(animation);

        // Handler untuk delay sebelum memulai MainActivity
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent mainIntent = new Intent(SplashScreenActivity.this, LoginActivity.class);
                startActivity(mainIntent);
                finish();
            }
        }, SPLASH_TIMEOUT);
    }
}