|
|
|
@ -1,13 +1,34 @@ |
|
|
|
package com.qhclh.ytzh.index.fumudai; |
|
|
|
|
|
|
|
import android.support.v7.widget.GridLayoutManager; |
|
|
|
import android.support.v7.widget.RecyclerView; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.ImageView; |
|
|
|
|
|
|
|
import com.bumptech.glide.Glide; |
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseFragment; |
|
|
|
import com.qhclh.ytzh.bean.FumudaiBean; |
|
|
|
import com.qhclh.ytzh.utils.RecyclerViewUtil; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
|
|
|
|
/** |
|
|
|
* Created by 青花瓷 on 2017/12/22. |
|
|
|
*/ |
|
|
|
|
|
|
|
public class FumudaiFragment extends BaseFragment { |
|
|
|
@BindView(R.id.fumudai_banner) |
|
|
|
ImageView fumudai_banner; |
|
|
|
@BindView(R.id.rv_fuwudai) |
|
|
|
RecyclerView rv_fuwudai; |
|
|
|
|
|
|
|
private List<FumudaiBean> fumudaiBeenList; |
|
|
|
private FumudaiAdapter fumudaiAdapter; |
|
|
|
private GridLayoutManager mLayoutManager; |
|
|
|
@Override |
|
|
|
protected int setLayout() { |
|
|
|
return R.layout.fragment_index_fumudai; |
|
|
|
@ -15,16 +36,36 @@ public class FumudaiFragment extends BaseFragment { |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initView() { |
|
|
|
|
|
|
|
Glide.with(getActivity()) |
|
|
|
.load("https://ss1.bdstatic.com/5aAHeD3nKgcUp2HgoI7O1ygwehsv/media/ch1000/png/2017shengdanbackground.png") |
|
|
|
.error(R.mipmap.ic_launcher_round) |
|
|
|
.placeholder(R.mipmap.ic_launcher_round) |
|
|
|
.into(fumudai_banner); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initData() { |
|
|
|
fumudaiBeenList = new ArrayList<>(); |
|
|
|
fumudaiBeenList.add(new FumudaiBean(11,"空栏:"+123,R.mipmap.ic_launcher_round)); |
|
|
|
fumudaiBeenList.add(new FumudaiBean(12,"育成期:"+34,R.mipmap.ic_launcher_round)); |
|
|
|
fumudaiBeenList.add(new FumudaiBean(23,"产蛋期:"+78,R.mipmap.ic_launcher_round)); |
|
|
|
|
|
|
|
fumudaiAdapter = new FumudaiAdapter(getActivity(),fumudaiBeenList); |
|
|
|
mLayoutManager=new GridLayoutManager(getActivity(),2,GridLayoutManager.VERTICAL,false);//设置为一个2列的纵向网格布局 |
|
|
|
rv_fuwudai.setLayoutManager(mLayoutManager); |
|
|
|
rv_fuwudai.setAdapter(fumudaiAdapter); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initOper() { |
|
|
|
|
|
|
|
RecyclerViewUtil util=new RecyclerViewUtil(getActivity(),rv_fuwudai); |
|
|
|
util.setOnItemClickListener(new RecyclerViewUtil.OnItemClickListener() { |
|
|
|
@Override |
|
|
|
public void onItemClick(View view, int position, long id) { |
|
|
|
System.out.println("aaa++++"+position); |
|
|
|
///< 设置的id |
|
|
|
System.out.println("aaa+++++++"+fumudaiAdapter.getItemId(position)); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |