/** * 解析详情json * * @param betQueryinfo * @return */ public WinPrizeQueryInfo detailJson(WinPrizeQueryInfo betQueryinfo) { try { JSONObject winprizejsonobj = new JSONObject(betQueryinfo.getJson()); JSONObject winprizejsonstring = winprizejsonobj.getJSONObject("result"); betQueryinfo.setBetCodeHtml(winprizejsonstring.getString("betCodeHtml")); betQueryinfo.setJson(winprizejsonstring.getString("betCodeJson")); } catch (JSONException e) { } return betQueryinfo; }
public void encodejson(String json) { try { JSONObject winprizejsonobj = new JSONObject(json); allPage = Integer.parseInt(winprizejsonobj.getString("totalPage")); String maxpage = ""; String winprizejsonstring = winprizejsonobj.getString("result"); JSONArray winprizejson = new JSONArray(winprizejsonstring); for (int i = 0; i < winprizejson.length(); i++) { try { WinPrizeQueryInfo winPrizeQueryinfo = new WinPrizeQueryInfo(); winPrizeQueryinfo.setBatchCode(winprizejson.getJSONObject(i).getString(BATCHCODE)); winPrizeQueryinfo.setCashTime(winprizejson.getJSONObject(i).getString(CASHTIME)); winPrizeQueryinfo.setLotNo(winprizejson.getJSONObject(i).getString(LOTNO)); winPrizeQueryinfo.setLotName(winprizejson.getJSONObject(i).getString(LOTNAME)); winPrizeQueryinfo.setSellTime(winprizejson.getJSONObject(i).getString(SELLTIME)); winPrizeQueryinfo.setWinAmount(winprizejson.getJSONObject(i).getString(WINAMOUNT)); winPrizeQueryinfo.setLotMulti(winprizejson.getJSONObject(i).getString("lotMulti")); winPrizeQueryinfo.setOrderId(winprizejson.getJSONObject(i).getString("orderId")); winPrizeQueryinfo.setBetNum(winprizejson.getJSONObject(i).getString("betNum")); winPrizeQueryinfo.setAmount(winprizejson.getJSONObject(i).getString("amount")); winPrizeQueryinfo.setWincode(winprizejson.getJSONObject(i).getString("winCode")); windatalist.add(winPrizeQueryinfo); } catch (Exception e) { } } } catch (JSONException e) { try { JSONObject winprizejson = new JSONObject(json); } catch (JSONException e1) { } } }
public AlertDialog lookDetailDialog(final WinPrizeQueryInfo info) { LayoutInflater factory = LayoutInflater.from(this); /* 中奖查询的查看详情使用余额查询的布局 */ View view = factory.inflate(R.layout.win_detail, null); final AlertDialog dialog = new AlertDialog.Builder(this).create(); TextView lotkind = (TextView) view.findViewById(R.id.gift_detail_text_lotno); TextView batchcode = (TextView) view.findViewById(R.id.gift_detail_text_batchcode); TextView dingdanno = (TextView) view.findViewById(R.id.gift_detail_text_dingdan); TextView beishu = (TextView) view.findViewById(R.id.gift_detail_text_beishu); TextView zhushu = (TextView) view.findViewById(R.id.gift_detail_text_zhushu); TextView atm = (TextView) view.findViewById(R.id.gift_detail_text_atm); TextView statetext = (TextView) view.findViewById(R.id.gift_detail_text_state); TextView bettime = (TextView) view.findViewById(R.id.gift_detail_tex_gifttime); TextView content = (TextView) view.findViewById(R.id.gift_detail_text_content); TextView person = (TextView) view.findViewById(R.id.gift_detail_text_person); TextView kaijianghao = (TextView) view.findViewById(R.id.gift_detail_text_kaijianghao); TextView atmz = (TextView) view.findViewById(R.id.gift_detail_text_atmzhong); TextView cashtime = (TextView) view.findViewById(R.id.gift_detail_tex_time); final String lotno = info.getLotNo(); lotkind.append(info.getLotName()); if (lotno.equals("J00001") || lotno.equals("J00002") || lotno.equals("J00003") || lotno.equals("J00004") || lotno.equals(Constants.LOTNO_JCLQ) || lotno.equals(Constants.LOTNO_JCLQ_DXF) || lotno.equals(Constants.LOTNO_JCLQ_RF) || lotno.equals(Constants.LOTNO_JCLQ_SFC)) { batchcode.setVisibility(View.GONE); } else { batchcode.setVisibility(TextView.VISIBLE); batchcode.append(info.getBatchCode()); } dingdanno.append(info.getOrderId()); beishu.append(info.getLotMulti()); zhushu.append(info.getBetNum()); final String FormatAmount = PublicMethod.toYuan(info.getAmount()); atm.append(FormatAmount + "元"); atmz.append(PublicMethod.toYuan(info.getWinAmount()) + "元"); cashtime.append(info.getCashTime()); person.setVisibility(View.GONE); statetext.setVisibility(View.GONE); kaijianghao.setVisibility(View.GONE); bettime.append(info.getSellTime()); content.setText(Html.fromHtml("方案内容:<br>" + info.getBetCodeHtml())); Button cancleLook = (Button) view.findViewById(R.id.gift_detail_img_cannle); cancleLook.setOnClickListener( new OnClickListener() { public void onClick(View v) { dialog.cancel(); } }); dialog.show(); dialog.getWindow().setContentView(view); return dialog; }