Android Open Source - Do-not-get-annoyed Finish Field






From Project

Back to project page Do-not-get-annoyed.

License

The source code is released under:

Apache License

If you think the Android project Do-not-get-annoyed 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 mn100013d.pmu.models;
/*from ww w  .j ava  2 s .c  o  m*/
import java.io.Serializable;

import mn100013d.pmu.R;
import android.content.Context;
import android.view.View;

public class FinishField extends Field implements Serializable{
  private int color;
  protected FinishField(Board board, View view, Context context, int color) {
    super(board, view, context);
    this.color = color;
    // TODO Auto-generated constructor stub
  }

  @Override
  protected int getInitialStateImageId(int color) {
    switch (color){
    case Color.BLUE: return R.drawable.blue_finish;
    case Color.RED: return R.drawable.red_finish;
    case Color.YELLOW: return R.drawable.yellow_finish;
    case Color.GREEN: return R.drawable.green_finish;
    default: return -1;
    }
  }

  @Override
  protected int getHighlightedStateImageId(int color) {
    return R.drawable.white_board_field_highlighted;
  }

  @Override
  protected int getOccupiedStateImageId(int color) {
    switch (color){
    case Color.BLUE: return R.drawable.blue_finish_occupied;
    case Color.RED: return R.drawable.red_finish_occupied;
    case Color.YELLOW: return R.drawable.yellow_finish_occupied;
    case Color.GREEN: return R.drawable.green_finish_occupied;
    default: return -1;
    }
  } 

  @Override
  protected int getAttackedStateImageId(int color) {
    // TODO Auto-generated method stub
    return 0;
  }

  @Override
  public void refresh(){
    removeOnClickListener();
    if (onFieldPawn == null){
      setState(Field.INITIAL_STATE, color);
    }
    else{
      setState(Field.OCCUPIED, onFieldPawn.getColor());
  
    }
  }
  
  

}




Java Source Code List

mn100013d.pmu.BeginingActivity.java
mn100013d.pmu.GameTypeFragment.java
mn100013d.pmu.NewGameActivity.java
mn100013d.pmu.NewGameFragment.java
mn100013d.pmu.PauseFragment.java
mn100013d.pmu.PauseGameFragment.java
mn100013d.pmu.ScoresFragment.java
mn100013d.pmu.SettingsFragment.java
mn100013d.pmu.StartActivity.java
mn100013d.pmu.StartGameFragment.java
mn100013d.pmu.controllers.GameController.java
mn100013d.pmu.data.GameDataDbHelper.java
mn100013d.pmu.data.GameSettingsEditor.java
mn100013d.pmu.data.GameTableContract.java
mn100013d.pmu.exceptions.ContextNotSetException.java
mn100013d.pmu.exceptions.GameExceptions.java
mn100013d.pmu.exceptions.PlayerNotRegisteredException.java
mn100013d.pmu.models.Board.java
mn100013d.pmu.models.CPUGamePlayer.java
mn100013d.pmu.models.Color.java
mn100013d.pmu.models.Dice.java
mn100013d.pmu.models.Field.java
mn100013d.pmu.models.FinishField.java
mn100013d.pmu.models.GamePlayer.java
mn100013d.pmu.models.HomeField.java
mn100013d.pmu.models.HumanGamePlayer.java
mn100013d.pmu.models.PathField.java
mn100013d.pmu.models.Pawn.java
mn100013d.pmu.models.Result.java
mn100013d.pmu.services.FragmentProvider.java
mn100013d.pmu.services.GamePlayerFactory.java
mn100013d.pmu.services.PopupService.java
mn100013d.pmu.services.Randomizer.java
mn100013d.pmu.services.ShakeDetector.java
mn100013d.pmu.services.SoundService.java