//点击
@Override
public void success(FLXQ_Bean flxq_bean) {
final List<FLXQ_Bean.DataBean> data = flxq_bean.getData();
FENLEIXQAdapter fenleixqAdapter=new FENLEIXQAdapter(this,data);
fenleixqAdapter.setFenleixqClick(new FENLEIXQAdapter.FENLEIXQClick() {
@Override
public void onFLXQClick(int position) {
int itemtype = data.get(position).getItemtype();
Intent intent=new Intent(FenLXQActivity.this,ShangpinXQActivity.class);
intent.putExtra("itemtype",itemtype+"");
startActivity(intent);
}
});
fenllei_xq_rlv.setAdapter(fenleixqAdapter);
}
//跳转
public class ShangpinXQActivity extends AppCompatActivity {
private ImageView iv;
private TextView titel;
private TextView neirong;
private TextView yuanjia;
private TextView xianjia;
private String typeNum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shangpin_xq);
iv = (ImageView) findViewById(R.id.xq_imageView1);
titel = (TextView) findViewById(R.id.xq_titel1);
neirong = (TextView) findViewById(R.id.xq_xiangqing1);
yuanjia = (TextView) findViewById(R.id.xq_yuanjia1);
xianjia = (TextView) findViewById(R.id.xq_xianjia1);
yuanjia.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG);
Map<String, String> map = new HashMap<>();
Intent intent = getIntent();
typeNum = intent.getStringExtra("itemtype");
map.put("pscid","2");
OkHttp3Utils.doPost(API.FENLEIXQ, map, new GsonObjectCallback<ShangPingXQ_Bean>() {
@Override
public void onUi(ShangPingXQ_Bean shangPingXQ_bean) {
if (typeNum.equals("2")){
String[] split = shangPingXQ_bean.getData().get(0).getImages().split("\\|");
Glide.with(ShangpinXQActivity.this).load(split[0]).into(iv);
titel.setText(shangPingXQ_bean.getData().get(0).getTitle());
neirong.setText(shangPingXQ_bean.getData().get(0).getSubhead());
yuanjia.setText(shangPingXQ_bean.getData().get(0).getPrice() + "");
xianjia.setText(shangPingXQ_bean.getData().get(0).getBargainPrice()+ "");
}
if (typeNum.equals("1")){
String[] split = shangPingXQ_bean.getData().get(2).getImages().split("\\|");
Glide.with(ShangpinXQActivity.this).load(split[0]).into(iv);
titel.setText(shangPingXQ_bean.getData().get(2).getTitle());
neirong.setText(shangPingXQ_bean.getData().get(2).getSubhead());
yuanjia.setText(shangPingXQ_bean.getData().get(2).getPrice() + "");
xianjia.setText(shangPingXQ_bean.getData().get(2).getBargainPrice()+ "");
}
if (typeNum.equals("0")){
String[] split = shangPingXQ_bean.getData().get(1).getImages().split("\\|");
Glide.with(ShangpinXQActivity.this).load(split[0]).into(iv);
titel.setText(shangPingXQ_bean.getData().get(1).getTitle());
neirong.setText(shangPingXQ_bean.getData().get(1).getSubhead());
yuanjia.setText(shangPingXQ_bean.getData().get(1).getPrice() + "");
xianjia.setText(shangPingXQ_bean.getData().get(1).getBargainPrice()+ "");
}
}
@Override
public void onFailed(Call call, IOException e) {
}
});
}
}