Skip to content

Commit f49f0eb

Browse files
authored
Merge pull request #18 from RaiderRobotix/develop
Fix auto populate issues from v3.01
2 parents f17cce7 + 15f0357 commit f49f0eb

File tree

4 files changed

+93
-92
lines changed

4 files changed

+93
-92
lines changed

scoutingapp/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
minSdkVersion 21
1212
targetSdkVersion 27
1313
versionCode 1
14-
versionName '3.01'
14+
versionName '3.02'
1515
multiDexEnabled true
1616

1717

scoutingapp/src/main/java/org/usfirst/frc/team25/scouting/ui/dataentry/AutoFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
162162

163163
private void crossHabLineState() {
164164
if (rocketCargo.getValue() > 0 || cargoShipCargo.getValue() > 0
165-
|| rocketHatches.getValue() > 0 || sideCargoShipHatchCapable.isChecked() ||
165+
|| cargoShipHatches.getValue() > 0 || rocketHatches.getValue() > 0 || sideCargoShipHatchCapable.isChecked() ||
166166
frontCargoShipHatchCapable.isChecked() || opponentCargoShipLineFoul.isChecked()) {
167167
reachHabLine.setChecked(true);
168168
reachHabLine.setEnabled(false);

scoutingapp/src/main/java/org/usfirst/frc/team25/scouting/ui/dataentry/TeleOpFragment.java

Lines changed: 90 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -64,95 +64,6 @@ public void setEntry(ScoutEntry entry) {
6464
this.entry = entry;
6565
}
6666

67-
@Override
68-
public void autoPopulate() {
69-
if (entry.getTeleOp() != null) {
70-
TeleOp tele = entry.getTeleOp();
71-
72-
cargoShipHatches.setValue(tele.getCargoShipHatches());
73-
rocketLevelOneHatches.setValue(tele.getCargoShipCargo());
74-
rocketLevelOneCargo.setValue(tele.getRocketLevelOneCargo());
75-
cargoShipCargo.setValue(tele.getRocketLevelOneHatches());
76-
rocketLevelTwoCargo.setValue(tele.getRocketLevelTwoCargo());
77-
rocketLevelTwoHatches.setValue(tele.getRocketLevelTwoHatches());
78-
rocketLevelThreeCargo.setValue(tele.getRocketLevelThreeCargo());
79-
rocketLevelThreeHatches.setValue(tele.getRocketLevelThreeHatches());
80-
81-
climbAssistedByPartners.setChecked(tele.isClimbAssistedByPartners());
82-
partnerClimbsAssisted.setValue(tele.getNumberOfPartnerClimbsAssisted());
83-
hatchesDropped.setValue(tele.getHatchesDropped());
84-
cargoDropped.setValue(tele.getCargoDropped());
85-
attemptHabClimb.setChecked(tele.isAttemptHabClimb());
86-
successHabClimb.setChecked(tele.isSuccessHabClimb());
87-
88-
if (tele.getAssistingClimbTeamNumber() != 0) {
89-
teamNumberThatAssistedClimb.setText(Integer.toString(tele.getAssistingClimbTeamNumber()));
90-
}
91-
92-
for (int i = 2; i <= 3; i++) {
93-
if (i == tele.getHighestClimbAssisted()) {
94-
highestAssistedClimbLevel[i - 2].setChecked(true);
95-
}
96-
}
97-
98-
for (int i = 1; i <= successHabClimbLevel.length; i++) {
99-
if (i == tele.getSuccessHabClimbLevel()) {
100-
successHabClimbLevel[i - 1].setChecked(true);
101-
}
102-
}
103-
104-
for (int i = 1; i <= attemptHabClimbLevel.length; i++) {
105-
if (i == tele.getAttemptHabClimbLevel()) {
106-
attemptHabClimbLevel[i - 1].setChecked(true);
107-
}
108-
}
109-
110-
if (partnerClimbsAssisted.getValue() >= 1) {
111-
radioButtonEnable(highestAssistedClimbLevelGroup, true);
112-
}
113-
114-
autoDisableSuccessGroup();
115-
116-
}
117-
}
118-
119-
@Override
120-
public void saveState() {
121-
122-
entry.setTeleOp(new TeleOp(cargoShipHatches.getValue(),
123-
cargoShipCargo.getValue(),
124-
rocketLevelOneCargo.getValue(),
125-
rocketLevelOneHatches.getValue(),
126-
rocketLevelTwoCargo.getValue(),
127-
rocketLevelTwoHatches.getValue(),
128-
rocketLevelThreeCargo.getValue(),
129-
rocketLevelThreeHatches.getValue(),
130-
hatchesDropped.getValue(),
131-
cargoDropped.getValue(),
132-
climbAssistedByPartners.isChecked(),
133-
getHabLevelSelected(attemptHabClimbLevel),
134-
getHabLevelSelected(successHabClimbLevel),
135-
attemptHabClimb.isChecked(),
136-
successHabClimb.isChecked(),
137-
getIntegerFromTextBox(teamNumberThatAssistedClimb),
138-
partnerClimbsAssisted.getValue(),
139-
getHighestHabLevelSelected(highestAssistedClimbLevel)));
140-
141-
}
142-
143-
public static void radioButtonEnable(RadioGroup groupToEnableOrDisable, boolean modeSelected) {
144-
if (modeSelected) {
145-
for (int i = 0; i < groupToEnableOrDisable.getChildCount(); i++) {
146-
groupToEnableOrDisable.getChildAt(i).setEnabled(true);
147-
}
148-
} else {
149-
for (int i = 0; i < groupToEnableOrDisable.getChildCount(); i++) {
150-
groupToEnableOrDisable.getChildAt(i).setEnabled(false);
151-
groupToEnableOrDisable.clearCheck();
152-
}
153-
}
154-
}
155-
15667
@Override
15768
public View onCreateView(LayoutInflater inflater, ViewGroup container,
15869
Bundle savedInstanceState) {
@@ -252,6 +163,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
252163

253164
});
254165

166+
autoPopulate();
255167

256168
continueButton.setOnClickListener(view1 -> {
257169
hideKeyboard();
@@ -283,6 +195,95 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
283195
return view;
284196
}
285197

198+
@Override
199+
public void saveState() {
200+
201+
entry.setTeleOp(new TeleOp(cargoShipHatches.getValue(),
202+
cargoShipCargo.getValue(),
203+
rocketLevelOneCargo.getValue(),
204+
rocketLevelOneHatches.getValue(),
205+
rocketLevelTwoCargo.getValue(),
206+
rocketLevelTwoHatches.getValue(),
207+
rocketLevelThreeCargo.getValue(),
208+
rocketLevelThreeHatches.getValue(),
209+
hatchesDropped.getValue(),
210+
cargoDropped.getValue(),
211+
climbAssistedByPartners.isChecked(),
212+
getHabLevelSelected(attemptHabClimbLevel),
213+
getHabLevelSelected(successHabClimbLevel),
214+
attemptHabClimb.isChecked(),
215+
successHabClimb.isChecked(),
216+
getIntegerFromTextBox(teamNumberThatAssistedClimb),
217+
partnerClimbsAssisted.getValue(),
218+
getHighestHabLevelSelected(highestAssistedClimbLevel)));
219+
220+
}
221+
222+
public static void radioButtonEnable(RadioGroup groupToEnableOrDisable, boolean modeSelected) {
223+
if (modeSelected) {
224+
for (int i = 0; i < groupToEnableOrDisable.getChildCount(); i++) {
225+
groupToEnableOrDisable.getChildAt(i).setEnabled(true);
226+
}
227+
} else {
228+
for (int i = 0; i < groupToEnableOrDisable.getChildCount(); i++) {
229+
groupToEnableOrDisable.getChildAt(i).setEnabled(false);
230+
groupToEnableOrDisable.clearCheck();
231+
}
232+
}
233+
}
234+
235+
@Override
236+
public void autoPopulate() {
237+
if (entry.getTeleOp() != null) {
238+
TeleOp tele = entry.getTeleOp();
239+
240+
cargoShipHatches.setValue(tele.getCargoShipHatches());
241+
cargoShipCargo.setValue(tele.getCargoShipCargo());
242+
rocketLevelOneCargo.setValue(tele.getRocketLevelOneCargo());
243+
rocketLevelOneHatches.setValue(tele.getRocketLevelOneHatches());
244+
rocketLevelTwoCargo.setValue(tele.getRocketLevelTwoCargo());
245+
rocketLevelTwoHatches.setValue(tele.getRocketLevelTwoHatches());
246+
rocketLevelThreeCargo.setValue(tele.getRocketLevelThreeCargo());
247+
rocketLevelThreeHatches.setValue(tele.getRocketLevelThreeHatches());
248+
249+
climbAssistedByPartners.setChecked(tele.isClimbAssistedByPartners());
250+
partnerClimbsAssisted.setValue(tele.getNumberOfPartnerClimbsAssisted());
251+
hatchesDropped.setValue(tele.getHatchesDropped());
252+
cargoDropped.setValue(tele.getCargoDropped());
253+
attemptHabClimb.setChecked(tele.isAttemptHabClimb());
254+
successHabClimb.setChecked(tele.isSuccessHabClimb());
255+
256+
if (tele.getAssistingClimbTeamNumber() != 0) {
257+
teamNumberThatAssistedClimb.setText(Integer.toString(tele.getAssistingClimbTeamNumber()));
258+
}
259+
260+
for (int i = 2; i <= 3; i++) {
261+
if (i == tele.getHighestClimbAssisted()) {
262+
highestAssistedClimbLevel[i - 2].setChecked(true);
263+
}
264+
}
265+
266+
for (int i = 1; i <= successHabClimbLevel.length; i++) {
267+
if (i == tele.getSuccessHabClimbLevel()) {
268+
successHabClimbLevel[i - 1].setChecked(true);
269+
}
270+
}
271+
272+
for (int i = 1; i <= attemptHabClimbLevel.length; i++) {
273+
if (i == tele.getAttemptHabClimbLevel()) {
274+
attemptHabClimbLevel[i - 1].setChecked(true);
275+
}
276+
}
277+
278+
if (partnerClimbsAssisted.getValue() >= 1) {
279+
radioButtonEnable(highestAssistedClimbLevelGroup, true);
280+
}
281+
282+
autoDisableSuccessGroup();
283+
284+
}
285+
}
286+
286287
public static boolean checkIfButtonIsChecked(RadioButton[] groupToCheck) {
287288
for (RadioButton button : groupToCheck) {
288289
if (button.isChecked()) {

scoutingapp/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
note that there is no trailing zero for the patch version. Tags on GitHub follow the same scheme,
1212
except the letter "v" is appended to the version number.
1313
Version 1.0 was created for the 2017 FRC season (FIRST Steamworks).-->
14-
<string name="version_number">v3.01</string>
14+
<string name="version_number">v3.02</string>
1515

1616
<!-- Name of the cheatsheet file in /assets-->
1717
<string name="cheatsheet_filename">Deep Space Cheatsheet.pdf</string>

0 commit comments

Comments
 (0)