Exemplo n.º 1
0
  public Game(Context context, GameView view) {
    this.view = view;

    // Dialogs are context dependent so this check allows the view to validate in the layout viewer
    if (!view.isInEditMode()) {
      // Setup the positive button action for the new round dialog pop-up
      view.getNewRound()
          .setButton(
              -1,
              context.getString(R.string.okay),
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                  dialog.dismiss();
                  reset();
                }
              });
    }

    // Setup the 2 block resources
    brown = BitmapFactory.decodeResource(context.getResources(), R.drawable.brick_brown);
    red = BitmapFactory.decodeResource(context.getResources(), R.drawable.brick_red1);

    // Setup the rest
    setup();
  }