de.palmmedia.yahtzee
Class Program

java.lang.Object
  extended by Activity
      extended by de.palmmedia.yahtzee.Program

public class Program
extends Activity

The activity where players can be created and the game can be started.

Author:
Daniel Palme

Nested Class Summary
private  class Program.PlayerCheckBoxListener
          Executed when the checkbox related to a player is activated.
 
Field Summary
private  TextWatcher textWatcher
          Executed when the text of a textbox containing a player's name is changed.
private  OnClickListener toggleSoundListener
          Executed when sound is activated/deactivated.
 
Constructor Summary
Program()
           
 
Method Summary
private  void enableNewGameButton()
          Activates/Deactivates the 'New Game' button.
private  List<Player> getPlayers()
          Get the players.
private  void initName(Player player, int playerCheckBoxId, int playerEditTextId)
          Initializes the player's view elements.
private  void loadPlayers()
          Load the saved players.
 void newGame(View view)
          Starts a new game.
 void onCreate(Bundle savedInstanceState)
          
protected  void onResume()
          
 void resumeGame(View view)
          Resumes the current game.
private  void savePlayers()
          Saved the current player.
 void showHighscores(View view)
          Shows the highscores.
private  void showResumeButton()
          Shows/Hides the 'Resume' button.
 void toggleSound(View view)
          Executed when sound is activated/deactivated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textWatcher

private TextWatcher textWatcher
Executed when the text of a textbox containing a player's name is changed.


toggleSoundListener

private OnClickListener toggleSoundListener
Executed when sound is activated/deactivated.

Constructor Detail

Program

public Program()
Method Detail

onCreate

public void onCreate(Bundle savedInstanceState)


onResume

protected void onResume()


toggleSound

public void toggleSound(View view)
Executed when sound is activated/deactivated.


newGame

public void newGame(View view)
Starts a new game.

Parameters:
view - The view.

resumeGame

public void resumeGame(View view)
Resumes the current game.

Parameters:
view - The view.

showHighscores

public void showHighscores(View view)
Shows the highscores.

Parameters:
view - The view.

loadPlayers

private void loadPlayers()
Load the saved players.


initName

private void initName(Player player,
                      int playerCheckBoxId,
                      int playerEditTextId)
Initializes the player's view elements.

Parameters:
player - The player.
playerCheckBoxId - The id of the player's checkbox.
playerEditTextId - The id of the player's textbox.

savePlayers

private void savePlayers()
Saved the current player.


enableNewGameButton

private void enableNewGameButton()
Activates/Deactivates the 'New Game' button.


showResumeButton

private void showResumeButton()
Shows/Hides the 'Resume' button.


getPlayers

private List<Player> getPlayers()
Get the players.

Returns:
The players.