public void drawListRow(ListField listField, Graphics g, int index, int y, int w) { String sColapsado = ""; Item item = (Item) get(listField, index); if (listField.getSelectedIndex() == index) { g.setColor(Color.WHITE); g.setBackgroundColor(Estilos.getBGSelected()); } else { if (item.isCabecera()) { g.setColor(Estilos.getColorInterlinea(0)); g.setBackgroundColor(Estilos.getBGInterlinea(0)); } else { g.setColor(Estilos.getColorInterlinea(1)); g.setBackgroundColor(Estilos.getBGInterlinea(1)); } g.clear(); } if (item.isCabecera()) { if (item.isColapsado()) { sColapsado = Characters.BLACK_RIGHT_POINTING_TRIANGLE + " "; } else { sColapsado = Characters.BLACK_DOWN_POINTING_TRIANGLE + " "; } } else { sColapsado = Characters.SPACE + ""; } g.drawText(sColapsado + item.getDescripcion(), 0, y, DrawStyle.LEFT, w); g.drawText(item.getValor(), 0, y, DrawStyle.RIGHT, w); }
protected void paintBackground(Graphics g) { // paint my bubble int col = g.getColor(); int height = this.getContentHeight(); // int width = this.getContentWidth(); int width = this.getWidth(); // draw corners g.drawBitmap(0, 0, 17, 17, blue_bubble, 0, 0); // left top g.drawBitmap(width - 11, 0, 10, 10, blue_bubble, 36, 0); // right top g.drawBitmap(0, height - 11, 17, 11, blue_bubble, 0, 17); // left bottom g.drawBitmap(width - 11, height - 11, 11, 11, blue_bubble, 36, 17); // right bottom // draw borders g.tileRop(Graphics.ROP_SRC_ALPHA, 17, 0, width - 27, 9, blue_top_bar, 0, 0); g.tileRop(Graphics.ROP_SRC_ALPHA, 7, 17, 10, height - 28, blue_left_bar, 0, 0); g.tileRop(Graphics.ROP_SRC_ALPHA, 17, height - 11, width - 27, 11, blue_bottom_bar, 0, 0); g.tileRop(Graphics.ROP_SRC_ALPHA, width - 15, 10, 9, height - 21, blue_right_bar, 0, 0); // draw inside bubble // g.tileRop(Graphics.ROP_SRC_ALPHA, 17, 10, width-27, height-19, grey_inside_bubble, 0, 0); g.setColor(0x00FAFAFA); g.fillRect(17, 9, width - 28, height - 19); g.setColor(col); super.paintBackground(g); }
protected void paintBackground(Graphics graphics) { int BGR_COLOR = graphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS) ? 0x000000 : 0x393939; graphics.setColor(BGR_COLOR); graphics.fillRect(0, 0, getPreferredWidth(), getPreferredHeight()); graphics.setColor(0x000000); graphics.drawLine(0, getPreferredHeight() - 1, getPreferredWidth(), getPreferredHeight() - 1); }
private void drawBtnStyle(Graphics gfx) { final int initialColor = gfx.getColor(); // draw border gfx.setColor(0x424242); gfx.drawLine(w - 1, 0, w - 1, h - 3); gfx.drawLine(0, h - 1, w - 1, h - 1); gfx.setColor(Color.BLACK); gfx.drawLine(w - 2, 0, w - 2, h - 2); gfx.drawLine(0, h - 2, w - 1, h - 2); gfx.setColor(initialColor); // corners are equal in size, so we can use just one value for both corners final int cornerWidth = BTN_STYLE_LEFT_CORNER.getWidth(); final int middleWidth = w - 2 * cornerWidth - 2; // height is equal for all three pieces final int height = BTN_STYLE_LEFT_CORNER.getHeight(); // draw left corner gfx.drawBitmap(0, 0, cornerWidth, height, BTN_STYLE_LEFT_CORNER, 0, 0); final EncodedImage middle = ImageUtils.resize(BTN_STYLE_MIDDLE, middleWidth + 1, height, false); // draw middle gfx.drawImage(cornerWidth, 0, middleWidth, height, middle, 0, 0, 0); // draw right corner gfx.drawBitmap(cornerWidth + middleWidth, 0, cornerWidth, height, BTN_STYLE_RIGHT_CORNER, 0, 0); }
// #ifdef VER_4.5.0 public void paint(Graphics g) { int oldColor = g.getColor(); g.setColor(0x00000000); g.drawRect(0, 0, getWidth() + 1, getHeight() + 1); g.setColor(oldColor); super.paint(g); }
protected void paintBackground(Graphics g) { int oldColor = g.getColor(); try { g.setColor(0xFFFFFF); g.fillRect(0, getVerticalScroll(), getWidth(), getHeight()); } finally { g.setColor(oldColor); } }
protected void paint(Graphics g) { g.setColor(Color.WHITE); g.fillRect(0, 0, userField.getWidth() + 8, userImage.getHeight()); g.setColor(Color.GRAY); g.drawRect(0, 0, userField.getWidth() + 8, userImage.getHeight()); super.paint(g); }
protected void paintBackground(Graphics g) { super.paintBackground(g); if (myCounter % 2 == 0) { g.setColor(Color.WHITE); } else { g.setColor(0xf8f8f8); } g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(0xe4e3e1); g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); }
private void drawDummyPhoto(Graphics graphics) { graphics.setColor(0xcccccc); int w = TEXT_ANCHOR - 2 * PADDING_TOP; graphics.fillRoundRect(PADDING_LEFT, PADDING_TOP, w, w, 10, 10); graphics.setFont(Utils.getFont(5)); graphics.setColor(0x999999); graphics.drawText( "NO PHOTO", (TEXT_ANCHOR - graphics.getFont().getAdvance("NO PHOTO")) / 2, (TEXT_ANCHOR - graphics.getFont().getHeight()) / 2); }
protected void paint(Graphics g) { g.setFont(fontSetting.getFont()); boolean focus = g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS); int textColor = Color.BLACK; if (focus) { g.setColor(Color.GREEN); g.fillRect(0, 0, 5, getHeight()); } if (locked) { textColor = Color.GRAY; g.drawBitmap( getWidth() - 5 - lock.getWidth(), (getHeight() - lock.getHeight()) / 2, lock.getWidth(), lock.getHeight(), lock, 0, 0); } else { if (focus) { g.drawBitmap( getWidth() - 5 - focusArrow.getWidth(), (getHeight() - focusArrow.getHeight()) / 2, focusArrow.getWidth(), focusArrow.getHeight(), focusArrow, 0, 0); } else { g.drawBitmap( getWidth() - 5 - normalArrow.getWidth(), (getHeight() - normalArrow.getHeight()) / 2, normalArrow.getWidth(), normalArrow.getHeight(), normalArrow, 0, 0); } } g.drawBitmap( 25, (getHeight() - image.getHeight()) / 2, image.getWidth(), image.getHeight(), image, 0, 0); g.setColor(textColor); g.drawText(title, 5 + 20 + image.getWidth() + 20, (getHeight() - g.getFont().getHeight()) / 2); }
private void drawBitmap(Graphics gfx) { final int width = imageBmp.getWidth(); final int height = imageBmp.getHeight(); final int x = paddingLeft + ((desiredImgWidth - width) >> 1); final int y = paddingTop + ((desiredImgHeight - height) >> 1); gfx.drawBitmap(x, y, width, height, imageBmp, 0, 0); final int initialColor = gfx.getColor(); gfx.setColor(Color.GRAY); gfx.drawRect(x, y, width, height); gfx.setColor(initialColor); }
public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) { Object[] childImagePair = (Object[]) this.get(listField, index); Child child = (Child) childImagePair[0]; Bitmap image = (Bitmap) childImagePair[1]; drawStatusBox(listField, graphics, index, child); drawChildImage(graphics, listField, index, image); graphics.setColor(Color.BLACK); graphics.setFont(titleFont); // Takes 5 params 1:display text, 2:horizontal position, // 3: vertical position, 4: flags, 5: text display width graphics.drawText( (String) child.getField("name"), firstRowPosition, y, (DrawStyle.LEFT | DrawStyle.ELLIPSIS | DrawStyle.TOP), screenWidth - firstRowPosition - 4); int yStartForText = y + (this.getFont()).getHeight() + 1; drawFieldRow(graphics, width, child, yStartForText, "age"); yStartForText = yStartForText + (this.getFont()).getHeight() + 1; drawFieldRow( graphics, width - secondRowPosition - 4, child, yStartForText, "last_known_location"); yStartForText = yStartForText + (this.getFont()).getHeight() + 1; graphics.drawLine( 0, (index * listField.getRowHeight()), width, (index * listField.getRowHeight())); }
/** * for drawing the Record with its Cell Title and Values * * @param graphics * @param b */ private void drawRecord(Graphics graphics, boolean haveFocus) { // graphics.setColor(Color.BLACK); // graphics.fillRoundRect(10, 2, Display.getWidth() - 10, height + 5, // 10, // 10); // graphics.drawRoundRect(10, 2, Display.getWidth() - 10, height + 5, // 10, // 10); int color = Color.BLACK; int[] colors = drawFousLostColors; int[] X_PTS = {getWidth(), getWidth(), getPreferredWidth(), getPreferredWidth()}; int[] Y_PTS = {height, getPreferredHeight(), getPreferredHeight(), height}; if (haveFocus) { colors = drawFousGainColors; color = Color.WHITE; } graphics.drawShadedFilledPath(X_PTS, Y_PTS, null, colors, null); graphics.setColor(color); // for placing the arrow icon int image_height = (height / 2) - 8; int img_x_position = total_Width - 18; graphics.drawBitmap( img_x_position, image_height, arrowBitmap.getHeight(), arrowBitmap.getWidth(), arrowBitmap, 0, 0); int halfWidth = (getWidth() / 2) - RIGHT_MARGIN; int yPosition = 0; // Draw each cell for (int i = 0; i < record.getCells().size(); i++) { Cell cell = (Cell) record.getCells().elementAt(i); // Draw the title of the cell String text = cell.getTitle().trim(); // take the value of the cell to draw String value = cell.getValue().trim(); int numberOfRowsForTitle = drawText(text, value, graphics, 0, yPosition); int numberOfRowsForValue = drawText(value, value, graphics, halfWidth, yPosition); if (numberOfRowsForTitle == 1 && numberOfRowsForValue == 1) { yPosition += CELL_HEIGHT - MULTIPLE_CELLS; } else { yPosition += CELL_HEIGHT - MULTIPLE_CELLS; yPosition += SECOND_CELL_HEIGHT; } } }
public void paint(Graphics g) { int xPts[] = {0, 0, getPreferredWidth(), getPreferredWidth()}; int yPts[] = {0, getPreferredHeight(), getPreferredHeight(), 0}; g.setColor(3947580); g.drawFilledPath(xPts, yPts, null, null); // g.drawTexturedPath(xPts,yPts,null,null,0,0,Fixed32.ONE,0,0,Fixed32.ONE,img); super.paint(g); }
protected void paint(Graphics graphics) { graphics.setFont(font); for (int i = 0; i < labels.length; i++) { graphics.setColor(0xF57000); graphics.drawText(labels[i], h_offset, font.getHeight() * i); graphics.setColor(Color.GRAY); graphics.drawText( "\t" + values[i], font.getAdvance(labels[i]), font.getHeight() * i, DrawStyle.ELLIPSIS); } for (int i = 0; i < lines.size(); i++) { graphics.drawText( (String) lines.elementAt(i), h_offset, label_height + i * font.getHeight() + 5, DrawStyle.HCENTER | DrawStyle.ELLIPSIS); } }
public void paint(Graphics graphics) { // Sets the BackgroundColor graphics.setBackgroundColor(Color.BLACK); graphics.setColor(Color.WHITESMOKE); graphics.drawText("Black", 0, 10); // Clears the entire graphic area to the current background graphics.clear(); }
private void drawError(Graphics gfx, int fontHeight) { errorLoadingHeight = fontHeight; errorLoadingWidth = w - totalPaddingX; final int initialColor = gfx.getColor(); if (drawBtnStyle) { gfx.setColor(Graphics.WHITE); } gfx.drawText( ERROR_LABEL, paddingLeft, ((h - labelToImageGap - labelHeight - errorLoadingHeight - paddingBottom) >> 1), (DrawStyle.ELLIPSIS | DrawStyle.HCENTER), errorLoadingWidth); gfx.setColor(initialColor); }
private void drawLabel(Graphics gfx, int fontHeight) { labelHeight = fontHeight; labelWidth = w - totalPaddingX; final int initialColor = gfx.getColor(); if (drawBtnStyle) { gfx.setColor(Graphics.WHITE); } gfx.drawText( label, paddingLeft, (h - labelHeight - paddingBottom), (DrawStyle.ELLIPSIS | DrawStyle.HCENTER), labelWidth); gfx.setColor(initialColor); }
public void drawListRow(ListField list, Graphics g, int index, int y, int w) { Font font = g.getFont(); int xPos = 30; int yPos = y + (list.getRowHeight() - imagee1.getHeight()) / 2; int yPosTxt = y + (list.getRowHeight() - font.getHeight()) / 2; if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { g.setBackgroundColor(0x005A6971); // g.setBackgroundColor(0x005A6971); // g.drawRoundRect(0, 0, 630, 80, 15, 15); g.clear(); } else { g.setColor(Color.WHITE); // g.drawRoundRect(0, 0, 630, 80, 15, 15); } for (int i = 0; i < bit.length; i++) { image = bit[index]; g.drawBitmap(5, yPos + 3, image.getWidth(), image.getHeight(), image, 0, 0); } g.setFont(Constants.fontBold); xPos = xPos + image.getWidth(); String text = (String) listElements.elementAt(index); g.drawText(text, xPos, yPosTxt); g.setFont(Constants.fontVerySmall); // for (int i = 0; i < bit.length; i++) { // xPos = 30 + image.getWidth(); // String textSubText = Constants.selectedBranch; // g.drawText(textSubText, xPos, yPosTxt + 25); // } xPos = 30 + image.getWidth(); switch (index) { case 0: String textSubText = Constants.selectedBranch; g.drawText(textSubText, xPos, yPosTxt + 25); break; case 1: String textProcessText = Constants.selectedProcess; g.drawText(textProcessText, xPos, yPosTxt + 25); break; case 2: String textLocationText = Constants.selectedLocation; g.drawText(textLocationText, xPos, yPosTxt + 25); break; } g.drawBitmap(580, yPos + 3, arrowImage.getWidth(), arrowImage.getHeight(), arrowImage, 0, 0); }
private void drawStatusBox(ListField listField, Graphics graphics, int index, Child child) { String childStatusString = child.childStatus().getStatusString(); int boxHeight = getFont().getHeight() + 4; int boxWidth = getFont().getAdvance(childStatusString) + 4; int boxX = screenWidth - 10 - boxWidth; int boxY = ((index) * listField.getRowHeight()) + getFont().getHeight() + 2; graphics.setColor(child.childStatus().getStatusColor()); graphics.drawRoundRect(boxX, boxY, boxWidth, boxHeight, 10, 10); graphics.fillRoundRect(boxX, boxY, boxWidth, boxHeight, 10, 10); graphics.setColor(16777215); graphics.setFont(rowFont); graphics.drawText( childStatusString, boxX, boxY + 2, (DrawStyle.HCENTER | DrawStyle.ELLIPSIS | DrawStyle.TOP), boxWidth); }
// Bitmap grey = Const.getGrey(); public void paint(Graphics g) { int xPts[] = {0, 0, getPreferredWidth(), getPreferredWidth()}; int yPts[] = {0, getPreferredHeight(), getPreferredHeight(), 0}; g.setColor(2500134); g.drawFilledPath(xPts, yPts, null, null); // g.drawTexturedPath(xPts,yPts,null,null,0,this.getTop(),Fixed32.ONE,0,0,Fixed32.ONE,grey); if (focus) { g.drawBitmap(6, 0, button_select.getWidth(), button_select.getHeight(), button_select, 0, 0); } else { g.drawBitmap( 6, 0, button_thumbnail.getWidth(), button_thumbnail.getHeight(), button_thumbnail, 0, 0); } }
public void drawListRow(ListField list, Graphics g, int index, int y, int w) { if (list.getSelectedIndex() == index) { } else { g.setColor(Color.WHITE); if (get(index).equals("Consultoras") || get(index).equals("Pedidos")) { g.setBackgroundColor(Estilos.getBGModulo()); } else { g.setBackgroundColor(Estilos.getBGSubModulo()); } g.clear(); } g.drawText(get(index), 0, y, 0, w); }
protected void paint(Graphics graphics) { // super.paint(graphics); // draw and underscore graphics.setColor(net.rim.device.api.ui.Color.LIGHTGREY); graphics.setFont(Font.getDefault()); // graphics.drawRect(this.getFont().getAdvance(getLabel()) , 0, getWidth(), getHeight()); graphics.drawRoundRect( this.getFont().getAdvance(getLabel()) + 3, 0, getWidth(), getHeight(), 5, 5); graphics.setColor(net.rim.device.api.ui.Color.DARKGRAY); graphics.drawRoundRect( this.getFont().getAdvance(getLabel()) + 4, 1, getWidth() - 2, getHeight() - 2, 5, 5); graphics.setColor(net.rim.device.api.ui.Color.BLACK); graphics.drawRoundRect( this.getFont().getAdvance(getLabel()) + 4, 1, getWidth() - 3, getHeight() - 3, 5, 5); String text = getText(); String label = getLabel(); if (label != null) { if (label.length() > 0) { graphics.drawText(label, 2, 2); } graphics.drawText(text, this.getFont().getAdvance(label) + 6, 2); } else { graphics.drawText(text, 6, 2); } if (hasFocus) { int x = Font.getDefault().getAdvance(getLabel()) + this.getFont().getAdvance(getText()) + 4; int y = Font.getDefault().getLeading(); Font font = Font.getDefault().derive(Font.BOLD); graphics.setFont(font); graphics.drawText("|", x, y); } // drawHighlightRegion(graphics,this.HIGHLIGHT_SELECT,true,2, 2, 2,5); }
/** * Field implementation. * * @see net.rim.device.api.ui.Field#paint(Graphics) */ protected void paint(Graphics graphics) { // First draw the background colour and picture switch (Display.getWidth()) { case 480: graphics.drawBitmap(12, 10, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0); graphics.drawBitmap(167, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0); graphics.drawBitmap(324, 10, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0); graphics.setFont(font); graphics.setColor(Color.DARKSLATEGRAY); graphics.drawText(_dboc, 18, 40); graphics.drawText(_iboc, 173, 40); graphics.drawText(_tboc, 330, 40); break; case 360: graphics.drawBitmap(15, 10, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0); graphics.drawBitmap(185, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0); graphics.setFont(font); graphics.setColor(Color.DARKSLATEGRAY); graphics.drawText(_dboc, 28, 40); graphics.drawText(_iboc, 198, 40); graphics.drawBitmap(15, 65, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0); graphics.drawText(_tboc, 130, 95); break; default: graphics.drawBitmap(15, 9, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0); graphics.drawBitmap(166, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0); graphics.setFont(font); graphics.setColor(Color.DARKSLATEGRAY); graphics.drawText(_dboc, 18, 40); graphics.drawText(_iboc, 172, 40); graphics.drawBitmap(15, 65, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0); graphics.drawText(_tboc, 110, 95); break; } }
public void paint(Graphics g) { // Calculate the slider position int sliderHeight = _imageSlider.getHeight(); int sliderBackYOffset = (_totalHeight - sliderHeight) >> 1; // Determine a Background Color for the slider int backgroundColor = _defaultBackgroundColour; if (_backgroundSelectedColours != null || _backgroundColours != null) { if (_selected) { backgroundColor = _backgroundSelectedColours != null ? _backgroundSelectedColours[getState()] : _defaultSelectColour; } else if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { backgroundColor = _backgroundColours != null ? _backgroundColours[getState()] : _defaultHoverColour; } else { backgroundColor = _defaultBackgroundColour; } } g.setColor(backgroundColor); g.fillRect(1, sliderBackYOffset + 1, _totalWidth - 2, sliderHeight - 2); if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { paintSliderBackground( g, _imageSliderFocusLeft, _imageSliderFocusCenter, _imageSliderFocusRight); } else { paintSliderBackground(g, _imageSliderLeft, _imageSliderCenter, _imageSliderRight); } // Calculate the thumb position int thumbXOffset = ((_totalWidth - _thumbWidth) * _currentState) / _numStates; // Draw the thumb g.drawBitmap( thumbXOffset, (_totalHeight - _thumbHeight) >> 1, _thumbWidth, _thumbHeight, _imageThumb, 0, 0); }
public void drawListRow(ListField list, Graphics g, int index, int y, int w) { Font font = g.getFont(); int xPos = 30; // int yPos = y + (list.getRowHeight() - bit[1].getHeight()) / 2; int yPos = y + (list.getRowHeight() - imagee2.getHeight()) / 2; int yPosTxt = y + (list.getRowHeight() - font.getHeight()) / 2; // Bitmap imageBackground = Bitmap // .getBitmapResource("button_for_thumbnails_inactive.png"); // if (list.getSelectedIndex() != index) { // g.drawBitmap(0, 0, 640, 80, imageBackground, 0, 0); // } if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { g.setBackgroundColor(0x005A6971); // g.drawRoundRect(0, 0, 630, 80, 15, 15); g.clear(); } else { g.setColor(Color.WHITE); // g.drawRoundRect(0, 0, 630, 80, 15, 15); } // for (int i = 0; i < bit.length; i++) { // image = bit[index]; // g.drawBitmap(5, yPos + 3, image.getWidth(), image.getHeight(), // image, 0, 0); // } g.drawBitmap(5, yPos + 3, imagee2.getWidth(), imagee2.getHeight(), imagee2, 0, 0); xPos = xPos + imagee2.getWidth(); String text = (String) listElements.elementAt(index); g.drawText(text, xPos, yPosTxt + 3); g.drawBitmap(580, yPos + 7, arrowImage.getWidth(), arrowImage.getHeight(), arrowImage, 0, 0); }
public void paint(Graphics graphics) { graphics.setColor(color); super.paint(graphics); }
public void drawListRow(ListField listField, Graphics g, int index, int y, int width) { if (isMoreButton(index)) { Font bold = Font.getDefault().derive(Font.BOLD); g.setFont(bold); String strMore = "More"; int xx = (width - bold.getAdvance(strMore)) / 2; int yy = y + (ScheduleScreen.LIST_HEIGHT - bold.getHeight()) / 2; if (listField.getSelectedIndex() == index) { g.setColor(0); g.drawText(strMore, xx + 1, yy + 1); g.setColor(0xffffff); g.drawText(strMore, xx, yy); } else { g.setColor(0); g.drawText(strMore, xx, yy); } return; } ProgramData data = (ProgramData) listData.elementAt(index); // if(!listField.isFocus() || index!=listField.getSelectedIndex()){ // for(int x=0; x<Display.getWidth(); x+= ScheduleScreen.LIST_BACKGROUND.getWidth()) // g.drawBitmap(x, y, ScheduleScreen.LIST_BACKGROUND.getWidth(), // ScheduleScreen.LIST_BACKGROUND.getHeight(), ScheduleScreen.LIST_BACKGROUND, 0, 0); // } if (!listField.isFocus() || index != listField.getSelectedIndex()) { for (int x = 0; x < Display.getWidth(); x += ScheduleScreen.LIST_BACKGROUND.getWidth()) g.drawBitmap( x, y, ScheduleScreen.LIST_BACKGROUND.getWidth(), ScheduleScreen.LIST_BACKGROUND.getHeight(), ScheduleScreen.LIST_BACKGROUND, 0, 0); } Bitmap thumb = TVApi.getChannelThumbnail(data.channelId); if (thumb != null) { int padding = (ScheduleScreen.LIST_HEIGHT - thumb.getHeight()) / 2; int ty = y + padding; int tx = padding; g.drawBitmap(tx, ty, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0); g.setColor(0); g.drawText(data.beginTime + " - " + data.endTime, tx + thumb.getWidth() + tx, ty); Bitmap favorite = data.isFavorite ? ScheduleScreen.LIST_FAVORITE_ON : ScheduleScreen.LIST_FAVORITE_OFF; int titleMaxWidth = width - thumb.getWidth() - favorite.getWidth() - (padding * 4); g.drawText( data.title, tx + thumb.getWidth() + tx, ty + thumb.getHeight(), DrawStyle.BASELINE | DrawStyle.ELLIPSIS, titleMaxWidth); g.drawBitmap( width - padding - favorite.getWidth(), y + (ScheduleScreen.LIST_HEIGHT - favorite.getHeight()) / 2, favorite.getWidth(), favorite.getHeight(), favorite, 0, 0); } }
protected void paint(Graphics g) { g.setColor(TITLE_COLOR); Font titleFont = Utils.getFontBold(FONT_SIZE); g.setFont(titleFont); int textWidht = Display.getWidth() - TEXT_ANCHOR - PADDING_RIGHT; if (title == null) { title = TextUtils.wrapText(newsItem.getTitle(), textWidht, titleFont); } int yOff = 0; for (int i = 0; i < title.size(); i++) { if (title.size() > 2 && i == 1) { g.drawText( title.elementAt(i).toString() + "...", TEXT_ANCHOR, PADDING_TOP + i * titleFont.getHeight()); yOff += g.getFont().getHeight(); break; } else { g.drawText( title.elementAt(i).toString(), TEXT_ANCHOR, PADDING_TOP + i * titleFont.getHeight()); yOff += g.getFont().getHeight(); } } Font textFont = Utils.getFont(FONT_SIZE); g.setColor(PRETEXT_COLOR); g.setFont(textFont); if (text == null) { text = TextUtils.wrapText(newsItem.getBody(), textWidht, textFont); } int titleHeight = PADDING_TOP + title.size() * titleFont.getHeight(); int contentHeight = getPreferredHeight() - (PADDING_TOP); for (int i = 0; i < text.size(); i++) { if (yOff + g.getFont().getHeight() >= getPreferredHeight() - 2 * PADDING_TOP) { g.drawText( (String) text.elementAt(i) + "...", TEXT_ANCHOR, titleHeight + i * textFont.getHeight()); } else { g.drawText((String) text.elementAt(i), TEXT_ANCHOR, titleHeight + i * textFont.getHeight()); } yOff += g.getFont().getHeight(); if (yOff >= getPreferredHeight() - 2 * PADDING_TOP) { break; } } if (newsImage != null) { try { g.drawBitmap( PADDING_LEFT, PADDING_TOP, newsImage.getWidth(), newsImage.getHeight(), newsImage, 0, 0); } catch (Exception e) { drawDummyPhoto(g); } } else { drawDummyPhoto(g); } }
protected void paint(Graphics g) { int oldColor = g.getColor(); Font oldFont = g.getFont(); try { // Left Bitmap if (this.leftIcon != null) { g.drawBitmap( ListStyleField.HPADDING, ListStyleField.VPADDING, this.leftIcon.getWidth(), this.leftIcon.getHeight(), this.leftIcon, 0, 0); } // Animated Bitmap if (this.animate == true && this.progressBitmap != null) { g.drawBitmap( getWidth() - (this.frameWidth + ListStyleField.HPADDING), (getHeight() - this.actionIcon.getHeight()) / 2, this.frameWidth, this.progressBitmap.getHeight(), this.progressBitmap, this.frameWidth * this.currentFrame, 0); this.currentFrame++; if (this.currentFrame >= this.numFrames) { this.currentFrame = 0; } } // Right (Action) Bitmap else if (this.actionIcon != null) { g.drawBitmap( getWidth() - (this.actionIcon.getWidth() + ListStyleField.HPADDING), (getHeight() - this.actionIcon.getHeight()) / 2, this.actionIcon.getWidth(), this.actionIcon.getHeight(), this.actionIcon, 0, 0); } int labelWidth = this.labelWidth; labelHeight = this.lableFont.getHeight(); if (this.badgeIcon != null) { labelWidth -= this.badgeIcon.getWidth(); } // Left Label Text int leftPos = this.labelLeft; g.setColor(this.fontColor); g.setFont(this.lableFont); if (labelWidth < this.lableFont.getAdvance(this.labelText) && g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) { int currentChar = textOffsetScalar.getInt(); String currentText = this.labelText; if (currentChar < currentText.length()) { currentText = currentText.substring(currentChar); } if (this.lableFont.getAdvance(this.labelText) < labelWidth) { this.textAnimation.end(0); } g.drawText(currentText, leftPos, this.labelTop, DrawStyle.ELLIPSIS, labelWidth); } else { g.drawText(this.labelText, leftPos, this.labelTop, DrawStyle.ELLIPSIS, labelWidth); } leftPos += labelWidth; // Badge icon (to the left of Action bitmap) if (this.badgeIcon != null) { g.drawBitmap( leftPos, (getHeight() - this.badgeIcon.getHeight()) / 2, this.badgeIcon.getWidth(), this.badgeIcon.getHeight(), this.badgeIcon, 0, 0); } } finally { g.setColor(oldColor); g.setFont(oldFont); } }