package com.hi.music.player.ui.activity;

import android.content.Intent;
import android.os.CountDownTimer;
import android.view.View;

import com.hi.music.player.databinding.ActivityAsplashBinding;


public class A_SplashActivity extends BaseActivity<ActivityAsplashBinding> {

    private static final int SPLASH_TIME_OUT = 1500;
    private CountDownTimer countDownTimer;

    @Override
    protected ActivityAsplashBinding getViewBinding() {
        return ActivityAsplashBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void onCreateInit() {

        intData();

    }

    @Override
    protected void onInitClick() {

    }

    @Override
    public boolean isFullScreen() {
        return true;
    }

    @Override
    public boolean statusBarLight() {
        return false;
    }

    public void intData(){

        countDownTimer = new CountDownTimer(SPLASH_TIME_OUT, 100) {

            @Override
            public void onTick(long millisUntilFinished) {

                float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
                int v1 = (int) v;
                vb.progressBar.setProgress(v1);

            }

            @Override
            public void onFinish() {
                vb.progressBar.setProgress(100);
                Intent intent = new Intent(A_SplashActivity.this, A_HomeActivity.class);
                startActivity(intent);
                finish();
            }
        };

        countDownTimer.start();

    }

    @Override
    public void onClick(View v) {

    }
}