Skip to content

Commit

Permalink
Merge pull request #258 from ajayyy/improvements
Browse files Browse the repository at this point in the history
Fixed tablet crash and made sure the user did not forget to mark the starting object.
  • Loading branch information
ajayyy authored Mar 7, 2019
2 parents b3f7a7f + 511b47d commit 59b3ab5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
24 changes: 23 additions & 1 deletion app/src/main/java/ca/lakeeffect/scoutingapp/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public class MainActivity extends AppCompatActivity {
//if the schedule has been overridden
boolean overrideSchedule;

//if the scout has confirmed that the robot has no starting object
boolean noStartingObject;

@Override
protected void onCreate(Bundle savedInstanceState) {

Expand Down Expand Up @@ -399,6 +402,24 @@ public void run() {
return null;
}

//check if the robot is starting with hatch or cargo
if (!noStartingObject && !((CheckBox) pagerAdapter.pregamePage.getView().findViewById(R.id.startingObjectsHatch)).isChecked()
&& !((CheckBox) pagerAdapter.pregamePage.getView().findViewById(R.id.startingObjectsCargo)).isChecked()) {
//double check the user meant this
new AlertDialog.Builder(MainActivity.this)
.setTitle("No starting Object?")
.setMessage("Are you sure the robot started with no object?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
noStartingObject = true;
pagerAdapter.qualitativePage.getView().findViewById(R.id.submit).performClick();
}
})
.setNegativeButton("No, let me go change that", null)
.create()
.show();
return null;
}
}

data = new StringBuilder();
Expand Down Expand Up @@ -796,7 +817,6 @@ public void reset(boolean incrementMatchNumber) {
//setup scrolling viewpager
alert(incrementMatchNumber);


viewPager.setAdapter(pagerAdapter);

PercentRelativeLayout layout;
Expand All @@ -815,6 +835,8 @@ public void reset(boolean incrementMatchNumber) {
//Qualitative page
layout = pagerAdapter.qualitativePage.getView().findViewById(R.id.qualitativePageLayout);
clearData(layout);

noStartingObject = false;
}

public void clearData(ViewGroup top) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout-sw600dp/field_ui_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
android:layout_height="match_parent"
android:text="Failed dropoff"
android:layout_weight="1"
android:id="@+id/failedDropHatch"
android:id="@+id/failDropHatch"
android:textSize="@dimen/text_small"
android:backgroundTint="#ffff84"
android:textColor="@color/black"/>
Expand Down Expand Up @@ -133,7 +133,7 @@
android:layout_height="match_parent"
android:text="Failed dropoff"
android:layout_weight="1"
android:id="@+id/failedDropCargo"
android:id="@+id/failDropCargo"
android:backgroundTint="#ffd38e"
android:textSize="@dimen/text_small"
android:textColor="@color/black"/>
Expand Down
1 change: 1 addition & 0 deletions python parsing/add all robots together.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def getdataforfile(filename, index, robotnumber):

files.remove("results")
files.remove("EventData")
files.remove("AutoEventData")

for i in range(len(files)):
getdataforfile(foldername + files[i], i, files[i])
Expand Down

0 comments on commit 59b3ab5

Please sign in to comment.