From 65f3964efb2882fd1ba56b90b98aa795281611fc Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Fri, 21 Aug 2026 17:03:47 -0700 Subject: [PATCH 1/3] initial save --- .../main/assets/input_data/ClimbLevels.csv | 4 + .../main/assets/input_data/ClimbPositions.csv | 7 ++ .../scouting_app/activities/AppLaunch.java | 18 ++-- .../scouting_app/activities/PostMatch.java | 26 ++--- .../scouting_app/config/Constants.java | 9 +- .../team3663/scouting_app/config/Globals.java | 10 +- .../scouting_app/data/ClimbLevel.java | 75 ------------- .../scouting_app/data/ClimbPosition.java | 80 -------------- .../utility/dataFile/ClimbLevelFile.java | 101 ++++++++++++++++++ .../utility/dataFile/ClimbPositionFile.java | 95 ++++++++++++++++ .../utility/dataFile/ColorsFile.java | 6 +- .../utility/dataFile/CommentsFile.java | 4 +- .../utility/dataFile/CompetitionsFile.java | 4 +- .../utility/dataFile/DevicesFile.java | 2 +- .../utility/dataFile/EventGroupsFile.java | 4 +- .../utility/dataFile/EventsFile.java | 6 +- .../utility/dataFile/MatchTypesFile.java | 2 +- .../utility/dataFile/MatchesFile.java | 4 +- .../utility/dataFile/TeamsFile.java | 2 +- .../utility/dataFile/_DataFile.java | 13 ++- app/src/main/res/values/datafiles.xml | 2 + .../main/res/values/strings_app_launch.xml | 34 +++--- 22 files changed, 277 insertions(+), 231 deletions(-) create mode 100644 app/src/main/assets/input_data/ClimbLevels.csv create mode 100644 app/src/main/assets/input_data/ClimbPositions.csv delete mode 100644 app/src/main/java/com/team3663/scouting_app/data/ClimbLevel.java delete mode 100644 app/src/main/java/com/team3663/scouting_app/data/ClimbPosition.java create mode 100644 app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbLevelFile.java create mode 100644 app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbPositionFile.java diff --git a/app/src/main/assets/input_data/ClimbLevels.csv b/app/src/main/assets/input_data/ClimbLevels.csv new file mode 100644 index 00000000..320a7e33 --- /dev/null +++ b/app/src/main/assets/input_data/ClimbLevels.csv @@ -0,0 +1,4 @@ +Id,Description +1,L3 +2,L2 +3,L1 \ No newline at end of file diff --git a/app/src/main/assets/input_data/ClimbPositions.csv b/app/src/main/assets/input_data/ClimbPositions.csv new file mode 100644 index 00000000..1451ac83 --- /dev/null +++ b/app/src/main/assets/input_data/ClimbPositions.csv @@ -0,0 +1,7 @@ +Id,Description +1,Left End +2,Left Upright +3,Center +4,Right End +5,Right Upright +6,Back \ No newline at end of file diff --git a/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java b/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java index dfca5d3c..a9ee74c1 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java @@ -148,7 +148,7 @@ protected void onCreate(Bundle in_savedInstanceState) { // Output: void // ============================================================================================= private void initSettings() { - // Define a Image Button to open up the Settings + // Define an Image Button to open up the Settings appLaunchBinding.imgButSettings.setImageResource(R.drawable.settings_icon); appLaunchBinding.imgButSettings.setVisibility(View.INVISIBLE); appLaunchBinding.imgButSettings.setClickable(false); @@ -231,7 +231,7 @@ private void initDataFiles() { Globals.output_df = Globals.base_df.createDirectory(Constants.Data.PUBLIC_OUTPUT_DIR); } } else { - // The base dir is there but we should check the two sub directories are there. + // The base dir is there, but we should check the two subdirectories are there. Globals.input_df = Globals.base_df.findFile(Constants.Data.PUBLIC_INPUT_DIR); if (Globals.input_df == null) Globals.input_df = Globals.base_df.createDirectory(Constants.Data.PUBLIC_INPUT_DIR); @@ -241,6 +241,8 @@ private void initDataFiles() { } // Instantiate the Global variables or reset their context + if (Globals.ClimbLevelList == null) Globals.ClimbLevelList = new ClimbLevelFile(this); else Globals.ClimbLevelList.setContext(this); + if (Globals.ClimbPositionList == null) Globals.ClimbPositionList = new ClimbPositionFile(this); else Globals.ClimbPositionList.setContext(this); if (Globals.ColorList == null) Globals.ColorList = new ColorsFile(this); else Globals.ColorList.setContext(this); if (Globals.CommentList == null) Globals.CommentList = new CommentsFile(this); else Globals.CommentList.setContext(this); if (Globals.CompetitionList == null) Globals.CompetitionList = new CompetitionsFile(this); else Globals.CompetitionList.setContext(this); @@ -269,21 +271,21 @@ private void loadDataFiles() { public void run() { appLaunchBinding.progressBarOverall.setMax(Globals.CompetitionList.getNumberOfFiles()); appLaunchBinding.progressBarOverall.setProgress(0); - appLaunchBinding.textStatusOverall.setText(getString(R.string.applaunch_loading)); + appLaunchBinding.textStatusOverall.setText(getString(R.string.applaunch_loading_prefix)); appLaunchBinding.textPercentOverall.setText(getString(R.string.applaunch_percent, 0)); - // Load all of the data with a BRIEF delay between. :) + // Load all the data with a BRIEF delay between. :) _DataFile.LoadAllDataFiles(appLaunchBinding.textStatusFile, appLaunchBinding.progressBarFile, appLaunchBinding.textPercentFile, appLaunchBinding.progressBarOverall, appLaunchBinding.textPercentOverall); - // After loading all of the data, we need to build the set of "next events" + // After loading all the data, we need to build the set of "next events" Globals.EventList.buildNextEvents(); // Setting the Visibility attribute can't be set from a non-UI thread (like withing a TimerTask - // that runs on a separate thread. So we need to make a Runner that will execute on the UI thread + // that runs on a separate thread). So we need to make a Runner that will execute on the UI thread // to set these. AppLaunch.this.runOnUiThread(() -> { - // Sleep a tiny bit to help the UI not glitch (otherwise this block of code doesn't - // do what it's trying to do (things don't become visible, etc). + // Sleep a tiny bit to help the UI not glitch. Otherwise, this block of code doesn't + // do what it's trying to do (things don't become visible, etc.). try { Thread.sleep(Constants.AppLaunch.SPLASH_SCREEN_DELAY); } diff --git a/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java b/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java index 7725474b..9ed38d08 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java @@ -215,22 +215,22 @@ private void initClimbLevel() { new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { - String newClimbLevel = Globals.ClimbLevelList.getClimbLevelValue(postMatchBinding.spinnerClimbLevel.getSelectedItem().toString()); + int newClimbLevel = Globals.ClimbLevelList.getClimbLevelId(postMatchBinding.spinnerClimbLevel.getSelectedItem().toString()); - if (!newClimbLevel.equals(Globals.CurrentClimbLevel)) { + if (newClimbLevel != Globals.CurrentClimbLevel) { Globals.CurrentClimbLevel = newClimbLevel; } - Achievements.data_match_ClimbSuccessTele = Globals.CurrentClimbLevel; + Achievements.data_match_ClimbSuccessTele = Globals.ClimbLevelList.getClimbLevelDescription(Globals.CurrentClimbLevel); } @Override public void onNothingSelected(AdapterView adapterView) { - Globals.CurrentClimbLevel = "-1"; + Globals.CurrentClimbLevel = Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED; } }); } else { - Globals.CurrentClimbLevel = "None"; + Globals.CurrentClimbLevel = Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED; ArrayAdapter adp_ClimbLevel = new ArrayAdapter<>(this, R.layout.cpr_spinner_empty, Constants.PostMatch.NO_CLIMB); postMatchBinding.spinnerClimbLevel.setAdapter(adp_ClimbLevel); postMatchBinding.spinnerClimbLevel.setBackgroundColor(getColor(R.color.light_grey)); @@ -265,20 +265,20 @@ private void initClimbPosition() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { - String newClimbPosition = Globals.ClimbPositionList.getClimbPositionValue(postMatchBinding.spinnerClimbPosition.getSelectedItem().toString()); + int newClimbPosition = Globals.ClimbPositionList.getClimbPositionId(postMatchBinding.spinnerClimbPosition.getSelectedItem().toString()); - if (!Objects.equals(newClimbPosition, Globals.CurrentClimbPosition)) { + if (newClimbPosition != Globals.CurrentClimbPosition) { Globals.CurrentClimbPosition = newClimbPosition; } } @Override public void onNothingSelected(AdapterView adapterView) { - Globals.CurrentClimbPosition = "-1"; + Globals.CurrentClimbPosition = Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED; } }); } else { - Globals.CurrentClimbPosition = "None"; + Globals.CurrentClimbPosition = Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED; ArrayAdapter adp_ClimbPosition = new ArrayAdapter<>(this, R.layout.cpr_spinner_empty, Constants.PostMatch.NO_CLIMB); postMatchBinding.spinnerClimbPosition.setAdapter(adp_ClimbPosition); postMatchBinding.spinnerClimbPosition.setBackgroundColor(getColor(R.color.light_grey)); @@ -374,7 +374,7 @@ private void initSubmit() { Intent GoToPreMatch = new Intent(PostMatch.this, PreMatch.class); startActivity(GoToPreMatch); } else { - // Log all of the data from this page + // Log all the data from this page StringBuilder comment_sep_ID = new StringBuilder(); for (Integer comment_dropID : CommentList) { String comment = CommentArray.get(comment_dropID); @@ -384,9 +384,9 @@ private void initSubmit() { Globals.EventLogger.LogData(Constants.Logger.LOGKEY_COMMENTS, comment_sep_ID.toString()); // If any spinner data is left blank - if ((Constants.PostMatch.ACCURACY_NOT_SELECTED == Globals.CurrentAccuracy) || - Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED.equals(Globals.CurrentClimbLevel) || - Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED.equals(Globals.CurrentClimbPosition)) { + if (Constants.PostMatch.ACCURACY_NOT_SELECTED == Globals.CurrentAccuracy || + Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED == Globals.CurrentClimbLevel || + Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED == Globals.CurrentClimbPosition) { Toast.makeText(this, R.string.post_missing_data, Toast.LENGTH_SHORT).show(); return; diff --git a/app/src/main/java/com/team3663/scouting_app/config/Constants.java b/app/src/main/java/com/team3663/scouting_app/config/Constants.java index 00b4a830..bdb56b61 100644 --- a/app/src/main/java/com/team3663/scouting_app/config/Constants.java +++ b/app/src/main/java/com/team3663/scouting_app/config/Constants.java @@ -4,9 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.List; -import java.util.Set; public class Constants { public static class Logger { @@ -82,10 +80,10 @@ public static class Match { } public static class PostMatch { - public static final String[] NO_CLIMB = new String[]{"No Climb"}; public static final int ACCURACY_NOT_SELECTED = -1; - public static final String CLIMB_LEVEL_NOT_SELECTED = "-1"; - public static final String CLIMB_POSITION_NOT_SELECTED = "-1"; + public static final int CLIMB_POSITION_NOT_SELECTED = -1; + public static final int CLIMB_LEVEL_NOT_SELECTED = -1; + public static final String[] NO_CLIMB = new String[]{"No Climb"}; public static final String STEAL_FUEL_NOT_SELECTED = "-1"; public static final String AFFECTED_BY_DEFENSE_NOT_SELECTED = "-1"; } @@ -105,7 +103,6 @@ public static class Events { public static final int ID_NOT_MOVING_START = 64; public static final int ID_NOT_MOVING_END = 65; public static final int ID_AUTO_START_GAME_PIECE = 0; - public static final int ID_AUTO_CLIMB = 6; public static final int ID_TELE_CLIMB = 40; public static final int ID_NO_EVENT = 999; // use to check if the eventID you're looking for doesn't exist } diff --git a/app/src/main/java/com/team3663/scouting_app/config/Globals.java b/app/src/main/java/com/team3663/scouting_app/config/Globals.java index d2ca9be7..decaa2f5 100644 --- a/app/src/main/java/com/team3663/scouting_app/config/Globals.java +++ b/app/src/main/java/com/team3663/scouting_app/config/Globals.java @@ -7,8 +7,6 @@ import androidx.documentfile.provider.DocumentFile; import com.team3663.scouting_app.data.Accuracy; -import com.team3663.scouting_app.data.ClimbLevel; -import com.team3663.scouting_app.data.ClimbPosition; import com.team3663.scouting_app.utility.CPR_Network; import com.team3663.scouting_app.utility.Logger; import com.team3663.scouting_app.utility.achievements.Achievements; @@ -26,10 +24,10 @@ public class Globals { @SuppressLint("StaticFieldLeak") public static MatchesFile MatchList; @SuppressLint("StaticFieldLeak") public static EventGroupsFile EventGroupList; @SuppressLint("StaticFieldLeak") public static EventsFile EventList; + @SuppressLint("StaticFieldLeak") public static ClimbPositionFile ClimbPositionList; + @SuppressLint("StaticFieldLeak") public static ClimbLevelFile ClimbLevelList; public static Accuracy AccuracyTypeList = new Accuracy(); - public static ClimbLevel ClimbLevelList = new ClimbLevel(); - public static ClimbPosition ClimbPositionList = new ClimbPosition(); public static int CurrentAccuracy = Constants.PostMatch.ACCURACY_NOT_SELECTED; public static int CurrentCompetitionId = 0; @@ -38,14 +36,14 @@ public class Globals { public static int CurrentColorId; public static int CurrentPrefTeamPos; public static int CurrentFieldOrientationPos; + public static int CurrentClimbPosition = Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED; + public static int CurrentClimbLevel = Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED; public static String CurrentMatchPhase = Constants.Phases.NONE; public static String CurrentScoutingTeam; public static String CurrentOverrideTeamNum; public static String CurrentOverrideAlliance; public static String CurrentTeamToScout; public static String CurrentMatchType = Constants.PreMatch.DEFAULT_MATCH_TYPE; - public static String CurrentClimbLevel = Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED; - public static String CurrentClimbPosition = Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED; public static String CheckBoxTextPadding = " "; diff --git a/app/src/main/java/com/team3663/scouting_app/data/ClimbLevel.java b/app/src/main/java/com/team3663/scouting_app/data/ClimbLevel.java deleted file mode 100644 index b52f9890..00000000 --- a/app/src/main/java/com/team3663/scouting_app/data/ClimbLevel.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.team3663.scouting_app.data; - -import java.util.ArrayList; -import java.util.Objects; - -// ============================================================================================= -// Class: ClimbLevel -// Description: Defines structure/class to hold the information for all Climb Level values -// ============================================================================================= -public class ClimbLevel { - private final ArrayList climbLevel_list; - - public ClimbLevel() { - climbLevel_list = new ArrayList<>(); - - // Add climb level values into the list - addClimbLevelRow("-1", ""); - addClimbPositionRow("Left End", "Left End"); - addClimbPositionRow("Left Upright", "Left Upright"); - addClimbPositionRow("Center", "Center"); - addClimbPositionRow("Right End", "Right End"); - addClimbPositionRow("Right Upright", "Right Upright"); - addClimbPositionRow("Back", "Back"); - } - - // Add a row - public void addClimbPositionRow(String in_value, String in_description) { - climbPosition_list.add(new ClimbPositionRow(in_value, in_description)); - } - - // Return the size - public int size() { - return climbPosition_list.size(); - } - - public ArrayList getDescriptionList() { - ArrayList descriptions = new ArrayList<>(); - for (ClimbPositionRow cpr : climbPosition_list) { - descriptions.add(cpr.description); - } - return descriptions; - } - - public String getClimbPositionValue(String in_description) { - for (ClimbPositionRow cpr : climbPosition_list) { - if (Objects.equals(cpr.description, in_description)) { - return cpr.value; - } - } - return ""; - } - - public String getClimbPositionDescription(String in_value) { - for (ClimbPositionRow cpr : climbPosition_list) { - if (Objects.equals(cpr.value, in_value)) { - return cpr.description; - } - } - return ""; - } - - // Member Function: Empties out the list - public void clear() {climbPosition_list.clear();} - - // ============================================================================================= - // Class: ClimbPositionRow - // Description: Defines a structure/class to hold the information for each climb position - // ============================================================================================= - private static class ClimbPositionRow { - private final String value; - private final String description; - - public ClimbPositionRow(String in_value, String in_description) { - value = in_value; - description = in_description; - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbLevelFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbLevelFile.java new file mode 100644 index 00000000..d384c9c5 --- /dev/null +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbLevelFile.java @@ -0,0 +1,101 @@ +package com.team3663.scouting_app.utility.dataFile; + +import android.content.Context; + +import com.team3663.scouting_app.R; +import com.team3663.scouting_app.config.Constants; + +import java.util.ArrayList; + +public class ClimbLevelFile extends _DataFile { + private final ArrayList ClimbLevel_list; + + public ClimbLevelFile(Context in_context) { + super(in_context, in_context.getString(R.string.file_climb_levels), in_context.getString(R.string.applaunch_loading_climb_levels)); + + ClimbLevel_list = new ArrayList<>(); + addClimbLevelRow(String.valueOf(Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED), ""); + } + + // Member Function: Add a row of Climb Level + // info into the list giving the data individually + public void addClimbLevelRow(String in_id, String in_description) { + ClimbLevel_list.add(new ClimbLevelRow(in_id, in_description)); + } + + // Member Function: return the size of the list + public int size() { + return ClimbLevel_list.size(); + } + + // Member Function: Get back the ID for a given Climb Level + // entry (needed for logging) + public String getClimbLevelDescription(int in_id) { + String ret = ""; + + // Loop through the Climb Level + // list to find a matching id and return the description + for (ClimbLevelRow cr : ClimbLevel_list) { + if (cr.id == in_id) { + ret = cr.description; + break; + } + } + + return ret; + } + + // Member Function: Get back the ID for a given Climb Level + // entry (needed for logging) + public int getClimbLevelId(String in_description) { + int ret = 0; + + // Loop through the Climb Level + // list to find a matching description and return the id + for (ClimbLevelRow cr : ClimbLevel_list) { + if (cr.description.equals(in_description)) { + ret = cr.id; + break; + } + } + return ret; + } + + // Member Function: Return a string list of all records + public ArrayList getDescriptionList() { + ArrayList ret = new ArrayList<>(); + + for (int i = 0; i < ClimbLevel_list.size(); i++) { + ret.add(ClimbLevel_list.get(i).description); + } + + return ret; + } + + // ============================================================================================= + // Class: ClimbLevelRow + // Description: Defines a structure/class to hold the information for each Climb Level + + // ============================================================================================= + protected static class ClimbLevelRow { + private final int id; + private final String description; + + // Constructor with individual data + public ClimbLevelRow(String in_id, String in_description) { + id = Integer.parseInt(in_id); + description = in_description; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbPositionFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbPositionFile.java new file mode 100644 index 00000000..120448c0 --- /dev/null +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ClimbPositionFile.java @@ -0,0 +1,95 @@ +package com.team3663.scouting_app.utility.dataFile; + +import android.content.Context; + +import com.team3663.scouting_app.R; +import com.team3663.scouting_app.config.Constants; + +import java.util.ArrayList; + +public class ClimbPositionFile extends _DataFile { + private final ArrayList climbPosition_list; + + public ClimbPositionFile(Context in_context) { + super(in_context, in_context.getString(R.string.file_climb_positions), in_context.getString(R.string.applaunch_loading_climb_positions)); + + climbPosition_list = new ArrayList<>(); + addClimbPositionRow(String.valueOf(Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED), ""); + } + + // Member Function: Add a row of Climb Position info into the list giving the data individually + public void addClimbPositionRow(String in_id, String in_description) { + climbPosition_list.add(new ClimbPositionRow(in_id, in_description)); + } + + // Member Function: return the size of the list + public int size() { + return climbPosition_list.size(); + } + + // Member Function: Get back the ID for a given Climb Position entry (needed for logging) + public String getClimbPositionDescription(int in_id) { + String ret = ""; + + // Loop through the Climb Position list to find a matching id and return the description + for (ClimbPositionRow cr : climbPosition_list) { + if (cr.id == in_id) { + ret = cr.description; + break; + } + } + + return ret; + } + + // Member Function: Get back the ID for a given Climb Position entry (needed for logging) + public int getClimbPositionId(String in_description) { + int ret = 0; + + // Loop through the Climb Position list to find a matching description and return the id + for (ClimbPositionRow cr : climbPosition_list) { + if (cr.description.equals(in_description)) { + ret = cr.id; + break; + } + } + return ret; + } + + // Member Function: Return a string list of all records + public ArrayList getDescriptionList() { + ArrayList ret = new ArrayList<>(); + + for (int i = 0; i < climbPosition_list.size(); i++) { + ret.add(climbPosition_list.get(i).description); + } + + return ret; + } + + // ============================================================================================= + // Class: ClimbPositionRow + // Description: Defines a structure/class to hold the information for each Climb Position + // ============================================================================================= + protected static class ClimbPositionRow { + private final int id; + private final String description; + + // Constructor with individual data + public ClimbPositionRow(String in_id, String in_description) { + id = Integer.parseInt(in_id); + description = in_description; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ColorsFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ColorsFile.java index 55b0f117..4d6fc2e7 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ColorsFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/ColorsFile.java @@ -11,7 +11,7 @@ public class ColorsFile extends _DataFile { private final ArrayList color_list; public ColorsFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_colors), in_context.getString(R.string.applaunch_loading_colors), in_context.getString(R.string.applaunch_file_error_colors)); + super(in_context, in_context.getString(R.string.file_colors), in_context.getString(R.string.applaunch_loading_colors)); color_list = new ArrayList<>(); } @@ -51,7 +51,7 @@ public int getColor(int in_ColorId, int in_ColorIndex) { else return 0; } - // Member Function: Get back the Id for a given Color entry (needed for logging) + // Member Function: Get back the ID for a given Color entry (needed for logging) public String getColorDescription(int in_id) { String ret = ""; @@ -66,7 +66,7 @@ public String getColorDescription(int in_id) { return ret; } - // Member Function: Get back the Id for a given Color entry (needed for logging) + // Member Function: Get back the ID for a given Color entry (needed for logging) public int getColorId(String in_description) { int ret = 0; diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CommentsFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CommentsFile.java index c53b5091..1b96bd8f 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CommentsFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CommentsFile.java @@ -10,7 +10,7 @@ public class CommentsFile extends _DataFile { private final ArrayList comment_list; public CommentsFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_comments), in_context.getString(R.string.applaunch_loading_comments), in_context.getString(R.string.applaunch_file_error_comments)); + super(in_context, in_context.getString(R.string.file_comments), in_context.getString(R.string.applaunch_loading_comments)); comment_list = new ArrayList<>(); } @@ -36,7 +36,7 @@ public int size() { return comment_list.size(); } - // Member Function: Get back the Id for a given DNP entry (needed for logging) + // Member Function: Get back the ID for a given DNP entry (needed for logging) public int getCommentId(String in_description) { int ret = 0; diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CompetitionsFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CompetitionsFile.java index 6eefc9bd..29dc51b0 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CompetitionsFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/CompetitionsFile.java @@ -10,7 +10,7 @@ public class CompetitionsFile extends _DataFile { private final ArrayList competition_list; public CompetitionsFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_competitions), in_context.getString(R.string.applaunch_loading_competitions), in_context.getString(R.string.applaunch_file_error_competitions)); + super(in_context, in_context.getString(R.string.file_competitions), in_context.getString(R.string.applaunch_loading_competitions)); competition_list = new ArrayList<>(); } @@ -26,7 +26,7 @@ public void clearList() { } - // Member Function: Add a row of competition info into the list giving all of the data individually + // Member Function: Add a row of competition info into the list giving all the data individually public void addCompetitionRow(String in_Id, String in_description, String in_attended) { competition_list.add(new CompetitionRow(in_Id, in_description, in_attended)); } diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/DevicesFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/DevicesFile.java index f0f7a715..57bca99f 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/DevicesFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/DevicesFile.java @@ -11,7 +11,7 @@ public class DevicesFile extends _DataFile { private final ArrayList device_list; public DevicesFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_devices), in_context.getString(R.string.applaunch_loading_devices), in_context.getString(R.string.applaunch_file_error_devices)); + super(in_context, in_context.getString(R.string.file_devices), in_context.getString(R.string.applaunch_loading_devices)); device_list = new ArrayList<>(); } diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventGroupsFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventGroupsFile.java index 03ef7615..560bd4e0 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventGroupsFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventGroupsFile.java @@ -11,7 +11,7 @@ public class EventGroupsFile extends _DataFile { private final ArrayList event_group_list; public EventGroupsFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_event_groups), in_context.getString(R.string.applaunch_loading_event_groups), in_context.getString(R.string.applaunch_file_error_event_groups)); + super(in_context, in_context.getString(R.string.file_event_groups), in_context.getString(R.string.applaunch_loading_event_groups)); event_group_list = new ArrayList<>(); } @@ -50,7 +50,7 @@ public int getGroupColor(int in_GroupId) { return Integer.parseInt(event_group_list.get(in_GroupId).color) - 1; } - // Member Function: Return the Group Name for a given Group Id + // Member Function: Return the Group Name for a given Group ID public String getGroupName(int in_GroupId) { return event_group_list.get(in_GroupId).name; } diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventsFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventsFile.java index 71d5e22c..0d1a5a1e 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventsFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/EventsFile.java @@ -12,7 +12,7 @@ public class EventsFile extends _DataFile { private final ArrayList event_list; public EventsFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_events), in_context.getString(R.string.applaunch_loading_events), in_context.getString(R.string.applaunch_file_error_events)); + super(in_context, in_context.getString(R.string.file_events), in_context.getString(R.string.applaunch_loading_events)); event_list = new ArrayList<>(); } @@ -106,7 +106,7 @@ public ArrayList getNextEvents(int in_EventId) { in_EventId = er.transition_event; } - // Find the event in the list, and return it's list of valid next events + // Find the event in the list, and return its list of valid next events for (EventRow er : event_list) { if (er.id == in_EventId) return er.next_events_desc; } @@ -122,7 +122,7 @@ public ArrayList getNextEventIds(int in_EventId) { if (!event_list.get(in_EventId).match_phase.equals(Globals.CurrentMatchPhase) && (event_list.get(in_EventId).transition_event > Constants.Match.TRANSITION_EVENT_DNE)) in_EventId = event_list.get(in_EventId).transition_event; - // Find the event in the list, and return it's list of valid next events + // Find the event in the list, and return its list of valid next events for (EventRow er : event_list) { if (er.id == in_EventId) return er.next_events_ids; } diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchTypesFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchTypesFile.java index 6959a496..22742166 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchTypesFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchTypesFile.java @@ -11,7 +11,7 @@ public class MatchTypesFile extends _DataFile { private final ArrayList matchType_list; public MatchTypesFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_match_types), in_context.getString(R.string.applaunch_loading_match_types), in_context.getString(R.string.applaunch_file_error_match_types)); + super(in_context, in_context.getString(R.string.file_match_types), in_context.getString(R.string.applaunch_loading_match_types)); matchType_list = new ArrayList<>(); } diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchesFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchesFile.java index 1a7af969..4d600a27 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchesFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/MatchesFile.java @@ -13,7 +13,7 @@ public class MatchesFile extends _DataFile { private final HashMap match_list; public MatchesFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_matches), in_context.getString(R.string.applaunch_loading_matches), in_context.getString(R.string.applaunch_file_error_matches)); + super(in_context, in_context.getString(R.string.file_matches), in_context.getString(R.string.applaunch_loading_matches)); match_list = new HashMap<>(); } @@ -23,7 +23,7 @@ protected void processLine(String[] in_line, String in_orig_line) { // Use only the match information that equals the competition we're in. boolean correct_competition = false; - // compare against the Global current competition id (if valid). Otherwise compare against the competition id in the preferences + // compare against the Global current competition id (if valid). Otherwise, compare against the competition id in the preferences if (Globals.CurrentCompetitionId > 0) { if (Integer.parseInt(in_line[0]) == Globals.CurrentCompetitionId) correct_competition = true; diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/TeamsFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/TeamsFile.java index 83800854..dbb58029 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/TeamsFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/TeamsFile.java @@ -10,7 +10,7 @@ public class TeamsFile extends _DataFile { private final HashMap team_list; public TeamsFile(Context in_context) { - super(in_context, in_context.getString(R.string.file_teams), in_context.getString(R.string.applaunch_loading_teams), in_context.getString(R.string.applaunch_file_error_teams)); + super(in_context, in_context.getString(R.string.file_teams), in_context.getString(R.string.applaunch_loading_teams)); team_list = new HashMap<>(); } diff --git a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/_DataFile.java b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/_DataFile.java index a00f6aeb..b2a89879 100644 --- a/app/src/main/java/com/team3663/scouting_app/utility/dataFile/_DataFile.java +++ b/app/src/main/java/com/team3663/scouting_app/utility/dataFile/_DataFile.java @@ -11,7 +11,6 @@ import androidx.documentfile.provider.DocumentFile; import com.team3663.scouting_app.R; -import com.team3663.scouting_app.activities.AppLaunch; import com.team3663.scouting_app.config.Constants; import com.team3663.scouting_app.config.Globals; @@ -35,9 +34,9 @@ public abstract class _DataFile { protected final int file_index; protected Context context; - public _DataFile(@NonNull Context in_context, @NonNull String in_filename, @NonNull String in_loading_message, @NonNull String in_error_message) { + public _DataFile(@NonNull Context in_context, @NonNull String in_filename, @NonNull String in_data_name) { // make sure we aren't being called without the required data - if (in_filename.trim().isEmpty() || in_loading_message.trim().isEmpty() || in_error_message.trim().isEmpty()) { + if (in_filename.trim().isEmpty() || in_data_name.trim().isEmpty()) { file_index = -1; return; } @@ -46,8 +45,8 @@ public _DataFile(@NonNull Context in_context, @NonNull String in_filename, @NonN context = Objects.requireNonNull(in_context, "Context cannot be null"); file_index = file_list.size() + 1; file_list.put(file_index, Objects.requireNonNull(in_filename, "Filename cannot be null")); - error_message_list.put(file_index, Objects.requireNonNull(in_error_message, "Error message cannot be null")); - loading_message_list.put(file_index, Objects.requireNonNull(in_loading_message, "Loading message cannot be null")); + error_message_list.put(file_index, Objects.requireNonNull(context.getString(R.string.applaunch_file_error_message, in_data_name), "Error message cannot be null")); + loading_message_list.put(file_index, Objects.requireNonNull(context.getString(R.string.applaunch_loading_detail, in_data_name), "Loading message cannot be null")); subclasses.add(this); } @@ -179,8 +178,8 @@ public void LoadDataFile(TextView in_status_view, ProgressBar in_progress_bar, T is = context.getAssets().open(Constants.Data.PRIVATE_BASE_DIR + "/" + filename); } - // Sleep a tiny bit to help the UI not glitch (otherwise this block of code doesn't - // do what it's trying to do (things don't become visible, etc). + // Sleep a tiny bit to help the UI not glitch. Otherwise, this block of code doesn't + // do what it's trying to do (things don't become visible, etc.). long finalFileSize = fileSize; // compiler complained if this wasn't done this way. ((Activity)context).runOnUiThread(() -> { diff --git a/app/src/main/res/values/datafiles.xml b/app/src/main/res/values/datafiles.xml index 08377918..89db848a 100644 --- a/app/src/main/res/values/datafiles.xml +++ b/app/src/main/res/values/datafiles.xml @@ -9,4 +9,6 @@ Events.csv Comments.csv Colors.csv + ClimbPositions.csv + ClimbLevels.csv \ No newline at end of file diff --git a/app/src/main/res/values/strings_app_launch.xml b/app/src/main/res/values/strings_app_launch.xml index ca7e3669..9c6d4c8a 100644 --- a/app/src/main/res/values/strings_app_launch.xml +++ b/app/src/main/res/values/strings_app_launch.xml @@ -1,26 +1,22 @@ - Loading… - Team Data - Match Types Data - Match Data - Event Group Data - Event Data - Competition Data - Device Data - Comment Data - Color Data + Loading… + %1$s Data + Data + Team + Match Types + Match + Event Groups + Events + Competitions + Devices + Comments + Colors + Climb Positions> + Climb Levels> %1$d %% - Error loading teams from data file! - Error loading match types from data file! - Error loading matches from data file! - Error loading Event Groups from data file! - Error loading Events from data file! - Error loading competitions from data file! - Error loading devices from data file! - Error loading comments from data file! - Error loading colors from data file! + Error loading %1$s from data file! Start Scouting This device is not configured yet. Go to Settings to set it up. From 093d16a5f1dda4a2c9aaff355d0165c86fcc99aa Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Fri, 21 Aug 2026 21:47:05 -0700 Subject: [PATCH 2/3] final Moved all of the dataFile classes up a level (got them out of the Utility folder) now that ALL of them use this method - no need to put them under utility. Added .csv files for Accuracy, ClimbPosition and ClimbLevel. Added dataFile classes for all three, and then fixed up any references to them to be consistent with the other dataFile classes. (getAccuracyValue -> getAccuracyId [for example]). Simplified how we display the Loading... messages using a parameterized string rather than having double strings (loading vs error). Fixed logic in PostMatch for detecting if all fields are filled in. Before, we logged a few things then did some checks (which leaves partial logged data - which didn't cause an issue, but didn't make sense (and used more memory). Also when checking the ClimbPosition and ClimbLevel, only check IF the components are ENABLED (meaning the robot climbed and we need a choice). Otherwise ignore it. Not sure how that worked correctly before if the robot didn't climb. --- app/src/main/assets/input_data/Accuracy.csv | 10 ++ .../scouting_app/activities/AppLaunch.java | 3 +- .../scouting_app/activities/PostMatch.java | 47 ++++---- .../team3663/scouting_app/config/Globals.java | 6 +- .../team3663/scouting_app/data/Accuracy.java | 87 --------------- .../scouting_app/dataFile/AccuracyFile.java | 101 ++++++++++++++++++ .../dataFile/ClimbLevelFile.java | 2 +- .../dataFile/ClimbPositionFile.java | 2 +- .../{utility => }/dataFile/ColorsFile.java | 2 +- .../{utility => }/dataFile/CommentsFile.java | 2 +- .../dataFile/CompetitionsFile.java | 2 +- .../{utility => }/dataFile/DevicesFile.java | 2 +- .../dataFile/EventGroupsFile.java | 2 +- .../{utility => }/dataFile/EventsFile.java | 2 +- .../dataFile/MatchTypesFile.java | 2 +- .../{utility => }/dataFile/MatchesFile.java | 2 +- .../{utility => }/dataFile/TeamsFile.java | 2 +- .../{utility => }/dataFile/_DataFile.java | 2 +- app/src/main/res/values/datafiles.xml | 1 + .../main/res/values/strings_app_launch.xml | 1 + 20 files changed, 150 insertions(+), 130 deletions(-) create mode 100644 app/src/main/assets/input_data/Accuracy.csv delete mode 100644 app/src/main/java/com/team3663/scouting_app/data/Accuracy.java create mode 100644 app/src/main/java/com/team3663/scouting_app/dataFile/AccuracyFile.java rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/ClimbLevelFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/ClimbPositionFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/ColorsFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/CommentsFile.java (97%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/CompetitionsFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/DevicesFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/EventGroupsFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/EventsFile.java (99%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/MatchTypesFile.java (98%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/MatchesFile.java (99%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/TeamsFile.java (93%) rename app/src/main/java/com/team3663/scouting_app/{utility => }/dataFile/_DataFile.java (99%) diff --git a/app/src/main/assets/input_data/Accuracy.csv b/app/src/main/assets/input_data/Accuracy.csv new file mode 100644 index 00000000..be0de93f --- /dev/null +++ b/app/src/main/assets/input_data/Accuracy.csv @@ -0,0 +1,10 @@ +Id,Description +100,100% +90,90% +80,80% +70,70% +60,60% +50,50% +25,25% +10,10% +0,0% \ No newline at end of file diff --git a/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java b/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java index a9ee74c1..09b83ea3 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/AppLaunch.java @@ -31,7 +31,7 @@ import com.team3663.scouting_app.config.Globals; import com.team3663.scouting_app.databinding.AppLaunchBinding; import com.team3663.scouting_app.utility.CPR_Network; -import com.team3663.scouting_app.utility.dataFile.*; +import com.team3663.scouting_app.dataFile.*; import java.util.List; import java.util.Objects; @@ -241,6 +241,7 @@ private void initDataFiles() { } // Instantiate the Global variables or reset their context + if (Globals.AccuracyList == null) Globals.AccuracyList = new AccuracyFile(this); else Globals.AccuracyList.setContext(this); if (Globals.ClimbLevelList == null) Globals.ClimbLevelList = new ClimbLevelFile(this); else Globals.ClimbLevelList.setContext(this); if (Globals.ClimbPositionList == null) Globals.ClimbPositionList = new ClimbPositionFile(this); else Globals.ClimbPositionList.setContext(this); if (Globals.ColorList == null) Globals.ColorList = new ColorsFile(this); else Globals.ColorList.setContext(this); diff --git a/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java b/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java index 9ed38d08..606fed6f 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/PostMatch.java @@ -36,7 +36,7 @@ public class PostMatch extends AppCompatActivity { //Creating an array list for the Comments ArrayList CommentList = new ArrayList<>(); ArrayList CommentArray = Globals.CommentList.getDescriptionList(); - ArrayList Accuracy = Globals.AccuracyTypeList.getDescriptionList(); + ArrayList Accuracy = Globals.AccuracyList.getDescriptionList(); ArrayList ClimbLevel = Globals.ClimbLevelList.getDescriptionList(); ArrayList ClimbPosition = Globals.ClimbPositionList.getDescriptionList(); @@ -160,7 +160,7 @@ private void initAccuracy() { // Set starting selection int start_Pos = 0; for (int i = 0; i < Accuracy.size(); i++) { - if (Accuracy.get(i).equals(Globals.AccuracyTypeList.getAccuracyDescription(Globals.CurrentAccuracy))) { + if (Accuracy.get(i).equals(Globals.AccuracyList.getAccuracyDescription(Globals.CurrentAccuracy))) { start_Pos = i; break; } @@ -173,7 +173,7 @@ private void initAccuracy() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { - int newAccuracy = Globals.AccuracyTypeList.getAccuracyValue(postMatchBinding.spinnerAccuracy.getSelectedItem().toString()); + int newAccuracy = Globals.AccuracyList.getAccuracyId(postMatchBinding.spinnerAccuracy.getSelectedItem().toString()); if (!Objects.equals(newAccuracy, Globals.CurrentAccuracy)) { Globals.CurrentAccuracy = newAccuracy; @@ -374,6 +374,17 @@ private void initSubmit() { Intent GoToPreMatch = new Intent(PostMatch.this, PreMatch.class); startActivity(GoToPreMatch); } else { + // If any spinner data is left blank -> abort + if (Constants.PostMatch.ACCURACY_NOT_SELECTED == Globals.CurrentAccuracy || + (postMatchBinding.spinnerClimbLevel.isEnabled() && Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED == Globals.CurrentClimbLevel) || + (postMatchBinding.spinnerClimbPosition.isEnabled() && Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED == Globals.CurrentClimbPosition) || + Objects.equals(Globals.stealFuelValue, "-1") || + Objects.equals(Globals.affectedByDefenseValue, "-1")) { + + Toast.makeText(this, R.string.post_missing_data, Toast.LENGTH_SHORT).show(); + return; + } + // Log all the data from this page StringBuilder comment_sep_ID = new StringBuilder(); for (Integer comment_dropID : CommentList) { @@ -383,29 +394,14 @@ private void initSubmit() { if (comment_sep_ID.length() > 0) comment_sep_ID = new StringBuilder(comment_sep_ID.substring(1)); Globals.EventLogger.LogData(Constants.Logger.LOGKEY_COMMENTS, comment_sep_ID.toString()); - // If any spinner data is left blank - if (Constants.PostMatch.ACCURACY_NOT_SELECTED == Globals.CurrentAccuracy || - Constants.PostMatch.CLIMB_LEVEL_NOT_SELECTED == Globals.CurrentClimbLevel || - Constants.PostMatch.CLIMB_POSITION_NOT_SELECTED == Globals.CurrentClimbPosition) { + // Log all the spinner data + Globals.EventLogger.LogData(Constants.Logger.LOGKEY_ACCURACY, String.valueOf(Globals.CurrentAccuracy)); + Globals.EventLogger.LogData(Constants.Logger.LOGKEY_CLIMB_LEVEL, String.valueOf(Globals.CurrentClimbLevel)); + Globals.EventLogger.LogData(Constants.Logger.LOGKEY_CLIMB_POSITION, String.valueOf(Globals.CurrentClimbPosition)); - Toast.makeText(this, R.string.post_missing_data, Toast.LENGTH_SHORT).show(); - return; - } else { - // Log all the spinner data - Globals.EventLogger.LogData(Constants.Logger.LOGKEY_ACCURACY, String.valueOf(Globals.CurrentAccuracy)); - Globals.EventLogger.LogData(Constants.Logger.LOGKEY_CLIMB_LEVEL, String.valueOf(Globals.CurrentClimbLevel)); - Globals.EventLogger.LogData(Constants.Logger.LOGKEY_CLIMB_POSITION, String.valueOf(Globals.CurrentClimbPosition)); - } - - // If any radio button is left blank - if (Objects.equals(Globals.stealFuelValue, "-1") || Objects.equals(Globals.affectedByDefenseValue, "-1")) { - Toast.makeText(this, R.string.post_missing_data, Toast.LENGTH_SHORT).show(); - return; - } else { - // Log all the spinner data - Globals.EventLogger.LogData(Constants.Logger.LOGKEY_STEAL_FUEL,String.valueOf(Globals.stealFuelValue)); - Globals.EventLogger.LogData(Constants.Logger.LOGKEY_AFFECTED_BY_DEFENSE, String.valueOf(Globals.affectedByDefenseValue)); - } + // Log all the spinner data + Globals.EventLogger.LogData(Constants.Logger.LOGKEY_STEAL_FUEL,String.valueOf(Globals.stealFuelValue)); + Globals.EventLogger.LogData(Constants.Logger.LOGKEY_AFFECTED_BY_DEFENSE, String.valueOf(Globals.affectedByDefenseValue)); Intent GoToSubmitData = new Intent(PostMatch.this, SubmitData.class); startActivity(GoToSubmitData); @@ -421,7 +417,6 @@ private void initSubmit() { .startsWith(Constants.Achievements.EVENT_TYPE_FINAL)) Achievements.data_FinalType++; finish(); - }); } diff --git a/app/src/main/java/com/team3663/scouting_app/config/Globals.java b/app/src/main/java/com/team3663/scouting_app/config/Globals.java index decaa2f5..c9541af4 100644 --- a/app/src/main/java/com/team3663/scouting_app/config/Globals.java +++ b/app/src/main/java/com/team3663/scouting_app/config/Globals.java @@ -6,11 +6,10 @@ import androidx.documentfile.provider.DocumentFile; -import com.team3663.scouting_app.data.Accuracy; import com.team3663.scouting_app.utility.CPR_Network; import com.team3663.scouting_app.utility.Logger; import com.team3663.scouting_app.utility.achievements.Achievements; -import com.team3663.scouting_app.utility.dataFile.*; +import com.team3663.scouting_app.dataFile.*; import java.util.HashMap; @@ -26,8 +25,7 @@ public class Globals { @SuppressLint("StaticFieldLeak") public static EventsFile EventList; @SuppressLint("StaticFieldLeak") public static ClimbPositionFile ClimbPositionList; @SuppressLint("StaticFieldLeak") public static ClimbLevelFile ClimbLevelList; - - public static Accuracy AccuracyTypeList = new Accuracy(); + @SuppressLint("StaticFieldLeak") public static AccuracyFile AccuracyList; public static int CurrentAccuracy = Constants.PostMatch.ACCURACY_NOT_SELECTED; public static int CurrentCompetitionId = 0; diff --git a/app/src/main/java/com/team3663/scouting_app/data/Accuracy.java b/app/src/main/java/com/team3663/scouting_app/data/Accuracy.java deleted file mode 100644 index 27f924fc..00000000 --- a/app/src/main/java/com/team3663/scouting_app/data/Accuracy.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.team3663.scouting_app.data; - -import com.team3663.scouting_app.config.Constants; - -import java.util.ArrayList; -import java.util.Objects; - -// ============================================================================================= -// Class: Accuracy -// Description: Defines a structure/class to hold the information for all Accuracy values -// ============================================================================================= - -public class Accuracy { - - private final ArrayList Accuracy_list; - - public Accuracy() { - Accuracy_list = new ArrayList<>(); - - // Add accuracy values into the list - addAccuracyRow(-1,""); + } + + @Override + protected void processLine(String[] in_line, String in_orig_line) { + addAccuracyRow(in_line[0], in_line[1]); + } + + @Override + public void clearList() { + Accuracy_list.clear(); + addAccuracyRow(String.valueOf(Constants.PostMatch.ACCURACY_NOT_SELECTED), "