added exercise rep increment to input processor
This commit is contained in:
@@ -90,9 +90,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
|
|
||||||
progressCircle = findViewById(R.id.progressCircle);
|
progressCircle = findViewById(R.id.progressCircle);
|
||||||
progressText = findViewById(R.id.progressText);
|
progressText = findViewById(R.id.progressText);
|
||||||
|
|
||||||
progressCircle.setMax(maxProgress);
|
progressCircle.setMax(maxProgress);
|
||||||
updateProgress();
|
|
||||||
|
|
||||||
// Set color of loading circle
|
// Set color of loading circle
|
||||||
ProgressBar loadingCircle = findViewById(R.id.loadingCircle);
|
ProgressBar loadingCircle = findViewById(R.id.loadingCircle);
|
||||||
@@ -266,7 +264,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementProgress(View view) {
|
public void incrementProgress() {
|
||||||
if (progress < maxProgress) {
|
if (progress < maxProgress) {
|
||||||
progress++;
|
progress++;
|
||||||
triggerColorBurst(true);
|
triggerColorBurst(true);
|
||||||
@@ -279,7 +277,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
progressText.setText(progress + "/" + maxProgress);
|
progressText.setText(progress + "/" + maxProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void triggerColorBurst(boolean isGoodRep) {
|
public void triggerColorBurst(boolean isGoodRep) {
|
||||||
|
|
||||||
if (isGoodRep) {
|
if (isGoodRep) {
|
||||||
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_good));
|
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_good));
|
||||||
|
@@ -130,15 +130,14 @@ public class InputProcessor {
|
|||||||
*/
|
*/
|
||||||
public void onAdequateRepetition() {
|
public void onAdequateRepetition() {
|
||||||
ExerciseManager.TOTAL_REPETITIONS_PERFORMED++;
|
ExerciseManager.TOTAL_REPETITIONS_PERFORMED++;
|
||||||
// TODO: Add animation for correct repetition
|
new FitnessActivity().incrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that is called whenever the user performs a bad repetition.
|
* Method that is called whenever the user performs a bad repetition.
|
||||||
*/
|
*/
|
||||||
public void onInadequateRepetition() {
|
public void onInadequateRepetition() {
|
||||||
|
new FitnessActivity().triggerColorBurst(false);
|
||||||
// TODO: Add animation for wrong repetition
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -77,7 +77,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:text="@string/title"
|
android:text="@string/exerciseTitle"
|
||||||
android:textAlignment="center" />
|
android:textAlignment="center" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -93,20 +93,11 @@
|
|||||||
style="@style/TextStyleDesc"
|
style="@style/TextStyleDesc"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:text="@string/context"
|
android:text="@string/exerciseDesc"
|
||||||
android:textAlignment="center" />
|
android:textAlignment="center" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/progressText"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:onClick="incrementProgress"
|
|
||||||
android:text="Increment" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -123,7 +114,7 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:indeterminate="false"
|
android:indeterminate="false"
|
||||||
android:max="10"
|
android:max="10"
|
||||||
android:progress="10"
|
android:progress="0"
|
||||||
android:progressDrawable="@drawable/progress_circle" />
|
android:progressDrawable="@drawable/progress_circle" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@@ -24,8 +24,8 @@
|
|||||||
<string name="score">Score:</string>
|
<string name="score">Score:</string>
|
||||||
|
|
||||||
<string name="title">Title</string>
|
<string name="title">Title</string>
|
||||||
<string name="context">ContextContextContext</string>
|
|
||||||
|
|
||||||
|
<string name="exerciseDesc">Exercise description</string>
|
||||||
<string name="description">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</string>
|
<string name="description">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</string>
|
||||||
<string name="descriptionTitle">Description</string>
|
<string name="exerciseTitle">Exercise title</string>
|
||||||
</resources>
|
</resources>
|
Reference in New Issue
Block a user