public class dianjiEvent {
private int postion;
private int adapterpostion;
private int sum;
public int getPostion() {
return postion;
}
public void setPostion(int postion) {
this.postion = postion;
}
public int getAdapterpostion() {
return adapterpostion;
}
public void setAdapterpostion(int adapterpostion) {
this.adapterpostion = adapterpostion;
}
public int getSum() {
return sum;
}
public void setSum(int sum) {
this.sum = sum;
}
Context context;
List<ShowBean.DataBean.SpusBean> spus;
//拿去外层的下标
int postion;
public List<ShowBean.DataBean.SpusBean> getSpus() {
return spus;
}
public void setSpus(List<ShowBean.DataBean.SpusBean> spus) {
this.spus = spus;
}
public RecycleSP_Adapter(Context context, List<ShowBean.DataBean.SpusBean> spus, int postion) {
this.context = context;
this.spus = spus;
this.postion = postion;
}
zdy.setOnAddListenter(new Zdy.OnAddListenter() {
@Override
public void numListenter(int sum) {
//获取里面的
int adapterPosition = getAdapterPosition();
//postion:主层的位置 // adapterPosition:内层的位置 sum:数据的数量
EventBus.getDefault().post(new dianjiEvent(postion,adapterPosition,sum));
}
});
//注解不能少@Subscribe
@Subscribe
public void onDianjiEvent(dianjiEvent dianjiEvent){
//获取两个下标
int adapterpostion = dianjiEvent.getAdapterpostion();
int postion = dianjiEvent.getPostion();
//获取Recycke_View的Adaoter中
List<ShowBean.DataBean> data = recycleYH_adapter.getData();
//获取当前那列
ShowBean.DataBean dataBean = data.get(postion);
//哪行
List<ShowBean.DataBean.SpusBean> spus = dataBean.getSpus();
ShowBean.DataBean.SpusBean spusBean = spus.get(adapterpostion);
//获取点击的数量 //自己去里层去设置一个数量
int sum = dianjiEvent.getSum();
//设置的值是你设置数量的值
spusBean.setPraise_num(sum);
//当里面的选中的时候
if (spusBean.isThree()){
CountPrice();
}