예제 #1
0
  /**
   * Render the text
   *
   * @see android.view.View#onDraw(android.graphics.Canvas)
   */
  @Override
  protected void onDraw(Canvas canvas) {

    Boolean isSelected = false;
    // if (Global.SelectedWaypoint() == waypoint ||((
    // Global.SelectedCache()== cache && !(waypoint == null)&&
    // Global.SelectedWaypoint() == waypoint )))
    // {
    // isSelected=true;
    // }

    canvas.drawColor(Global.getColor(R.attr.myBackground));
    int BackgroundColor;
    if (BackColorChanger) {
      BackgroundColor =
          (isSelected)
              ? Global.getColor(R.attr.ListBackground_select)
              : Global.getColor(R.attr.ListBackground);
    } else {
      BackgroundColor =
          (isSelected)
              ? Global.getColor(R.attr.ListBackground_select)
              : Global.getColor(R.attr.ListBackground_secend);
    }

    int LineColor = Global.getColor(R.attr.ListSeparator);
    CB_Rect DrawingRec = new CB_Rect(5, 5, width - 5, height - 5);
    ActivityUtils.drawFillRoundRecWithBorder(canvas, DrawingRec, 2, LineColor, BackgroundColor);

    if (joker == null) // this Item is the Cache
    {
      CacheDraw.DrawInfo(
          cache, canvas, DrawingRec, BackgroundColor, DrawStyle.withoutSeparator, false);
    } else {

      int left = 15;
      int top = LineSep * 2;

      int iconWidth = 0;
      // draw icon
      // if (((int)waypoint.Type.ordinal()) < Global.CacheIconsBig.length)
      // iconWidth=ActivityUtils.PutImageTargetHeight(canvas,
      // Global.CacheIconsBig[(int)waypoint.Type.ordinal()],
      // CornerSize/2,CornerSize, imgSize);

      // draw Text info
      left += iconWidth;
      top += ActivityUtils.drawStaticLayout(canvas, LayoutName, left, top);
      top += ActivityUtils.drawStaticLayout(canvas, LayoutTage, left, top);
      top += ActivityUtils.drawStaticLayout(canvas, LayoutTelefon, left, top);
      ActivityUtils.drawStaticLayout(canvas, LayoutBemerkung, left, top);
    }
  }
예제 #2
0
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    measureWidth(widthMeasureSpec);
    this.imgSize = (int) ((JokerView.windowH / 5) * 0.6);
    this.rightBorder = (int) (JokerView.windowH / 5);
    int TextWidth = this.width - this.imgSize - this.rightBorder;

    Rect bounds = new Rect();
    LayoutTextPaint = new TextPaint();
    LayoutTextPaint.setTextSize((float) (UI_Size_Base.that.getScaledFontSize() * 1.3));
    LayoutTextPaint.getTextBounds("T", 0, 1, bounds);
    LineSep = bounds.height() / 3;

    LayoutTextPaint.setAntiAlias(true);
    LayoutTextPaint.setColor(Global.getColor(R.attr.TextColor));

    if (joker.Tage == -1) // this Joker is Owner
    {
      LayoutTage =
          new StaticLayout(
              "Owner von diesem Cache",
              LayoutTextPaint,
              TextWidth,
              Alignment.ALIGN_NORMAL,
              1.0f,
              0.0f,
              false);
    } else {
      LayoutTage =
          new StaticLayout(
              "gefunden vor " + String.valueOf(joker.Tage) + " Tagen",
              LayoutTextPaint,
              TextWidth,
              Alignment.ALIGN_NORMAL,
              1.0f,
              0.0f,
              false);
    }
    LayoutTelefon =
        new StaticLayout(
            "Tel: " + joker.Telefon,
            LayoutTextPaint,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    LayoutBemerkung =
        new StaticLayout(
            "Bem.:" + joker.Bemerkung,
            LayoutTextPaint,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    LayoutTextPaintBold = new TextPaint(LayoutTextPaint);
    LayoutTextPaintBold.setFakeBoldText(true);
    LayoutName =
        new StaticLayout(
            joker.GCLogin + " (" + joker.Vorname + ", " + joker.Name + ")",
            LayoutTextPaintBold,
            TextWidth,
            Alignment.ALIGN_NORMAL,
            1.0f,
            0.0f,
            false);
    this.height =
        (LineSep * 5)
            + LayoutTage.getHeight()
            + LayoutTelefon.getHeight()
            + LayoutBemerkung.getHeight()
            + LayoutName.getHeight();

    setMeasuredDimension(this.width, this.height);
  }