Exemplo n.º 1
0
  @Override
  public void onDraw(Canvas canvas) {
    loadBitmap();

    if (image != null) {
      shader =
          new BitmapShader(
              Bitmap.createScaledBitmap(image, canvas.getWidth(), canvas.getHeight(), false),
              Shader.TileMode.CLAMP,
              Shader.TileMode.CLAMP);
      paint.setShader(shader);
      int circleCenter = viewWidth / 2;

      canvas.drawCircle(
          circleCenter + borderWidth,
          circleCenter + borderWidth,
          circleCenter + borderWidth - 4.0f,
          paintBorder);

      if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
          == Configuration.SCREENLAYOUT_SIZE_LARGE) {
        canvas.drawCircle(
            circleCenter + borderWidth, circleCenter + borderWidth, circleCenter - 2.0f, paint);

      } else {
        canvas.drawCircle(
            circleCenter + borderWidth, circleCenter + borderWidth, circleCenter - 4.0f, paint);
      }

      //			canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter -
      // 4.0f, paint);
    }
  }
Exemplo n.º 2
0
  @Override
  protected void dispatchDraw(Canvas canvas) {
    if (showcaseX < 0 || showcaseY < 0 || isRedundant) {
      super.dispatchDraw(canvas);
      return;
    }

    // Draw the semi-transparent background
    canvas.drawColor(backColor);

    // Draw to the scale specified
    Matrix mm = new Matrix();
    mm.postScale(scaleMultiplier, scaleMultiplier, showcaseX, showcaseY);
    canvas.setMatrix(mm);

    // Erase the area for the ring
    canvas.drawCircle(showcaseX, showcaseY, showcaseRadius, mEraser);

    boolean recalculateText = makeVoidedRect() || mAlteredText;
    mAlteredText = false;

    showcase.setBounds(voidedArea);
    showcase.draw(canvas);

    canvas.setMatrix(new Matrix());

    if (!TextUtils.isEmpty(mTitleText) || !TextUtils.isEmpty(mSubText)) {
      if (recalculateText)
        mBestTextPosition = getBestTextPosition(canvas.getWidth(), canvas.getHeight());

      if (!TextUtils.isEmpty(mTitleText)) {
        // TODO: use a dynamic detail layout
        canvas.drawText(mTitleText, mBestTextPosition[0], mBestTextPosition[1], mPaintTitle);
      }

      if (!TextUtils.isEmpty(mSubText)) {
        canvas.save();
        if (recalculateText)
          mDynamicDetailLayout =
              new DynamicLayout(
                  mSubText,
                  mPaintDetail,
                  ((Number) mBestTextPosition[2]).intValue(),
                  Layout.Alignment.ALIGN_NORMAL,
                  1.2f,
                  1.0f,
                  true);
        canvas.translate(mBestTextPosition[0], mBestTextPosition[1] + 12 * metricScale);
        mDynamicDetailLayout.draw(canvas);
        canvas.restore();
      }
    }

    super.dispatchDraw(canvas);
  }
  @Override
  protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    final boolean ret;

    final Integer row = (Integer) child.getTag(R.id.tag_row);
    final Integer column = (Integer) child.getTag(R.id.tag_column);
    // row == null => Shadow view
    if (row == null || (row == -1 && column == -1)) {
      ret = super.drawChild(canvas, child, drawingTime);
    } else {
      canvas.save();
      if (row == -1) {
        canvas.clipRect(widths[0], 0, canvas.getWidth(), canvas.getHeight());
      } else if (column == -1) {
        canvas.clipRect(0, heights[0], canvas.getWidth(), canvas.getHeight());
      } else {
        canvas.clipRect(widths[0], heights[0], canvas.getWidth(), canvas.getHeight());
      }

      ret = super.drawChild(canvas, child, drawingTime);
      canvas.restore();
    }
    return ret;
  }
    public boolean play(Canvas out, Context context) {
      float aspect = out.getHeight() * 1.0f / out.getWidth();
      int width = 1000;
      Bitmap bitmap = Bitmap.createBitmap(width, Math.round(width * aspect), Bitmap.Config.RGB_565);
      Canvas c = new Canvas(bitmap);
      bounds = c.getClipBounds();
      windowBounds = out.getClipBounds();

      if (paint == null) {
        String currentSize =
            Shared.getOptionAtribute(
                context.getString(R.string.FontSize), getString(R.string.current), context);
        String textColour =
            Shared.getOptionAtribute(
                context.getString(R.string.Colours), getString(R.string.text), context);
        paint = new Paint();
        paint.setColor(
            Color.parseColor(
                Shared.getOption(context.getString(R.string.Colours) + "/" + textColour, context)
                    .getTextContent()));
        paint.setTextSize(
            new Integer(
                Shared.getOption(context.getString(R.string.FontSize) + "/" + currentSize, context)
                    .getTextContent()));
        String font =
            Shared.getOptionAtribute(
                getString(R.string.Font), getString(R.string.current), getApplicationContext());
        Typeface face =
            Typeface.createFromAsset(
                getAssets(),
                Shared.getOption(getString(R.string.Font) + "/" + font, getApplicationContext())
                    .getTextContent());
        paint.setTypeface(face);
      }
      c.drawText("tap the screen", 50, 50, paint);
      c.drawText("to start", 50, 100, paint);
      c.drawText("the test.", 50, 150, paint);
      c.drawText("Pick the Months", 50, 200, paint);
      c.drawText("in reverse order", 50, 250, paint);
      // c.drawText("",50,300,paint);

      out.drawBitmap(bitmap, c.getClipBounds(), out.getClipBounds(), paint);

      return finished;
    }
