Skip to content

Commit

Permalink
Added event values for TBA short names, fixed team list checking
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerng committed Mar 22, 2017
1 parent f022943 commit d1f585a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 33 deletions.
Binary file added app/app-release.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
scoutPos.setFloatingLabel(MaterialAutoCompleteTextView.FLOATING_LABEL_NORMAL);

event = (MaterialBetterSpinner) view.findViewById(R.id.event_spin);
event.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_dropdown_item_1line, getResources().getStringArray(R.array.event_options)));
event.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_dropdown_item_1line, getResources().getStringArray(R.array.event_options_values)));
event.setFloatingLabel(MaterialAutoCompleteTextView.FLOATING_LABEL_NORMAL);

name = (MaterialEditText) view.findViewById(R.id.scout_name_field);
Expand Down Expand Up @@ -126,7 +126,6 @@ else if(Integer.parseInt(matchNum.getText().toString()) < 1 || Integer.parseInt(
proceed=false;
}

Log.i("tag",Settings.newInstance(getActivity()).getMatchType());
//TODO Pull team numbers from The Blue Alliance for verification
if(teamNum.getText().toString().equals("") || Integer.parseInt(teamNum.getText().toString()) < 1 || Integer.parseInt(teamNum.getText().toString()) > 9999) {
if (teamNum.getText().toString().equals(""))
Expand All @@ -136,11 +135,12 @@ else if(Integer.parseInt(matchNum.getText().toString()) < 1 || Integer.parseInt(
}


else if(Settings.newInstance(getActivity()).useTeamList()){
if(proceed) { //Alert is only displayed after all other errors are fixed

if(Settings.newInstance(getActivity()).useTeamList()&&proceed){
boolean checkTeamList = false;
try {
if (Settings.newInstance(getActivity()).getMatchType().equals("Q")&&!FileManager.getTeamPlaying(getActivity(), scoutPos.getText().toString(), Integer.parseInt(matchNum.getText().toString())).equals(teamNum.getText().toString())) {
if(!Settings.newInstance(getActivity()).getMatchType().equals("Q")) //Non-quals matches don't get checked against match schedule
checkTeamList = true;
else if (!FileManager.getTeamPlaying(getActivity(), scoutPos.getText().toString(), Integer.parseInt(matchNum.getText().toString())).equals(teamNum.getText().toString())) {

proceed = false;
new AlertDialog.Builder(getActivity())
Expand All @@ -166,35 +166,34 @@ public void onClick(DialogInterface dialog, int which) {
.show();

}

} catch (IOException e) {
//Match list does not exist; looking for team list

e.printStackTrace();
if(!FileManager.isOnTeamlist(teamNum.getText().toString(),getActivity())) {
proceed = false;
new AlertDialog.Builder(getActivity())
.setTitle("Confirm team number")
.setMessage("Are you sure that team " + teamNum.getText().toString() + " is playing this match?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
FileManager.addToTeamList(teamNum.getText().toString(), getActivity());
continueButton.callOnClick();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {

}
})
.create()
.show();
}
checkTeamList = true;
}
if(checkTeamList&&!FileManager.isOnTeamlist(teamNum.getText().toString(),getActivity())) {
proceed = false;
new AlertDialog.Builder(getActivity())
.setTitle("Confirm team number")
.setMessage("Are you sure that team " + teamNum.getText().toString() + " is playing this match?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
FileManager.addToTeamList(teamNum.getText().toString(), getActivity());
continueButton.callOnClick();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {

}
})
.create()
.show();
}
}

}



if(proceed) {
saveState();

Expand Down
10 changes: 9 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@
<item>"Mount Olive"</item>
<item>"Montgomery"</item>
<item>"MAR District Championship</item>
<item>"St. Louis World Championships"</item>
<item>"St. Louis World Championship"</item>
<item>"Brunswick Eruption"</item>
</string-array>

<string-array name="event_options_values">
<item>"Mount Olive"</item>
<item>"Montgomery"</item>
<item>"Mid-Atlantic"</item>
<item>"Darwin"</item>
<item>"Brunswick Eruption"</item>
</string-array>

Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="General"
android:layout="@layout/preference_category_normal"/>
android:layout="@layout/preference_category_normal"
/>

<EditTextPreference
android:key="scout_name"
Expand Down Expand Up @@ -45,7 +46,7 @@
android:key="event"
android:title="@string/event"
android:entries="@array/event_options"
android:entryValues="@array/event_options"
android:entryValues="@array/event_options_values"
android:defaultValue="Brunswick Eruption"
android:summary="%s" />

Expand All @@ -56,6 +57,7 @@
android:summary="2017"
android:layout="@layout/preference_normal"
android:enabled="true"

/>

<PreferenceCategory
Expand Down Expand Up @@ -127,7 +129,7 @@

<Preference
android:title="Version"
android:summary="v1.1"/>
android:summary="v1.11"/>



Expand Down

0 comments on commit d1f585a

Please sign in to comment.