public override void onMouseUp(int x, int y) { if (viewState == VIEWSTATE_1_NHOMNGANH && chartG != null) { chartG.onMouseUp(x, y); return; } for (int i = 0; i < mButtonPositions.size(); i++) { Rectangle rc = (Rectangle)mButtonPositions.elementAt(i); if (rc.Contains(x, y)) { mPeriod = mPeriods.elementAt(i); doCalcChanged(); return; } } for (int i = 0; i < mChanges.size(); i++) { GroupChanges gc = (GroupChanges)mChanges.elementAt(i); if (x >= gc.x && x <= gc.x + gc.w && y >= gc.y && y <= gc.y + gc.h) { stShareGroup g = gc.group; showDetailOfGroup(g); } } }
//========================================== void loadShareGroup(xDataInput di) { int cnt = di.readInt(); if (cnt > stShareGroup.MAX_SHARES_IN_GROUP) { cnt = stShareGroup.MAX_SHARES_IN_GROUP; } xVector v = shareGroups(); if (cnt > 0) { v.removeAllElements(); } for (int i = 0; i < cnt; i++) { stShareGroup g = new stShareGroup(); g.load(di); if (g.getType() == stShareGroup.ID_GROUP_GAINLOSS || g.getName() == null || g.getName().Length == 0) { continue; } v.addElement(g); } }
//========================================== void showDetailOfGroup(stShareGroup g) { viewState = VIEWSTATE_1_NHOMNGANH; if (g.getTotal() == 1 && (g.getName().CompareTo("^VNINDEX") == 0 || g.getName().CompareTo("^HASTC") == 0 || g.getName().CompareTo("^UPCOM") == 0)) { int cnt = mContext.mShareManager.getShareCount(); int[] market = { 0 }; int marketID = 1; if (g.getName().CompareTo("^HASTC") == 0) { marketID = 2; } else if (g.getName().CompareTo("^UPCOM") == 0) { marketID = 3; } for (int i = 0; i < cnt; i++) { int shareID = mContext.mShareManager.getShareIDAt(i, market); if (shareID > 0 && market[0] == marketID) { g.addCode(mContext.mShareManager.getShareCode(shareID)); } } } chartG = new ChartTangtruongGroup(); chartG.setGroup(g); chartG.setPosition(0, 0); chartG.onBack += dismissGroupDetail; //chartG.setSize(mPriceboardContainer); int h = getH();// chartG.estimateH(getH(), g.getTotal()); if (h < getH()) { h = getH(); } //list.setSize(W_PRICEBOARD, mPriceboardH); chartG.setSize(getW() - 20, h); chartG.onBack += dismissGroupDetail; chartG.onHistoryClick += delegateShowHistoryChartOfGroup; chartG.onClickShare += delegateShowHistoryChartOfShare; chartG.onProcessingCompleted += onProcessingCompleted; chartG.onProcessingStart += onProcessingStart; invalidate(); }
public void setGroup(xVector groups) { //-------------------- mGroups = groups; for (int i = 0; i < mGroups.size(); i++) { stShareGroup g = (stShareGroup)mGroups.elementAt(i); //calcIndexOfGroup(g); } doCalcChanged(); }
public TablePriceboard(xIEventListener listener, stShareGroup g, int w, int rowH) : base(listener) { //makeCustomRender(true); setBackgroundColor(C.COLOR_BLACK); rowW = w; this.rowH = rowH; setShareGroup(g, ShareSortUtils.SORT_DUMUA_DUBAN); }
//======================================== public ChartChangeIndex(Font f) : base(f) { mContext = Context.getInstance(); currentSelected = null; startDate = 0; endDate = 0; group = null; _isProcessing = false; }
static void processListIndices(VTDictionary dict) { int code = dict.getValueInt(kErrorCode); ArrayList arr = dict.getArray(kArray); stShareGroup g = Context.getInstance().vnIndicesGroup; if (g == null) { g = new stShareGroup(); Context.getInstance().vnIndicesGroup = g; g.setType(stShareGroup.ID_GROUP_INDICES); } if (code == 0 & arr != null) { for (int i = 0; i < arr.Count; i++) { VTDictionary d = (VTDictionary)arr[i]; int id = d.getValueInt("id"); String symbol = d.getValueString(kSymbol); float price = d.getValueFloat(kPoint) / 1000.0f; float change = d.getValueFloat(kChanged) / 1000.0f; long vol = d.getValueLong(kVolume); float hi = d.getValueFloat(kHighest) / 1000.0f; float lo = d.getValueFloat(kLowest) / 1000.0f; float reference = d.getValueFloat(kRef) / 1000.0f; stPriceboardState ps = GlobalData.getPriceboardStateOfIndexWithSymbol(symbol); if (ps == null) { ps = new stPriceboardState(); GlobalData.addPriceboardStateOfIndex(ps); } ps.id = id; ps.code = symbol; ps.current_price_1 = price; ps.total_volume = Convert.ToInt32(vol); ps.max = hi; ps.min = lo; ps.change = change; ps.reference = reference; g.addCode(symbol); } } }
static public void exportGroupToCSV(stShareGroup g) { xVector v = new xVector(); for (int i = 0; i < g.getTotal(); i++) { String code = g.getCodeAt(i); if (code != null) { Share share = Context.getInstance().mShareManager.getShare(code); if (share != null) { v.addElement(share); } } } if (v.size() > 0) { exportGroupToCSV(v, null); } }
xDataOutput shareGroupsBlock() { xDataOutput o = new xDataOutput(5 * 1024); xVector v = new xVector(); for (int i = 0; i < _shareGroups.size(); i++) { stShareGroup p = (stShareGroup)_shareGroups.elementAt(i); if (p.getType() == stShareGroup.ID_GROUP_GAINLOSS || p.getName() == null || p.getName().Length == 0) { continue; } v.addElement(p); } // int groupCnt = v.size() < 30? v.size():30; o.writeInt(groupCnt); for (int i = 0; i < groupCnt; i++) { stShareGroup p = (stShareGroup)v.elementAt(i); if (p.getType() == stShareGroup.ID_GROUP_GAINLOSS || p.getName() == null || p.getName().Length == 0) { continue; } p.save(o); } return(o); }
public xDataOutput getUserDataAsStreamOldVersion() { xDataOutput o = new xDataOutput(5 * 1024); o.writeInt(FILE_ONLINE_USERDATA_VER); int i; xVector v = new xVector(10); xVector mFavorGroups = shareGroups(); GainLossManager mGainLossManager = gainLossManager(); int groupCnt = mFavorGroups.size() < 30?mFavorGroups.size():30; for (i = 0; i < groupCnt; i++) { stShareGroup p = (stShareGroup)mFavorGroups.elementAt(i); bool added = false; for (int j = 0; j < v.size(); j++) { stShareGroup o1 = (stShareGroup)v.elementAt(j); if (o1.getName().CompareTo(p.getName()) == 0) { added = true; break; } } if (added == false) { v.addElement(p); } } o.writeInt(v.size()); for (i = 0; i < v.size(); i++) { stShareGroup p = (stShareGroup)v.elementAt(i); p.save(o); } // gainloss com.data o.writeInt(FILE_GAINLOSS_SIGNAL); o.writeInt(mGainLossManager.getTotal()); for (i = 0; i < mGainLossManager.getTotal(); i++) { stGainloss g = mGainLossManager.getGainLossAt(i); o.writeUTF(g.code); o.writeInt(g.date); o.writeInt((int)g.price); o.writeInt(g.volume); } // filter sets o.writeInt(FILE_FILTER_SET_VERSION); FilterManager.getInstance().saveFilterSets(o); // down signal group //o.writeInt(FILE_DOWN_SIGNAL); //mAlarmGroup.save(o); return(o); }
public void setShareGroupAsFilterResult(stShareGroup g, int filterType) { mTableType = TABLE_GAINLOSS; this.removeAllControls(); _shareGroup = g; int cnt = g.getTotal(); int y = 0; xLabel l; if (hasTitle) { Font f = Context.getInstance().getFontText(); l = xLabel.createSingleLabel(g.getName(), f, 300); l.setBackgroundColor(C.COLOR_ORANGE); l.setSize(rowW, (int)f.GetHeight() + 4); l.setPosition(0, 0); l.setTextColor(C.COLOR_WHITE); y = (int)l.getBottom() + 1; addControl(l); } // gia tri GD if (filterType <= 0) { filterType = ShareSortUtils.SORT_TRADE_VALUE; xVector v = shareGroupToVector(); if (v != null && v.size() > 0) { ShareSortUtils.evalueSortValueTrade(v); } } //------------------- for (int i = 0; i <= cnt; i++) { int idx = i - 1; int rH = i == 0 ? 36 : rowH; RowNormalShare r = new RowFilterResult(mListener, i, rowW, rH); r.onShowSortMenu += delegateShowSortMenu; r.setSortType(filterType); if (idx >= 0) { String code = g.getCodeAt(idx); if (code != null && code.Length > 0) { r.setData(code); } else { continue; } //r.mAllowDelete = deletable; } r.setParent(this); r.setPosition(0, y); r.invalidate(); addControl(r); vRows.addElement(r); y += rH + 1; } invalidate(); }
void setShareGroup(stShareGroup g, int sortType) { if (mTableType == TABLE_GAINLOSS) { setShareGroupAsFilterResult(g, sortType); return; } //========================= this.removeAllControls(); mTableType = TABLE_NORMAL_PRICEBOARD; if (g == null) { return; } _shareGroup = g; int cnt = g.getTotal(); int y = 0; xLabel l; if (hasTitle) { Font f = Context.getInstance().getFontText(); l = xLabel.createSingleLabel(g.getName(), f, 300); l.setBackgroundColor(C.COLOR_ORANGE); l.setSize(rowW, (int)f.GetHeight() + 4); l.setPosition(0, 0); l.setTextColor(C.COLOR_WHITE); addControl(l); y = (int)l.getBottom() + 1; } bool deletable = g.getType() == stShareGroup.ID_GROUP_FAVOR; if (deletable) { Utils.trace("++++++++++===============row is detelable"); } for (int i = 0; i <= cnt; i++) { int idx = i - 1; int rH = i == 0? 36: rowH; RowNormalShare r; if (g.getType() == stShareGroup.ID_GROUP_INDICES) { r = new RowIndice(mListener, i, rowW, rH); if (idx >= 0) { String code = g.getCodeAt(idx); if (code != null && code.Length > 0) { r.setData(code); } else { continue; } //r.mAllowDelete = deletable; } } else { r = new RowNormalShare(mListener, i, rowW, rH); r.onShowSortMenu += delegateShowSortMenu; r.onSortABC += delegateSortABC; if (idx >= 0) { int shareID = g.getIDAt(idx); String code = g.getCodeAt(idx); if (code != null && code.Length > 0 && shareID >= 0) { r.setData(code); } else { continue; } //r.mAllowDelete = deletable; } } r.setParent(this); r.setSortType(sortType); r.setPosition(0, y); r.invalidate(); addControl(r); vRows.addElement(r); y += rH + 1; } if (g.getType() == stShareGroup.ID_GROUP_FAVOR) { xFillBackground bottom = xFillBackground.createFill(rowW, 1, C.COLOR_GRAY_LIGHT); bottom.setPosition(0, y); addControl(bottom); y += 1; l = xLabel.createSingleLabel("Click phím phải chuột để thêm/xóa mã hoặc nhóm"); l.setTextColor(C.COLOR_WHITE); l.setPosition(l.getW() - 4, y + 3); addControl(l); int tmp = l.getX(); // xoa nhom y = (int)l.getBottom() + 4; /* * bt = xUIButton.createButton(listener, C.ID_BUTTON_REMOVE_GROUP, " - ", bw); * bt.setSize(bw, xApplication.point2Pixels(40)); * bt.setPosition(w - bw - 2, y+1); * addControl(bt); * * l = xLabel.createSingleLabel("Xóa nhóm ->", AppContext.getInstance().getFontText()); * l.setTextColor(C.COLOR_RED); * l.setPosition(bt.getX() - l.getW() - 4, y + (bt.getH()-l.getH())/2); * addControl(l); * * y += bt.getH() + 2; */ } xFillBackground fillBottom = xFillBackground.createFill(rowW, 2, C.COLOR_GRAY_LIGHT); fillBottom.setPosition(0, y); addControl(fillBottom); invalidate(); }
/* * void cb_SelectedIndexChanged(object sender, EventArgs e) * { * try * { * ComboBox combo = (ComboBox)sender; * int id = (Int32)combo.Tag; * stShareGroup g = null; * String name = (String)combo.SelectedItem; * if (id == C.ID_DROPDOWN_FAVOR_GROUP) * { * g = mContext.getFavoriteGroup(name); * } * if (id == C.ID_DROPDOWN_COMMON_GROUP) * { * g = mContext.getShareGroup(name); * } * onShareGroupSelected(g); * } * catch (Exception ex) * { * } * } */ virtual public void onShareGroupSelected(stShareGroup g) { }
void refreshChart2() { if (group == null) { group = new stShareGroup(); group.setType(stShareGroup.ID_GROUP_DEFAULT); } group.clear(); currentSelected = null; Share index = mContext.mShareManager.getShare(mShareID); stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexOfMarket(index.getMarketID()); if (index == null || pi == null) { return; } if (mContext.mShareManager.getVnindexCnt() == 0) { return; } _isProcessing = true; index.loadShareFromFile(false); stCandle cIndex = new stCandle(); index.getCandleByDate(startDate, 0, cIndex); //=============================================== double totalEquity = 0.0; totalIndexInc = 0; totalIndexDec = 0; int cnt = mContext.mShareManager.getVnindexCnt(); double[] indexOfShares = new double[cnt]; double[] changedPercents = new double[cnt]; float[] prices = new float[cnt]; stCandle _c0 = new stCandle(); stCandle _c1 = new stCandle(); // tinh total equity for (int i = 0; i < cnt; i++) { Share share = mContext.mShareManager.getVnindexShareAt(i); if (share.getShareID() == 223) { indexOfShares[i] = 1; } indexOfShares[i] = 0; if (share.getMarketID() == index.getMarketID() && !share.isIndex()) { stCompanyInfo inf = mContext.mShareManager.getCompanyInfo(share.getShareID()); if (inf != null) { share.loadShareFromCommonData(false); share.appendTodayCandle2(); // use last price if today is not trade stCandle c0 = share.getCandleByDate(startDate, 0, _c0); stCandle c1 = share.getCandleByDate(endDate, startDate, _c1); if (c0 == null || c1 == null) { continue; } if (c0.close == 0 || c1.close == 0) { continue; } totalEquity += (inf.volume * c0.close); double changedPercent = (c1.close - c0.close) / c0.close; if (changedPercent < 0) { //changedPercent = changedPercent; } indexOfShares[i] = cIndex.close * (inf.volume * c0.close) * changedPercent; if (changedPercent > 0) { totalIndexInc += changedPercent; } else { totalIndexDec += changedPercent; } //--------- changedPercents[i] = (c1.close - c0.close) * 100 / c0.close; prices[i] = c1.close; } } } // cleanup vChangeDec.removeAllElements(); vChangeInc.removeAllElements(); //==================================== totalIndexInc /= totalEquity; totalIndexDec /= totalEquity; totalIndexInc = 0; totalIndexDec = 0; for (int i = 0; i < cnt; i++) { Share share = mContext.mShareManager.getVnindexShareAt(i); //if (strcmp(share.mCode, "VIC") == 0){ // /i = i; //} double indexChanged = indexOfShares[i] / totalEquity; ChangeIndexItem item; if (indexChanged > 0) { item = new ChangeIndexItem(); item.modifiedValue = (float)indexChanged; totalIndexInc += item.modifiedValue; item.shareID = share.getShareID(); vChangeInc.addElement(item); } else { item = new ChangeIndexItem(); item.modifiedValue = (float)(-indexChanged); totalIndexDec += item.modifiedValue; item.shareID = share.getShareID(); vChangeDec.addElement(item); } item.price = prices[i]; item.modifiedPercent = (float)changedPercents[i]; } // end of calc sortChanges(vChangeInc); sortChanges(vChangeDec); while (vChangeInc.size() > 200) { vChangeInc.removeElementAt(vChangeInc.size() - 1); } while (vChangeDec.size() > 200) { vChangeDec.removeElementAt(vChangeDec.size() - 1); } //--------------- // ChangeIndexItem xVector[] vv = { vChangeInc, vChangeDec }; for (int j = 0; j < 2; j++) { for (int i = 0; i < vv[j].size(); i++) { ChangeIndexItem item = (ChangeIndexItem)vv[j].elementAt(i); Share share = mContext.mShareManager.getShare(item.shareID); if (share != null && share.getCode() != null) { group.addCode(share.getCode()); } } } invalidate(); }
void calcChanged(int period) { stCandle c0 = new stCandle(); stCandle c1 = new stCandle(); mChanges.removeAllElements(); Utils.trace("----------------------"); bool isNhomIndex = false; for (int i = 0; i < mGroups.size(); i++) { stShareGroup g = (stShareGroup)mGroups.elementAt(i); GroupChanges gc = new GroupChanges(); gc.group = g; mChanges.addElement(gc); gc.code = g.getName(); Utils.trace(g.getName()); double firstGTGD = 0; double lastGTGD = 0; double totalGTGD0 = 0; double totalGTGD1 = 0; int today = 0; isNhomIndex = false; if (g.getType() == stShareGroup.ID_GROUP_MARKET_OVERVIEW && g.getTotal() == 1) { isNhomIndex = true; String code = g.getCodeAt(0); Share share = mContext.mShareManager.getShare(code); if (share == null) { continue; } share.loadShareFromFile(false); share.appendTodayCandle2(); int last = share.getCandleCnt() - 1; int first = (last > period)?(last - period):0; if (last < 0 || first < 0) { continue; } c0 = share.getCandle(last, c0); c1 = share.getCandle(first, c1); if (c1.close > 0) { double changed = 100 * (c0.close - c1.close) / c1.close; gc.changedPercent += changed; } continue; } for (int j = 0; j < g.getTotal(); j++) { string code = g.getCodeAt(j); Share share = Context.getInstance().mShareManager.getShare(code); int shareID = Context.getInstance().mShareManager.getShareID(code); stCompanyInfo info = Context.getInstance().mShareManager.getCompanyInfo(shareID); if (share != null && info != null) { share.loadShareFromCommonData(true); int last = share.getCandleCnt() - 1; int first = (last > period)?(last - period):0; if (last < 0 || first < 0) { continue; } share.getCandle(last, c0); share.getCandle(first, c1); double changed; if (period == 1 && c0.date < today) { // khong co giao dich hom nay changed = 0; } else { double r = (info.volume * c1.close); changed = 0;// (c0.close - c1.close) * r; changed = 100 * (c0.close - c1.close) / c1.close; changed *= r; } totalGTGD0 += (c0.close * info.volume); totalGTGD1 += (c1.close * info.volume); gc.changedPercent += changed; //String s = String.Format("Code: {0}, Price: Close0/Close1={1}/{2}, r={3} changed/totalChanged: {4}/{5}", //share.getCode(), c0.close, c1.close, r, changed, gc.changedPercent); //Utils.trace(s); } gc.changedPercent = 100 * (totalGTGD0 - totalGTGD1); gc.changedPercent /= totalGTGD1; } //Utils.trace(String.Format("Total changed: {0}", gc.changedPercent)); } // sort if (false)//isNhomIndex) { // khong sort } else { xVector marketOverView = new xVector(); for (int i = 0; i < mChanges.size() - 1; i++) { GroupChanges g = (GroupChanges)mChanges.elementAt(i); if (g.group.getType() == stShareGroup.ID_GROUP_MARKET_OVERVIEW || g.code.IndexOf('#') == 0) { marketOverView.addElement(g); } } for (int i = 0; i < marketOverView.size(); i++) { mChanges.removeElement(marketOverView.elementAt(i)); } //================================ for (int i = 0; i < mChanges.size() - 1; i++) { GroupChanges biggest = (GroupChanges)mChanges.elementAt(i); int biggestIdx = i; for (int j = i + 1; j < mChanges.size(); j++) { GroupChanges gc = (GroupChanges)mChanges.elementAt(j); if (gc.changedPercent > biggest.changedPercent) { biggest = gc; biggestIdx = j; } } if (biggestIdx != i) { mChanges.swap(i, biggestIdx); } } //======================== for (int i = 0; i < mChanges.size(); i++) { marketOverView.addElement(mChanges.elementAt(i)); } mChanges.removeAllElements(); for (int i = 0; i < marketOverView.size(); i++) { mChanges.addElement(marketOverView.elementAt(i)); } } }
public void setGroup(stShareGroup g) { shareGroup = g; doCalcChanged(); }
/* * protected xBaseControl createShareGroupDroplist(int id, String title, xVector groups) * { * xContainer c = new xContainer(); * xLabel l = xLabel.createSingleLabel(title, mContext.getFontTextB(), 150); * l.setTextColor(C.COLOR_BLUE); * l.setSize(l.getW(), 16); * int w = 150; * l.setPosition(0, 0); * c.addControl(l); * * ComboBox cb = new ComboBox(); * c.addControl(cb); * cb.Size = new Size(w, cb.Size.Height); * cb.Left = 0; * cb.Top = l.getBottom(); * cb.DropDownStyle = ComboBoxStyle.DropDownList; * * stShareGroup current = mContext.getCurrentShareGroup(); * * for (int i = 0; i < groups.size(); i++) * { * stShareGroup favor = (stShareGroup)groups.elementAt(i); * cb.Items.Add(favor.getName()); * * if (current != null && favor.getName().CompareTo(current.getName()) == 0) * { * cb.SelectedIndex = i; * mContext.setCurrentShareGroup(favor); * } * } * * cb.Tag = (Int32)id; * cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged); * * c.setSize(w, 40); * * return c; * } */ protected xBaseControl createShareGroupList(bool editable, int id, String title, xVector groups, int w, int h) { xContainer c = new xContainer(); c.setSize(w, h); Font f = Context.getInstance().getFontText(); xLabel l = xLabel.createSingleLabel(title, f, w); l.setBackgroundColor(C.COLOR_ORANGE); l.setTextColor(C.COLOR_WHITE); c.addControl(l); int titleH = l.getH(); xContainer c1 = new xContainer(); if (editable) { c1.setSize(w, h - 30 - titleH); } else { c1.setSize(w, h - 6 - titleH); } c1.setPosition(0, l.getH()); c.addControl(c1); stShareGroup current = mContext.getCurrentShareGroup(); string[] ss = { title }; float[] cols = { 100.0f }; xListView list = xListView.createListView(this, ss, cols, w, c1.getH(), Context.getInstance().getImageList(C.IMG_BLANK_ROW_ICON, 1, 21)); list.hideHeader(); list.setID(id); ((ListView)list.getControl()).HideSelection = false; ((ListView)list.getControl()).Scrollable = true; list.setBackgroundColor(C.COLOR_GRAY_DARK); int y = 0; for (int i = 0; i < groups.size(); i++) { stShareGroup favor = (stShareGroup)groups.elementAt(i); xListViewItem item = xListViewItem.createListViewItem(this, new string[] { favor.getName() }); uint color = C.COLOR_WHITE; //if (favor.getGroupType() == stShareGroup.ID_GROUP_MARKET_OVERVIEW) //{ //color = C.COLOR_ORANGE; //} if (favor.getGroupType() == stShareGroup.ID_GROUP_GAINLOSS) { color = C.COLOR_ORANGE; } item.getItem().SubItems[0].Font = mContext.getFontText2(); item.getItem().SubItems[0].ForeColor = Color.FromArgb((int)color); item.setData(favor); list.addRow(item); } c1.addControl(list); //==================== if (editable) { xButton bt; bt = xButton.createStandardButton(C.ID_ADD_GROUP, this, "Thêm nhóm", w / 2 - 2); bt.setPosition(1, c1.getBottom() + 3); c.addControl(bt); bt = xButton.createStandardButton(C.ID_REMOVE_GROUP, this, "Xóa nhóm", w / 2 - 2); bt.setPosition(w / 2 + 1, c1.getBottom() + 3); c.addControl(bt); } return(c); }
public void loadUserDataOldVersion(xDataInput di) { int ver = 0; if (di != null) { ver = di.readInt(); } xVector mFavorGroups = shareGroups(); GainLossManager mGainLossManager = gainLossManager(); if (di != null && (ver == FILE_VERSION_FAVORITE || ver == FILE_ONLINE_USERDATA_VER)) { mFavorGroups.removeAllElements(); mGainLossManager.clearAll(); int cnt = di.readInt(); for (int i = 0; i < cnt; i++) { stShareGroup g = new stShareGroup(); g.load(di); //g.setType(stShareGroup::GROUP_TYPE_FAVORITE); mFavorGroups.addElement(g); } /* * // sort * Collections.sort(mFavorGroups, new Comparator<stShareGroup>() { * @Override * public int compare(stShareGroup o1, stShareGroup o2) { * return o1.getName().compareToIgnoreCase(o2.getName()); * } * }); */ //======this version does not support gainloss====== if (di.available() > 0) { ver = di.readInt(); if (ver == FILE_GAINLOSS_SIGNAL) { cnt = di.readInt(); mGainLossManager.clearAll(); for (int i = 0; i < cnt; i++) { String code = di.readUTF(); int date = di.readInt(); int price = di.readInt(); int vol = di.readInt(); if (date == 0) { GlobalData.vars().setValueBool("should_flush_userdata", true); } if (code != null && code.Length >= 3) { mGainLossManager.addGainLoss(code, date, price, vol); } } mGainLossManager.sortList(); if (mGainLossManager.getTotal() > 0) { mGainLossManager.save(); } } ver = di.readInt(); if (ver == FILE_FILTER_SET_VERSION) { FilterManager.getInstance().loadFilterSets(di); } } } }