package tw.com.altob.goodpk.Activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

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

import com.ga.sdk.activity.BaseActivity;

import tw.com.altob.goodpk.Fragment.MainFragment;
import tw.com.altob.goodpk.R;
import tw.com.altob.goodpk.Util.CommonIntent;
import tw.com.altob.goodpk.Util.PrefsUtil;

public class MainActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //存token(定值)
        PrefsUtil.setAccountData(MainActivity.this, "9a406a82bd551e6ef8e845f42f788af4");
        this.createFrameLayout();
        this.nextActivity();
    }

    @Override
    protected Fragment newFragment() {
        return new MainFragment();
    }

    private void nextActivity() {
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent;

                intent = CommonIntent.createHomeActivity(MainActivity.this);

                startActivity(intent);
                overridePendingTransition(R.anim.right_in,0);
                finish();
            }
        }, 2000);
    }
}