Exemplo n.º 5
0
  @Override
  public void onDraw(Canvas canvas) {
    int margeLeft, margeRight, margeTop, margeBot, line, calcLine, part;
    if (canvas.getWidth() > canvas.getHeight()) {
      ref = (int) (canvas.getHeight() * 0.85);
      margin = (int) (canvas.getHeight() * 0.15);
    } else {
      ref = (int) (canvas.getWidth() * 0.85);
      margin = (int) (canvas.getWidth() * 0.15);
    }
    part = ref / NB_SQUARE_PAR_LINE;
    line = -1;
    int size = (int) Math.pow(NB_SQUARE_PAR_LINE, 2);
    for (int i = 0; i < size; i++) {
      ISquare square = chessboard.get(i);
      calcLine = (i - i % NB_SQUARE_PAR_LINE) / NB_SQUARE_PAR_LINE;
      margeTop = calcLine * part + margin / 2;
      if (calcLine != line) {
        line = calcLine;
        margeLeft = margin / 2;
      } else {
        margeLeft = margin / 2 + part * (i % NB_SQUARE_PAR_LINE);
      }
      margeBot = margeTop + part;
      margeRight = margeLeft + part;

      if ((line + i) % 2 == 1) {
        paintSquare.setColor(Color.parseColor("#a7823d"));
      } else {
        paintSquare.setColor(Color.parseColor("#e6e6ff"));
      }
      Rect rect = new Rect(margeLeft, margeTop, margeRight, margeBot);

      canvas.drawRect(rect, paintSquare);

      int status = square.getStatus();
      if (status != ISquare.STATUS_DEFAULT) {
        int border_margin = (int) (part * 0.08);
        int inner_margin;
        switch (status) {
          case (ISquare.STATUS_SELECTED):
            paintStatus.setColor(Color.parseColor("#0034E1")); // "#FFA200"));
            paintStatus.setStyle(Paint.Style.STROKE);
            paintStatus.setStrokeWidth(border_margin);
            inner_margin = border_margin / 2;
            rectF.set(
                margeLeft + inner_margin,
                margeTop + inner_margin,
                margeRight - inner_margin,
                margeBot - inner_margin);
            canvas.drawRect(rectF, paintStatus);
            break;
          case (ISquare.STATUS_TARGETABLE):
            paintStatus.setColor(Color.parseColor("#D23939"));
            paintStatus.setStyle(Paint.Style.FILL);
            paintStatus.setStrokeWidth(0);
            inner_margin = (int) (border_margin / 1.5);
            rectF.set(
                margeLeft + inner_margin,
                margeTop + inner_margin,
                margeRight - inner_margin,
                margeBot - inner_margin);
            canvas.drawRect(rectF, paintStatus);
            break;
          case (ISquare.STATUS_MOVE):
            paintStatus.setColor(Color.parseColor("#3899D1"));
            paintStatus.setStyle(Paint.Style.FILL);
            paintStatus.setStrokeWidth(0);
            inner_margin = (int) (border_margin / 1.5);
            rectF.set(
                margeLeft + inner_margin,
                margeTop + inner_margin,
                margeRight - inner_margin,
                margeBot - inner_margin);
            canvas.drawRect(rectF, paintStatus);
            break;
        }
      }

      if (!square.isEmpty()) {
        IPiece piece = square.getPiece();

        int marginDrawable = (int) (part * 0.2);

        RelativeLayout myLayout = (RelativeLayout) this.getParent();

        int width = (margeRight - marginDrawable) - (margeLeft + marginDrawable);
        int height = (margeBot - marginDrawable) - (margeTop + marginDrawable);
        int left = margeLeft + marginDrawable;
        int top = margeTop + marginDrawable;

        piece.setImage(getContext(), myLayout, width, height, left, top);
      }
    }
  }
