Skip to content

Commit 09ae313

Browse files
committed
Added auto incrementing match number.
Each time data is submitted, the match number goes up by 1. Resolves #140
1 parent b5546a4 commit 09ae313

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

app/src/main/java/ca/lakeeffect/scoutingapp/MainActivity.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected void onCreate(Bundle savedInstanceState) {
145145
matchesLeftText = findViewById(R.id.matchesLeft);
146146

147147
//call alert (asking scout name and robot number)
148-
alert();
148+
alert(false);
149149

150150
//add all buttons and counters etc.
151151

@@ -737,7 +737,7 @@ public boolean onMenuItemClick(MenuItem item) {
737737
.setMessage("Continuing will reset current data.")
738738
.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
739739
public void onClick(DialogInterface dialog, int which) {
740-
reset();
740+
reset(false);
741741

742742
}
743743
})
@@ -746,7 +746,7 @@ public void onClick(DialogInterface dialog, int which) {
746746
.show();
747747
}
748748
if (item.getItemId() == R.id.changeNum) {
749-
alert();
749+
alert(false);
750750
}
751751
if (item.getItemId() == R.id.resetPendingMessages) {
752752
for(int i = 0; i< pendingMessages.size(); i++){
@@ -799,9 +799,9 @@ public void onClick(DialogInterface dialog, int which) {
799799
return;
800800
}
801801

802-
public void reset() {
802+
public void reset(boolean incrementMatchNumber) {
803803
//setup scrolling viewpager
804-
alert();
804+
alert(incrementMatchNumber);
805805

806806

807807
viewPager.setAdapter(pagerAdapter);
@@ -849,7 +849,7 @@ public void clearData(ViewGroup top) {
849849
}
850850
}
851851

852-
public void alert() {
852+
public void alert(final boolean incrementMatchNumber) {
853853
AlertDialog dialog = new AlertDialog.Builder(this)
854854
.setView(R.layout.dialog)
855855
.setTitle("Enter Info")
@@ -935,6 +935,10 @@ public void afterTextChanged(Editable editable) {
935935
}
936936
});
937937

938+
if (incrementMatchNumber) {
939+
((EditText) linearLayout.findViewById(R.id.matchNumber)).setText(matchNumber + 1 + "");
940+
}
941+
938942
overriddenScoutName = new EditText(MainActivity.this);
939943
overriddenScoutName.setHint("Scout Name");
940944

app/src/main/java/ca/lakeeffect/scoutingapp/QualitativePage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ public void onClick(DialogInterface dialog, int which) {
8282
//Save the data
8383
if (((MainActivity) getActivity()).saveData()) {
8484
Toast.makeText(getActivity(),
85-
"Saving", Toast.LENGTH_LONG).show();
85+
"Saved", Toast.LENGTH_LONG).show();
8686
//Reset the inputs
87-
((MainActivity) getActivity()).reset();
87+
((MainActivity) getActivity()).reset(true);
8888
}
8989

9090
}

0 commit comments

Comments
 (0)