コード例 #1
0
 @Override
 public void setMessage(String sMsg) {
   _tvPuzzleText.setText(sMsg);
   // _parent.doToast(sMsg);
   // _tvMessage.setText(sMsg);
   // m_textMessage.setText(sMsg);
 }
コード例 #2
0
        // @Override
        public void handleMessage(Message msg) {
          if (msg.what == 1) {
            _progressDlg.hide();

            getNumPuzzles();
            if (_seekBar != null) {
              _seekBar.setMax(_num);
            }

            play();
          } else if (msg.what == 2) {
            _progressDlg.setMessage(
                _parent.getString(R.string.msg_progress)
                    + String.format(" %d", (_cnt * 100) / _num)
                    + " %");
          } else if (msg.what == 3) {
            _progressDlg.hide();
            _tvPuzzleText.setText("An error occured during install");
          }
        }
コード例 #3
0
 @Override
 public void setMessage(int res) {
   _tvPuzzleText.setText(res);
   // _parent.doToast(_parent.getString(res));
 }
コード例 #4
0
  @Override
  public void play() {
    m_iFrom = -1;
    Log.i("ChessViewPuzzle", "Numboard = " + _jni.getNumBoard());

    _imgStatus.setImageResource(R.drawable.indicator_none);

    String sPGN;

    _iPos++;
    if (_iPos < 1) _iPos = 1;
    if (_iPos > _num) {
      setMessage("You completed all puzzles!!!");
      return;
    }

    if (_seekBar != null) {
      _seekBar.setProgress(_iPos);
    }
    if (_cursor != null) {
      _cursor.moveToPosition(_iPos - 1);
      sPGN = _cursor.getString(_cursor.getColumnIndex(MyPuzzleProvider.COL_PGN));
      Log.i("ChessViewPuzzle", "init: " + sPGN);
      loadPGN(sPGN);

      jumptoMove(0);

      int turn = _jni.getTurn();
      if (turn == BoardConstants.BLACK && false == _view.getFlippedBoard()
          || turn == BoardConstants.WHITE && _view.getFlippedBoard()) _view.flipBoard();

      String sWhite = _mapPGNHead.get("White");
      if (sWhite == null) {
        sWhite = "";
      } else {
        sWhite = sWhite.replace("?", "");
      }
      String sDate = _mapPGNHead.get("Date");
      if (sDate == null) {
        sDate = "";
      } else {
        sDate = sDate.replace("????", "");
        sDate = sDate.replace(".??.??", "");
      }

      if (sWhite.length() > 0 && sDate.length() > 0) {
        sWhite += ", ";
      }

      _tvPuzzleText.setText(
          "# " + _iPos + " - " + sWhite
              + sDate); // + "\n\n" + _mapPGNHead.get("Event") + ", " +
                        // _mapPGNHead.get("Date").replace(".??.??", ""));
      // _tvPuzzle.setText(");

      _imgTurn.setImageResource(
          (turn == BoardConstants.WHITE ? R.drawable.turnwhite : R.drawable.turnblack));

      updateState();
    }
  }