public void update() { if (mShare.isIndex()) { if (mShare.mMarketID == 1) { setImageIndex(0); } else if (mShare.mMarketID == 2) { setImageIndex(1); } // truncate the code StringBuilder sb = Utils.sb; sb.Length = 0; for (int i = 0; i < mShare.mCode.Length; i++) { if (mShare.mCode[i] == '^') { continue; } sb.Append(mShare.mCode[i]); //if (sb.Length > 5) //break; } setTextFont(P_CODE, mContext.getFontSmall()); setTextForCell(P_CODE, sb.ToString(), C.COLOR_WHITE); stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexOfMarket(mShare.mMarketID); // khop uint color = C.COLOR_YELLOW; if (pi.changed_point > 0) { color = C.COLOR_GREEN; } else { color = C.COLOR_RED; } setTextForCell(P_PRICE, String.Format("{0:F2}", pi.current_point), color); Utils.sb.Length = 0; if (pi.changed_point > 0) { Utils.sb.AppendFormat("+{0:F2}", (float)(pi.changed_point / 100)); } else { Utils.sb.AppendFormat("{0:F2}", ((float)pi.changed_point / 100)); } // change setTextForCell(P_COMPARE, Utils.sb.ToString(), color); } else { stPriceboardState ps = mContext.mPriceboard.getPriceboard(mShare.mID); if (ps != null) { if (ps.getMarketID() == 1) { if (mContext.mAlarmManager.isAlarmInstalled(ps.getCode())) { setImageIndex(2); } else { setImageIndex(0); } } else if (ps.getMarketID() == 2) { if (mContext.mAlarmManager.isAlarmInstalled(ps.getCode())) { setImageIndex(3); } else { setImageIndex(1); } } // code setTextForCell(P_CODE, ps.getCode(), C.COLOR_WHITE); //setID(ps.getID()); // ref float reference = ps.getRef(); float ce = ps.getCe(); float floor = ps.getFloor(); float price = ps.getCurrentPrice(); if (price == 0) { price = ps.getRef(); } // khop uint color = mContext.valToColorF(price, ce, reference, floor); Utils.sb.Length = 0; Utils.sb.AppendFormat("{0:F2}", (float)price); setTextForCell(P_PRICE, Utils.sb.ToString(), color); // extra info if (mShare.mCompareText == null) { Utils.sb.Length = 0; Utils.sb.AppendFormat("{0:F2}", (float)ps.getChange()); mShare.mCompareText = Utils.sb.ToString(); } if (mShare.mCompareText != null) { setTextForCell(P_COMPARE, mShare.mCompareText, C.COLOR_WHITE); } } } }