package com.sheep.gamegroup.view.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

import com.sheep.gamegroup.absBase.BaseActivity;
import com.sheep.gamegroup.util.share.ShareLinkConfig;
import com.sheep.gamegroup.view.fragment.FgtSignCardRecord;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;

/**
 * Created by realicing on 2018/9/11.
 * realicing@sina.com
 */
public class ActSignCardRecord extends BaseActivity {

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

    private ActSignCardRecord activity;

    @Override
    public void initView() {
        activity = this;
        TitleBarUtils
                .getInstance()
                .setShowOrHide(this, true)
                .setTitleFinish(activity)
                .setTitle(activity, "我的战绩")
                .setRightBtn(activity, "分享", 0, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        new ShareLinkConfig().toShare(activity);
                    }
                });

        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        Bundle bundle = new Bundle();
        Fragment fragment = getSupportFragmentManager().findFragmentByTag("tag");
        if(fragment == null){
            fragment = new FgtSignCardRecord();
            fragment.setArguments(bundle);
            transaction.add(R.id.frame_container, fragment, "tag");
            transaction.commitAllowingStateLoss();
        }else {
            fragment.setArguments(bundle);
            transaction.replace(R.id.frame_container, fragment);
            transaction.commitAllowingStateLoss();
        }
    }


    @Override
    public void initListener() {
    }

    @Override
    public void initData() {
    }

}
