コード例 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_race_main);
    //        getActionBar().setDisplayHomeAsUpEnabled(true);

    // default settings
    Utilities.PopulateAppSettings(getApplicationContext());
    // get Extras

    Intent intent = getIntent();
    isAlone = intent.getBooleanExtra("alone", false);
    raceId = intent.getIntExtra("raceid", IDNOTSET);
    selectedUsers = intent.getParcelableArrayListExtra("users");

    // init state
    if (isAlone) {
      raceState = new AloneRace();
    } else {
      raceState = new WithFriendsRace();
    }

    // set preferences:
    SharedPreferences prefs =
        PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    Editor editor = prefs.edit();
    editor.putString("time_before_logging", "15");

    editor.commit();

    AppSettings.setMinimumSeconds(15);

    // start service if not started and bind
    StartAndBindService();

    // define the order of colors
    colors = new ArrayList<Integer>();
    colors.add(Color.CYAN);
    colors.add(Color.BLUE);
    colors.add(Color.GREEN);
    colors.add(Color.MAGENTA);
    colors.add(Color.RED);

    initDrawings();
    drawCircle();
    refreshPaint();
  }