Exemplo n.º 6
0
 public double getWIDTH() {
   return canvas.getWidth();
 }
Exemplo n.º 7
0
  @Override
  public void render(MainGamePanel game, Canvas canvas, GameState gameState) {

    setzIndex(5);

    if (gameState.isStateDefeat()) {

      canvas.clipRect(0, 0, canvas.getWidth(), canvas.getHeight(), Region.Op.REPLACE);

      int border = canvas.getWidth() / 15;

      paint.setTextSize(TextSizeCalculator.getDefaultTextSize(canvas));
      paint.setTextAlign(Paint.Align.CENTER);
      paint.setAntiAlias(true);
      paint.setStrokeWidth(2f);
      paint.setColorFilter(MyColors.getFilterGui());

      paint.setColor(MyColors.getGuiElementColor());
      canvas.drawLine(border, border, canvas.getWidth() - border, border, paint);
      canvas.drawLine(border, border, border, canvas.getHeight() - border, paint);
      canvas.drawLine(
          border,
          canvas.getHeight() - border,
          canvas.getWidth() - border,
          canvas.getHeight() - border,
          paint);
      canvas.drawLine(
          canvas.getWidth() - border,
          border,
          canvas.getWidth() - border,
          canvas.getHeight() - border,
          paint);

      int headingHeight = TextSizeCalculator.getHeightFromTextSize(paint.getTextSize());
      int highScoreTextSize = (int) (TextSizeCalculator.getDefaultTextSize(canvas) * 0.7);

      ExtStorage ext =
          (ExtStorage) game.getElements().getComponent(Elements.EXTERNAL_STORAGE_PROVIDER);

      String heading = "";
      String secondaryScoreName = "";
      String secondaryScoreShortName = "";
      String secondaryScoreValue = "";
      int secondaryScoreIntValue = 0;
      List<String> highScoreList = null;

      // Normal
      if (gameState.getPreviousState() == GameState.STATE_GAME) {

        heading = "LOL NOOB";
        secondaryScoreName = "level";
        secondaryScoreShortName = ". level";

        // Level value
        secondaryScoreIntValue = LevelList.getLevelId() + 1;
        secondaryScoreValue = Integer.toString(secondaryScoreIntValue);

        if (ext != null) {
          highScoreList = ext.getHighScore(ExtStorage.HIGH_SCORE_NORMAL_FILE);
        }

        // Arcade
      } else if (gameState.getPreviousState() == GameState.STATE_ARCADE) {

        heading = "NICE TRY!";
        secondaryScoreName = "seconds";
        secondaryScoreShortName = " sec";

        // Seconds value
        secondaryScoreIntValue =
            (int) ((gameState.getArcadeTimeEnd() - gameState.getArcadeTimeStart()) / 1000.0f);
        secondaryScoreValue = Integer.toString(secondaryScoreIntValue);

        if (ext != null) {
          highScoreList = ext.getHighScore(ExtStorage.HIGH_SCORE_ARCADE_FILE);
        }
      }

      // Heading
      paint.setTextAlign(Paint.Align.LEFT);
      canvas.drawText(heading, border * 1.5f, border * 2.5f + headingHeight * 0.5f, paint);

      paint.setTextAlign(Paint.Align.CENTER);
      paint.setTextSize(paint.getTextSize() * 0.9f);
      canvas.drawText(secondaryScoreValue, canvas.getWidth() - border * 2.5f, border * 2.7f, paint);
      paint.setTextSize(paint.getTextSize() * 0.4f);
      canvas.drawText(secondaryScoreName, canvas.getWidth() - border * 2.5f, border * 3.5f, paint);
      canvas.drawLine(
          canvas.getWidth() - border * 4f,
          border,
          canvas.getWidth() - border * 4f,
          border * 4f,
          paint);

      // Restore defaults
      paint.setTextSize(TextSizeCalculator.getDefaultTextSize(canvas));
      paint.setTextAlign(Paint.Align.CENTER);

      if (highScoreList != null) {

        int lineHeight = TextSizeCalculator.getHeightFromTextSize(highScoreTextSize) * 2;

        int left = border;
        int right = canvas.getWidth() - border;

        int baseTop = border * 4;
        int counter = 0;

        paint.setColor(MyColors.getGuiElementColor());
        paint.setTextSize(highScoreTextSize);
        canvas.drawLine(
            left, baseTop + (counter * lineHeight), right, baseTop + (counter * lineHeight), paint);
        counter++;

        canvas.drawText(
            "HIGH SCORE",
            canvas.getWidth() / 2,
            baseTop + (counter * lineHeight) - lineHeight / 4,
            paint);

        canvas.drawLine(
            left, baseTop + (counter * lineHeight), right, baseTop + (counter * lineHeight), paint);
        counter++;

        for (String score : highScoreList) {

          if (score != null && !score.equals("") && score.split("\\|").length == 2) {

            canvas.drawLine(
                left,
                baseTop + (counter * lineHeight),
                right,
                baseTop + (counter * lineHeight),
                paint);

            String highScoreValue = score.split("\\|")[0];
            String secondaryHighScoreValue = score.split("\\|")[1];

            // Arcade
            if (gameState.getPreviousState() == GameState.STATE_ARCADE) {

              Score scoreComponent = (Score) game.getElements().getComponent(Elements.SCORE);

              if (Integer.parseInt(highScoreValue) == scoreComponent.getScore()
                  && Integer.parseInt(secondaryHighScoreValue) == secondaryScoreIntValue) {
                paint.setColor(MyColors.getGuiNewHighScoreColor());
              }
            }

            // Score values
            paint.setTextAlign(Paint.Align.RIGHT);
            canvas.drawText(
                highScoreValue,
                canvas.getWidth() / 2 - border / 2,
                baseTop + (counter * lineHeight) - lineHeight / 4,
                paint);
            canvas.drawText(
                secondaryHighScoreValue + secondaryScoreShortName,
                canvas.getWidth() - border * 1.5f,
                baseTop + (counter * lineHeight) - lineHeight / 4,
                paint);
            paint.setColor(MyColors.getGuiElementColor());
            // Line
            canvas.drawLine(
                canvas.getWidth() / 2,
                baseTop + (counter * lineHeight),
                canvas.getWidth() / 2,
                baseTop + ((counter - 1) * lineHeight),
                paint);

            counter++;
          }
        }
      }

      paint.setTextAlign(Paint.Align.CENTER);

      buttonLeft = 2 * border;
      buttonRight = canvas.getWidth() - 2 * border;
      buttonRetryTop = canvas.getHeight() - 7 * border;
      buttonRetryBottom = canvas.getHeight() - 5 * border;
      buttonMainMenuTop = canvas.getHeight() - 4 * border;
      buttonMainMenuBottom = canvas.getHeight() - 2 * border;

      // Draw buttons
      canvas.drawRect(buttonLeft, buttonRetryTop, buttonRight, buttonRetryBottom, paint);
      paint.setStyle(Paint.Style.STROKE);
      canvas.drawRect(buttonLeft, buttonMainMenuTop, buttonRight, buttonMainMenuBottom, paint);

      // Draw button texts
      paint.setStyle(Paint.Style.FILL);
      paint.setColor(MyColors.getGuiElementTextColor());
      int textHeight = TextSizeCalculator.getHeightFromTextSize(highScoreTextSize);
      canvas.drawText(
          "RETRY",
          canvas.getWidth() / 2,
          getTextY(buttonRetryTop, buttonRetryBottom, textHeight),
          paint);

      paint.setColor(MyColors.getGuiElementColor());
      canvas.drawText(
          "QUIT TO MENU",
          canvas.getWidth() / 2,
          getTextY(buttonMainMenuTop, buttonMainMenuBottom, textHeight),
          paint);
    }
  }
