private void onDrawPrizeInfoAndLossValue(Canvas canvas) { // 遍历集合对象,绘制开奖信息和遗漏值信息 for (int row_i = 0; row_i < viewRowNum - 1; row_i++) { Row chileRow = viewRows.get(row_i); for (int colum_i = 0; colum_i < Row.columNum; colum_i++) { Cell chileCell = chileRow.getRowCells().get(colum_i); if (chileCell instanceof BatchCodeCell) { ((BatchCodeCell) chileCell).onDrawBatchCode(canvas); } else if (chileCell instanceof LotteryNumberCell) { ((LotteryNumberCell) chileCell).onDrawLossValue(canvas); if (isWinCodeCell(chileCell)) { ((LotteryNumberCell) chileCell).onDrawPrizeInfo(canvas); } } } } }
public void onDrawBackground(Canvas canvas) { List<Cell> cells = getRowCells(); int cellsLength = cells.size(); // 遍历列集合,绘制单元格背景 for (int i = 0; i < cellsLength; i++) { Cell cell = cells.get(i); if (cell instanceof BatchCodeCell) { ((BatchCodeCell) cell).onDrawbackground(canvas); } else if (cell instanceof LotteryNumberCell) { ((LotteryNumberCell) cell).onDrawBackground(canvas); } } }
public void setLossValues(List<LossValue> lossValues) { // 遍历List<Row>集合,设置对象的遗漏值属性 for (int row_i = 0; row_i < viewRowNum - 1; row_i++) { Row childRow = viewRows.get(row_i); LossValue lossValue = lossValues.get(row_i); for (int colum_i = 0; colum_i < Row.columNum; colum_i++) { Cell chileCell = childRow.getRowCells().get(colum_i); if (chileCell instanceof LotteryNumberCell) { if (isRedBallCell(colum_i)) { ((LotteryNumberCell) chileCell).setLoss(lossValue.getRedLossNum(colum_i - 1)); } else { ((LotteryNumberCell) chileCell) .setLoss(lossValue.getBlueLossNum(colum_i - Row.redColumNum - 1)); } } } } hasDownloadLossValue = true; invalidate(); }
public void setPrizeInfos(List<PrizeInfo> prizeInfos) { // 遍历List<Row>集合,设置开奖信息属性 for (int row_i = 0; row_i < viewRowNum - 1; row_i++) { Row childRow = viewRows.get(row_i); PrizeInfo prizeInfo = prizeInfos.get(row_i); // Log.i(TAG, "prizeInfos's lenght:" + prizeInfos.size()); for (int colum_i = 0; colum_i < Row.columNum; colum_i++) { Cell childCell = childRow.getRowCells().get(colum_i); if (childCell instanceof BatchCodeCell) { ((BatchCodeCell) childCell).setBatchCode(prizeInfo.getBatchCode()); } else if (childCell instanceof LotteryNumberCell) { ((LotteryNumberCell) childCell).setNumber(prizeInfo.getWinCodeByColum(colum_i)); } } } hasDownloadPrizeInfo = true; invalidate(); }