// -------------------------------------------------------------初始化 // 类似oncreate--------------------------------------------- @Init private void init() { setBottom(R.id.list); setTitle("商品详情"); Handler_Ui.resetLLBack(views.frame); Handler_Ui.resetLLBack(views.shuoming); banner = adapter.getData(); views.good_image.setAdapter(adapter); views.good_image.setFlowIndicator(views.circle); views.price.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); views.message.addTextChangedListener(this); // ------------------------------------------------------------------------------------------ // 获取商品数据 getInfo(); }
/** * 网络请求回调 * * @author [email protected] 2015年12月9日 下午4:43:46 * @param result * @return void */ @InHttp public void result(Result data) { progressDimss(); // 判断请求是否成功 if (!data.isOk()) { Toast.makeText(this, "请求失败,请重试", Toast.LENGTH_SHORT).show(); return; } banner.clear(); HashMap<String, Object> result = Handler_Json.JsonToCollection(data.object); switch (data.key) { case HttpUrl.ADD_FAVORITE_KEY: if (result.containsKey("status") && result.get("status").toString().equals("1")) { showToast("收藏成功"); } break; case HttpUrl.GOODS_INFO_KEY: if (!result.containsKey("data")) { return; } result = (HashMap<String, Object>) result.get("data"); if (result.containsKey("gallery")) { Object object = result.get("gallery"); if (object instanceof ArrayList) { banner.addAll((ArrayList<HashMap<String, Object>>) object); adapter.notifyDataSetChanged(); } } supplierid = result.get("supplierid").toString(); if (result.containsKey("name")) { views.image_title.setText(result.get("name").toString()); } if (result.containsKey("price")) { views.price.setText(result.get("price").toString()); } if (result.containsKey("saleprice")) { views.saleprice.setText(result.get("saleprice").toString()); } if (result.containsKey("suppliername")) { views.suppliername.setText(result.get("suppliername").toString()); } if (result.containsKey("spec")) { views.spec.setText(result.get("spec").toString()); } if (result.containsKey("serial")) { views.serial.setText(result.get("serial").toString()); } if (result.containsKey("area")) { views.area.setText(result.get("area").toString()); } if (result.containsKey("space")) { views.space.setText(result.get("space").toString()); } if (result.containsKey("style")) { views.style.setText(result.get("style").toString()); } if (result.containsKey("message")) { Object object = result.get("message"); if (object instanceof ArrayList) { ArrayList<HashMap<String, Object>> message = (ArrayList<HashMap<String, Object>>) object; if (message.size() > 0) { if (message.get(0).containsKey("content")) { views.question.setText(message.get(0).get("content").toString()); } if (message.get(0).containsKey("rep_time")) { views.question_time.setText(message.get(0).get("rep_time").toString()); } if (message.get(0).containsKey("rep_content")) { views.answer.setText(message.get(0).get("rep_content").toString()); } if (message.get(0).containsKey("rep_time")) { views.answer_time.setText(message.get(0).get("rep_time").toString()); } } } } break; case HttpUrl.LEAVE_MESSAGE_KEY: if (result.containsKey("status") && result.get("status").toString().equals("1")) { showToast("留言成功,等待审核"); views.message.setText(""); } break; case HttpUrl.ADD_CART_KEY: if (result.containsKey("status") && result.get("status").toString().equals("1")) { startActivity(new Intent(GoodsDetailInfoActivity.this, ShoppingCartActivity.class)); } break; default: break; } }