Android Open Source - android-chess P G N View






From Project

Back to project page android-chess.

License

The source code is released under:

MIT License

If you think the Android project android-chess listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package jwtc.android.chess;
/*w  w  w .  j a va  2 s  .  c o  m*/
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.TextView;

public class PGNView {

  public String _sMove;
  public boolean _bAnnotated;
  public View _view;
  public ChessView _parent;
  private TextView _tvItem;
  
  public PGNView(ChessView parent, View view, int num, String sMove, boolean bAnno){
    _parent = parent;
    _view = view;
    _bAnnotated = bAnno;
    
    TextView tvItemNum = (TextView)_view.findViewById(R.id.TextViewNumMove);
    if(num % 2 == 1){
      int i = ((int)num/2 + 1);
      String s = "";
      if(parent.hasVerticalScroll()){
        if(i < 100)
          s += "  ";
        if(i < 10)
          s += "  ";
      }
      tvItemNum.setText(s + i/* + ". "*/);
      //tvItemNum.setVisibility(View.VISIBLE);
      
    } else {
      //tvItemNum.setVisibility(View.INVISIBLE);
      tvItemNum.setWidth(0);
    }
    _tvItem = (TextView)_view.findViewById(R.id.TextViewMove);
    _tvItem.setText(sMove);
    _sMove = sMove;
    
    _view.setOnClickListener(new OnClickListener() {
          public void onClick(View arg0) {
            _parent.onClickPGNView(PGNView.this);
          }
      });
    
    _view.setOnLongClickListener(new OnLongClickListener(){

      public boolean onLongClick(View v) {
        _parent.onLongClickPGNView(PGNView.this);
        return false;
      }
    });
  }
  public void setAnnotated(boolean b){
    _bAnnotated = b;
  }
  public void setSelected(boolean b){
    if(b){
      _tvItem.setBackgroundColor(0xff884444);
    }
    else{
      if(_bAnnotated)
        _tvItem.setBackgroundColor(0xff648fd5);
      else
        _tvItem.setBackgroundColor(0xff404040);
    }
  }
}




Java Source Code List

jwtc.android.chess.ChessFieldView.java
jwtc.android.chess.ChessImageView.java
jwtc.android.chess.ChessPreferences.java
jwtc.android.chess.ChessViewBase.java
jwtc.android.chess.ChessView.java
jwtc.android.chess.GamesListView.java
jwtc.android.chess.HtmlActivity.java
jwtc.android.chess.ImageCacheObject.java
jwtc.android.chess.MyBaseActivity.java
jwtc.android.chess.MyPGNProvider.java
jwtc.android.chess.PGNView.java
jwtc.android.chess.SaveGameDlg.java
jwtc.android.chess.UI.java
jwtc.android.chess.convergence.Connection.java
jwtc.android.chess.convergence.ConvergenceActivity.java
jwtc.android.chess.convergence.RestServer.java
jwtc.android.chess.iconifiedlist.IconifiedTextListAdapter.java
jwtc.android.chess.iconifiedlist.IconifiedTextView.java
jwtc.android.chess.iconifiedlist.IconifiedText.java
jwtc.android.chess.ics.CustomCommands.java
jwtc.android.chess.ics.ICSChatDlg.java
jwtc.android.chess.ics.ICSChessView.java
jwtc.android.chess.ics.ICSClient.java
jwtc.android.chess.ics.ICSConfirmDlg.java
jwtc.android.chess.ics.ICSMatchDlg.java
jwtc.android.chess.ics.TelnetSocket.java
jwtc.android.chess.ics.TimesealInputStream.java
jwtc.android.chess.ics.TimesealOutputStream.java
jwtc.android.chess.ics.TimesealPipe.java
jwtc.android.chess.ics.TimesealingSocket.java
jwtc.android.chess.puzzle.ChessViewPractice.java
jwtc.android.chess.puzzle.ChessViewPuzzle.java
jwtc.android.chess.puzzle.MyPuzzleProvider.java
jwtc.android.chess.puzzle.practice.java
jwtc.android.chess.puzzle.puzzle.java
jwtc.android.chess.tools.FileListView.java
jwtc.android.chess.tools.PGNProcessor.java
jwtc.android.chess.tools.importactivity.java
jwtc.android.chess.tools.pgntool.java
jwtc.android.chess.main.java
jwtc.android.chess.options.java
jwtc.android.chess.setup.java
jwtc.android.chess.start.java
jwtc.android.timeseal.TimesealingSocket.java
jwtc.android.timeseal.streams.a.java
jwtc.android.timeseal.streams.b.java
jwtc.android.timeseal.streams.c.java
jwtc.chess.ChessPuzzleProvider.java
jwtc.chess.GameControl.java
jwtc.chess.JNI.java
jwtc.chess.Move.java
jwtc.chess.PGNColumns.java
jwtc.chess.PGNEntry.java
jwtc.chess.PGNProvider.java
jwtc.chess.Pos.java
jwtc.chess.Valuation.java
jwtc.chess.algorithm.SearchAlgorithmRunner.java
jwtc.chess.algorithm.UCIWrapper.java
jwtc.chess.board.BoardConstants.java
jwtc.chess.board.BoardHashKeys.java
jwtc.chess.board.BoardMembers.java
jwtc.chess.board.BoardStatics.java
jwtc.chess.board.ChessBoard.java