private void resetValues(boolean updateDisplay) {
    if (mService != null && mIsRunning) {
      mService.resetValues();
    } else {
      mStepValueView.setText("0");
      mChildStepCountView.setText("0");
      mChildCoinView.setText("0");
      mParentCoinView.setText("0");
      ;
      // mPaceValueView.setText("0");
      // mDistanceValueView.setText("0");
      // mSpeedValueView.setText("0");
      // mCaloriesValueView.setText("0");

      if (updateDisplay) {
        stateEditor.putInt("steps", 0);
        stateEditor.putInt("pace", 0);
        stateEditor.putFloat("distance", 0);
        stateEditor.putFloat("speed", 0);
        stateEditor.putFloat("calories", 0);

        stateEditor.putInt("parentStepCountKey", 0);
        stateEditor.putInt("parentCoinsKey", 0);
        stateEditor.putInt("childStepCountKey", 0);
        stateEditor.putInt("childCoinsKey", 0);
        stateEditor.commit();
      }
    }
  }
  private void resetValues(boolean updateDisplay) {
    if (mService != null && mIsRunning) {
      mService.resetValues();

    } else {
      TextView timer = (TextView) findViewById(R.id.textView);
      // timer.setText("00:00");
      finalTime = 0;
      timeSwap = 0;
      timeInMillies = 0;
      mStepValueView.setText("0");
      mPaceValueView.setText("0");
      mDistanceValueView.setText("0");
      mSpeedValueView.setText("0");
      mCaloriesValueView.setText("0");
      mTimeValueView.setText("00:00");
      SharedPreferences state = getSharedPreferences("state", 0);
      SharedPreferences.Editor stateEditor = state.edit();
      if (updateDisplay) {
        stateEditor.putInt("steps", 0);
        stateEditor.putInt("pace", 0);
        stateEditor.putFloat("distance", 0);
        stateEditor.putFloat("speed", 0);
        stateEditor.putFloat("calories", 0);
        stateEditor.putLong("time", 0);
        stateEditor.commit();
      }
    }
    Toast.makeText(getApplicationContext(), "Pedometer Reset!", Toast.LENGTH_LONG).show();
  }
Beispiel #3
0
 private void resetValues(boolean updateDisplay) {
   if (mService != null && mIsRunning) {
     mService.resetValues();
   } else {
     mStepValueView.setText("0");
     mPaceValueView.setText("0");
     mDistanceValueView.setText("0");
     mSpeedValueView.setText("0");
     mCaloriesValueView.setText("0");
     SharedPreferences state = getSharedPreferences("state", 0);
     SharedPreferences.Editor stateEditor = state.edit();
     if (updateDisplay) {
       stateEditor.putInt("steps", 0);
       stateEditor.putInt("pace", 0);
       stateEditor.putFloat("distance", 0);
       stateEditor.putFloat("speed", 0);
       stateEditor.putFloat("calories", 0);
       stateEditor.commit();
     }
   }
 }