Exemplo n.º 8
0
  public void startApp() {
    if (svgCanvas == null) {
      // If there is a splash screen defined, show it immediately.
      boolean hasSplash = ((splashImageName != null) && !"".equals(splashImageName));

      if (hasSplash) {
        InputStream splashStream = getClass().getResourceAsStream(splashImageName);

        try {
          Image splashImage = Image.createImage(splashStream);
          splashCanvas = new SplashCanvas(splashImage);
        } catch (IOException ioe) {
          ioe.printStackTrace();
          hasSplash = false;
        }

        if (splashCanvas != null) {
          Display.getDisplay(this).setCurrent(splashCanvas);
        }
      }

      long start = System.currentTimeMillis();

      // Get input stream to the SVG image stored in the MIDlet's jar.
      InputStream svgDemoStream = getClass().getResourceAsStream(svgImageName);

      // Build an SVGImage instance from the stream
      svgImage = null;

      if (svgDemoStream != null) {
        try {
          svgImage = (SVGImage) SVGImage.createImage(svgDemoStream, null);
        } catch (IOException io) {
          io.printStackTrace();
        }
      }

      if (svgImage == null) {
        throw new Error(ERROR_COULD_NOT_LOAD_SVG + svgImageName);
      }

      // Build an SVGAnimator from the SVGImage. The SVGAnimator will handle
      // all the animation details and run the SVG animation in a
      // Canvas instance.
      svgAnimator = SVGAnimator.createAnimator(svgImage);

      // Set to 10 fps (frames per second)
      svgAnimator.setTimeIncrement(0.01f);

      // Get the Canvas managed by the SVGAnimator and set the
      // svgImage's size to the canvas display area.
      svgCanvas = (Canvas) svgAnimator.getTargetComponent();
      svgImage.setViewportWidth(svgCanvas.getWidth());
      svgImage.setViewportHeight(svgCanvas.getHeight());

      // Hook the exit command so that we can exit the animation demo.
      svgCanvas.addCommand(exitCommand);
      svgCanvas.setCommandListener(this);

      // The SVG root element is used to reset the time on a stop operation.
      doc = svgImage.getDocument();
      svg = (SVGSVGElement) doc.getDocumentElement();

      // Hook-in key listeners to play, pause and stop the animation.
      svgAnimator.setSVGEventListener(this);

      long end = System.currentTimeMillis();

      if (hasSplash) {
        long waitMore = SPLASH_MIN_LENGTH - (end - start);

        if (waitMore > 0) {
          try {
            Thread.currentThread().sleep(waitMore);
          } catch (InterruptedException ie) {
            // Do nothing.
          }
        }
      }

      if (autoStart) {
        svgAnimator.play();
        state = STATE_PLAYING;
        System.err.println("PLAYING...");
      }
    }

    Display.getDisplay(this).setCurrent(svgCanvas);
    resumeAnimation();
  }
    public boolean play(Canvas out, Context context) {
      Paint paint = null;
      float aspect = out.getHeight() * 1.0f / out.getWidth();
      int width = 1000;
      Bitmap bitmap = Bitmap.createBitmap(width, Math.round(width * aspect), Bitmap.Config.RGB_565);
      Canvas c = new Canvas(bitmap);
      bounds = c.getClipBounds();
      windowBounds = out.getClipBounds();

      if (!started) {
        started = true;
        months = getMonthVector();

        paint = new Paint();
        paint.setColor(Color.parseColor("#00ff00"));
        paint.setStrokeWidth(5);
      }

      for (rectangle month : months) {
        // ball.Update();  // the months don't need to be updated
        month.Draw(c);
      }

      out.drawBitmap(bitmap, c.getClipBounds(), out.getClipBounds(), paint);

      //                for(int i = 0; i < userSequenceTest.size(); i++)
      //                {
      //                    if(demoSequence.get(i) != userSequenceTest.get(i))
      //                    {
      //                        sequencesMatch = false;
      //                    }
      //
      //                    if(sequencesMatch == false)
      //                    {
      //                        break;
      //                    }
      //
      //                }

      return false;

      //                // if we've pressed more circles than are in the sequence, then we have
      // failed.
      //                if(monthPressedCount > getDemoSequence().size() || sequencesMatch == false)
      //                {
      //                    // return true when finished
      //                    for(rectangle month: months)
      //                    {
      //                        month.setPressed(false);
      //                    }
      //                    setResult(false);
      //                    return true;
      //                }
      //                // if the sequences match and we have pressed the number of months in the
      // demo sequence
      //                else if(sequencesMatch == true && monthPressedCount == demoSequence.size()){
      //                    // then we have succeded and return true because we have finished
      //
      //                    setResult(true);
      //                    return true;
      //                } else {
      //                    return false;
      //                }

    }
        public boolean play(Canvas out, Context context) {

          float aspect = out.getHeight() * 1.0f / out.getWidth();
          int width = 1000;
          Bitmap bitmap =
              Bitmap.createBitmap(width, Math.round(width * aspect), Bitmap.Config.RGB_565);
          Canvas c = new Canvas(bitmap);
          bounds = c.getClipBounds();
          windowBounds = out.getClipBounds();

          if (!started) {
            months = new Vector<rectangle>();
            // months.add(new Ball(new
            // Point(bounds.width()/4,10+(2+random.nextInt(10))*(1+random.nextInt(10))),Color.parseColor("#00ff00"),45,bounds));
            List<Rect> rectList = new ArrayList<Rect>();
            rectList.add(
                new Rect(bounds.left, bounds.top, bounds.width() / 4, bounds.height() / 3));
            rectList.add(
                new Rect(
                    bounds.width() / 4, bounds.top, bounds.width() * 2 / 4, bounds.height() / 3));
            rectList.add(
                new Rect(
                    bounds.width() * 2 / 4,
                    bounds.top,
                    bounds.width() * 3 / 4,
                    bounds.height() / 3));
            rectList.add(
                new Rect(bounds.width() * 3 / 4, bounds.top, bounds.right, bounds.height() / 3));

            rectList.add(
                new Rect(
                    bounds.left, bounds.height() / 3, bounds.width() / 4, bounds.height() * 2 / 3));
            rectList.add(
                new Rect(
                    bounds.width() / 4,
                    bounds.height() / 3,
                    bounds.width() * 2 / 4,
                    bounds.height() * 2 / 3));
            rectList.add(
                new Rect(
                    bounds.width() * 2 / 4,
                    bounds.height() / 3,
                    bounds.width() * 3 / 4,
                    bounds.height() * 2 / 3));
            rectList.add(
                new Rect(
                    bounds.width() * 3 / 4,
                    bounds.height() / 3,
                    bounds.right,
                    bounds.height() * 2 / 3));

            rectList.add(
                new Rect(
                    bounds.left,
                    bounds.height() * 2 / 3,
                    bounds.width() / 4,
                    bounds.height() * 3 / 3));
            rectList.add(
                new Rect(
                    bounds.width() / 4,
                    bounds.height() * 2 / 3,
                    bounds.width() * 2 / 4,
                    bounds.height() * 3 / 3));
            rectList.add(
                new Rect(
                    bounds.width() * 2 / 4,
                    bounds.height() * 2 / 3,
                    bounds.width() * 3 / 4,
                    bounds.height() * 3 / 3));
            rectList.add(
                new Rect(
                    bounds.width() * 3 / 4,
                    bounds.height() * 2 / 3,
                    bounds.right,
                    bounds.height() * 3 / 3));

            Collections.shuffle(rectList);
            String boxColour =
                Shared.getOption(context.getString(R.string.Colours) + "/" + boxColourStr, context)
                    .getTextContent();
            // Color boxColour =
            // Color.parseColor(Shared.getOption(context.getString(R.string.Colours) + "/"
            // +boxColourStr  ));

            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(0), "January", boxBoundry));
            months.add(
                new rectangle(
                    Color.parseColor(boxColour), rectList.get(1), "February", boxBoundry));
            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(2), "March", boxBoundry));
            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(3), "April", boxBoundry));

            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(4), "May", boxBoundry));
            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(5), "June", boxBoundry));
            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(6), "July", boxBoundry));
            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(7), "August", boxBoundry));

            months.add(
                new rectangle(
                    Color.parseColor(boxColour), rectList.get(8), "September", boxBoundry));
            months.add(
                new rectangle(Color.parseColor(boxColour), rectList.get(9), "October", boxBoundry));
            months.add(
                new rectangle(
                    Color.parseColor(boxColour), rectList.get(10), "November", boxBoundry));
            months.add(
                new rectangle(
                    Color.parseColor(boxColour), rectList.get(11), "December", boxBoundry));

            // Vector v = new Vector();
            //                    Iterator itr = months.iterator();
            //                    while(itr.hasNext())
            //                    {
            //                        itr.next().
            //                    }

            String textColour =
                Shared.getOption(context.getString(R.string.Colours) + "/" + textColourStr, context)
                    .getTextContent();
            for (int i = 0; i < months.size(); i++) {
              months.get(i).setTextSize(textSize);
              months.get(i).setTextColour(textColour);
            }

            //                    setSequenceNumber(months.size());
            //                    sequenceNumber = getSequenceNumber();
            //                    // create a list of random months from the months Vector.
            // SequenceNumber dictates how many random months will be stored in the sequence
            // variable
            //                    for(int i = 0; i< sequenceNumber; i++)
            //                    {
            //                        sequence.add(months.get(i));
            //                    }

            // NB
            // set the SpaceCogViewViewModle's sequence variable
            setDemoSequence(sequence);

            setMonthVector(months);
            started = true;
          }

          if (paint == null) {
            String currentSize =
                Shared.getOptionAtribute(
                    context.getString(R.string.FontSize), getString(R.string.current), context);
            String textColour =
                Shared.getOptionAtribute(
                    context.getString(R.string.Colours), getString(R.string.text), context);
            paint = new Paint();
            paint.setColor(
                Color.parseColor(
                    Shared.getOption(
                            context.getString(R.string.Colours) + "/" + textColour, context)
                        .getTextContent()));
            paint.setTextSize(
                new Integer(
                    Shared.getOption(
                            context.getString(R.string.FontSize) + "/" + currentSize, context)
                        .getTextContent()));
            String font =
                Shared.getOptionAtribute(
                    getString(R.string.Font), getString(R.string.current), getApplicationContext());
            Typeface face =
                Typeface.createFromAsset(
                    getAssets(),
                    Shared.getOption(getString(R.string.Font) + "/" + font, getApplicationContext())
                        .getTextContent());
            paint.setTypeface(face);
          }
          c.drawText("tap the screen", 50, 50, paint);
          c.drawText("to start", 50, 100, paint);
          c.drawText("the test.", 50, 150, paint);
          c.drawText("Pick the Months", 50, 200, paint);
          c.drawText("in reverse order", 50, 250, paint);

          out.drawBitmap(bitmap, c.getClipBounds(), out.getClipBounds(), paint);

          return finished;
        }