/** * 团购商品列表 * * @param json * @return */ public static HotPromTheTemBean parseGroupBuyListJson(String json) { JsonResult result = new JsonResult(json); if (!result.isSuccess()) { return null; } JSONObject content = result.getJsContent(); HotPromTheTemBean hotPromThem = new HotPromTheTemBean(); try { ActivityInfo info = new ActivityInfo(); JSONObject activityInfoObject = content.optJSONObject(JK_PROMOTION_ACTIVITY_INFO); if (activityInfoObject != null) { info.setActivityId(activityInfoObject.optString(JK_ACTIVITY_ID)); info.setActivityName(activityInfoObject.optString(JK_ACTIVITY_NAME)); info.setActivityRule(activityInfoObject.optString(JK_ACTIVITY_RULE)); } hotPromThem.setActivityInfo(info); JSONObject extendAttrObj = content.optJSONObject(JK_ACTIVITYEXTENDATTR); if (extendAttrObj != null) { hotPromThem.setBananerImgUrl(extendAttrObj.optString(JK_BANANERIMGURL)); // hotPromThem.setBgImgUrl(extendAttrObj.optString(JK_BGIMGURL)); // hotPromThem.setBgColor(extendAttrObj.optString(JK_BGCOLOR)); // hotPromThem.setGoodsbgColor(extendAttrObj.optString(JK_GOODSBGCOLOR)); // hotPromThem.setSkuOrgPriceColor(extendAttrObj.optString(JK_SKUORGPRICECOLOR)); // hotPromThem.setPromPriceColor(extendAttrObj.optString(JK_PROMPRICECOLOR)); // hotPromThem.setSkuNameColor(extendAttrObj.optString(JK_SKUNAMECOLOR)); // ; hotPromThem.setGoodsBorderColor(extendAttrObj.optString(JK_GOODSBORDERCOLOR)); } JSONArray goodsArray = content.optJSONArray(JK_GROUP_BUY_LIST); if (goodsArray != null) { ArrayList<Goods> goodList = new ArrayList<Goods>(); for (int i = 0, length = goodsArray.length(); i < length; i++) { JSONObject item = goodsArray.getJSONObject(i); GroupBuyProduct goods = new GroupBuyProduct(); goods.setGoodsNo(item.optString(JK_GOODS_NO)); goods.setSkuID(item.optString(JK_SKU_ID)); goods.setSkuNo(item.optString(JK_SKU_NO)); goods.setSkuName(item.optString(JK_SKU_NAME)); String skuThumbImgUrl = item.optString(JK_SKU_THUMB_IMG_URL); goods.setSkuThumbImgUrl(UrlMatcher.getFitGridThumbUrl(skuThumbImgUrl)); goods.setOriginalPrice(item.optString(JK_SKU_ORIGINAL_PRICE)); goods.setPromPrice(item.optString(JK_GROUP_BUY_SALE_PRICE)); goods.setSalePromoItem(item.optString(JK_GROUP_BUY_SALE_PROM_ID)); goodList.add(goods); } // end for hotPromThem.setGoodslist(goodList); } // end if } catch (JSONException e) { e.printStackTrace(); return null; } return hotPromThem; }
public void writeToParcel(Parcel dest, int parcelableFlags) { if (activityInfo != null) { dest.writeInt(1); activityInfo.writeToParcel(dest, parcelableFlags); } else if (serviceInfo != null) { dest.writeInt(2); serviceInfo.writeToParcel(dest, parcelableFlags); } else if (providerInfo != null) { dest.writeInt(3); providerInfo.writeToParcel(dest, parcelableFlags); } else { dest.writeInt(0); } if (filter != null) { dest.writeInt(1); filter.writeToParcel(dest, parcelableFlags); } else { dest.writeInt(0); } dest.writeInt(priority); dest.writeInt(preferredOrder); dest.writeInt(match); dest.writeInt(specificIndex); dest.writeInt(labelRes); TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags); dest.writeInt(icon); dest.writeString(resolvePackageName); dest.writeInt(system ? 1 : 0); }
public void dump(Printer pw, String prefix) { if (filter != null) { pw.println(prefix + "Filter:"); filter.dump(pw, prefix + " "); } pw.println( prefix + "priority=" + priority + " preferredOrder=" + preferredOrder + " match=0x" + Integer.toHexString(match) + " specificIndex=" + specificIndex + " isDefault=" + isDefault); if (resolvePackageName != null) { pw.println(prefix + "resolvePackageName=" + resolvePackageName); } if (labelRes != 0 || nonLocalizedLabel != null || icon != 0) { pw.println( prefix + "labelRes=0x" + Integer.toHexString(labelRes) + " nonLocalizedLabel=" + nonLocalizedLabel + " icon=0x" + Integer.toHexString(icon)); } if (activityInfo != null) { pw.println(prefix + "ActivityInfo:"); activityInfo.dump(pw, prefix + " "); } else if (serviceInfo != null) { pw.println(prefix + "ServiceInfo:"); serviceInfo.dump(pw, prefix + " "); } else if (providerInfo != null) { pw.println(prefix + "ProviderInfo:"); providerInfo.dump(pw, prefix + " "); } }