package com.kfzs.duanduan;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

import com.sheep.jiuyan.samllsheep.R;
import com.kfzs.duanduan.BaseCompatActivity;
import com.kfzs.duanduan.fragment.CategoryRankFragment;
import com.kfzs.duanduan.utils.dlg.TitleBarUtils;

/**
 * 游戏列表页面
 * Created by Administrator on 2017/12/13.
 */

public class ActGategoryRank extends BaseCompatActivity {

    public static final String INTENT_TYPE_ID="INTENT_TYPE_ID";

    private int mIntGameTypeId=0;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game_lists_common);
        mIntGameTypeId=getIntent().getIntExtra(INTENT_TYPE_ID,0);
        TitleBarUtils.getInstance().setTitle(this, "分类");
        TitleBarUtils.getInstance().setTitleFinish(this);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();;
        Bundle bundle = new Bundle();
        bundle.putInt(INTENT_TYPE_ID, mIntGameTypeId);
        Fragment fragment = getSupportFragmentManager().findFragmentByTag("tag");
        if(fragment == null){
            fragment = new CategoryRankFragment();
            fragment.setArguments(bundle);
            transaction.add(R.id.fragment_container, fragment, "tag");
            transaction.commit();
        }else{
            fragment.setArguments(bundle);
            transaction.replace(R.id.fragment_container, fragment);
            transaction.commit();
        }


    }
}
