Android Open Source - yahtzee4android Yahtzee Activity






From Project

Back to project page yahtzee4android.

License

The source code is released under:

GNU General Public License

If you think the Android project yahtzee4android 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 com.tum.yahtzee;
// w  w w. j  a  v a 2 s. co m
import com.tum.yahtzee.R;
import com.tum.yahtzee.services.MessageService;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class YahtzeeActivity extends Activity {
  
  private EditText playerAmountText;
  private EditText roundsText;
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        playerAmountText = (EditText)findViewById(R.id.editText_player);
        roundsText = (EditText)findViewById(R.id.editText_rounds);
    }
    
    public void play(View v)
    {
      String sPlayers = playerAmountText.getText().toString();
      String sRounds = roundsText.getText().toString();
      
      if (sPlayers == null || sPlayers.isEmpty() || Integer.parseInt(sPlayers) == 0 || sRounds == null || sRounds.isEmpty() || Integer.parseInt(sRounds) == 0) {
        MessageService.showMessage(YahtzeeActivity.this, "Impossible", "Amount of Rounds and Players must not be zero.");
      } else {
        GameController.get().newGame(Integer.parseInt(sPlayers), Integer.parseInt(sRounds));
        
        Intent intent = new Intent(YahtzeeActivity.this, GameActivity.class);
        startActivity(intent);
      }
  }
}




Java Source Code List

com.tum.yahtzee.GameActivity.java
com.tum.yahtzee.GameController.java
com.tum.yahtzee.YahtzeeActivity.java
com.tum.yahtzee.listeners.OnCubeClickListener.java
com.tum.yahtzee.moves.ChanceMove.java
com.tum.yahtzee.moves.DummyMove.java
com.tum.yahtzee.moves.FourOfAKindMove.java
com.tum.yahtzee.moves.FullHouseMove.java
com.tum.yahtzee.moves.IBaseMove.java
com.tum.yahtzee.moves.LargeStraightMove.java
com.tum.yahtzee.moves.NumberMove.java
com.tum.yahtzee.moves.SmallStraightMove.java
com.tum.yahtzee.moves.ThreeOfAKindMove.java
com.tum.yahtzee.moves.YahtzeeMove.java
com.tum.yahtzee.services.MessageService.java
com.tum.yahtzee.services.MethodPointer.java
com.tum.yahtzee.units.Cube.java
com.tum.yahtzee.units.Player.java