diff --git a/app/src/main/java/com/databits/androidscouting/fragment/Crowd.java b/app/src/main/java/com/databits/androidscouting/fragment/Crowd.java index 0143225..4ee5589 100644 --- a/app/src/main/java/com/databits/androidscouting/fragment/Crowd.java +++ b/app/src/main/java/com/databits/androidscouting/fragment/Crowd.java @@ -38,7 +38,6 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; -import java.util.LinkedList; import java.util.List; import java.util.Objects; @@ -115,17 +114,13 @@ public boolean onMenuItemSelected(@NonNull MenuItem menuItem) { }) .create(); - ArrayList student_list = debugPreference.getObject("student_list", - ArrayList.class); - - if (student_list == null) { - scouterList = new LinkedList<>(Arrays.asList(getResources(). - getStringArray(R.array.student_names))); + if (configPreference.getBoolean("altMode", false)) { + scouterList = new ArrayList<>(Arrays.asList(getResources() + .getStringArray(R.array.royal_students))); } else { - scouterList = student_list; + scouterList = new ArrayList<>(Arrays.asList(getResources() + .getStringArray(R.array.databits_students))); } - //scouterList = new LinkedList<>(Arrays.asList(getResources(). - // getStringArray(R.array.student_names))); ArrayAdapter adapter = new ArrayAdapter<>(requireContext(), R.layout.ui_list_item, scouterList); diff --git a/app/src/main/java/com/databits/androidscouting/fragment/Main.java b/app/src/main/java/com/databits/androidscouting/fragment/Main.java index 9fd6b5c..ff20ec2 100644 --- a/app/src/main/java/com/databits/androidscouting/fragment/Main.java +++ b/app/src/main/java/com/databits/androidscouting/fragment/Main.java @@ -104,6 +104,28 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { } }); + binding.buttonGroupSelector.setOnPositionChangedListener(position -> { + switch (position) { + case 0: + configPreference.remove("altMode"); + break; + case 1: + configPreference.setBoolean("altMode",false); + break; + case 2: + configPreference.setBoolean("altMode",true); + break; + } + }); + + boolean alt = configPreference.getBoolean("altMode"); + if (alt) { + binding.buttonGroupSelector.setPosition(1,false); + } else { + binding.buttonGroupSelector.setPosition(2,false); + } + + if (lock) { role_selector(controller); } diff --git a/app/src/main/java/com/databits/androidscouting/fragment/Pit.java b/app/src/main/java/com/databits/androidscouting/fragment/Pit.java index cb97489..66e4dd5 100644 --- a/app/src/main/java/com/databits/androidscouting/fragment/Pit.java +++ b/app/src/main/java/com/databits/androidscouting/fragment/Pit.java @@ -126,7 +126,7 @@ public boolean onMenuItemSelected(@NonNull MenuItem menuItem) { .create(); scouterList = new LinkedList<>(Arrays.asList(getResources(). - getStringArray(R.array.student_names))); + getStringArray(R.array.databits_students))); ArrayAdapter adapter = new ArrayAdapter<>(requireContext(), R.layout.ui_list_item, scouterList); diff --git a/app/src/main/java/com/databits/androidscouting/fragment/Provision.java b/app/src/main/java/com/databits/androidscouting/fragment/Provision.java index e06641f..153c9c0 100644 --- a/app/src/main/java/com/databits/androidscouting/fragment/Provision.java +++ b/app/src/main/java/com/databits/androidscouting/fragment/Provision.java @@ -119,8 +119,13 @@ public boolean onMenuItemSelected(@NonNull MenuItem menuItem) { public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - scouterList = new LinkedList<>(Arrays.asList(getResources() - .getStringArray(R.array.student_names))); + if (configPreference.getBoolean("altMode", false)) { + scouterList = new LinkedList<>(Arrays.asList(getResources() + .getStringArray(R.array.royal_students))); + } else { + scouterList = new LinkedList<>(Arrays.asList(getResources() + .getStringArray(R.array.databits_students))); + } NavController controller = NavHostFragment.findNavController(Provision.this); diff --git a/app/src/main/java/com/databits/androidscouting/util/SheetsUpdateTaskNew.java b/app/src/main/java/com/databits/androidscouting/util/SheetsUpdateTaskNew.java index b8fa9d3..dd042e7 100644 --- a/app/src/main/java/com/databits/androidscouting/util/SheetsUpdateTaskNew.java +++ b/app/src/main/java/com/databits/androidscouting/util/SheetsUpdateTaskNew.java @@ -78,7 +78,15 @@ public SheetsUpdateTaskNew(Activity activity) { ArrayList.class, new ArrayList<>())); try { // Sheet name and range to upload data to - String range = "SuperRawDatabase!A2:BL700"; + String range; + + if (configPreference.getBoolean("altMode", false)) { + // Royal Twrecks + range = "Raw Data!A2:BL700"; + } else { + // Databits + range = "SuperRawDatabase!A2:BL700"; + } // Configure a new value range to store the data ValueRange content = new ValueRange(); @@ -132,7 +140,14 @@ public SheetsUpdateTaskNew(Activity activity) { @Override protected void onPreExecute() { - String hardcode = "1ZKXLsKNM05-5BhIzbWjLOdvka-9NipSjVqFf_iG2eak"; + String hardcode; + if (configPreference.getBoolean("altMode", false)) { + // Royal Twrecks + hardcode = ""; + } else { + // Databits + hardcode = ""; + } spreadsheetId = configPreference.getString("linked_spreadsheet_id", hardcode); } diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml index 80fdcf3..e6b5d6b 100644 --- a/app/src/main/res/layout/fragment_main.xml +++ b/app/src/main/res/layout/fragment_main.xml @@ -192,4 +192,74 @@ app:layout_constraintTop_toBottomOf="@+id/buttonPermissions" /> + + + + + + + + + + \ No newline at end of file