protected void paint(AbstractTnGraphics graphics) {
    NavBottomStatusBarHelper.getInstance().drawBackground(graphics, this, false);

    if (isDisabled) {
      return;
    }

    int width = this.getWidth();
    int height = this.getHeight();

    AbstractTnFont fontNumber =
        UiStyleManager.getInstance().getFont(UiStyleManager.FONT_SPEED_LIMIT_NUMBER);
    AbstractTnFont fontUnit = UiStyleManager.getInstance().getFont(UiStyleManager.FONT_SPEED_LIMIT);

    int gap = (height - fontNumber.getHeight() - fontUnit.getHeight()) / 3;
    int xNumber = (width - fontNumber.stringWidth(speedStr)) / 2;
    int yNumber = (height - fontNumber.getHeight() - fontUnit.getHeight() - gap) / 2;

    int xUnit = (width - fontUnit.stringWidth(unitStr)) / 2;
    int yUnit = yNumber + fontNumber.getHeight() + gap;

    graphics.setColor(UiStyleManager.getInstance().getColor(UiStyleManager.TEXT_COLOR_WH));
    graphics.setFont(fontNumber);
    graphics.drawString(
        speedStr, xNumber, yNumber, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
    graphics.setFont(fontUnit);
    graphics.drawString(unitStr, xUnit, yUnit, AbstractTnGraphics.LEFT | AbstractTnGraphics.TOP);
  }
 /**
  * set the badge
  *
  * @param badge
  */
 public void setBadge(String badge) {
   if (badge == null || badge.length() == 0 || badge.equals("0")) {
     this.badge = TnTextParser.parse("");
     this.setBadgeImage(null);
   } else {
     this.badge = TnTextParser.parse(badge);
     this.setBadgeImage(ImageDecorator.IMG_RECEIVE_ALARM_CIRCLE_UNFOCUSED.getImage());
     if (badge.length() > 1) {
       this.setBadgeFont(UiStyleManager.getInstance().getFont(UiStyleManager.FONT_SMALL_BADGE));
     } else {
       this.setBadgeFont(UiStyleManager.getInstance().getFont(UiStyleManager.FONT_BADGE));
     }
   }
   if (nativeUiComponent != null) {
     requestLayout();
     requestPaint();
   }
 }
Exemplo n.º 3
0
 protected void addAddressEditView(ViewGroup filterContainer) {
   addressEditView =
       UiFactory.getInstance()
           .createCitizenTextField(
               "", 100, TnTextField.ANY, "", 0, null, ImageDecorator.IMG_AC_BACKSPACE.getImage());
   addressEditView.setBackgroundColor(
       UiStyleManager.getInstance().getColor(UiStyleManager.TEXT_COLOR_WH));
   addressEditView
       .getTnUiArgs()
       .put(TnUiArgs.KEY_PREFER_WIDTH, ((AddPlaceUiDecorator) uiDecorator).TEXTFIELD_WIDTH);
   addressEditView
       .getTnUiArgs()
       .put(TnUiArgs.KEY_PREFER_HEIGHT, ((AddPlaceUiDecorator) uiDecorator).TEXTFIELD_HEIGHT);
   addressEditView
       .getTnUiArgs()
       .put(
           CitizenTextField.KEY_PREFER_TEXTFIELD_HEIGHT,
           ((AddPlaceUiDecorator) uiDecorator).TEXTFIELD_HEIGHT);
   addressEditView.setHintTextColor(
       UiStyleManager.getInstance().getColor(UiStyleManager.TEXT_COLOR_FILTER));
   addressEditView.setFont(UiStyleManager.getInstance().getFont(UiStyleManager.FONT_TEXT_FIELD));
   addressEditView.setKeyEventListener(this);
   filterContainer.addView((View) addressEditView.getNativeUiComponent());
 }