Add scouting dashboard details

This commit is contained in:
Michael Mikovsky
2025-04-10 14:00:31 -06:00
parent 15c503bbb7
commit b83d67359e
4 changed files with 70 additions and 7 deletions
@@ -108,12 +108,11 @@ public class EventFragment extends Fragment {
if(rescout[0]) { if(rescout[0]) {
text.setBackgroundColor(color_rescout); text.setBackgroundColor(color_rescout);
DataManager.rescout_list.add(filename); DataManager.rescout_list.add(filename);
DataManager.save_rescout_list();
}else{ }else{
text.setBackgroundColor(color_found); text.setBackgroundColor(color_found);
DataManager.rescout_list.remove(filename); DataManager.rescout_list.remove(filename);
DataManager.save_rescout_list();
} }
DataManager.save_rescout_list();
return true; return true;
}); });
}else{ }else{
@@ -179,12 +178,11 @@ public class EventFragment extends Fragment {
if(rescout[0]) { if(rescout[0]) {
text.setBackgroundColor(color_rescout); text.setBackgroundColor(color_rescout);
DataManager.rescout_list.add(filename); DataManager.rescout_list.add(filename);
DataManager.save_rescout_list();
}else{ }else{
text.setBackgroundColor(color_found); text.setBackgroundColor(color_found);
DataManager.rescout_list.remove(filename); DataManager.rescout_list.remove(filename);
DataManager.save_rescout_list();
} }
DataManager.save_rescout_list();
return true; return true;
}); });
@@ -3,6 +3,7 @@ package com.ridgebotics.ridgescout.ui.scouting;
import static android.widget.LinearLayout.VERTICAL; import static android.widget.LinearLayout.VERTICAL;
import static androidx.navigation.fragment.FragmentKt.findNavController; import static androidx.navigation.fragment.FragmentKt.findNavController;
import static com.ridgebotics.ridgescout.utility.DataManager.evcode;
import static com.ridgebotics.ridgescout.utility.DataManager.event; import static com.ridgebotics.ridgescout.utility.DataManager.event;
import android.app.AlertDialog; import android.app.AlertDialog;
@@ -27,6 +28,7 @@ import com.ridgebotics.ridgescout.databinding.FragmentScoutingBinding;
import com.ridgebotics.ridgescout.utility.DataManager; import com.ridgebotics.ridgescout.utility.DataManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set;
public class ScoutingFragment extends Fragment { public class ScoutingFragment extends Fragment {
@@ -82,6 +84,12 @@ public class ScoutingFragment extends Fragment {
if(event == null){ if(event == null){
binding.noEventError.setVisibility(View.VISIBLE); binding.noEventError.setVisibility(View.VISIBLE);
binding.textMatchAlliance.setVisibility(View.GONE);
binding.textName.setVisibility(View.GONE);
binding.textNextMatch.setVisibility(View.GONE);
binding.textRescoutIndicator.setVisibility(View.GONE);
binding.matchScoutingButton.setEnabled(false); binding.matchScoutingButton.setEnabled(false);
binding.pitScoutingButton.setEnabled(false); binding.pitScoutingButton.setEnabled(false);
binding.eventButton.setEnabled(false); binding.eventButton.setEnabled(false);
@@ -113,6 +121,21 @@ public class ScoutingFragment extends Fragment {
findNavController(this).navigate(R.id.action_navigation_scouting_to_navigation_scouting_event); findNavController(this).navigate(R.id.action_navigation_scouting_to_navigation_scouting_event);
}); });
binding.textName.setText("Welcome, " + SettingsManager.getUsername() + "!");
int nextMatch = -1;
int teamNum = SettingsManager.getTeamNum();
for(int i = SettingsManager.getMatchNum(); i < event.matches.size(); i++){ // Loop through matches and find next match
boolean foundMatch = false;
for(int a = 0; a < 3; a++) if(event.matches.get(i).blueAlliance[a] == teamNum){nextMatch = i+1; foundMatch = true;}
for(int a = 0; a < 3; a++) if(event.matches.get(i).redAlliance[a] == teamNum){nextMatch = i+1; foundMatch = true;}
if(foundMatch) break;
}
binding.textNextMatch.setText("Our next match: Match " + nextMatch);
binding.textMatchAlliance.setText("Match: " + (SettingsManager.getMatchNum()+1) + ", " + SettingsManager.getAllyPos());
binding.textRescoutIndicator.setText("Things to rescout: " + DataManager.rescout_list.size());
return binding.getRoot(); return binding.getRoot();
} }
@@ -265,7 +265,7 @@ public final class FileEditor {
} }
public static boolean deleteFile(String filepath){ public static boolean deleteFile(String filepath){
if(fileExist(filepath)){ if(!fileExist(filepath)){
return true; return true;
} }
File file = new File(baseDir + filepath); File file = new File(baseDir + filepath);
+44 -2
View File
@@ -30,8 +30,10 @@
android:layout_marginBottom="48dp" android:layout_marginBottom="48dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<Button <Button
android:id="@+id/matchScoutingButton" android:id="@+id/matchScoutingButton"
@@ -79,9 +81,49 @@
app:layout_constraintStart_toEndOf="@+id/event_button" app:layout_constraintStart_toEndOf="@+id/event_button"
app:layout_constraintTop_toBottomOf="@+id/pitScoutingButton" /> app:layout_constraintTop_toBottomOf="@+id/pitScoutingButton" />
<TextView
android:id="@+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_next_match"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_name" />
<TextView
android:id="@+id/text_match_alliance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
app:layout_constraintStart_toStartOf="@+id/matchScoutingButton"
app:layout_constraintTop_toBottomOf="@+id/matchScoutingButton" />
<TextView
android:id="@+id/text_rescout_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/event_button" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>