package com.qhclh.ytzh.splash;

import android.content.Intent;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.LinearLayout;

import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseActivity;
import com.qhclh.ytzh.login.LoginActivity;

import butterknife.BindView;

/**
 * Created by 青花瓷 on 2017/11/23.
 */

public class SplashActivity extends BaseActivity {
    @BindView(R.id.ll_splash)
    LinearLayout ll_splash;

    @Override
    protected int setLayoutId() {
        return R.layout.act_splash;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initOper() {

        //渐变展示启动屏
        AlphaAnimation aa = new AlphaAnimation(0.3f, 1.0f);
        aa.setDuration(2000);
        ll_splash.startAnimation(aa);
        aa.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationEnd(Animation arg0) {
                redirectTo();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationStart(Animation animation) {
            }

        });

    }

    private void redirectTo() {
        startActivity(new Intent(this, LoginActivity.class));
        finish();
    }
}
