diff --git a/app/build.gradle b/app/build.gradle index 13e0014..20447c5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "ca.lakeeffect.scoutingapp" minSdkVersion 14 targetSdkVersion 27 - versionCode 32 - versionName "Deep Space - 2.2.0" + versionCode 33 + versionName "Deep Space - 2.3.0" } buildTypes { release { diff --git a/app/src/main/java/ca/lakeeffect/scoutingapp/Field.java b/app/src/main/java/ca/lakeeffect/scoutingapp/Field.java index ad792de..4dfbcc6 100644 --- a/app/src/main/java/ca/lakeeffect/scoutingapp/Field.java +++ b/app/src/main/java/ca/lakeeffect/scoutingapp/Field.java @@ -7,6 +7,7 @@ import android.graphics.Paint; import android.graphics.Rect; import android.support.v4.content.res.ResourcesCompat; +import android.util.TypedValue; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -14,6 +15,7 @@ public class Field implements View.OnTouchListener { + FieldUIPage fieldUIPage; SurfaceView surface; Bitmap fieldRed, fieldBlue; @@ -37,14 +39,11 @@ public class Field implements View.OnTouchListener { makeRect(664, 206), makeRect(744, 206), makeRect(824, 206), - makeRect(584, 225), - makeRect(584, 305), + makeRect(584, 267), makeRect(664, 328), makeRect(744, 328), makeRect(824, 328) }; - - //the normal paint for the boxes Paint normal = new Paint(); @@ -62,7 +61,11 @@ public class Field implements View.OnTouchListener { //code in surfacecreated can only be called once boolean alreadyCreated = false; - public Field(SurfaceView s, Bitmap fieldRed, Bitmap fieldBlue) { + Rect backgroundRect; + Paint backgroundPaint; + + public Field(final FieldUIPage fieldUIPage, SurfaceView s, Bitmap fieldRed, Bitmap fieldBlue) { + this.fieldUIPage = fieldUIPage; surface = s; this.fieldRed = fieldRed; this.fieldBlue = fieldBlue; @@ -77,13 +80,26 @@ public Field(SurfaceView s, Bitmap fieldRed, Bitmap fieldBlue) { surface.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { - if(alreadyCreated){ redraw(); return; } alreadyCreated = true; + backgroundRect = new Rect(0, 0, surface.getWidth(), surface.getHeight()); + + //get theme background color + backgroundPaint = new Paint(); + if (fieldUIPage.autoPage) { + TypedValue typedValue = new TypedValue(); + Field.this.fieldUIPage.getContext().getTheme().resolveAttribute(R.attr.colorAuto, typedValue, true); + backgroundPaint.setColor(typedValue.data); + } else { + TypedValue typedValue = new TypedValue(); + Field.this.fieldUIPage.getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, typedValue, true); + backgroundPaint.setColor(typedValue.data); + } + boolean scaleByHeight = false; //scaled with height @@ -144,6 +160,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { } }); + } // called by the FieldUIPage class when the deselect button is hit @@ -256,10 +273,12 @@ public void drawImage(Canvas c, int selected) { field = fieldBlue; } + //clear screen + c.drawRect(backgroundRect, backgroundPaint); + c.drawBitmap(field, 0, 0, null); for (Rect rect : fieldPlacements) { - Rect scaledRect = scaleRect(rect, c); if(java.util.Arrays.asList(fieldPlacements).indexOf(rect) == selected){ @@ -267,8 +286,6 @@ public void drawImage(Canvas c, int selected) { }else { c.drawRect(scaledRect.left, scaledRect.top, scaledRect.right, scaledRect.bottom, normal); } - - } } diff --git a/app/src/main/java/ca/lakeeffect/scoutingapp/FieldUIPage.java b/app/src/main/java/ca/lakeeffect/scoutingapp/FieldUIPage.java index 082ed5e..4fc1e43 100644 --- a/app/src/main/java/ca/lakeeffect/scoutingapp/FieldUIPage.java +++ b/app/src/main/java/ca/lakeeffect/scoutingapp/FieldUIPage.java @@ -73,7 +73,7 @@ public View onCreateView(LayoutInflater inflator, ViewGroup container, Bundle sa surface = view.findViewById(R.id.fieldCanvas); Bitmap fieldRed = BitmapFactory.decodeResource(getResources(), R.drawable.fieldred); Bitmap fieldBlue = BitmapFactory.decodeResource(getResources(), R.drawable.fieldblue); - field = new Field(surface, fieldRed, fieldBlue); + field = new Field(this, surface, fieldRed, fieldBlue); surface.setOnTouchListener(field); pickupHatch = view.findViewById(R.id.pickupHatch); @@ -117,9 +117,8 @@ public void onClick(final View v) { } else if (autoPage && System.currentTimeMillis() - firstPress > 15000 && v != undo) { //it has been 15 seconds, they should be done auto by now new AlertDialog.Builder(getContext()) - .setTitle("YOU ARE ON THE SANDSTORM PAGE! It has been 15 seconds since your last press! " + - "SANDSTORM should be done by now!") - .setMessage("Are you sure you would like to put an event?") + .setTitle("YOU ARE ON THE SANDSTORM PAGE! It has been 15 seconds since your last press!") + .setMessage("Are you sure you would like to put an event? SANDSTORM should be done by now!") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { firstPress = -1; @@ -266,8 +265,8 @@ public String[] getData() { int[] closeRocket = new int[4]; int[] fullRocket = new int[4]; - int[] cargoShipLocations = {12, 13, 14, 15, 16, 17, 18, 19}; - int[] sideCargoShipLocations = {12, 13, 14, 17, 18, 19}; + int[] cargoShipLocations = {12, 13, 14, 15, 16, 17, 18}; + int[] sideCargoShipLocations = {12, 13, 14, 16, 17, 18}; int[] levelOneRocketLocations = {4, 5, 10, 11}; int[] levelTwoRocketLocations = {2, 3, 8, 9}; int[] levelThreeRocketLocations = {0, 1, 6, 7}; diff --git a/app/src/main/java/ca/lakeeffect/scoutingapp/MainActivity.java b/app/src/main/java/ca/lakeeffect/scoutingapp/MainActivity.java index 1abfedd..2737bad 100644 --- a/app/src/main/java/ca/lakeeffect/scoutingapp/MainActivity.java +++ b/app/src/main/java/ca/lakeeffect/scoutingapp/MainActivity.java @@ -56,8 +56,6 @@ public class MainActivity extends AppCompatActivity { - //TODO: Redo text sizes - List counters = new ArrayList<>(); List checkboxes = new ArrayList<>(); List radiogroups = new ArrayList<>(); @@ -373,6 +371,16 @@ public void run() { return null; } + //if the confidence rating is visible and it is <= 0 + if (((RatingBar) pagerAdapter.postgamePage.getView().findViewById(R.id.dataConfidence)).getRating() <= 0) { + runOnUiThread(new Thread() { + public void run() { + new Toast(MainActivity.this).makeText(MainActivity.this, "You didn't rate the confidence in your data!", Toast.LENGTH_LONG).show(); + } + }); + return null; + } + if (((Spinner) pagerAdapter.pregamePage.getView().findViewById(R.id.autoStartLocation)).getSelectedItem().toString().equals("Choose One")) { runOnUiThread(new Thread() { public void run() { diff --git a/app/src/main/res/layout-sw600dp/postgame_page.xml b/app/src/main/res/layout-sw600dp/postgame_page.xml index 52c58b1..8a02887 100644 --- a/app/src/main/res/layout-sw600dp/postgame_page.xml +++ b/app/src/main/res/layout-sw600dp/postgame_page.xml @@ -13,7 +13,7 @@ android:layout_height="wrap_content" android:id="@+id/endgameTableLayout" android:layout_margin="10dp" - android:rowCount="3" + android:rowCount="5" android:columnCount="5"> + android:textSize="@dimen/text_large"/> @@ -62,6 +62,42 @@ android:layout_column="1" android:layout_columnSpan="4"/> + + + + + + + + + + diff --git a/app/src/main/res/layout-sw600dp/qualitative_page.xml b/app/src/main/res/layout-sw600dp/qualitative_page.xml index 3185c99..f66c477 100644 --- a/app/src/main/res/layout-sw600dp/qualitative_page.xml +++ b/app/src/main/res/layout-sw600dp/qualitative_page.xml @@ -67,7 +67,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/driveRating" - android:numStars="4" + android:numStars="5" android:stepSize="0.5" android:isIndicator="false"/> @@ -91,7 +91,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/intakeRating" - android:numStars="4" + android:numStars="5" android:stepSize="0.5" android:isIndicator="false"/> @@ -116,7 +116,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/defenceRating" - android:numStars="4" + android:numStars="5" android:stepSize="0.5" android:isIndicator="false"/> diff --git a/app/src/main/res/layout/postgame_page.xml b/app/src/main/res/layout/postgame_page.xml index b12b2d9..59518af 100644 --- a/app/src/main/res/layout/postgame_page.xml +++ b/app/src/main/res/layout/postgame_page.xml @@ -13,7 +13,7 @@ android:layout_height="wrap_content" android:id="@+id/endgameTableLayout" android:layout_margin="10dp" - android:rowCount="3" + android:rowCount="5" android:columnCount="5"> + + + + + + + + + + diff --git a/app/src/main/res/layout/qualitative_page.xml b/app/src/main/res/layout/qualitative_page.xml index ff00521..82775b4 100644 --- a/app/src/main/res/layout/qualitative_page.xml +++ b/app/src/main/res/layout/qualitative_page.xml @@ -67,7 +67,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/driveRating" - android:numStars="4" + android:numStars="5" android:stepSize="0.5" android:isIndicator="false"/> @@ -91,7 +91,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/intakeRating" - android:numStars="4" + android:numStars="5" android:stepSize="0.5" android:isIndicator="false"/> @@ -116,7 +116,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/defenceRating" - android:numStars="4" + android:numStars="5" android:stepSize="0.5" android:isIndicator="false"/>