public void init(Context context, ArrayList<CharSequence> widgetIds) {
    this.context = context;

    paintSmall = new TextPaint();
    paintSmall.setColor(Color.BLACK);
    paintSmall.setTextSize(FontCache.instance(context).Small.size);
    paintSmall.setTypeface(FontCache.instance(context).Small.face);
    paintSmall.setTextAlign(Align.CENTER);

    paintSmallNumerals = new TextPaint();
    paintSmallNumerals.setColor(Color.BLACK);
    paintSmallNumerals.setTextSize(FontCache.instance(context).SmallNumerals.size);
    paintSmallNumerals.setTypeface(FontCache.instance(context).SmallNumerals.face);
    paintSmallNumerals.setTextAlign(Align.CENTER);

    paintNumerals = new TextPaint();
    paintNumerals.setColor(Color.BLACK);
    paintNumerals.setTextSize(FontCache.instance(context).Numerals.size);
    paintNumerals.setTypeface(FontCache.instance(context).Numerals.face);
    paintNumerals.setTextAlign(Align.CENTER);
  }
  public Bitmap update(Context context, boolean preview, int watchType) {

    TextPaint paintSmall = new TextPaint();
    paintSmall.setColor(Color.BLACK);
    paintSmall.setTextSize(FontCache.instance(context).Small.size);
    paintSmall.setTypeface(FontCache.instance(context).Small.face);

    TextPaint paintSmallOutline = new TextPaint();
    paintSmallOutline.setColor(Color.WHITE);
    paintSmallOutline.setTextSize(FontCache.instance(context).Small.size);
    paintSmallOutline.setTypeface(FontCache.instance(context).Small.face);

    TextPaint paintLarge = new TextPaint();
    paintLarge.setColor(Color.BLACK);
    paintLarge.setTextSize(FontCache.instance(context).Large.size);
    paintLarge.setTypeface(FontCache.instance(context).Large.face);

    TextPaint paintLargeOutline = new TextPaint();
    paintLargeOutline.setColor(Color.WHITE);
    paintLargeOutline.setTextSize(FontCache.instance(context).Large.size);
    paintLargeOutline.setTypeface(FontCache.instance(context).Large.face);

    MediaControl.TrackInfo lastTrack = MediaControl.getLastTrack();

    if (watchType == WatchType.DIGITAL) {

      Bitmap bitmap = Bitmap.createBitmap(96, 96, Bitmap.Config.RGB_565);
      Canvas canvas = new Canvas(bitmap);
      canvas.drawColor(Color.WHITE);

      if (lastTrack.isEmpty()) {
        canvas.drawBitmap(Utils.getBitmap(context, "media_player_idle.png"), 0, 0, null);
      } else {
        canvas.drawBitmap(Utils.getBitmap(context, "media_player.png"), 0, 0, null);

        StringBuilder lowerText = new StringBuilder();
        if (!lastTrack.artist.equals("")) {
          lowerText.append(lastTrack.artist);
        }
        if (!lastTrack.album.equals("")) {
          if (lowerText.length() > 0) lowerText.append("\n\n");
          lowerText.append(lastTrack.album);
        }

        Utils.autoText(
            context,
            canvas,
            lastTrack.track,
            0,
            8,
            96,
            35,
            Layout.Alignment.ALIGN_CENTER,
            Color.BLACK);
        Utils.autoText(
            context,
            canvas,
            lowerText.toString(),
            0,
            54,
            96,
            35,
            Layout.Alignment.ALIGN_CENTER,
            Color.BLACK);
      }
      drawDigitalAppSwitchIcon(context, canvas, preview);

      return bitmap;
    } else if (watchType == WatchType.ANALOG) {
      Bitmap bitmap = Bitmap.createBitmap(80, 32, Bitmap.Config.RGB_565);
      Canvas canvas = new Canvas(bitmap);
      canvas.drawColor(Color.WHITE);

      if (lastTrack.isEmpty()) {
        canvas.drawBitmap(Utils.getBitmap(context, "media_player_idle_oled.png"), 0, 0, null);
      } else {
        canvas.drawBitmap(Utils.getBitmap(context, "media_player_oled.png"), 0, 0, null);

        TextPaint tp = null;
        if (paintLarge.measureText(lastTrack.track) < 75) {
          tp = paintLarge;
        } else {
          tp = paintSmall;
        }

        canvas.save();
        StaticLayout layout =
            new StaticLayout(
                lastTrack.track, tp, 75, Layout.Alignment.ALIGN_CENTER, 1.2f, 0, false);
        int height = layout.getHeight();
        int textY = 8 - (height / 2);
        if (textY < 0) {
          textY = 0;
        }
        canvas.translate(0, textY); // position the text
        canvas.clipRect(0, 0, 75, 16);
        layout.draw(canvas);
        canvas.restore();

        canvas.save();
        StringBuilder lowerText = new StringBuilder();
        if (!lastTrack.artist.equals("")) {
          lowerText.append(lastTrack.artist);
        }
        if (!lastTrack.album.equals("")) {
          if (lowerText.length() > 0) lowerText.append("\n\n");
          lowerText.append(lastTrack.album);
        }

        if (paintLarge.measureText(lowerText.toString()) < 75) {
          tp = paintLarge;
        } else {
          tp = paintSmall;
        }

        layout =
            new StaticLayout(
                lowerText.toString(), tp, 75, Layout.Alignment.ALIGN_CENTER, 1.0f, 0, false);
        height = layout.getHeight();
        textY = 24 - (height / 2);
        if (textY < 16) {
          textY = 16;
        }
        canvas.translate(0, textY); // position the text
        canvas.clipRect(0, 0, 75, 16);
        layout.draw(canvas);
        canvas.restore();
      }

      return bitmap;
    }

    return null;
  }