package com.sheep.gamegroup.view.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

import com.sheep.gamegroup.absBase.BaseActivity;
import com.sheep.gamegroup.util.DataUtil;
import com.sheep.gamegroup.view.fragment.FgtMainAudit;
import com.sheep.jiuyan.samllsheep.R;

/**
 * Created by ljy on 2018/8/16.
 */

public class ActAudit extends BaseActivity {
    Activity activity;

    @Override
    protected int getLayoutId() {
        return R.layout.common_container;
    }

    @Override
    public void initView() {
        activity = this;

        int index = DataUtil.getObject(getIntent(), Integer.class);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        Fragment fragment = getSupportFragmentManager().findFragmentByTag("tag");
        if(fragment == null){
            fragment = FgtMainAudit.newInstance(index);
            transaction.add(R.id.frame_container, fragment, "tag");
            transaction.commitAllowingStateLoss();
        }else {
            transaction.replace(R.id.frame_container, fragment);
            transaction.commitAllowingStateLoss();
        }
    }
}
