5 Commits

Author SHA1 Message Date
Michael Mikovsky 534207ebb1 Fix more scouting data crashing 2025-03-15 06:09:47 -06:00
Michael Mikovsky d458ad7669 Update Version Number 2025-03-07 12:31:10 -07:00
Michael Mikovsky 3e045bfcb7 Field selector, Field back button, TBA popup 2025-03-07 12:24:16 -07:00
Michael Mikovsky c78fa58754 Colors and adaptable icon 2025-03-07 11:17:02 -07:00
Michael Mikovsky 18748301cd Merge pull request #3 from Team4388/Fix-CSV-Export
Fix CSV Export
2025-03-06 18:48:05 +00:00
16 changed files with 146 additions and 116 deletions
+2 -2
View File
@@ -25,8 +25,8 @@ android {
applicationId = "com.ridgebotics.ridgescout"
minSdk = 24
targetSdk = 34
versionCode = 9 // **IMPORTANT** Increment this before releasing on github
versionName = "1.2"// **IMPORTANT** Change this before releasing on github (<Year num since 2024>.<Update Version>)
versionCode = 11 // **IMPORTANT** Increment this before releasing on github
versionName = "1.4"// **IMPORTANT** Change this before releasing on github (<Year num since 2024>.<Update Version>)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -89,18 +89,16 @@ public class MainActivity extends AppCompatActivity {
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);
navView.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
clearBackStack();
navController.navigate(item.getItemId(), savedInstanceState, new NavOptions.Builder()
.setEnterAnim(R.anim.enter_anim)
.setExitAnim(R.anim.exit_anim)
.setPopEnterAnim(R.anim.pop_enter_anim)
.setPopExitAnim(R.anim.pop_exit_anim).build()
);
return true;
}
navView.setOnItemSelectedListener(item -> {
backPressed = null;
clearBackStack();
navController.navigate(item.getItemId(), savedInstanceState, new NavOptions.Builder()
.setEnterAnim(R.anim.enter_anim)
.setExitAnim(R.anim.exit_anim)
.setPopEnterAnim(R.anim.pop_enter_anim)
.setPopExitAnim(R.anim.pop_exit_anim).build()
);
return true;
});
}
@@ -116,11 +114,9 @@ public class MainActivity extends AppCompatActivity {
public interface activityResultRelay {
void onActivityResult(int requestCode, int resultCode, Intent data);
}
public static activityResultRelay resultRelay = null;
public static void setResultRelay(activityResultRelay tmpresultRelay){
resultRelay = tmpresultRelay;
@@ -135,4 +131,25 @@ public class MainActivity extends AppCompatActivity {
}
}
public interface onBackPressed {
boolean onBackPressed();
}
public onBackPressed backPressed = null;
public void setOnBackPressed(onBackPressed onBackPressed){
this.backPressed = onBackPressed;
}
@Override
public void onBackPressed() {
if(backPressed != null) {
if (backPressed.onBackPressed()) {
super.onBackPressed();
}
} else {super.onBackPressed();}
}
}
@@ -59,7 +59,8 @@ public class fields {
public static final inputType[][] default_pit_fields = new inputType[][] {
{
new dropdownType("Drivetrain type", "What type of drivetrain does this team have?", new String[]{"Swerve Drive", "Tank Drive (Differential)", "Other, Info in comments"}, 0),
new dropdownType("Intake type", "What type of intake does this team have?", new String[]{"Swerve Drive", "Tank Drive (Differential)", "Other, Info in comments"}, 0),
new dropdownType("Intake type", "What type of intake does this team have?", new String[]{"Ground only", "Player Station only", "Both", "Other, Info in comments"}, 0),
new dropdownType("Intake Consistency", "How consistent is the robot at intakeing?", new String[]{"Does not work", "Worked a few times during testing", "Works most of the time", "Fails sometimes", "Never fails"}, 0),
new dropdownType("Score Area", "What does this robot score?", new String[]{"Only Algae", "Mostly Algae", "Both", "Mostly Coral", "Only Coral"}, 0),
@@ -67,16 +68,18 @@ public class fields {
new checkboxType("L3 Scoring", "Will the robot score in Layer 3?", 0),
new checkboxType("L2 Scoring", "Will the robot score in Layer 3?", 0),
new checkboxType("L1/Trough Scoring", "Will the robot score in Layer 1?", 0),
new checkboxType("Processor Scoring", "Will the robot score in the processor?", 0),
new checkboxType("Processor Scoring", "Will the robot score in the Processor?", 0),
new checkboxType("Barge Scoring", "Will the robot score algae in the Barge?", 0),
new dropdownType("Scoring Consistency", "How consistent is the robot at Scoring?", new String[]{"Does not work", "Worked a few times during testing", "Works most of the time", "Fails sometimes", "Never fails"}, 0),
new dropdownType("Auto type", "What autos does this team have?", new String[]{"No auto", "Simple Coral", "Simple Algae", "Complex Coral", "Complex Algae", "Other, Info in comments"}, 0),
new textType("Auto Capability", "What autos does this team have?", ""),
new dropdownType("Auto Consistency", "How consistent is the robot at Auto?", new String[]{"Does not work", "Worked a few times during testing", "Works most of the time", "Fails sometimes", "Never fails"}, 0),
new dropdownType("Climb type", "What does the robot do to climb?", new String[]{"No Climb", "Only Shallow", "Only Deep", "Both Shallow and Deep"}, 0),
new dropdownType("Climb Consistency", "How consistent is the robot at climbing?", new String[]{"Does not work", "Worked a few times during testing", "Works most of the time", "Fails sometimes", "Never fails"}, 0),
new textType("Cool Comments", "Is there anything cool about the robot?", ""),
new textType("Comments", "Things go here", "Day 1:\n\nDay 2:\n\nDay 3:\n")
}
};
@@ -1,6 +1,7 @@
package com.ridgebotics.ridgescout.ui.data;
import static android.view.View.VISIBLE;
import static androidx.navigation.fragment.FragmentKt.findNavController;
import android.os.Bundle;
@@ -14,6 +15,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.ridgebotics.ridgescout.R;
import com.ridgebotics.ridgescout.scoutingData.fields;
import com.ridgebotics.ridgescout.utility.settingsManager;
import com.ridgebotics.ridgescout.databinding.FragmentDataBinding;
import com.ridgebotics.ridgescout.types.frcTeam;
@@ -36,15 +38,26 @@ public class DataFragment extends Fragment {
String evcode = settingsManager.getEVCode();
binding.fieldsButton.setOnClickListener(v -> {
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_fields_chooser);
binding.fieldsButton.setEnabled(false);
binding.fieldsButtons.setVisibility(VISIBLE);
});
binding.fieldsMatchesButton.setOnClickListener(v -> {
FieldsFragment.set_filename(fields.matchFieldsFilename);
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_fields);
});
binding.fieldsPitsButton.setOnClickListener(v -> {
FieldsFragment.set_filename(fields.pitsFieldsFilename);
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_fields);
});
if(evcode.equals("unset")){
binding.noEventError.setVisibility(View.VISIBLE);
binding.noEventError.setVisibility(VISIBLE);
binding.buttons.setVisibility(View.VISIBLE);
binding.buttons.setVisibility(VISIBLE);
binding.teamsButton.setEnabled(false);
binding.fieldsButton.setVisibility(View.VISIBLE);
binding.fieldsButton.setVisibility(VISIBLE);
return root;
@@ -1,38 +0,0 @@
package com.ridgebotics.ridgescout.ui.data;
import static androidx.navigation.fragment.FragmentKt.findNavController;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.ridgebotics.ridgescout.R;
import com.ridgebotics.ridgescout.databinding.FragmentDataFieldsChooserBinding;
import com.ridgebotics.ridgescout.scoutingData.fields;
public class FieldsChooserFragment extends Fragment {
FragmentDataFieldsChooserBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
binding = FragmentDataFieldsChooserBinding.inflate(inflater, container, false);
binding.matchScoutingButton.setOnClickListener(v -> {
FieldsFragment.set_filename(fields.matchFieldsFilename);
findNavController(this).navigate(R.id.action_navigation_data_fields_chooser_to_navigation_data_fields);
});
binding.pitScoutingButton.setOnClickListener(v -> {
FieldsFragment.set_filename(fields.pitsFieldsFilename);
findNavController(this).navigate(R.id.action_navigation_data_fields_chooser_to_navigation_data_fields);
});
return binding.getRoot();
}
}
@@ -21,6 +21,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import com.ridgebotics.ridgescout.MainActivity;
import com.ridgebotics.ridgescout.R;
import com.ridgebotics.ridgescout.databinding.FragmentDataFieldsBinding;
import com.ridgebotics.ridgescout.scoutingData.fields;
@@ -66,6 +67,25 @@ public class FieldsFragment extends Fragment {
load_field_menu();
((MainActivity) getActivity()).setOnBackPressed(() -> {
if(binding.saveButton.getVisibility() == View.GONE) return true;
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
alert.setTitle("Warning!");
alert.setMessage("You have not saved your progress!");
alert.setPositiveButton("Return", null);
alert.setNeutralButton("Quit without saving", (dialogInterface, i) -> {
binding.saveButton.setVisibility(View.GONE);
if(getActivity() != null)
getActivity().onBackPressed();
});
alert.setCancelable(true);
alert.create().show();
return false;
});
return binding.getRoot();
}
@@ -223,7 +243,7 @@ public class FieldsFragment extends Fragment {
if(fields.save(filename, newValues))
AlertManager.toast("Saved");
Navigation.findNavController((Activity) getContext(), R.id.nav_host_fragment_activity_main).navigate(R.id.action_navigation_data_fields_to_navigation_data_fields_chooser);
Navigation.findNavController((Activity) getContext(), R.id.nav_host_fragment_activity_main).navigate(R.id.action_navigation_data_fields_to_navigation_data);
});
alert.setNegativeButton("Cancel", null);
alert.setCancelable(true);
@@ -101,8 +101,8 @@ public class TeamsFragment extends Fragment {
// tv.setTextSize(16);
// ll.addView(tv);
add_pit_data(team);
add_match_data(team, mode);
try {add_pit_data(team);}catch(Exception e){AlertManager.error(e);}
try {add_match_data(team, mode);}catch(Exception e){AlertManager.error(e);}
}
public void add_pit_data(frcTeam team){
@@ -273,7 +273,8 @@ public class TeamsFragment extends Fragment {
binding.matchArea.addView(tv);
match_latest_values[i].add_individual_view(binding.matchArea, psda.data.array[i]);
if(psda.data.array[i] != null)
match_latest_values[i].add_individual_view(binding.matchArea, psda.data.array[i]);
}
}catch (Exception e){
e.printStackTrace();
@@ -293,7 +294,8 @@ public class TeamsFragment extends Fragment {
try {
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
for (int a = 0; a < data.length; a++) {
data[a][i] = psda.data.array[a];
if(psda.data.array[a] != null && psda.data.array[a].get() != null)
data[a][i] = psda.data.array[a];
}
} catch (Exception e){
e.printStackTrace();
@@ -313,7 +315,8 @@ public class TeamsFragment extends Fragment {
tv.setTextSize(30);
binding.matchArea.addView(tv);
match_latest_values[i].add_compiled_view(binding.matchArea, data[i]);
if(data[i] != null)
match_latest_values[i].add_compiled_view(binding.matchArea, data[i]);
}
}
@@ -327,7 +330,8 @@ public class TeamsFragment extends Fragment {
try {
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
for (int a = 0; a < data.length; a++) {
data[a][i] = psda.data.array[a];
if(psda.data.array[a] != null && psda.data.array[a].get() != null)
data[a][i] = psda.data.array[a];
}
}catch (Exception e){
e.printStackTrace();
@@ -347,7 +351,8 @@ public class TeamsFragment extends Fragment {
tv.setTextSize(30);
binding.matchArea.addView(tv);
match_latest_values[i].add_history_view(binding.matchArea, data[i]);
if(data[i] != null)
match_latest_values[i].add_history_view(binding.matchArea, data[i]);
}
}
}
@@ -70,7 +70,7 @@ public class CSVExport {
data += tempData;
} catch (Exception e){
e.printStackTrace();
data += ("null,".repeat(pit_latest_values.length));
data += ("null,".repeat(match_latest_values.length));
}
}
@@ -57,18 +57,7 @@ public class TransferFragment extends Fragment {
});
binding.TBAButton.setOnClickListener(v -> {
binding.noEventError.setVisibility(View.GONE);
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
alert.setTitle("Warning");
alert.setMessage("This action requires internet.");
alert.setCancelable(true);
alert.setPositiveButton("Ok", (dialog, which) -> {
findNavController(this).navigate(R.id.action_navigation_transfer_to_navigation_tba);
});
alert.setNegativeButton("Cancel", null);
alert.create().show();
findNavController(this).navigate(R.id.action_navigation_transfer_to_navigation_tba);
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

+30
View File
@@ -49,5 +49,35 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fieldsButton" />
<LinearLayout
android:id="@+id/fieldsButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fieldsButton"
tools:visibility="visible">
<Button
android:id="@+id/fieldsPitsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Pits"
android:textSize="34sp" />
<Button
android:id="@+id/fieldsMatchesButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Matches"
android:textSize="34sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -8,6 +8,7 @@
android:id="@+id/minus_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
android:text="-" />
<TextView
@@ -22,6 +23,7 @@
android:id="@+id/plus_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
android:text="+" />
</LinearLayout>
@@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
@@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_robologo" />
</adaptive-icon>
@@ -15,21 +15,21 @@
app:destination="@id/navigation_match_scouting"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim"/>
<action
android:id="@+id/action_navigation_scouting_to_navigation_team_selector"
app:destination="@id/navigation_team_selector"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_scouting_to_navigation_scouting_event"
app:destination="@id/navigation_scouting_status"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim"/>
</fragment>
@@ -48,14 +48,14 @@
app:destination="@id/navigation_pit_scouting"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_team_selector_to_navigation_data_teams"
app:destination="@id/navigation_data_teams"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
@@ -79,14 +79,14 @@
app:destination="@id/navigation_team_selector"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_data_to_navigation_data_fields_chooser"
app:destination="@id/navigation_data_fields_chooser"
android:id="@+id/action_navigation_data_to_navigation_data_fields"
app:destination="@id/navigation_data_fields"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
@@ -102,29 +102,16 @@
tools:layout="@layout/fragment_data_teams">
</fragment>
<fragment
android:id="@+id/navigation_data_fields_chooser"
android:name="com.ridgebotics.ridgescout.ui.data.FieldsChooserFragment"
tools:layout="@layout/fragment_data_fields_chooser">
<action
android:id="@+id/action_navigation_data_fields_chooser_to_navigation_data_fields"
app:destination="@id/navigation_data_fields"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
<fragment
android:id="@+id/navigation_data_fields"
android:name="com.ridgebotics.ridgescout.ui.data.FieldsFragment"
tools:layout="@layout/fragment_data_fields">
<action
android:id="@+id/action_navigation_data_fields_to_navigation_data_fields_chooser"
app:destination="@id/navigation_data_fields_chooser"
android:id="@+id/action_navigation_data_fields_to_navigation_data"
app:destination="@id/navigation_data"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
@@ -142,21 +129,21 @@
app:destination="@id/navigation_tba"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_transfer_to_navigation_file_selector"
app:destination="@id/navigation_file_selector"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_transfer_to_navigation_transfer_selector"
app:destination="@id/navigation_transfer_selector"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
@@ -169,7 +156,7 @@
app:destination="@id/navigation_transfer_selector"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
@@ -182,28 +169,28 @@
app:destination="@id/navigation_code_generator"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_transfer_selector_to_navigation_bluetooth_sender"
app:destination="@id/navigation_bluetooth_sender"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_transfer_selector_to_navigation_code_scanner"
app:destination="@id/navigation_code_scanner"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_navigation_transfer_selector_to_navigation_bluetooth_receiver"
app:destination="@id/navigation_bluetooth_receiver"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/enter_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
</fragment>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="main_200">#FFBBFC86</color>
<color name="main_200">#FFA0E044</color>
<color name="main_500">#FF62EE00</color>
<color name="main_700">#FF37B300</color>
<color name="teal_200">#FF03DAC5</color>