diff --git a/app/src/org/runnerup/view/RunActivity.java b/app/src/org/runnerup/view/RunActivity.java index 1d0b519b8..79d666193 100644 --- a/app/src/org/runnerup/view/RunActivity.java +++ b/app/src/org/runnerup/view/RunActivity.java @@ -519,7 +519,7 @@ private View getWorkoutRow(org.runnerup.workout.Step step, int level, View conve durationValue.setText(""); } if (currentStep == step) { - view.setBackgroundResource(android.R.color.background_light); + //view.setBackgroundResource(android.R.color.background_light); } else { view.setBackgroundResource(android.R.color.black); } @@ -538,9 +538,8 @@ private View getWorkoutRow(org.runnerup.workout.Step step, int level, View conve formatter.format(Formatter.Format.TXT_SHORT, step.getTargetType(), maxValue)); } } - - if (step.getRepeatCount() > 0) { - if (step.getCurrentRepeat() == step.getRepeatCount()) { + if (step.getIntensity() == Intensity.REPEAT){ + if (step.getCurrentRepeat() >= step.getRepeatCount()) { durationValue.setText(getString(R.string.Finished)); } else { durationValue.setText("" + (step.getCurrentRepeat() + 1) + "/" diff --git a/app/src/org/runnerup/workout/RepeatStep.java b/app/src/org/runnerup/workout/RepeatStep.java index 38a2c44b7..e2f97b07d 100644 --- a/app/src/org/runnerup/workout/RepeatStep.java +++ b/app/src/org/runnerup/workout/RepeatStep.java @@ -27,7 +27,7 @@ @TargetApi(Build.VERSION_CODES.FROYO) public class RepeatStep extends Step { - int repeatCount = 1; + int repeatCount = 0; public ArrayList getSteps() { return steps; @@ -105,20 +105,17 @@ public void onPause(Workout s) { @Override public boolean onTick(Workout w) { - if (steps.get(currentStep).onTick(w)) { - return true; - } - return false; + return currentRepeat >= repeatCount || steps.get(currentStep).onTick(w); } @Override public boolean onNextStep(Workout w) { if (steps.get(currentStep).onNextStep(w)) { currentStep++; - if (currentStep == steps.size()) { + if (currentStep >= steps.size()) { currentStep = 0; currentRepeat++; - if (currentRepeat == repeatCount) { + if (currentRepeat >= repeatCount) { return true; } for (Step s : steps) { @@ -188,10 +185,10 @@ public Step getCurrentStep() { @Override public boolean isLastStep() { + if (currentRepeat >= repeatCount) + return true; if (currentStep + 1 < steps.size()) return false; - if (currentRepeat < repeatCount) - return false; return steps.get(currentStep).isLastStep(); } diff --git a/app/src/org/runnerup/workout/Workout.java b/app/src/org/runnerup/workout/Workout.java index eed04f3c2..c7e238d83 100644 --- a/app/src/org/runnerup/workout/Workout.java +++ b/app/src/org/runnerup/workout/Workout.java @@ -309,7 +309,7 @@ public double getDistance(Scope scope) { case LAP: if (currentStep != null) return currentStep.getDistance(this, scope); - if (BuildConfig.DEBUG) { throw new AssertionError(); } + //if (BuildConfig.DEBUG) { throw new AssertionError(); } break; case CURRENT: break; @@ -326,7 +326,7 @@ public double getTime(Scope scope) { case LAP: if (currentStep != null) return currentStep.getTime(this, scope); - if (BuildConfig.DEBUG) { throw new AssertionError(); } + //if (BuildConfig.DEBUG) { throw new AssertionError(); } break; case CURRENT: return System.currentTimeMillis() / 1000; // now @@ -442,6 +442,7 @@ public double getCadence(Scope scope) { double t = getTime(scope); // in seconds double b = -1; //TODO get steps for scope + //TODO if (BuildConfig.DEBUG) { throw new AssertionError(); } if (t != 0) { return (60 * b)/ 2 / t; // bpm @@ -501,8 +502,8 @@ public int getSport() { @Override public Intensity getIntensity() { - if (currentStep == null) - return Intensity.ACTIVE; // needed ?? + if (currentStep == null || currentStep.getCurrentStep() == null) + return Intensity.ACTIVE; //No next step, assertion return currentStep.getCurrentStep().getIntensity(); } @@ -553,9 +554,9 @@ void saveLap(ContentValues tmp, boolean next) { } } - public int getStepCount() { - return steps.size(); - } + //public int getStepCount() { + // return steps.size(); + //} public boolean isLastStep() { if (currentStepNo + 1 < steps.size())