Exemplo n.º 1
0
  /**
   * ごちそうさまボタンタップ時のイベント処理
   *
   * @param view
   */
  public void onEndButtonTapped(View view) {
    // タイマーをとめる
    mEatingTimer.cancel();
    mEatingTimer = null;

    // 次画面へ遷移
    Intent intent = new Intent(this, FinishMealActivity.class);
    intent.putExtra("MESSAGE", R.string.message_succeed);
    startActivity(intent);
  }
Exemplo n.º 2
0
  /** アクティビティ終了 */
  @Override
  public void finish() {
    super.finish();

    if (mEatingTimer != null) {
      mEatingTimer.cancel();
      mEatingTimer = null;
    }
    player.unloadSounds();
  }
Exemplo n.º 3
0
  /**
   * いただきますボタンタップ時のイベント処理
   *
   * @param view
   */
  public void onStartButtonTapped(View view) {
    // いただきますタップ禁止
    Button btnS = (Button) this.findViewById(R.id.btnStart);
    btnS.setEnabled(false);
    // ごちそうさまタップ可能
    Button btnE = (Button) this.findViewById(R.id.btnEnd);
    btnE.setEnabled(true);

    // 入力時間とTicker設定(デフォルト30秒・5秒おき)
    int seconds = 30 * 1000;
    int tickTime = 5000;
    CheckBox checkBox = (CheckBox) findViewById(R.id.chkDebug);
    if (!checkBox.isChecked()) {
      // Debugオフの場合は設定した時間
      seconds = (mTimePicker.getValue() + 1) * 5 * 60 * 1000;
      // ごはん画像の数にあわせてTickerを計算
      tickTime = seconds / foods.size() - 1000;
    }

    // タイマー開始
    mEatingTimer = new EatingCountDownTimer(seconds, tickTime, this);
    mEatingTimer.start();
  }