Exemplo n.º 1
0
  @Override
  public void draw(Canvas c, Layer l) {
    if (layer == l && alpha > 0) {
      paint.setAlpha(alpha);
      int width = numbers.getMinimumWidth() / 10;

      location.top = top;
      location.bottom = top + getPrologHeight();
      location.left = left + (getWidth() - prolog.getMinimumWidth()) / 2;
      location.right = location.left + prolog.getMinimumWidth();
      c.drawBitmap(prolog.getBitmap(), null, location, paint);

      source.top = 0;
      source.bottom = numbers.getIntrinsicHeight();
      location.top = top + numbers_offset;
      location.bottom = top + getTotalHeight();
      for (int i = digits - 1, n = number > 0 ? number : 0; i >= 0; --i, n = n / 10) {
        location.left = left + (getWidth() - width * digits) / 2 + i * width;
        location.right = location.left + width;
        source.left = (n % 10) * width;
        source.right = source.left + width;
        c.drawBitmap(numbers.getBitmap(), source, location, paint);
      }
    }
  }
 public void setImage(String bitmapLocation) {
   this.bitmapLocation = bitmapLocation;
   if (bitmapLocation == null || bitmapLocation.equals("")) return;
   Bitmap backgroundBitmap =
       ImageTools.decodeFile(
           bitmapLocation,
           DisplayUtils
               .dispayWidth); // BitmapFactory.decodeFile(bitmapLocation,
                              // ImageTools.getDefaultBitmapOptions());
   BitmapDrawable background = (BitmapDrawable) topLayout.getBackground();
   topLayout.setBackgroundDrawable(
       new BitmapDrawable(
           ImageTools.resizeBitmapToFitExactlyInBox(
               backgroundBitmap,
               DisplayUtils.getDpiSpecificValue(background.getMinimumWidth()),
               DisplayUtils.getDpiSpecificValue(background.getMinimumHeight()))));
   Utils.recycle(backgroundBitmap);
   hideWidgets();
 }
Exemplo n.º 3
0
 public int getWidth() {
   return Math.max(numbers.getMinimumWidth() / 10 * digits, prolog.getMinimumWidth());
 }