Android Open Source - android-chess I C S Match Dlg






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.ics;
//from w w w. j ava 2s  .  co m
import jwtc.android.chess.*;
import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

/**
 * 
 */
public class ICSMatchDlg extends Dialog {

  private Spinner _spinTime, _spinIncrement, _spinVariant;
  private EditText _editPlayer;
  private ArrayAdapter<CharSequence> _adapterTime, _adapterIncrement, _adapterVariant;
  private Button _butOk, _butCancel;
  private CheckBox _checkRated;
  private ICSClient _parent;
  
  public ICSMatchDlg(Context context) {
    super(context);

    _parent = (ICSClient)context;

    setContentView(R.layout.ics_match);
    
    setTitle("Seek or Challenge");
    
    _editPlayer = (EditText)findViewById(R.id.EditTextMatchOpponent);

      _spinTime = (Spinner) findViewById(R.id.SpinnerMatchTime);
      _adapterTime = ArrayAdapter.createFromResource(context, R.array.match_time_minutes, android.R.layout.simple_spinner_item);
      _adapterTime.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      _spinTime.setAdapter(_adapterTime);
      
      _spinTime.setSelection(5);
      
      _spinIncrement = (Spinner) findViewById(R.id.SpinnerMatchTimeIncrement);
      _adapterIncrement = ArrayAdapter.createFromResource(context, R.array.match_time_increments, android.R.layout.simple_spinner_item);
      _adapterIncrement.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      _spinIncrement.setAdapter(_adapterIncrement);
      
      _spinVariant = (Spinner) findViewById(R.id.SpinnerMatchVariant);
      _adapterVariant = ArrayAdapter.createFromResource(context, R.array.match_variant, android.R.layout.simple_spinner_item);
      _adapterVariant.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      _spinVariant.setAdapter(_adapterVariant);
      
      _checkRated = (CheckBox)findViewById(R.id.CheckBoxSeekRated);
   /*
      _spinRated = (Spinner) findViewById(R.id.SpinnerMatchRate);
      _adapterRated = ArrayAdapter.createFromResource(context, R.array.match_rated, android.R.layout.simple_spinner_item);
      _adapterRated.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      _spinRated.setAdapter(_adapterRated);
*/
      _butOk = (Button)findViewById(R.id.ButtonMatchOk);
      _butOk.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        ICSMatchDlg.this.dismiss();
        String s = "", sP = _editPlayer.getText().toString();
        if(sP.equals("*")){
          s = "seek " + (_checkRated.isChecked() ? "rated" : "unrated") + " " +
          (String)_spinTime.getSelectedItem() + " " +
          (String)_spinIncrement.getSelectedItem()
          ;
          
        } else {
          s = "match " + 
          sP + " " + (_checkRated.isChecked() ? "rated" : "unrated") + " " +  
          (String)_spinTime.getSelectedItem() + " " + 
          (String)_spinIncrement.getSelectedItem();
        }
        // wild fr
        if(((String)_spinVariant.getSelectedItem()).equals("Standard")){
          
        } else {
          s += " wild fr";
        }
        Log.i("ICSMatchDlg", s);
        _parent.sendString(s);
        Toast.makeText(_parent, "Challenge posted", Toast.LENGTH_SHORT).show();
      }
        });
      _butCancel = (Button)findViewById(R.id.ButtonMatchCancel);
      _butCancel.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        ICSMatchDlg.this.dismiss();
      }
        });
  }

  public void setPlayer(String s){
    _editPlayer.setText(s);
  }
  
}




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