com.mob.tools.utils.ResHelper Java Examples
The following examples show how to use
com.mob.tools.utils.ResHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RealTimeExchangeAdapter.java From styT with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public void onSuccess(API api, int action, Map<String, Object> result) { isLoading = false; // 解析数据 result = (Map<String, Object>) result.get("result"); try { int curPage = ResHelper.parseInt(ResHelper.toString(result.get("page"))); totalPage = ResHelper.parseInt(ResHelper.toString(result.get("totalPage"))); if (curPage != pageIndex + 1) { return; } } catch (Throwable t) { throw new RuntimeException(t); } // 追加数据 pageIndex++; ArrayList<HashMap<String, Object>> resultList = ResHelper.forceCast(result.get("resultList")); list.addAll(resultList); // 显示数据 notifyDataSetChanged(); }
Example #2
Source File: QueryExchangeRateByCode.java From styT with Apache License 2.0 | 6 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { Map<String, Object> res = ResHelper.forceCast(result.get("result")); tvBuyPic.setText(String.valueOf(res.get("buyPic"))); tvClosePri.setText(String.valueOf(res.get("closePri"))); tvCode.setText(String.valueOf(res.get("code"))); tvCurrency.setText(String.valueOf(res.get("currency"))); tvDate.setText(String.valueOf(res.get("date"))); tvDiffAmo.setText(String.valueOf(res.get("diffAmo"))); tvDiffPer.setText(String.valueOf(res.get("diffPer"))); tvHighPic.setText(String.valueOf(res.get("highPic"))); tvLowPic.setText(String.valueOf(res.get("lowPic"))); tvOpenPri.setText(String.valueOf(res.get("openPri"))); tvRange.setText(String.valueOf(res.get("range"))); tvSellPic.setText(String.valueOf(res.get("sellPic"))); tvYesterdayPic.setText(String.valueOf(res.get("yesDayPic"))); }
Example #3
Source File: OnekeyShareThemeImpl.java From LQRWeChat with MIT License | 6 votes |
final ShareParams shareDataToShareParams(Platform plat) { if (plat == null || shareParamsMap == null) { toast("ssdk_oks_share_failed"); return null; } try { String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath")); Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare")); if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) { String path = ResHelper.getCachePath(plat.getContext(), "screenshot"); File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg"); FileOutputStream fos = new FileOutputStream(ss); viewToShare.compress(CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); shareParamsMap.put("imagePath", ss.getAbsolutePath()); } } catch (Throwable t) { t.printStackTrace(); toast("ssdk_oks_share_failed"); return null; } return new ShareParams(shareParamsMap); }
Example #4
Source File: TestActivity.java From BBSSDK-for-Android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MobSDK.init(this); setContentView(ResHelper.getLayoutRes(this, "layout_test")); cleverImageView = (CleverImageView) findViewById(ResHelper.getIdRes(this, "cleverImageView")); btnTest = (Button) findViewById(ResHelper.getIdRes(this, "btnTest")); btnTest.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // cleverImageView.setOval(false); cleverImageView.setBorderColor(Color.BLUE); cleverImageView.setBorderWidthDP(2); cleverImageView.setCornerRadiiDP(10, 5, 20, 30); cleverImageView.setImageUrl(IMAGE_URL); } }); }
Example #5
Source File: IKTokenAPIActivity.java From styT with Apache License 2.0 | 6 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { switch (action) { case IKToken.ACTION_CATEGORY: { ArrayList<HashMap<String, String>> tmpList = ResHelper.forceCast(result.get("result")); if (tmpList == null || tmpList.size() < 1) { return; } categoryList.clear(); categoryList.addAll(tmpList); categoryAdapter.notifyDataSetChanged(); } break; case IKToken.ACTION_ANALYZE: { tvResult.setText(result.get("result").toString()); isQuerying = false; } break; } }
Example #6
Source File: IKTokenAPIActivity.java From styT with Apache License 2.0 | 6 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_iktoken); etText = ResHelper.forceCast(findViewById(R.id.etText)); tvResultTitle = ResHelper.forceCast(findViewById(R.id.tvResultTitle)); tvResult = ResHelper.forceCast(findViewById(R.id.tvResult)); GridView gvCategory = ResHelper.forceCast(findViewById(R.id.gvCategory)); gvCategory.setOnItemClickListener(this); categoryList = new ArrayList<HashMap<String, String>>(); categoryAdapter = new SimpleAdapter(this, categoryList, android.R.layout.simple_list_item_1, new String[]{"desc"}, new int[]{android.R.id.text1}); gvCategory.setAdapter(categoryAdapter); //获取分词库 ((IKToken) MobAPI.getAPI(IKToken.NAME)).queryWordCategory(IKTokenAPIActivity.this); }
Example #7
Source File: StationAPIActivity.java From styT with Apache License 2.0 | 6 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { @SuppressWarnings("unchecked") HashMap<String, Object> address = (HashMap<String, Object>) result.get("result"); tvId.setText(com.mob.tools.utils.ResHelper.toString(address.get("id"))); tvAddr.setText(com.mob.tools.utils.ResHelper.toString(address.get("addr"))); tvCell.setText(com.mob.tools.utils.ResHelper.toString(address.get("cell"))); tvGoogleLat.setText(com.mob.tools.utils.ResHelper.toString(address.get("googleLat"))); tvGoogleLng.setText(com.mob.tools.utils.ResHelper.toString(address.get("googleLng"))); tvLac.setText(com.mob.tools.utils.ResHelper.toString(address.get("lac"))); tvLat.setText(com.mob.tools.utils.ResHelper.toString(address.get("lat"))); tvLng.setText(com.mob.tools.utils.ResHelper.toString(address.get("lng"))); tvMcc.setText(com.mob.tools.utils.ResHelper.toString(address.get("mcc"))); tvMnc.setText(com.mob.tools.utils.ResHelper.toString(address.get("mnc"))); tvPrecision.setText(com.mob.tools.utils.ResHelper.toString(address.get("precision"))); if (tvPrecision.getText().length() > 0) { String text = tvPrecision.getText().toString(); String unit = getString(R.string.units_meters); tvPrecision.setText(text + unit); } }
Example #8
Source File: TiKuAdapter.java From styT with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public void onSuccess(API api, int action, Map<String, Object> result) { isLoading = false; // 解析数据 result = (Map<String, Object>) result.get("result"); try { int curPage = com.mob.tools.utils.ResHelper.parseInt(com.mob.tools.utils.ResHelper.toString(result.get("curPage"))); total = com.mob.tools.utils.ResHelper.parseInt(com.mob.tools.utils.ResHelper.toString(result.get("total"))); if (curPage != pageIndex + 1) { return; } } catch (Throwable t) { throw new RuntimeException(t); } // 追加数据 pageIndex++; ArrayList<HashMap<String, Object>> resultList = ResHelper.forceCast(result.get("list")); list.addAll(resultList); // 显示数据 notifyDataSetChanged(); }
Example #9
Source File: GetAllAdapter.java From styT with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private View getView1(int position, View convertView, ViewGroup parent) { final ViewHolder viewHolder; if (convertView == null) { convertView = View.inflate(parent.getContext(), R.layout.view_ucache_getall_list_item, null); viewHolder = new ViewHolder(); viewHolder.tvKey = ResHelper.forceCast(convertView.findViewById(R.id.tvKey)); viewHolder.tvValue = ResHelper.forceCast(convertView.findViewById(R.id.tvValue)); convertView.setTag(viewHolder); } else { viewHolder = ResHelper.forceCast(convertView.getTag()); } HashMap<String, Object> data = getItem(position); viewHolder.tvKey.setText(String.valueOf(data.get("k"))); viewHolder.tvValue.setText(String.valueOf(data.get("v"))); return convertView; }
Example #10
Source File: PlatformPageAdapterPort.java From LiuAGeAndroid with MIT License | 6 votes |
protected void calculateSize(Context context, ArrayList<Object> plats) { int screenWidth = ResHelper.getScreenWidth(context); lineSize = LINE_SIZE_P; float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_P; sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio); sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth; logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio); paddingTop = (int) (DESIGN_PADDING_TOP * ratio); bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); cellHeight = (screenWidth - sepLineWidth * 3) / 4; if (plats.size() <= lineSize) { panelHeight = cellHeight + sepLineWidth; } else if (plats.size() <= PAGE_SIZE_P - lineSize) { panelHeight = (cellHeight + sepLineWidth) * 2; } else { panelHeight = (cellHeight + sepLineWidth) * 3; } }
Example #11
Source File: PlatformPageAdapterPort.java From enjoyshop with Apache License 2.0 | 6 votes |
protected void calculateSize(Context context, ArrayList<Object> plats) { int screenWidth = ResHelper.getScreenWidth(context); lineSize = LINE_SIZE_P; float ratio = ((float) screenWidth) / DESIGN_SCREEN_WIDTH_P; sepLineWidth = (int) (DESIGN_SEP_LINE_WIDTH * ratio); sepLineWidth = sepLineWidth < 1 ? 1 : sepLineWidth; logoHeight = (int) (DESIGN_LOGO_HEIGHT * ratio); paddingTop = (int) (DESIGN_PADDING_TOP * ratio); bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); cellHeight = (screenWidth - sepLineWidth * 3) / 4; if (plats.size() <= lineSize) { panelHeight = cellHeight + sepLineWidth; } else if (plats.size() <= PAGE_SIZE_P - lineSize) { panelHeight = (cellHeight + sepLineWidth) * 2; } else { panelHeight = (cellHeight + sepLineWidth) * 3; } }
Example #12
Source File: DomesticMetalAPIActivity.java From styT with Apache License 2.0 | 5 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { ArrayList<Map<String, Object>> res = ResHelper.forceCast(result.get("result")); if (res != null && res.size() > 0) { showSpotResult(res); } setBtnEnable(true); }
Example #13
Source File: OnekeyShare.java From LQRWeChat with MIT License | 5 votes |
/** 设置自己图标和点击事件,可以重复调用添加多次 */ public void setCustomerLogo(Bitmap logo, String label, OnClickListener ocl) { CustomerLogo cl = new CustomerLogo(); cl.logo = logo; cl.label = label; cl.listener = ocl; ArrayList<CustomerLogo> customers = ResHelper.forceCast(params.get("customers")); customers.add(cl); }
Example #14
Source File: CustomAPISemiAutomaticActivity.java From styT with Apache License 2.0 | 5 votes |
private void onAPIListGot(List<Map<String, Object>> apis) { if (apis == null) { apis = new ArrayList<Map<String, Object>>(); } this.apis = apis; ArrayList<String> apiNames = new ArrayList<String>(); for (Map<String, Object> api : apis) { apiNames.add(ResHelper.toString(api.get("name"))); } Collections.sort(apiNames); spAPI.setAdapter(new ArrayAdapter<String>(this, R.layout.view_weather_district, apiNames)); }
Example #15
Source File: PlatformPageAdapter.java From LiuAGeAndroid with MIT License | 5 votes |
public View getView(int index, View convertView, ViewGroup parent) { if (convertView == null) { convertView = createPanel(parent.getContext()); } LinearLayout llPanel = ResHelper.forceCast(convertView); LinearLayout[] llCells = ResHelper.forceCast(llPanel.getTag()); refreshPanel(llCells, cells[index]); return convertView; }
Example #16
Source File: EditPage.java From YiZhi with Apache License 2.0 | 5 votes |
/** 执行分享时的方法 */ private void shareAndFinish() { int resId = ResHelper.getStringRes(activity, "ssdk_oks_sharing"); if (resId > 0) { Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show(); } if (isDisableSSO()) { platform.SSOSetting(true); } platform.setPlatformActionListener(getCallback()); platform.share(sp); finish(); }
Example #17
Source File: OilPriceAPIActivity.java From styT with Apache License 2.0 | 5 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { HashMap<String, Object> res = ResHelper.forceCast(result.get("result")); if (res != null && res.size() > 0) { ArrayList<HashMap<String, Object>> tempList = new ArrayList<HashMap<String, Object>>(); for (Map.Entry<String, Object> entry : res.entrySet()) { HashMap<String, Object> value = ResHelper.forceCast(entry.getValue()); tempList.add(value); } if (tempList.size() > 0) { oilPriceList.clear(); oilPriceList.addAll(tempList); oilPriceAdapter.notifyDataSetChanged(); } } }
Example #18
Source File: EditPagePort.java From BaoKanAndroid with MIT License | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = ResHelper.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example #19
Source File: WxArticleAPIActivity.java From styT with Apache License 2.0 | 5 votes |
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { HashMap<String, Object> item = ResHelper.forceCast(categoryAdapter.getItem(position)); //goto wx articles Intent intent = new Intent(this, WxArticleListAPIActivity.class); intent.putExtra("name", (String) item.get("name")); intent.putExtra("cid", (String) item.get("cid")); startActivity(intent); }
Example #20
Source File: UcachePutActivity.java From styT with Apache License 2.0 | 5 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ucache_put); etTable = ResHelper.forceCast(findViewById(R.id.etTable)); etKey = ResHelper.forceCast(findViewById(R.id.etKey)); etValue = ResHelper.forceCast(findViewById(R.id.etValue)); etTable.setText("mobile"); etKey.setText("mobile");//bW9iaWxl etValue.setText("14782867238");//MTQ3ODI4NjcyMzg btnPut = findViewById(R.id.btnPut); btnPut.setOnClickListener(this); }
Example #21
Source File: DreamAPIActivity.java From styT with Apache License 2.0 | 5 votes |
private View getView1(int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(R.layout.view_dream_item, null); TextView tvName = ResHelper.forceCast(convertView.findViewById(R.id.tvName)); TextView tvDetail = ResHelper.forceCast(convertView.findViewById(R.id.tvDetail)); HashMap<String, Object> res = list.get(position); tvName.setText(ResHelper.toString(res.get("name"))); tvDetail.setText(ResHelper.toString(res.get("detail"))); return convertView; }
Example #22
Source File: DreamAPIActivity.java From styT with Apache License 2.0 | 5 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { isLoading = false; HashMap<String, Object> res = ResHelper.forceCast(result.get("result")); total = Integer.parseInt(ResHelper.toString(res.get("total"))); ArrayList<HashMap<String, Object>> list = ResHelper.forceCast(res.get("list")); if (null != list) { dreamList.addAll(list); adapter.notifyDataSetChanged(); } pageIndex ++; }
Example #23
Source File: DreamAPIActivity.java From styT with Apache License 2.0 | 5 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dream); lvDream = ResHelper.forceCast(findViewById(R.id.lvDream)); etDream = ResHelper.forceCast(findViewById(R.id.etDream)); etDream.setText(R.string.dream_api_example); findViewById(R.id.btnSearch).setOnClickListener(this); dreamList = new ArrayList<HashMap<String,Object>>(); adapter = new DreamSimpleAdapter(this, dreamList); lvDream.setAdapter(adapter); }
Example #24
Source File: EditPagePort.java From YiZhi with Apache License 2.0 | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = ResHelper.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example #25
Source File: OilPriceAPIActivity.java From styT with Apache License 2.0 | 5 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_oilprice); ListView lvResult = ResHelper.forceCast(findViewById(R.id.lvResult)); //init data oilPriceList = new ArrayList<HashMap<String, Object>>(); oilPriceAdapter = new OilPriceAdapter(this, oilPriceList); lvResult.setAdapter(oilPriceAdapter); //查询今日油价 ((OilPrice) ResHelper.forceCast(MobAPI.getAPI(OilPrice.NAME))).queryOilPrice(OilPriceAPIActivity.this); }
Example #26
Source File: QueryRMBQuotationByBank.java From styT with Apache License 2.0 | 5 votes |
public void onSuccess(API api, int action, Map<String, Object> result) { ArrayList<Map<String, Object>> res = ResHelper.forceCast(result.get("result")); if (res == null) { res = new ArrayList<Map<String, Object>>(); } dataList.clear(); dataList.addAll(res); adapter.notifyDataSetChanged(); setBtnEnable(true); }
Example #27
Source File: MenuAdapter.java From styT with Apache License 2.0 | 5 votes |
/** * 请求下一个页面的数据 */ public void requestMenu() { if (isLoading) { return; } isLoading = true; Cook api = ResHelper.forceCast(MobAPI.getAPI(Cook.NAME)); api.searchMenu(ctgId, null, pageIndex + 1, PAGE_SIZE, this); }
Example #28
Source File: QueryRMBQuotationByBank.java From styT with Apache License 2.0 | 5 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_exchange_rmb_quotation); btnICBC = ResHelper.forceCast(findViewById(R.id.btnICBC)); btnCMB = ResHelper.forceCast(findViewById(R.id.btnCMB)); btnCCB = ResHelper.forceCast(findViewById(R.id.btnCCB)); btnBOC = ResHelper.forceCast(findViewById(R.id.btnBOC)); btnBCM = ResHelper.forceCast(findViewById(R.id.btnBCM)); btnABC = ResHelper.forceCast(findViewById(R.id.btnABC)); tvTittle = ResHelper.forceCast(findViewById(R.id.tvTittle)); lvResult = ResHelper.forceCast(findViewById(R.id.lvResult)); btnICBC.setOnClickListener(this); btnCMB.setOnClickListener(this); btnCCB.setOnClickListener(this); btnBOC.setOnClickListener(this); btnBCM.setOnClickListener(this); btnABC.setOnClickListener(this); //init data adapter = new SimpleAdapter(this, dataList, R.layout.view_exchange_rmb_quotation_item, new String[]{"bankName", "bank", "currencyName", "currencyCode", "fBuyPri", "mBuyPri", "fSellPri", "mSellPri", "bankConversionPri", "date", "time"}, new int[]{R.id.tvBankName, R.id.tvBankCode, R.id.tvCurrencyName, R.id.tvCurrencyCode, R.id.tvFBuyPri, R.id.tvMBuyPri, R.id.tvFSellPri, R.id.tvMSellPri, R.id.tvBankConversionPri, R.id.tvDate, R.id.tvTime}); lvResult.setAdapter(adapter); }
Example #29
Source File: RealTimeExchangeAdapter.java From styT with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private View getView1(int position, View convertView, ViewGroup parent) { final ViewHolder viewHolder; if (convertView == null) { convertView = View.inflate(parent.getContext(), R.layout.view_exchange_real_time_item, null); viewHolder = new ViewHolder(); viewHolder.tvBuyPic = ResHelper.forceCast(convertView.findViewById(R.id.tvBuyPic)); viewHolder.tvClosePri = ResHelper.forceCast(convertView.findViewById(R.id.tvClosePri)); viewHolder.tvCode = ResHelper.forceCast(convertView.findViewById(R.id.tvCode)); viewHolder.tvCurrency = ResHelper.forceCast(convertView.findViewById(R.id.tvCurrency)); viewHolder.tvDate = ResHelper.forceCast(convertView.findViewById(R.id.tvDate)); viewHolder.tvDiffAmo = ResHelper.forceCast(convertView.findViewById(R.id.tvDiffAmo)); viewHolder.tvDiffPer = ResHelper.forceCast(convertView.findViewById(R.id.tvDiffPer)); viewHolder.tvHighPic = ResHelper.forceCast(convertView.findViewById(R.id.tvHighPic)); viewHolder.tvLowPic = ResHelper.forceCast(convertView.findViewById(R.id.tvLowPic)); viewHolder.tvOpenPri = ResHelper.forceCast(convertView.findViewById(R.id.tvOpenPri)); viewHolder.tvRange = ResHelper.forceCast(convertView.findViewById(R.id.tvRange)); viewHolder.tvSellPic = ResHelper.forceCast(convertView.findViewById(R.id.tvSellPic)); viewHolder.tvYesterdayPic = ResHelper.forceCast(convertView.findViewById(R.id.tvYesterdayPic)); convertView.setTag(viewHolder); } else { viewHolder = ResHelper.forceCast(convertView.getTag()); } HashMap<String, Object> data = getItem(position); viewHolder.tvBuyPic.setText(String.valueOf(data.get("buyPic"))); viewHolder.tvClosePri.setText(String.valueOf(data.get("closePri"))); viewHolder.tvCode.setText(String.valueOf(data.get("code"))); viewHolder.tvCurrency.setText(String.valueOf(data.get("currency"))); viewHolder.tvDate.setText(String.valueOf(data.get("date"))); viewHolder.tvDiffAmo.setText(String.valueOf(data.get("diffAmo"))); viewHolder.tvDiffPer.setText(String.valueOf(data.get("diffPer"))); viewHolder.tvHighPic.setText(String.valueOf(data.get("highPic"))); viewHolder.tvLowPic.setText(String.valueOf(data.get("lowPic"))); viewHolder.tvOpenPri.setText(String.valueOf(data.get("openPri"))); viewHolder.tvRange.setText(String.valueOf(data.get("range"))); viewHolder.tvSellPic.setText(String.valueOf(data.get("sellPic"))); viewHolder.tvYesterdayPic.setText(String.valueOf(data.get("yesDayPic"))); return convertView; }
Example #30
Source File: EditPage.java From BaoKanAndroid with MIT License | 5 votes |
/** 动态适配编辑界面的高度 */ public void run() { int height = svContent.getChildAt(0).getHeight(); RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams()); if (height > maxBodyHeight && lp.height != maxBodyHeight) { lp.height = maxBodyHeight; svContent.setLayoutParams(lp); } else if (height < maxBodyHeight && lp.height == maxBodyHeight) { lp.height = LayoutParams.WRAP_CONTENT; svContent.setLayoutParams(lp); } }