package com.sheep.gamegroup.view.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.sheep.gamegroup.event.BigEvent;
import com.sheep.gamegroup.event.EventTypes;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.base.BaseFragment;

import org.greenrobot.eventbus.EventBus;

/**
 * 图片
 * Created by realicing on 2018/6/1.
 */

public class FgtImage extends BaseFragment implements View.OnClickListener{

    public static FgtImage newInstance(int id){
        FgtImage fgt = new FgtImage();
        Bundle bundle = new Bundle();
        bundle.putInt("id", id);
        fgt.setArguments(bundle);
        return fgt;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_iv;
    }

    @Override
    public void onViewCreated() {
        ImageView item_iv = getView().findViewById(R.id.item_iv);
        item_iv.setOnClickListener(this);
        Bundle bundle = getArguments();
        if(bundle != null){
            int id = bundle.getInt("id", 0);
            if(id != 0) {
                Glide.with(this)
                        .load(id)
                        .into(item_iv);
            }
        }
    }

    @Override
    public void onClick(View view) {
        EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.GUIDE_NEXT));
    }
}
