commit 2e142b56b75b876a6cf75129593fbb93f0313b75
Author: ncgears <1918ncgears@gmail.com>
Date: Tue Apr 23 18:39:21 2024 -0400
Initial commit
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..21c2028
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# ScoutingBase
+Base Project for NC GEARS Scouting app
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..be55868
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1,59 @@
+#built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+bin/
+gen/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+# Windows thumbnail db
+Thumbs.db
+
+# OSX files
+.DS_Store
+
+# Android Studio
+*.iml
+.idea
+#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
+.gradle
+build/
+.navigation
+captures/
+output.json
+
+#NDK
+obj/
+.externalNativeBuild
+Since Android Studio 2.2 and up to 3.0, new projects are created with this gitignore file:
+
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+Deprecated - for older project format, add this section to your gitignore file:
+
+
+/*/out
+/*/*/build
+/*/*/production
+*.iws
+*.ipr
+*~
+*.swp
+
+Settings.java
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..4b5e6a2
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,35 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 26
+ defaultConfig {
+ applicationId "com.example.vande.scouting2018"
+ minSdkVersion 17
+ targetSdkVersion 26
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ namespace 'com.example.ncgears.scouting'
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ implementation 'com.android.support:appcompat-v7:26.1.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'com.jakewharton:butterknife:8.7.0'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
+ implementation 'com.android.support:design:26.1.0'
+ testImplementation 'junit:junit:4.12'
+ implementation files('libs/javacsv.jar')
+
+}
diff --git a/app/libs/javacsv.jar b/app/libs/javacsv.jar
new file mode 100644
index 0000000..84e3353
Binary files /dev/null and b/app/libs/javacsv.jar differ
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..136e284
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..1c1f32f
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/com/example/ncgears/scouting/AutonActivity.java b/app/src/main/java/com/example/ncgears/scouting/AutonActivity.java
new file mode 100644
index 0000000..c81bdcf
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/AutonActivity.java
@@ -0,0 +1,525 @@
+/*
+
+ *************** Code Designed by Team 107 Team Robotics *********************
+ *************** Edited for Team 1918 By Nate and Ken *********************
+
+
+ */
+
+package com.example.ncgears.scouting;
+
+import android.Manifest;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.design.widget.TextInputEditText;
+import android.support.design.widget.TextInputLayout;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.ncgears.scouting.data.TeamsDbHelper;
+
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import utils.FormatStringUtils;
+import utils.StringUtils;
+import utils.ViewUtils;
+
+public class AutonActivity extends AppCompatActivity implements View.OnKeyListener {
+
+ /*This area sets and binds all of the variables that we will use in the auton activity*/
+ public static String AUTON_STRING_EXTRA = "auton_extra";
+
+ /* These are the names of the match number and team number extras that will be passed into teleop */
+ public static final String MATCH_STRING_EXTRA = "match_extra";
+ public static final String TEAMNUMBER_STRING_EXTRA = "teamnumber_extra";
+
+
+ @BindView(R.id.team_number_spinner)
+ public Spinner TeamNumberInputLayout;
+
+ @BindView(R.id.auto_high_attempt_input_layout)
+ public TextInputLayout AutoHighAttemptInputLayout;
+
+ @BindView(R.id.auto_high_attempt_input)
+ public TextInputEditText AutoHighAttemptInput;
+
+ @BindView(R.id.auto_high_made_layout)
+ public TextInputLayout AutoHighMadeLayout;
+
+ @BindView(R.id.auto_high_made_input)
+ public TextInputEditText AutoHighMadeInput;
+
+ @BindView(R.id.auto_low_attempt_input_layout)
+ public TextInputLayout AutoLowAttemptInputLayout;
+
+ @BindView(R.id.auto_low_attempt_input)
+ public TextInputEditText AutoLowAttemptInput;
+
+ @BindView(R.id.auto_low_made_layout)
+ public TextInputLayout AutoLowMadeLayout;
+
+ @BindView(R.id.auto_low_made_input)
+ public TextInputEditText AutoLowMadeInput;
+
+ //Trap Starts
+ @BindView(R.id.auto_trap_attempt_input_layout)
+ public TextInputLayout AutoTrapAttemptInputLayout;
+
+ @BindView(R.id.auto_trap_attempt_input)
+ public TextInputEditText AutoTrapAttemptInput;
+
+ @BindView(R.id.auto_trap_made_layout)
+ public TextInputLayout AutoTrapMadeLayout;
+
+ @BindView(R.id.auto_trap_made_input)
+ public TextInputEditText AutoTrapMadeInput;
+ //Trap Ends
+ @BindView(R.id.matchNumber_input_layout)
+ public TextInputLayout matchNumberInputLayout;
+
+ @BindView(R.id.matchNumber_input)
+ public EditText matchNumberInput;
+
+ @BindView(R.id.starting_location)
+ public Spinner startingLocation;
+
+ @BindView(R.id.auto_initiation_line)
+ RadioGroup autoInitiationLine;
+
+ @BindView(R.id.next_button)
+ public Button nextButton;
+
+ int HighAttempt = 0;
+ int HighMissed =0;
+ int HighMade = 0;
+ int LowAttempt = 0;
+ int LowMissed = 0;
+ int LowMade = 0;
+ int TrapAttempt = 0;
+ int TrapMade = 0;
+ int TrapMissed = 0;
+
+ public ArrayList team_numbers = new ArrayList<>();
+ private ArrayList autonDataStringList;
+ public static final int REQUEST_CODE = 1;
+
+
+ /*When this activity is first called,
+ *we will call the activity_auton layout so we can display
+ *the user interface
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ TeamsDbHelper mDbHelper = new TeamsDbHelper(this);
+ SQLiteDatabase db = mDbHelper.getReadableDatabase();
+
+ setContentView(R.layout.activity_auton);
+ ButterKnife.bind(this);
+ autonDataStringList = new ArrayList<>();
+ team_numbers = TeamsDbHelper.getTeamNumbers(db);
+
+ checkForPermissions();
+
+ AutoHighAttemptInput.setText("" + HighMissed);
+ AutoHighMadeInput.setText("" + HighMade);
+ AutoLowAttemptInput.setText("" + LowMissed);
+ AutoLowMadeInput.setText("" + LowMade);
+ AutoTrapAttemptInput.setText("" + TrapMissed);
+ AutoTrapMadeInput.setText("" + TrapMade);
+
+
+ // --- Team Numbers spinner ---
+
+ Spinner teamnumberspinner = (Spinner) findViewById(R.id.team_number_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter teamnumberadapter = new ArrayAdapter(AutonActivity.this,
+ android.R.layout.simple_spinner_dropdown_item, team_numbers);
+// Specify the layout to use when the list of choices appears
+ teamnumberadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ teamnumberspinner.setAdapter(teamnumberadapter);
+
+
+ }
+
+ /*If this activity is resumed from a paused state the data
+ *will be set to what they previously were set to
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ autonDataStringList.clear();
+
+ TeamNumberInputLayout.setOnKeyListener(this);
+ AutoHighAttemptInputLayout.setOnKeyListener(this);
+ AutoHighMadeLayout.setOnKeyListener(this);
+ AutoLowAttemptInputLayout.setOnKeyListener(this);
+ AutoLowMadeLayout.setOnKeyListener(this);
+ AutoTrapAttemptInputLayout.setOnKeyListener(this);
+ AutoTrapMadeLayout.setOnKeyListener(this);
+ matchNumberInput.setOnKeyListener(this);
+ startingLocation.setOnKeyListener(this);
+
+
+ }
+
+ /*If this activity enters a paused state the data will be set to null*/
+ @Override
+ protected void onPause() {
+ super.onPause();
+
+ TeamNumberInputLayout.setOnKeyListener(null);
+ AutoHighAttemptInputLayout.setOnKeyListener(null);
+ AutoHighMadeLayout.setOnKeyListener(null);
+ AutoLowAttemptInputLayout.setOnKeyListener(null);
+ AutoLowMadeLayout.setOnKeyListener(null);
+ AutoTrapAttemptInputLayout.setOnKeyListener(null);
+ AutoTrapMadeLayout.setOnKeyListener(null);
+ matchNumberInput.setOnKeyListener(null);
+ startingLocation.setOnKeyListener(null);
+
+ }
+
+ /* This method will display the options menu when the icon is pressed
+ * and this will inflate the menu options for the user to choose
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ /*This method will launch the correct activity
+ *based on the menu option user presses
+ */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.main_activity:
+ startActivity(new Intent(this, MainActivity.class));
+ return true;
+ case R.id.send_data:
+ startActivity(new Intent(this, SendDataActivity.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+
+ /*This method will look at all of the text/number input fields and set error
+ *for validation of data entry
+ */
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ if (keyCode != KeyEvent.KEYCODE_SPACE && keyCode != KeyEvent.KEYCODE_TAB) {
+ TextInputEditText inputEditText = (TextInputEditText) v;
+
+ if (inputEditText != null) {
+
+ switch (inputEditText.getId()) {
+
+
+ case R.id.matchNumber_input:
+ matchNumberInputLayout.setError(null);
+ break;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /*This method takes place when the Show teleop button is pressed
+ *This will first check if the text fields are empty and highlight
+ * The area not completed as well as put that text input as the focus
+ * to the user in the app. If everything passes by being filled in,
+ * The value of the radio buttons will be obtained.
+ * Then all of the values of this activity are added to the autonDataStringList
+ * delimited by a comma. This method will then launch the teleop activity while sending
+ * over our list of data. A request on result is requested so we can clear this aplication
+ * after the teleop activity closes
+ */
+ public void onShowTeleop(View view) {
+ boolean allInputsPassed = false;
+
+ final RadioButton autoInitiationLineRadioBtn = findViewById(autoInitiationLine.getCheckedRadioButtonId());
+
+ if (TeamNumberInputLayout.getSelectedItem().toString().equals("Select Team Number")) {
+ setSpinnerError(TeamNumberInputLayout, "Select a Team Number.");
+ ViewUtils.requestFocus(TeamNumberInputLayout, this);
+ } else if (StringUtils.isEmptyOrNull(getTextInputLayoutString(matchNumberInputLayout)) || Integer.valueOf(getTextInputLayoutString(matchNumberInputLayout)) == 0 || Integer.valueOf(getTextInputLayoutString(matchNumberInputLayout)) >= 150) {
+ matchNumberInput.setText("");
+ matchNumberInputLayout.setError(getText(R.string.matchNumberError));
+ ViewUtils.requestFocus(matchNumberInputLayout, this);
+ } else {
+ allInputsPassed = true;
+ }
+
+ if (!allInputsPassed) {
+ return;
+ }
+
+ autonDataStringList.add(TeamNumberInputLayout.getSelectedItem().toString());
+ autonDataStringList.add(getTextInputLayoutString(matchNumberInputLayout));
+// autonDataStringList.add(startingLocation.getSelectedItem().toString());
+ autonDataStringList.add(getTextInputLayoutString(AutoHighAttemptInputLayout));
+ autonDataStringList.add(getTextInputLayoutString(AutoHighMadeLayout));
+ autonDataStringList.add(getTextInputLayoutString(AutoLowAttemptInputLayout));
+ autonDataStringList.add(getTextInputLayoutString(AutoLowMadeLayout));
+ autonDataStringList.add(getTextInputLayoutString(AutoTrapAttemptInputLayout));
+ autonDataStringList.add(getTextInputLayoutString(AutoTrapMadeLayout));
+ autonDataStringList.add(autoInitiationLineRadioBtn.getText().toString());
+
+
+
+
+ //autonDataStringList.add(playStyle.getSelectedItem().toString());
+
+ final Intent intent = new Intent(this, TeleopActivity.class);
+ intent.putExtra(AUTON_STRING_EXTRA, FormatStringUtils.addDelimiter(autonDataStringList, "|"));
+ intent.putExtra(MATCH_STRING_EXTRA, getTextInputLayoutString(matchNumberInputLayout));
+ intent.putExtra(TEAMNUMBER_STRING_EXTRA, TeamNumberInputLayout.getSelectedItem().toString());
+
+ startActivityForResult(intent, REQUEST_CODE);
+
+
+ matchNumberInputLayout.setError(null);
+
+ matchNumberInput.requestFocus();
+
+ }
+
+
+ /*This method will check for the result code from the teleop activity
+ *so we can clear the data before the next match scouting starts
+ */
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ try {
+ super.onActivityResult(requestCode, resultCode, data);
+
+ if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
+ clearData();
+ finish();
+ }
+ } catch (Exception ex) {
+ Toast.makeText(this, ex.toString(), Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ /*This method will clear all of the text entry fields as well
+ * as reset the checkboxes and reset the radio buttons to their default*/
+ public void clearData() {
+ TeamNumberInputLayout.setSelection(0);
+ matchNumberInput.setText("");
+ startingLocation.setSelection(0);
+ AutoHighAttemptInput.setText("" + HighMissed);
+ AutoHighMadeInput.setText("" + HighMade);
+ AutoLowAttemptInput.setText("" + LowMissed);
+ AutoLowMadeInput.setText("" + LowMade);
+ AutoTrapAttemptInput.setText("" + TrapAttempt);
+ AutoTrapMadeInput.setText("" + TrapMade);
+ HighAttempt = 0;
+ HighMissed =0;
+ HighMade = 0;
+ LowAttempt = 0;
+ LowMissed = 0;
+ LowMade = 0;
+ TrapAttempt = 0;
+ TrapMissed = 0;
+ TrapMade = 0;
+ autoInitiationLine.check(R.id.AutoInitiationLine_yes);
+ displayAutoHighAttemptInput(HighMissed);
+ displayAutoHighMadeInput(HighMade);
+ displayAutoLowAttemptInput(LowMissed);
+ displayAutoLowMadeInput(LowMade);
+
+
+ }
+
+
+ private void setSpinnerError(Spinner spinner, String error) {
+ View selectedView = spinner.getSelectedView();
+ if (selectedView instanceof TextView) {
+ spinner.requestFocus();
+ TextView selectedTextView = (TextView) selectedView;
+ selectedTextView.setError("error");
+ selectedTextView.setTextColor(Color.RED);
+ selectedTextView.setText(error);
+
+ }
+ }
+
+
+ /* This method will change the text entered into the app into a string if it is not already*/
+ private String getTextInputLayoutString(@NonNull TextInputLayout textInputLayout) {
+ final EditText editText = textInputLayout.getEditText();
+ return editText != null && editText.getText() != null ? editText.getText().toString() : "";
+ }
+
+ private void checkForPermissions() {
+ int writePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
+
+ if (writePermission != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
+ }
+ }
+
+ public void decreaseAutoHighAttemptInput(View view) {
+ if (HighMissed != 0) {
+ HighMissed -= 1;
+ HighAttempt -=1;
+
+ displayAutoHighAttemptInput(HighMissed);
+
+ }
+ }
+
+ public void increaseAutoHighAttemptInput(View view) {
+ if (HighMissed <= 800) {
+ HighMissed += 1;
+ HighAttempt +=1;
+ displayAutoHighAttemptInput(HighMissed);
+ }
+
+ }
+
+ private void displayAutoHighAttemptInput(int number) {
+
+ AutoHighAttemptInput.setText("" + number);
+ }
+
+ public void decreaseAutoHighMadeInput(View view) {
+ if (HighMade != 0) {
+ HighMade -= 1;
+ HighAttempt -= 1;
+ displayAutoHighMadeInput(HighMade);
+ }
+ }
+
+ public void increaseAutoHightMadeInput(View view) {
+ if (HighMade <= 800) {
+ HighMade +=1;
+ HighAttempt += 1;
+ displayAutoHighMadeInput(HighMade);
+ }
+
+ }
+
+ private void displayAutoHighMadeInput(int number) {
+
+ AutoHighMadeInput.setText("" + number);
+ }
+
+ public void decreaseAutoLowAttemptInput(View view) {
+ if (LowMissed != 0) {
+ LowMissed -= 1;
+ LowAttempt -=1;
+
+ displayAutoLowAttemptInput(LowMissed);
+ }
+ }
+
+ public void increaseAutoLowAttemptInput(View view) {
+ if (LowMissed <= 800) {
+ LowMissed += 1;
+ LowAttempt += 1;
+ displayAutoLowAttemptInput(LowMissed);
+ }
+
+ }
+
+ private void displayAutoLowAttemptInput(int number) {
+
+ AutoLowAttemptInput.setText("" + number);
+ }
+
+ public void decreaseAutoLowMadeInput(View view) {
+ if (LowMade != 0) {
+ LowMade -= 1;
+ LowAttempt -=1;
+ displayAutoLowMadeInput(LowMade);
+ }
+ }
+
+ public void increaseAutoLowMadeInput(View view) {
+ if (LowMade <= 800) {
+ LowMade += 1;
+ LowAttempt +=1;
+ displayAutoLowMadeInput(LowMade);
+
+ }
+
+ }
+
+ private void displayAutoLowMadeInput(int number) {
+
+ AutoLowMadeInput.setText("" + number);
+ }
+ public void decreaseAutoTrapAttemptInput(View view) {
+ if (TrapMissed != 0) {
+ TrapMissed -= 1;
+ TrapAttempt -=1;
+
+ displayAutoTrapAttemptInput(TrapMissed);
+ }
+ }
+ public void increaseAutoTrapAttemptInput(View view) {
+ if (TrapMissed <= 800) {
+ TrapMissed += 1;
+ TrapAttempt += 1;
+ displayAutoTrapAttemptInput(TrapMissed);
+ }
+
+ }
+
+ public void decreaseAutoTrapMadeInput(View view) {
+ if (TrapMade != 0) {
+ TrapMade -= 1;
+ TrapAttempt -=1;
+ displayAutoTrapMadeInput(TrapMade);
+ }
+ }
+
+ public void increaseAutoTrapMadeInput(View view) {
+ if (TrapMade <= 800) {
+ TrapMade += 1;
+ TrapAttempt +=1;
+ displayAutoTrapMadeInput(TrapMade);
+
+ }
+
+ }
+ private void displayAutoTrapMadeInput(int number) {
+
+ AutoTrapMadeInput.setText("" + number);
+ }
+ private void displayAutoTrapAttemptInput(int number) {
+
+ AutoTrapAttemptInput.setText("" + number);
+ }
+}
+
diff --git a/app/src/main/java/com/example/ncgears/scouting/MainActivity.java b/app/src/main/java/com/example/ncgears/scouting/MainActivity.java
new file mode 100644
index 0000000..036be07
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/MainActivity.java
@@ -0,0 +1,154 @@
+/*
+
+ *************** Code Designed by Team 107 Team Robotics *********************
+ *************** Edited for Team 1918 By Nate and Ken *********************
+
+
+ */
+
+package com.example.ncgears.scouting;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.database.sqlite.SQLiteDatabase;
+import android.inputmethodservice.Keyboard;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.support.design.widget.TextInputEditText;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.ncgears.scouting.customToast.CustomToast;
+import com.example.ncgears.scouting.data.GetJasonData;
+import com.example.ncgears.scouting.data.TeamsContract.TeamEntry;
+import com.example.ncgears.scouting.data.TeamsDbHelper;
+
+import org.json.JSONArray;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+
+import butterknife.ButterKnife;
+
+public class MainActivity extends AppCompatActivity implements View.OnKeyListener {
+
+
+ public static TextView data;
+ public static String TeamsList = "No teams loaded";
+ public static String postData;
+
+ SQLiteDatabase db;
+
+ public ArrayList teams = new ArrayList<>();
+
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_main);
+ ButterKnife.bind(this);
+
+ // set up Database object
+ TeamsDbHelper mDbHelper = new TeamsDbHelper(this);
+ db = mDbHelper.getWritableDatabase();
+
+ teams = TeamsDbHelper.getTeams(db);
+
+ if (!teams.isEmpty()){
+ TeamsList = "";
+ for(int i =0; i < teams.size(); i++){
+
+ TeamsList = TeamsList + teams.get(i) + "\n";
+ }
+ }
+
+ data = findViewById(R.id.TeamsList);
+ data.setText(TeamsList);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.main_activity:
+ startActivity(new Intent(this, MainActivity.class));
+ return true;
+ case R.id.send_data:
+ startActivity(new Intent(this, SendDataActivity.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ if (keyCode != KeyEvent.KEYCODE_SPACE && keyCode != KeyEvent.KEYCODE_TAB) {
+ TextInputEditText inputEditText = (TextInputEditText) v;
+
+ if (inputEditText != null) {
+
+ switch (inputEditText.getId()) {
+
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isNetworkAvailable(){
+ ConnectivityManager connectivityManager
+ = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
+ return activeNetworkInfo !=null && activeNetworkInfo.isConnected();
+ }
+
+ public void showMatch(View view) {
+ startActivity(new Intent(this, ScouterInitialsActivity.class));
+ }
+
+ public void showPit(View view) {
+ startActivity(new Intent(this, PitActivity.class));
+ }
+
+ public void sendData(View view) {
+ startActivity(new Intent(this, SendDataActivity.class));
+ }
+
+ public void getTeams(View view){
+
+ if(isNetworkAvailable()){
+
+ TeamsDbHelper.dropTable(db);
+ TeamsDbHelper.createTable(db);
+ GetJasonData process = new GetJasonData(this);
+ process.execute();
+
+ Toast.makeText(this, "Import Complete", Toast.LENGTH_LONG).show();
+ }
+ else{
+
+ CustomToast.showLong(this, "Sorry! But your WiFi doesn't seem to be on at this time");
+
+
+ }
+
+
+
+ }
+}
diff --git a/app/src/main/java/com/example/ncgears/scouting/PitActivity.java b/app/src/main/java/com/example/ncgears/scouting/PitActivity.java
new file mode 100644
index 0000000..ecfc50b
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/PitActivity.java
@@ -0,0 +1,980 @@
+/*
+
+ *************** Code Designed by Team 107 Team Robotics *********************
+ *************** Edited for Team 1918 By Nate and Ken *********************
+
+
+ */
+
+package com.example.ncgears.scouting;
+
+import android.Manifest;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.MediaStore;
+import android.provider.Settings;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.support.v4.content.FileProvider;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.Spinner;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.ncgears.scouting.data.TeamsDbHelper;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import utils.FormatStringUtils;
+import utils.PermissionUtils;
+import utils.StringUtils;
+import utils.ViewUtils;
+
+/**
+ * Created by Matt from Team 107 on 9/30/2017.
+ * Borrowed by Ken from Team 1918 on 1/7/2019.
+ */
+
+public class PitActivity extends AppCompatActivity implements View.OnKeyListener {
+
+ @BindView(R.id.pit_team_number_spinner)
+ public Spinner pitTeamNumberSpinner;
+
+ @BindView(R.id.pit_power_cell_pickup_radio_group)
+ public RadioGroup pitPowerCellPickupRadioGroup;
+
+ @BindView(R.id.pit_robot_weight)
+ public EditText pitRobotWeight;
+
+ @BindView(R.id.pit_drive_train_spinner)
+ public Spinner pitDriveTrainSpinner;
+
+ @BindView(R.id.drive_train_other)
+ public EditText driveTrainOther;
+
+ @BindView(R.id.pit_programming_language_spinner)
+ public Spinner pitProgrammingLanguages;
+
+ @BindView(R.id.programming_language_other)
+ public EditText programmingLanguageOther;
+
+ @BindView(R.id.pit_basic_plan)
+ public EditText pitBasicPlan;
+
+ @BindView(R.id.pit_auto_programs)
+ public EditText pitAutoPrograms;
+
+ @BindView(R.id.pit_shoot_target_zone)
+ public CheckBox pitShootTargetZone;
+
+ @BindView(R.id.pit_shoot_field_front)
+ public CheckBox pitShootFieldFront;
+
+ @BindView(R.id.pit_shoot_field_diagonal)
+ public CheckBox pitShootFieldDiagonal;
+
+ @BindView(R.id.pit_shoot_trench_near)
+ public CheckBox pitShootTrenchNear;
+
+ @BindView(R.id.pit_shoot_trench_far)
+ public CheckBox pitShootTrenchFar;
+
+ @BindView(R.id.pit_shoot_other)
+ public CheckBox pitShootOther;
+
+ public String shotString = "";
+
+ @BindView(R.id.pit_fav_target_zone)
+ public CheckBox pitFavTargetZone;
+
+ @BindView(R.id.pit_fav_field_front)
+ public CheckBox pitFavFieldFront;
+
+ @BindView(R.id.pit_fav_field_diagonal)
+ public CheckBox pitFavFieldDiagonal;
+
+ @BindView(R.id.pit_fav_trench_near)
+ public CheckBox pitFavTrenchNear;
+
+ @BindView(R.id.pit_fav_trench_far)
+ public CheckBox pitFavTrenchFar;
+
+ @BindView(R.id.pit_fav_other)
+ public CheckBox pitFavOther;
+
+ public String favShotString = "";
+
+// @BindView(R.id.pit_end_game_location_spinner)
+// public Spinner pitEndGameLocationSpinner;
+
+ @BindView(R.id.pit_shot_location_inner)
+ public CheckBox pitShotLocationInner;
+
+ @BindView(R.id.pit_shot_location_outer)
+ public CheckBox pitShotLocationOuter;
+
+ @BindView(R.id.pit_shot_location_bottom)
+ public CheckBox pitShotLocationBottom;
+
+ @BindView(R.id.pit_shot_location_na)
+ public CheckBox pitShotLocationNa;
+
+ public String pitShotLocationString = "";
+
+// @BindView(R.id.pit_control_panel_rotate_3to5)
+ public CheckBox pitControlPanelRotate3to5;
+
+// @BindView(R.id.pit_control_panel_position)
+ public CheckBox pitControlPanelPosition;
+
+// @BindView(R.id.pit_control_panel_nothing)
+ public CheckBox pitControlPanelNothing;
+
+ public String ControlPanelString = "";
+
+ @BindView(R.id.pit_endgame_location)
+ public RadioGroup pitEndgameLocation;
+
+ @BindView(R.id.pit_drive_thru_trench)
+ public RadioGroup pitDriveThruTrench;
+
+// @BindView(R.id.pit_endgame_hang)
+// public CheckBox pitEndgameHang;
+
+ @BindView(R.id.scouterInitials_input)
+ public EditText scouterInitialsInput;
+
+
+ @BindView(R.id.take_photo_btn)
+ public Button takePhotoBtn;
+
+ @BindView(R.id.save_pit_btn)
+ public Button savePitBtn;
+
+ @BindView(R.id.pit_robot_name)
+ public EditText RobotNameInput;
+
+ public ArrayList team_numbers = new ArrayList<>();
+ private ArrayList pitDataStringList;
+
+
+
+
+
+
+
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ TeamsDbHelper mDbHelper = new TeamsDbHelper(this);
+ SQLiteDatabase db = mDbHelper.getReadableDatabase();
+
+ setContentView(R.layout.activity_pit);
+ pitDataStringList = new ArrayList<>();
+
+ team_numbers = TeamsDbHelper.getTeamNumbers(db);
+
+ ButterKnife.bind(this);
+
+ checkForPermissions();
+
+ pitDriveTrainSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> adapterView, View view, int i, long l) {
+ if(pitDriveTrainSpinner.getSelectedItem().toString().equals("Other")){
+ driveTrainOther.setVisibility(view.VISIBLE);
+ }
+ else{
+ driveTrainOther.setVisibility(view.INVISIBLE);
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> adapterView) {
+
+ }
+ });
+
+ pitProgrammingLanguages.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> adapterView, View view, int i, long l) {
+ if(pitProgrammingLanguages.getSelectedItem().toString().equals("Other")){
+ programmingLanguageOther.setVisibility(view.VISIBLE);
+ }
+ else{
+ programmingLanguageOther.setVisibility(view.INVISIBLE);
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> adapterView) {
+
+ }
+ });
+
+
+ // --- Drive Train spinner ---
+
+ // Spinner drivetrainspinner = (Spinner) findViewById(R.id.pit_drive_train_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter drivetrainadapter = ArrayAdapter.createFromResource(this,
+ R.array.driveTrain, android.R.layout.simple_spinner_item);
+// Specify the layout to use when the list of choices appears
+ drivetrainadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ pitDriveTrainSpinner.setAdapter(drivetrainadapter);
+
+ // --- Team Numbers spinner ---
+
+ // Spinner teamnumberspinner = (Spinner) findViewById(R.id.pit_team_number_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter teamnumberadapter = new ArrayAdapter<>(PitActivity.this,
+ android.R.layout.simple_spinner_dropdown_item, team_numbers);
+// Specify the layout to use when the list of choices appears
+ teamnumberadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ pitTeamNumberSpinner.setAdapter(teamnumberadapter);
+
+
+ // --- Programming languages spinner ---
+
+ // Spinner languagespinner = (Spinner) findViewById(R.id.pit_programming_language_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter languageadapter = ArrayAdapter.createFromResource(this,
+ R.array.programmingLanguages, android.R.layout.simple_spinner_item);
+// Specify the layout to use when the list of choices appears
+ languageadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ pitProgrammingLanguages.setAdapter(languageadapter);
+
+ // --- End Game Location spinner ---
+
+// Spinner pitendgamelocationspinner = (Spinner) findViewById(R.id.pit_end_game_location_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter pitendgamelocationadapter = ArrayAdapter.createFromResource(this,
+ R.array.endgame_location, android.R.layout.simple_spinner_item);
+// Specify the layout to use when the list of choices appears
+ pitendgamelocationadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+// pitendgamelocationspinner.setAdapter(pitendgamelocationadapter);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.main_activity:
+ startActivity(new Intent(this, MainActivity.class));
+ return true;
+ case R.id.send_data:
+ startActivity(new Intent(this, SendDataActivity.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ public void setStringShot(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+
+ case R.id.pit_shoot_trench_near:
+ s1 = pitShootTrenchNear.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_trench_far:
+ s1 = pitShootTrenchFar.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_other:
+ s1 = pitShootOther.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_target_zone:
+ s1 = pitShootTargetZone.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_field_diagonal:
+ s1 = pitShootFieldDiagonal.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_field_front:
+ s1 = pitShootFieldFront.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+ public void setStringFavShot(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+
+ case R.id.pit_fav_trench_near:
+ s1 = pitFavTrenchNear.getText().toString() + " ,";
+ if (checked) {
+ if (favShotString.isEmpty()) {
+ favShotString = s1;
+ } else {
+ favShotString = favShotString + s1;
+ }
+ } else {
+ if (favShotString.contains(s1)) {
+ int start = favShotString.indexOf(s1);
+ favShotString = favShotString.substring(0, start) + favShotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_fav_trench_far:
+ s1 = pitFavTrenchFar.getText().toString() + " ,";
+ if (checked) {
+ if (favShotString.isEmpty()) {
+ favShotString = s1;
+ } else {
+ favShotString = favShotString + s1;
+ }
+ } else {
+ if (favShotString.contains(s1)) {
+ int start = favShotString.indexOf(s1);
+ favShotString = favShotString.substring(0, start) + favShotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_fav_other:
+ s1 = pitFavOther.getText().toString() + " ,";
+ if (checked) {
+ if (favShotString.isEmpty()) {
+ favShotString = s1;
+ } else {
+ favShotString = favShotString + s1;
+ }
+ } else {
+ if (favShotString.contains(s1)) {
+ int start = favShotString.indexOf(s1);
+ favShotString = favShotString.substring(0, start) + favShotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_fav_target_zone:
+ s1 = pitFavTargetZone.getText().toString() + " ,";
+ if (checked) {
+ if (favShotString.isEmpty()) {
+ favShotString = s1;
+ } else {
+ favShotString = favShotString + s1;
+ }
+ } else {
+ if (favShotString.contains(s1)) {
+ int start = favShotString.indexOf(s1);
+ favShotString = favShotString.substring(0, start) + favShotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_fav_field_diagonal:
+ s1 = pitFavFieldDiagonal.getText().toString() + " ,";
+ if (checked) {
+ if (favShotString.isEmpty()) {
+ favShotString = s1;
+ } else {
+ favShotString = favShotString + s1;
+ }
+ } else {
+ if (favShotString.contains(s1)) {
+ int start = favShotString.indexOf(s1);
+ favShotString = favShotString.substring(0, start) + favShotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_fav_field_front:
+ s1 = pitFavFieldFront.getText().toString() + " ,";
+ if (checked) {
+ if (favShotString.isEmpty()) {
+ favShotString = s1;
+ } else {
+ favShotString = favShotString + s1;
+ }
+ } else {
+ if (favShotString.contains(s1)) {
+ int start = favShotString.indexOf(s1);
+ favShotString = favShotString.substring(0, start) + favShotString.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+ public void setPowerPortShotString(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+
+ case R.id.pit_shoot_trench_near:
+ s1 = pitShootTrenchNear.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_trench_far:
+ s1 = pitShootTrenchFar.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_other:
+ s1 = pitShootOther.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shoot_target_zone:
+ s1 = pitShootTargetZone.getText().toString() + " ,";
+ if (checked) {
+ if (shotString.isEmpty()) {
+ shotString = s1;
+ } else {
+ shotString = shotString + s1;
+ }
+ } else {
+ if (shotString.contains(s1)) {
+ int start = shotString.indexOf(s1);
+ shotString = shotString.substring(0, start) + shotString.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+ public void setControlPanelString(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+// switch (view.getId()) {
+//
+// case R.id.pit_control_panel_rotate_3to5:
+// s1 = pitControlPanelRotate3to5.getText().toString() + " ,";
+// if (checked) {
+// if (ControlPanelString.isEmpty()) {
+// ControlPanelString = s1;
+// } else {
+// ControlPanelString = ControlPanelString + s1;
+// }
+// } else {
+// if (ControlPanelString.contains(s1)) {
+// int start = ControlPanelString.indexOf(s1);
+// ControlPanelString = ControlPanelString.substring(0, start) + ControlPanelString.substring(start + s1.length());
+// }
+// }
+// break;
+//
+// case R.id.pit_control_panel_position:
+// s1 = pitControlPanelPosition.getText().toString() + " ,";
+// if (checked) {
+// if (ControlPanelString.isEmpty()) {
+// ControlPanelString = s1;
+// } else {
+// ControlPanelString = ControlPanelString + s1;
+// }
+// } else {
+// if (ControlPanelString.contains(s1)) {
+// int start = ControlPanelString.indexOf(s1);
+// ControlPanelString = ControlPanelString.substring(0, start) + ControlPanelString.substring(start + s1.length());
+// }
+// }
+// break;
+
+// case R.id.pit_control_panel_nothing:
+// s1 = pitControlPanelNothing.getText().toString() + " ,";
+// if (checked) {
+// if (ControlPanelString.isEmpty()) {
+// ControlPanelString = s1;
+// } else {
+// ControlPanelString = ControlPanelString + s1;
+// }
+// } else {
+// if (ControlPanelString.contains(s1)) {
+// int start = ControlPanelString.indexOf(s1);
+// ControlPanelString = ControlPanelString.substring(0, start) + ControlPanelString.substring(start + s1.length());
+// }
+// }
+// break;
+// }
+ }
+
+ public void setPitShotLocationString(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+
+ case R.id.pit_shot_location_bottom:
+ s1 = pitShotLocationBottom.getText().toString() + " ,";
+ if (checked) {
+ if (pitShotLocationString.isEmpty()) {
+ pitShotLocationString = s1;
+ } else {
+ pitShotLocationString = pitShotLocationString + s1;
+ }
+ } else {
+ if (pitShotLocationString.contains(s1)) {
+ int start = pitShotLocationString.indexOf(s1);
+ pitShotLocationString = pitShotLocationString.substring(0, start) + pitShotLocationString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shot_location_inner:
+ s1 = pitShotLocationInner.getText().toString() + " ,";
+ if (checked) {
+ if (pitShotLocationString.isEmpty()) {
+ pitShotLocationString = s1;
+ } else {
+ pitShotLocationString = pitShotLocationString + s1;
+ }
+ } else {
+ if (pitShotLocationString.contains(s1)) {
+ int start = pitShotLocationString.indexOf(s1);
+ pitShotLocationString = pitShotLocationString.substring(0, start) + pitShotLocationString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shot_location_outer:
+ s1 = pitShotLocationOuter.getText().toString() + " ,";
+ if (checked) {
+ if (pitShotLocationString.isEmpty()) {
+ pitShotLocationString = s1;
+ } else {
+ pitShotLocationString = pitShotLocationString + s1;
+ }
+ } else {
+ if (pitShotLocationString.contains(s1)) {
+ int start = pitShotLocationString.indexOf(s1);
+ pitShotLocationString = pitShotLocationString.substring(0, start) + pitShotLocationString.substring(start + s1.length());
+ }
+ }
+ break;
+
+ case R.id.pit_shot_location_na:
+ s1 = pitShotLocationNa.getText().toString() + " ,";
+ if (checked) {
+ if (pitShotLocationString.isEmpty()) {
+ pitShotLocationString = s1;
+ } else {
+ pitShotLocationString = pitShotLocationString + s1;
+ }
+ } else {
+ if (pitShotLocationString.contains(s1)) {
+ int start = pitShotLocationString.indexOf(s1);
+ pitShotLocationString = pitShotLocationString.substring(0, start) + pitShotLocationString.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ pitTeamNumberSpinner.setOnKeyListener(this);
+ pitDriveTrainSpinner.setOnKeyListener(this);
+// pitEndGameLocationSpinner.setOnKeyListener(this);
+ driveTrainOther.setOnKeyListener(this);
+ pitRobotWeight.setOnKeyListener(this);
+ pitProgrammingLanguages.setOnKeyListener(this);
+ programmingLanguageOther.setOnKeyListener(this);
+ pitAutoPrograms.setOnKeyListener(this);
+ pitDriveThruTrench.setOnKeyListener(this);
+ pitBasicPlan.setOnKeyListener(this);
+ pitPowerCellPickupRadioGroup.setOnKeyListener(this);
+ pitEndgameLocation.setOnKeyListener(this);
+ }
+
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+
+ pitTeamNumberSpinner.setOnKeyListener(null);
+ pitDriveTrainSpinner.setOnKeyListener(null);
+ driveTrainOther.setOnKeyListener(null);
+ pitRobotWeight.setOnKeyListener(null);
+ pitProgrammingLanguages.setOnKeyListener(null);
+ programmingLanguageOther.setOnKeyListener(null);
+ pitAutoPrograms.setOnKeyListener(null);
+ pitDriveThruTrench.setOnKeyListener(null);
+// pitEndgameHang.setOnKeyListener(null);
+ pitBasicPlan.setOnKeyListener(null);
+// pitEndGameLocationSpinner.setOnKeyListener(null);
+ pitPowerCellPickupRadioGroup.setOnKeyListener(null);
+ pitEndgameLocation.setOnKeyListener(null);
+
+ }
+
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+
+
+ return false;
+ }
+
+ public void savePitData(View view) throws IOException {
+ String state = Environment.getExternalStorageState();
+ boolean allInputsPassed = false;
+
+ // ****** Check Required fields set focus to field if it hasn't been filled out ******
+
+
+ if (pitTeamNumberSpinner.getSelectedItem().toString().equals("Select Team Number") ) {
+ setSpinnerError(pitTeamNumberSpinner, "Select a Team Number.");
+ ViewUtils.requestFocus(pitTeamNumberSpinner, this);
+ }else if (pitProgrammingLanguages.getSelectedItem().toString().equals("") ) {
+ setSpinnerError(pitProgrammingLanguages, "Select a Programming Language.");
+ ViewUtils.requestFocus(pitProgrammingLanguages, this);
+ }else if(pitDriveTrainSpinner.getSelectedItem().toString().equals("")){
+ setSpinnerError(pitDriveTrainSpinner, "Select a drive train.");
+ ViewUtils.requestFocus(pitDriveTrainSpinner, this);
+ } else if (StringUtils.isEmptyOrNull(pitRobotWeight.getText().toString())) {
+ pitRobotWeight.setError(getText(R.string.pitRobotWeightError));
+ ViewUtils.requestFocus(pitRobotWeight, this);
+ } else if (StringUtils.isEmptyOrNull(scouterInitialsInput.getText().toString())) {
+ scouterInitialsInput.setError(getText(R.string.scouterInitialsError));
+ ViewUtils.requestFocus(scouterInitialsInput, this);
+ } else {
+ allInputsPassed = true;
+ }
+ if (!allInputsPassed) {
+ return;
+ }
+
+
+ final RadioButton pitDriveThruTrenchbtn = findViewById(pitDriveThruTrench.getCheckedRadioButtonId());
+// final RadioButton pitEndgameHangbtn = findViewById(pitEndgameHang.getCheckedRadioButtonId());
+ final RadioButton pitPowerCellPickUpRadioBtn = findViewById(pitPowerCellPickupRadioGroup.getCheckedRadioButtonId());
+ final RadioButton pitEndgameLocationBtn = findViewById(pitEndgameLocation.getCheckedRadioButtonId());
+
+ if(PermissionUtils.getPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+ if (Environment.MEDIA_MOUNTED.equals(state)) {
+ File dir = new File(Environment.getExternalStorageDirectory() + "/Scouting");
+ //create csv file
+ File file = new File(dir, "Pit" + Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID) + ".csv");
+
+ pitDataStringList.add(pitTeamNumberSpinner.getSelectedItem().toString());
+ pitDataStringList.add(RobotNameInput.getText().toString());
+ pitDataStringList.add(pitRobotWeight.getText().toString());
+ pitDataStringList.add(pitDriveTrainSpinner.getSelectedItem().toString());
+ pitDataStringList.add(driveTrainOther.getText().toString());
+ pitDataStringList.add(pitProgrammingLanguages.getSelectedItem().toString());
+ pitDataStringList.add(programmingLanguageOther.getText().toString());
+ pitDataStringList.add(pitAutoPrograms.getText().toString());
+ pitDataStringList.add(pitPowerCellPickUpRadioBtn.getText().toString());
+ pitDataStringList.add(shotString);
+ pitDataStringList.add(favShotString);
+// pitDataStringList.add(pitDriveThruTrenchbtn.getText().toString());
+ pitDataStringList.add(pitShotLocationString);
+ pitDataStringList.add(ControlPanelString);
+// pitDataStringList.add(pitEndGameLocationSpinner.getSelectedItem().toString());
+ pitDataStringList.add(pitEndgameLocationBtn.getText().toString());
+ pitDataStringList.add(pitBasicPlan.getText().toString());
+ pitDataStringList.add(scouterInitialsInput.getText().toString());
+
+
+
+
+
+ String message = FormatStringUtils.addDelimiter(pitDataStringList, "|") + "\n";
+
+
+ //Output data to file
+ try {
+ FileOutputStream fileOutputStream = new FileOutputStream(file, true);
+ fileOutputStream.write(message.getBytes());
+ fileOutputStream.close();
+
+ Toast.makeText(getApplicationContext(), "Saved!", Toast.LENGTH_LONG).show();
+ } catch (IOException e) {
+ Toast.makeText(getApplicationContext(), "IOException! Go talk to the programmers!", Toast.LENGTH_LONG).show();
+ Log.d("Scouting", e.getMessage());
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), "SD card not found", Toast.LENGTH_LONG).show();
+ }
+
+ clearData();
+ pitTeamNumberSpinner.requestFocus();
+ }
+
+
+
+
+ }
+
+ public void takePhoto(View view) {
+ String name = pitTeamNumberSpinner.getSelectedItem().toString();
+
+ if(PermissionUtils.getPermissions(this, Manifest.permission.CAMERA) &&
+ PermissionUtils.getPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) &&
+ PermissionUtils.getPermissions(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
+ if (!StringUtils.isEmptyOrNull(name)) {
+ File dir = new File(Environment.getExternalStorageDirectory() + "/Scouting/Photos");
+ dir.mkdirs();
+
+ File file = new File(dir, name + ".jpg");
+
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ Log.d("Scouting", e.getMessage());
+ }
+
+ Uri outputUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", file);
+
+ Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
+ takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputUri);
+ startActivityForResult(takePictureIntent, 0);
+ }
+ } else {
+ //setSpinnerError(pitTeamNumberInputLayout, "Select a Team Number.");
+ ViewUtils.requestFocus(pitTeamNumberSpinner, this);
+ }
+ } else {
+ checkForPermissions();
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == 0) {
+ if(resultCode == RESULT_OK) {
+ compressPhoto();
+ }
+ }
+ }
+
+ private void compressPhoto() {
+ try {
+ String name = pitTeamNumberSpinner.getSelectedItem().toString();
+
+ File dir = new File(Environment.getExternalStorageDirectory() + "/Scouting/Photos");
+ File file = new File(dir, name + ".jpg");
+
+ FileInputStream inputStream = new FileInputStream(file);
+ Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ bitmap.compress(Bitmap.CompressFormat.JPEG, 25, out);
+
+ FileOutputStream outputStream = new FileOutputStream(file);
+ outputStream.write(out.toByteArray());
+ inputStream.close();
+ out.close();
+ outputStream.close();
+
+ Toast.makeText(this, "Photo taken!", Toast.LENGTH_SHORT).show();
+ } catch (IOException e) {
+ Log.d("Scouting", e.getMessage());
+ Toast.makeText(this, "Failed to save photo. Try again!", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ private void setSpinnerError(Spinner spinner, String error){
+ View selectedView = spinner.getSelectedView();
+ if (selectedView instanceof TextView){
+ spinner.requestFocus();
+ TextView selectedTextView = (TextView) selectedView;
+ selectedTextView.setError("error");
+ selectedTextView.setTextColor(Color.RED);
+ selectedTextView.setText(error);
+
+ }
+ }
+
+ public void clearData() {
+ pitTeamNumberSpinner.setSelection(0);
+ pitRobotWeight.setText(null);
+ pitDriveTrainSpinner.setSelection(0);
+ driveTrainOther.setText(null);
+ pitProgrammingLanguages.setSelection(0);
+ programmingLanguageOther.setText(null);
+ pitAutoPrograms.setText(null);
+ scouterInitialsInput.setText(null);
+ pitControlPanelNothing.setChecked(false);
+ pitControlPanelPosition.setChecked(false);
+ pitControlPanelRotate3to5.setChecked(false);
+ pitShootTrenchNear.setChecked(false);
+ pitShootTrenchFar.setChecked(false);
+ pitShootOther.setChecked(false);
+ pitShootFieldFront.setChecked(false);
+ pitShootFieldDiagonal.setChecked(false);
+ pitShootTargetZone.setChecked(false);
+// pitEndgameHang.setChecked(false);
+ pitDriveThruTrench.clearCheck();
+ pitShotLocationOuter.setChecked(false);
+ pitShotLocationInner.setChecked(false);
+ pitShotLocationBottom.setChecked(false);
+ pitShotLocationNa.setChecked(false);
+ pitBasicPlan.setText(null);
+// pitEndGameLocationSpinner.setSelection(0);
+ ControlPanelString = "";
+ shotString = "";
+ pitShotLocationString = "";
+ RobotNameInput.setText(null);
+
+ pitDataStringList.clear();
+ }
+
+ private void checkForPermissions() {
+ int cameraPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
+ if (cameraPermission != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1);
+ }
+ }
+
+
+
+}
diff --git a/app/src/main/java/com/example/ncgears/scouting/ScouterInitialsActivity.java b/app/src/main/java/com/example/ncgears/scouting/ScouterInitialsActivity.java
new file mode 100644
index 0000000..664ce93
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/ScouterInitialsActivity.java
@@ -0,0 +1,105 @@
+/*
+
+ *************** Code Designed by Team 107 Team Robotics *********************
+ *************** Edited for Team 1918 By Nate and Ken *********************
+
+
+ */
+
+package com.example.ncgears.scouting;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.design.widget.TextInputEditText;
+import android.support.design.widget.TextInputLayout;
+import android.support.v7.app.AppCompatActivity;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import utils.StringUtils;
+import utils.ViewUtils;
+
+public class ScouterInitialsActivity extends AppCompatActivity implements View.OnKeyListener {
+
+ @BindView(R.id.scouterInitials_input_layout)
+ public TextInputLayout scouterInitialsInputLayout;
+
+ @BindView(R.id.scouterInitials_input)
+ public TextInputEditText scouterInitialsInput;
+
+ private static String initials;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_scouter_initials);
+ ButterKnife.bind(this);
+
+ }
+
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.main_activity:
+ startActivity(new Intent(this, MainActivity.class));
+ return true;
+ case R.id.send_data:
+ startActivity(new Intent(this, SendDataActivity.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ if (keyCode != KeyEvent.KEYCODE_SPACE && keyCode != KeyEvent.KEYCODE_TAB) {
+ TextInputEditText inputEditText = (TextInputEditText) v;
+
+ if (inputEditText != null) {
+
+ switch (inputEditText.getId()) {
+ case R.id.scouterInitials_input_layout:
+ scouterInitialsInputLayout.setError(null);
+ break;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static String getInitials() {
+ return initials;
+ }
+
+ public void submitInitials(View view) {
+ initials = getTextInputLayoutString(scouterInitialsInputLayout);
+ scouterInitialsInput.setText(null);
+
+ if(!StringUtils.isEmptyOrNull(initials))
+ startActivity(new Intent(this, AutonActivity.class));
+ else
+ scouterInitialsInputLayout.setError(getText(R.string.scouterInitialsError));
+ }
+
+ private String getTextInputLayoutString(@NonNull TextInputLayout textInputLayout) {
+ final EditText editText = textInputLayout.getEditText();
+ return editText != null && editText.getText() != null ? editText.getText().toString() : "";
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/ncgears/scouting/SendDataActivity.java b/app/src/main/java/com/example/ncgears/scouting/SendDataActivity.java
new file mode 100644
index 0000000..100b0d5
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/SendDataActivity.java
@@ -0,0 +1,211 @@
+/*
+
+ *************** Code Designed by Team 107 Team Robotics *********************
+ *************** Edited for Team 1918 By Nate and Ken *********************
+
+
+ */
+
+package com.example.ncgears.scouting;
+
+import android.Manifest;
+import android.app.ActionBar;
+import android.bluetooth.BluetoothAdapter;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Message;
+import android.os.Parcelable;
+import android.provider.Settings;
+import android.support.annotation.NonNull;
+import android.support.design.widget.TextInputEditText;
+import android.support.design.widget.TextInputLayout;
+import android.support.v4.content.FileProvider;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import utils.FormatStringUtils;
+import utils.PermissionUtils;
+
+import static android.os.Environment.getExternalStorageDirectory;
+
+/**
+ * Created by Matt on 10/9/2017.
+ */
+
+public class SendDataActivity extends AppCompatActivity {
+
+ // @BindView(R.id.matchOrPit_RadiobtnGrp)
+ public RadioGroup matchOrPitRadiobtnGrp;
+
+ // @BindView(R.id.concatFolder_editText)
+ public EditText concatFolderEditText;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_send_data);
+
+ ButterKnife.bind(this);
+ }
+
+ /* This method will display the options menu when the icon is pressed
+ * and this will inflate the menu options for the user to choose
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ /*This method will launch the correct activity
+ *based on the menu option user presses
+ */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.main_activity:
+ startActivity(new Intent(this, MainActivity.class));
+ return true;
+ case R.id.send_data:
+ startActivity(new Intent(this, SendDataActivity.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ public void concatenateData(View view) {
+ if(PermissionUtils.getPermissions(this, Manifest.permission.READ_EXTERNAL_STORAGE) &&
+ PermissionUtils.getPermissions(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
+ RadioButton radioButton = findViewById(matchOrPitRadiobtnGrp.getCheckedRadioButtonId());
+
+ if(radioButton != null) {
+ String dir = Environment.getExternalStorageDirectory() + "/" + concatFolderEditText.getText().toString();
+
+ File folder = new File(dir);
+
+ if(folder.exists() && concatFolderEditText.getText().toString().length() > 0) {
+ File[] files = folder.listFiles();
+
+ StringBuilder builder = new StringBuilder();
+ FileReader fileReader;
+ BufferedReader bufferedReader;
+ FileOutputStream fileOutputStream;
+
+ String type = radioButton.getText().toString().contains("Match") ? "Match" : "Pit";
+
+ if (files != null) {
+ try {
+ int fileCount = 0;
+ for (File file : files) {
+ if (file.getName().contains(type)) {
+ fileCount++;
+ fileReader = new FileReader(file);
+ bufferedReader = new BufferedReader(fileReader);
+
+ String line;
+ while ((line = bufferedReader.readLine()) != null) {
+ builder.append(line + '\n');
+ }
+ }
+ }
+ fileOutputStream = new FileOutputStream(new File(dir, "new.csv"), false);
+ fileOutputStream.write("teamNumber,matchNumber,startingLocation,baseline,autoCubesInSwitch,autoCubesInScale,numberOfCubesInExchange,numberOfCubesInTheirSwitch,numberOfCubesInOpSwitch,NumberOfCubesInScale,cubePickup,climb,canHelpOthersClimb,onPlatform,defense,fouls,scouterInitials".getBytes());
+ fileOutputStream.write(builder.toString().getBytes());
+ fileOutputStream.close();
+
+ Toast.makeText(this, "Successfully concatenated " + fileCount + " " + type + " files to new.csv!", Toast.LENGTH_LONG).show();
+
+ } catch (IOException e) {
+ Log.d("Scouting", e.getMessage());
+ Toast.makeText(this, "Failed to concatenate data.", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ } else {
+ Toast.makeText(this, "Invalid folder name!", Toast.LENGTH_LONG).show();
+ }
+ } else {
+ Toast.makeText(this, "Select an option!", Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+
+ public void sendMatchData(View view) {
+ if(PermissionUtils.getPermissions(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ String file = "storage/emulated/0/Scouting/Match" + Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID) + ".csv";
+ intent.setType("text/plain");
+ intent.setPackage("com.android.bluetooth");
+ intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", new File(file)));
+ startActivity(Intent.createChooser(intent, "Share app"));
+ }
+ }
+
+ public void sendPitData(View view) {
+ if(PermissionUtils.getPermissions(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ String file = "storage/emulated/0/Scouting/Pit" + Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID) + ".csv";
+ intent.setType("text/plain");
+ intent.setPackage("com.android.bluetooth");
+ intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", new File(file)));
+ startActivity(Intent.createChooser(intent, "Share app"));
+ }
+ }
+
+ public void sendRobotPhotos(View view) {
+ if(PermissionUtils.getPermissions(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
+ Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
+ intent.setType("image/jpeg");
+ intent.setPackage("com.android.bluetooth");
+ String dir = "storage/emulated/0/Scouting/Photos/";
+
+ File folder = new File(dir);
+ File[] photos = folder.listFiles();
+
+ if(photos != null) {
+ ArrayList toSend = new ArrayList<>();
+
+ for (int i = 0; i < photos.length; i++) {
+ toSend.add(FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".provider", photos[i]));
+ }
+
+ intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, toSend);
+ startActivity(Intent.createChooser(intent, "Share app"));
+ } else {
+ Toast.makeText(this, "No photos!", Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+
+ private String getTextInputLayoutString(@NonNull TextInputLayout textInputLayout) {
+ final EditText editText = textInputLayout.getEditText();
+ return editText != null && editText.getText() != null ? editText.getText().toString() : "";
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/ncgears/scouting/TeleopActivity.java b/app/src/main/java/com/example/ncgears/scouting/TeleopActivity.java
new file mode 100644
index 0000000..e14b8cf
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/TeleopActivity.java
@@ -0,0 +1,1362 @@
+/*
+
+*************** Code Designed by Team 107 Team Robotics *********************
+*************** Edited for Team 1918 By Nate and Ken *********************
+
+
+ */
+
+package com.example.ncgears.scouting;
+
+import static android.R.attr.value;
+import static com.example.ncgears.scouting.AutonActivity.AUTON_STRING_EXTRA;
+import static com.example.ncgears.scouting.AutonActivity.MATCH_STRING_EXTRA;
+import static com.example.ncgears.scouting.AutonActivity.TEAMNUMBER_STRING_EXTRA;
+
+import android.Manifest;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.Settings;
+import android.support.annotation.NonNull;
+import android.support.design.widget.TextInputEditText;
+import android.support.design.widget.TextInputLayout;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import utils.FormatStringUtils;
+import utils.PermissionUtils;
+import utils.StringUtils;
+import utils.ViewUtils;
+
+
+public class TeleopActivity extends AppCompatActivity implements View.OnKeyListener {
+ /*This area sets and binds all of the variables that we will use in the auton activity*/
+
+ @BindView(R.id.teleop_high_attempt_input_layout)
+ public TextInputLayout teleopHighAttemptInputLayout;
+
+ @BindView(R.id.teleop_high_made_input_layout)
+ public TextInputLayout teleopHighMadeInputLayout;
+
+ @BindView(R.id.teleop_trap_made_input_layout)
+ public TextInputLayout teleopTrapMadeInputLayout;
+
+ @BindView(R.id.teleop_trap_attempt_input_layout)
+ public TextInputLayout teleopTrapAttemptInputLayout;
+
+ @BindView(R.id.teleop_low_attempt_input_layout)
+ public TextInputLayout teleopLowAttemptInputLayout;
+
+ @BindView(R.id.teleop_low_made_input_layout)
+ public TextInputLayout teleopLowMadeInputLayout;
+
+ @BindView(R.id.teleop_high_attempts_input)
+ public TextInputEditText teleopHighAttemptsInput;
+
+ @BindView(R.id.teleop_high_made_input)
+ public TextInputEditText teleopHighMadeInput;
+
+ @BindView(R.id.teleop_trap_attempt_input)
+ public TextInputEditText teleopTrapAttemptsInput;
+
+ @BindView(R.id.teleop_trap_made_input)
+ public TextInputEditText teleopTrapMadeInput;
+
+ @BindView(R.id.teleop_low_attempt_input)
+ public TextInputEditText teleopLowAttemptInput;
+
+ @BindView(R.id.teleop_low_made_input)
+ public TextInputEditText teleopLowMadeInput;
+
+ @BindView(R.id.defense_rating_radio_group)
+ public RadioGroup defenseRatingRadioGroup;
+
+ @BindView(R.id.power_cell_pickup_radio_group)
+ public RadioGroup powerCellPickupRadioGroup;
+
+ @BindView(R.id.low_port_dump_radio_group)
+ public RadioGroup lowPortDumpRadioGroup;
+
+ @BindView(R.id.under_trench_radio_group)
+ public RadioGroup underTrenchRadioGroup;
+
+ @BindView(R.id.power_cell_placement_rating_radio_group)
+ public RadioGroup powerCellPlacementRatingRadioGroup;
+
+ @BindView(R.id.control_panel_rating_radio_group)
+ public RadioGroup controlPanelRadingRadioGroup;
+
+ @BindView(R.id.counter_defense_effectiveness)
+ public RadioGroup counterDefenseEffectiveness;
+
+ @BindView(R.id.end_game_location_spinner)
+ public Spinner endGameLocationSpinner;
+
+ @BindView(R.id.climb_time_radio_group)
+ public RadioGroup climbTimeRadioGroup;
+
+ //@BindView(R.id.cycle_time_spinner)
+ // public Spinner cycleTimeSpinner;
+
+ @BindView(R.id.cycle_time_radio_group)
+ public RadioGroup cycleTimeRadioGroup;
+
+ @BindView(R.id.overall_effectiveness_radio_group)
+ public RadioGroup overallEffectivenessRadioGoup;
+
+ @BindView(R.id.trained_drive_team_radio_group)
+ public RadioGroup trainedDriveTeamRadioGoup;
+
+ @BindView(R.id.observe_Power_Cell_Pickup)
+ public CheckBox observPowerCellPickup;
+
+ @BindView(R.id.observ_died_back)
+ public CheckBox observDiedBack;
+
+ @BindView(R.id.observ_died_mid)
+ public CheckBox observDiedMid;
+
+ @BindView(R.id.observ_dns)
+ public CheckBox observDns;
+
+ @BindView(R.id.observ_fast)
+ public CheckBox observFast;
+
+ @BindView(R.id.observ_fell_apart)
+ public CheckBox observFellApart;
+
+ @BindView(R.id.observ_fell_over)
+ public CheckBox observFellOver;
+
+ @BindView(R.id.control_panel_issues)
+ public CheckBox observPanelIssues;
+
+ @BindView(R.id.observ_jerky)
+ public CheckBox observJerky;
+
+ @BindView(R.id.observ_not_much)
+ public CheckBox observNotMuch;
+
+ @BindView(R.id.observ_penalties)
+ public CheckBox observPenalties;
+
+ @BindView(R.id.observ_played_defense)
+ public CheckBox observPlayedDefense;
+
+ @BindView(R.id.observ_slow)
+ public CheckBox observSlow;
+
+ @BindView(R.id.observ_slowed_by_robot)
+ public CheckBox observSlowedByRobot;
+
+ @BindView(R.id.observ_smooth)
+ public CheckBox observsmooth;
+
+ @BindView(R.id.observ_average_speed)
+ public CheckBox observAverageSpeed;
+
+ @BindView(R.id.observ_power_cell_stuck_intake)
+ public CheckBox observPowerCellStuckIntake;
+
+// @BindView(R.id.observ_hung_up_power_cell)
+// public CheckBox observHungUpPowerCell;
+//
+// @BindView(R.id.observ_fell_off_switch)
+// public CheckBox observFellOffSwitch;
+
+ @BindView(R.id.observ_hung_up)
+ public CheckBox observHungUp;
+
+ @BindView(R.id.type_high_shooter)
+ public CheckBox typeHighShooter;
+
+ @BindView(R.id.type_low_shooter)
+ public CheckBox typeLowShooter;
+
+ @BindView(R.id.type_feeder_bot)
+ public CheckBox typeFeederBot;
+
+ @BindView(R.id.type_control_panel)
+ public CheckBox typeControlPanel;
+
+ @BindView(R.id.type_defense_bot)
+ public CheckBox typeDefenseBot;
+
+ @BindView(R.id.type_counter_defense_bot)
+ public CheckBox typeCounterDefenseBot;
+
+ @BindView(R.id.tele_shoot_target_zone)
+ public CheckBox teleShootTargetZone;
+
+ @BindView(R.id.tele_shoot_field_front)
+ public CheckBox teleShootFieldFront;
+
+ @BindView(R.id.tele_shoot_field_diagonal)
+ public CheckBox teleShootFieldDiagonal;
+
+ @BindView(R.id.tele_shoot_trench_near)
+ public CheckBox teleShootTrenchNear;
+
+ @BindView(R.id.tele_shoot_trench_far)
+ public CheckBox teleShootTrenchFar;
+
+ @BindView(R.id.tele_shoot_other)
+ public CheckBox teleShootOther;
+
+
+ // @BindView(R.id.type_of_bot_spinner)
+ // public Spinner typeOfBotSpinner;
+
+ @BindView(R.id.summary_input)
+ public EditText summaryInput;
+
+ @BindView(R.id.issues_input)
+ public EditText issuesInput;
+
+ public String observations = "";
+ public String typeOfBot = "";
+ public String shotFrom = "";
+
+ @BindView(R.id.save_btn)
+ public Button saveBtn;
+
+ int teleopHighAttempt = 0;
+ int teleopHighMissed = 0;
+ int teleopHighMade = 0;
+ int teleopLowAttempt = 0;
+ int teleopLowMissed = 0;
+ int teleopLowMade = 0;
+ int teleopTrapAttempt = 0;
+ int teleopTrapMissed = 0;
+ int teleopTrapMade = 0;
+
+
+
+
+ public String auton;
+ public String matchNumber;
+ public String teamNumber;
+
+ private ArrayList teleopDataStringList;
+/*
+ *When this activity is first called,
+ *we will call the activity_auton layout so we can display
+ *the user interface
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_teleop);
+
+ ButterKnife.bind(this);
+
+ Bundle bundle = getIntent().getExtras();
+ auton = bundle.getString(AUTON_STRING_EXTRA);
+ matchNumber = bundle.getString(MATCH_STRING_EXTRA);
+ teamNumber = bundle.getString(TEAMNUMBER_STRING_EXTRA);
+
+ getSupportActionBar().setTitle("Match: " + matchNumber + " - Team: " + teamNumber);
+
+ teleopDataStringList = new ArrayList<>();
+
+ displayHighAttemptInput(teleopHighAttempt);
+ displayHighMade(teleopHighMade);
+ displayLowAttemptInput(teleopLowAttempt);
+ displayLowMadeInput(teleopLowMade);
+ displayTrapMade(teleopTrapMade);
+ displayTrapAttemptInput(teleopTrapAttempt);
+
+
+ // --- End Game Location spinner ---
+
+ Spinner endgamelocationspinner = (Spinner) findViewById(R.id.end_game_location_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter endgamelocationadapter = ArrayAdapter.createFromResource(this,
+ R.array.endgame_location, android.R.layout.simple_spinner_item);
+// Specify the layout to use when the list of choices appears
+ endgamelocationadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ endgamelocationspinner.setAdapter(endgamelocationadapter);
+
+
+ // --- Cycle Time spinner ---
+
+/* Spinner cycletimespinner = (Spinner) findViewById(R.id.cycle_time_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter cycletimeadapter = ArrayAdapter.createFromResource(this,
+ R.array.cycle_time_spinner, android.R.layout.simple_spinner_item);
+// Specify the layout to use when the list of choices appears
+ cycletimeadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ cycletimespinner.setAdapter(cycletimeadapter);
+*/
+ // --- Type of Bot Spinner ---
+
+/* Spinner typeofbotspinner = (Spinner) findViewById(R.id.type_of_bot_spinner);
+// Create an ArrayAdapter using the string array and a default spinner layout
+ ArrayAdapter typeofbotadapter = ArrayAdapter.createFromResource(this,
+ R.array.bot_type_array, android.R.layout.simple_spinner_item);
+// Specify the layout to use when the list of choices appears
+ typeofbotadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+// Apply the adapter to the spinner
+ typeofbotspinner.setAdapter(typeofbotadapter);
+*/
+ }
+
+
+ /*If this activity is resumed from a paused state the data
+ *will be set to what they previously were set to
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ teleopHighAttemptsInput.setOnKeyListener(this);
+ teleopHighMadeInput.setOnKeyListener(this);
+ teleopTrapAttemptsInput.setOnKeyListener(this);
+ teleopTrapMadeInput.setOnKeyListener(this);
+ teleopLowAttemptInput.setOnKeyListener(this);
+ teleopLowMadeInput.setOnKeyListener(this);
+ controlPanelRadingRadioGroup.setOnKeyListener(this);
+ counterDefenseEffectiveness.setOnKeyListener(this);
+ endGameLocationSpinner.setOnKeyListener(this);
+ climbTimeRadioGroup.setOnKeyListener(this);
+ cycleTimeRadioGroup.setOnKeyListener(this);
+ overallEffectivenessRadioGoup.setOnKeyListener(this);
+ defenseRatingRadioGroup.setOnKeyListener(this);
+ powerCellPlacementRatingRadioGroup.setOnKeyListener(this);
+ trainedDriveTeamRadioGoup.setOnKeyListener(this);
+ powerCellPickupRadioGroup.setOnKeyListener(this);
+ lowPortDumpRadioGroup.setOnKeyListener(this);
+ underTrenchRadioGroup.setOnKeyListener(this);
+ observsmooth.setOnKeyListener(this);
+ observSlowedByRobot.setOnKeyListener(this);
+ observSlow.setOnKeyListener(this);
+ observPlayedDefense.setOnKeyListener(this);
+ observPenalties.setOnKeyListener(this);
+ observNotMuch.setOnKeyListener(this);
+ observJerky.setOnKeyListener(this);
+ observPanelIssues.setOnKeyListener(this);
+ observFellOver.setOnKeyListener(this);
+ observFellApart.setOnKeyListener(this);
+ observFast.setOnKeyListener(this);
+ observDns.setOnKeyListener(this);
+ observDiedMid.setOnKeyListener(this);
+ observDiedBack.setOnKeyListener(this);
+ observPowerCellPickup.setOnKeyListener(this);
+ observAverageSpeed.setOnKeyListener(this);
+ observPowerCellStuckIntake.setOnKeyListener(this);
+// observHungUpPowerCell.setOnKeyListener(this);
+// observFellOffSwitch.setOnKeyListener(this);
+ observHungUp.setOnKeyListener(this);
+ typeHighShooter.setOnKeyListener(this);
+ typeLowShooter.setOnKeyListener(this);
+ typeFeederBot.setOnKeyListener(this);
+ typeControlPanel.setOnKeyListener(this);
+ typeCounterDefenseBot.setOnKeyListener(this);
+ typeDefenseBot.setOnKeyListener(this);
+ teleShootTargetZone.setOnKeyListener(this);
+ teleShootFieldFront.setOnKeyListener(this);
+ teleShootFieldDiagonal.setOnKeyListener(this);
+ teleShootTrenchNear.setOnKeyListener(this);
+ teleShootTrenchFar.setOnKeyListener(this);
+ teleShootOther.setOnKeyListener(this);
+ // typeOfBotSpinner.setOnKeyListener(this);
+ summaryInput.setOnKeyListener(this);
+ issuesInput.setOnKeyListener(this);
+
+ }
+
+ /*If this activity enters a paused state the data will be set to null*/
+ @Override
+ protected void onPause() {
+ super.onPause();
+
+ teleopHighAttemptsInput.setOnKeyListener(null);
+ teleopHighMadeInput.setOnKeyListener(null);
+ teleopTrapAttemptsInput.setOnKeyListener(null);
+ teleopTrapMadeInput.setOnKeyListener(null);
+ teleopLowAttemptInput.setOnKeyListener(null);
+ teleopLowMadeInput.setOnKeyListener(null);
+ controlPanelRadingRadioGroup.setOnKeyListener(null);
+ counterDefenseEffectiveness.setOnKeyListener(null);
+ endGameLocationSpinner.setOnKeyListener(null);
+ climbTimeRadioGroup.setOnKeyListener(null);
+ cycleTimeRadioGroup.setOnKeyListener(null);
+ overallEffectivenessRadioGoup.setOnKeyListener(null);
+ defenseRatingRadioGroup.setOnKeyListener(null);
+ powerCellPlacementRatingRadioGroup.setOnKeyListener(null);
+ trainedDriveTeamRadioGoup.setOnKeyListener(null);
+ powerCellPickupRadioGroup.setOnKeyListener(null);
+ lowPortDumpRadioGroup.setOnKeyListener(null);
+ underTrenchRadioGroup.setOnKeyListener(null);
+ observsmooth.setOnKeyListener(null);
+ observSlowedByRobot.setOnKeyListener(null);
+ observSlow.setOnKeyListener(null);
+ observPlayedDefense.setOnKeyListener(null);
+ observPenalties.setOnKeyListener(null);
+ observNotMuch.setOnKeyListener(null);
+ observJerky.setOnKeyListener(null);
+ observPanelIssues.setOnKeyListener(null);
+ observFellOver.setOnKeyListener(null);
+ observFellApart.setOnKeyListener(null);
+ observFast.setOnKeyListener(null);
+ observDns.setOnKeyListener(null);
+ observDiedMid.setOnKeyListener(null);
+ observDiedBack.setOnKeyListener(null);
+ observPowerCellPickup.setOnKeyListener(null);
+ observAverageSpeed.setOnKeyListener(null);
+ observPowerCellStuckIntake.setOnKeyListener(null);
+// observHungUpPowerCell.setOnKeyListener(null);
+// observFellOffSwitch.setOnKeyListener(null);
+ observHungUp.setOnKeyListener(null);
+ typeHighShooter.setOnKeyListener(null);
+ typeLowShooter.setOnKeyListener(null);
+ typeFeederBot.setOnKeyListener(null);
+ typeControlPanel.setOnKeyListener(null);
+ typeCounterDefenseBot.setOnKeyListener(null);
+ typeDefenseBot.setOnKeyListener(null);
+ teleShootTargetZone.setOnKeyListener(null);
+ teleShootFieldFront.setOnKeyListener(null);
+ teleShootFieldDiagonal.setOnKeyListener(null);
+ teleShootTrenchNear.setOnKeyListener(null);
+ teleShootTrenchFar.setOnKeyListener(null);
+ teleShootOther.setOnKeyListener(null);
+ //typeOfBotSpinner.setOnKeyListener(null);
+ summaryInput.setOnKeyListener(null);
+ issuesInput.setOnKeyListener(null);
+
+ }
+
+ /* This method will display the options menu when the icon is pressed
+ * and this will inflate the menu options for the user to choose
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return true;
+ }
+
+ /*This method will launch the correct activity
+ *based on the menu option user presses
+ */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.main_activity:
+ startActivity(new Intent(this, MainActivity.class));
+ return true;
+ case R.id.send_data:
+ startActivity(new Intent(this, SendDataActivity.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ private void setSpinnerError(Spinner spinner, String error){
+ View selectedView = spinner.getSelectedView();
+ if (selectedView instanceof TextView){
+ spinner.requestFocus();
+ TextView selectedTextView = (TextView) selectedView;
+ selectedTextView.setError("error");
+ selectedTextView.setTextColor(Color.RED);
+ selectedTextView.setText(error);
+
+ }
+ }
+
+ //Teleop high shots
+ public void decreaseHighAttempts(View view) {
+ if (teleopHighMissed != 0) {
+ teleopHighMissed -= 1;
+ teleopHighAttempt -=1;
+
+ displayHighAttemptInput(teleopHighMissed);
+ }
+ }
+
+ public void increaseHighAttempts(View view) {
+ if (teleopHighMissed <= 800) {
+ teleopHighMissed += 1;
+ teleopHighAttempt += 1;
+ displayHighAttemptInput(teleopHighMissed);
+ }
+ }
+
+ private void displayHighAttemptInput(int number) {
+ teleopHighAttemptsInput.setText("" + number);
+ }
+
+ //Teleop High Made
+ public void decreaseHighMadeInput(View view) {
+ if (teleopHighMade != 0) {
+ teleopHighMade -= 1;
+ teleopHighAttempt -= 1;
+ displayHighMade(teleopHighMade);
+ }
+ }
+
+ public void increaseHighMadeInput(View view) {
+ if (teleopHighMade <= 800) {
+ teleopHighMade += 1;
+ teleopHighAttempt += 1;
+ displayHighMade(teleopHighMade);
+
+ }
+ }
+
+ private void displayHighMade(int number) {
+ teleopHighMadeInput.setText("" + number);
+ }
+
+ //Teleop Low Missed
+
+ public void decreaseLowAttempt(View view) {
+ if (teleopLowMissed != 0) {
+ teleopLowMissed -= 1;
+ teleopLowAttempt -= 1;
+
+ displayLowAttemptInput(teleopLowMissed);
+ }
+ }
+
+ public void increaseLowAttempt(View view) {
+ if (teleopLowMissed <= 100) {
+ teleopLowMissed += 1;
+ teleopLowAttempt += 1;
+ displayLowAttemptInput(teleopLowMissed);
+ }
+ }
+
+ private void displayLowAttemptInput(int number) {
+ teleopLowAttemptInput.setText("" + number);
+ }
+
+ //Teleop trap shots
+ public void decreaseTrapAttempt(View view) {
+ if (teleopTrapMissed != 0) {
+ teleopTrapMissed -= 1;
+ teleopTrapAttempt -=1;
+
+ displayTrapAttemptInput(teleopTrapMissed);
+ }
+ }
+
+ public void increaseTrapAttempt(View view) {
+ if (teleopTrapMissed <= 800) {
+ teleopTrapMissed += 1;
+ teleopTrapAttempt += 1;
+ displayTrapAttemptInput(teleopTrapMissed);
+ }
+ }
+
+ private void displayTrapAttemptInput(int number) {
+ teleopTrapAttemptsInput.setText("" + number);
+ }
+
+ //Teleop Trap Made
+ public void decreaseTrapMadeInput(View view) {
+ if (teleopTrapMade != 0) {
+ teleopTrapMade -= 1;
+ teleopTrapAttempt -= 1;
+ displayTrapMade(teleopTrapMade);
+ }
+ }
+
+ public void increaseTrapMadeInput(View view) {
+ if (teleopTrapMade <= 800) {
+ teleopTrapMade += 1;
+ teleopTrapAttempt += 1;
+ displayTrapMade(teleopTrapMade);
+
+ }
+ }
+
+ private void displayTrapMade(int number) {
+ teleopTrapMadeInput.setText("" + number);
+ }
+ //Teleop Low Made
+
+ public void decreaseLowMadeInput(View view) {
+ if (teleopLowMade != 0) {
+ teleopLowMade -= 1;
+ teleopLowAttempt -=1;
+ displayLowMadeInput(teleopLowMade);
+ }
+ }
+
+ public void increaseLowMadeInput(View view) {
+ if (teleopLowMade <= 800) {
+ teleopLowMade += 1;
+ teleopLowAttempt +=1;
+
+ displayLowMadeInput(teleopLowMade);
+
+ }
+ }
+
+ private void displayLowMadeInput(int number) {
+ teleopLowMadeInput.setText("" + number);
+ }
+
+
+ // this method sets up a string for a group of checkBoxes
+
+ public void setString(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+ case R.id.observe_Power_Cell_Pickup:
+ s1 = observPowerCellPickup.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_died_back:
+ s1 = observDiedBack.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_died_mid:
+ s1 = observDiedMid.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_dns:
+ s1 = observDns.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_fast:
+ s1 = observFast.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_fell_apart:
+ s1 = observFellApart.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_fell_over:
+ s1 = observFellOver.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.control_panel_issues:
+ s1 = observPanelIssues.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_jerky:
+ s1 = observJerky.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_not_much:
+ s1 = observNotMuch.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_penalties:
+ s1 = observPenalties.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_played_defense:
+ s1 = observPlayedDefense.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_slow:
+ s1 = observSlow.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_slowed_by_robot:
+ s1 = observSlowedByRobot.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_smooth:
+ s1 = observsmooth.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_average_speed:
+ s1 = observAverageSpeed.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.observ_power_cell_stuck_intake:
+ s1 = observPowerCellStuckIntake.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+// case R.id.observ_hung_up_power_cell:
+// s1 = observHungUpPowerCell.getText().toString() + " ,";
+// if (checked) {
+// if (observations.isEmpty()) {
+// observations = s1;
+// } else {
+// observations = observations + s1;
+// }
+// } else {
+// if (observations.contains(s1)) {
+// int start = observations.indexOf(s1);
+// observations = observations.substring(0, start) + observations.substring(start + s1.length());
+// }
+// }
+// break;
+// case R.id.observ_fell_off_switch:
+// s1 = observFellOffSwitch.getText().toString() + " ,";
+// if (checked) {
+// if (observations.isEmpty()) {
+// observations = s1;
+// } else {
+// observations = observations + s1;
+// }
+// } else {
+// if (observations.contains(s1)) {
+// int start = observations.indexOf(s1);
+// observations = observations.substring(0, start) + observations.substring(start + s1.length());
+// }
+// }
+// break;
+ case R.id.observ_hung_up:
+ s1 = observHungUp.getText().toString() + " ,";
+ if (checked) {
+ if (observations.isEmpty()) {
+ observations = s1;
+ } else {
+ observations = observations + s1;
+ }
+ } else {
+ if (observations.contains(s1)) {
+ int start = observations.indexOf(s1);
+ observations = observations.substring(0, start) + observations.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+ /*public void setTypeOfBotString(View view) { this is the original line of code before I copied and modified the following on 2/15/2020 ATB*/
+ public void setStringTypeBot(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+ case R.id.type_high_shooter:
+ s1 = typeHighShooter.getText().toString() + " ,";
+ if (checked) {
+ if (typeOfBot.isEmpty()) {
+ typeOfBot = s1;
+ } else {
+ typeOfBot = typeOfBot + s1;
+ }
+ } else {
+ if (typeOfBot.contains(s1)) {
+ int start = typeOfBot.indexOf(s1);
+ typeOfBot = typeOfBot.substring(0, start) + typeOfBot.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.type_low_shooter:
+ s1 = typeLowShooter.getText().toString() + " ,";
+ if (checked) {
+ if (typeOfBot.isEmpty()) {
+ typeOfBot = s1;
+ } else {
+ typeOfBot = typeOfBot + s1;
+ }
+ } else {
+ if (typeOfBot.contains(s1)) {
+ int start = typeOfBot.indexOf(s1);
+ typeOfBot = typeOfBot.substring(0, start) + typeOfBot.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.type_feeder_bot:
+ s1 = typeFeederBot.getText().toString() + " ,";
+ if (checked) {
+ if (typeOfBot.isEmpty()) {
+ typeOfBot = s1;
+ } else {
+ typeOfBot = typeOfBot + s1;
+ }
+ } else {
+ if (typeOfBot.contains(s1)) {
+ int start = typeOfBot.indexOf(s1);
+ typeOfBot = typeOfBot.substring(0, start) + typeOfBot.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.type_control_panel:
+ s1 = typeControlPanel.getText().toString() + " ,";
+ if (checked) {
+ if (typeOfBot.isEmpty()) {
+ typeOfBot = s1;
+ } else {
+ typeOfBot = typeOfBot + s1;
+ }
+ } else {
+ if (typeOfBot.contains(s1)) {
+ int start = typeOfBot.indexOf(s1);
+ typeOfBot = typeOfBot.substring(0, start) + typeOfBot.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.type_counter_defense_bot:
+ s1 = typeCounterDefenseBot.getText().toString() + " ,";
+ if (checked) {
+ if (typeOfBot.isEmpty()) {
+ typeOfBot = s1;
+ } else {
+ typeOfBot = typeOfBot + s1;
+ }
+ } else {
+ if (typeOfBot.contains(s1)) {
+ int start = typeOfBot.indexOf(s1);
+ typeOfBot = typeOfBot.substring(0, start) + typeOfBot.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.type_defense_bot:
+ s1 = typeDefenseBot.getText().toString() + " ,";
+ if (checked) {
+ if (typeOfBot.isEmpty()) {
+ typeOfBot = s1;
+ } else {
+ typeOfBot = typeOfBot + s1;
+ }
+ } else {
+ if (typeOfBot.contains(s1)) {
+ int start = typeOfBot.indexOf(s1);
+ typeOfBot = typeOfBot.substring(0, start) + typeOfBot.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+ public void setStringShot(View view) {
+ boolean checked = ((CheckBox) view).isChecked();
+ String s1;
+
+ switch (view.getId()) {
+ case R.id.tele_shoot_target_zone:
+ s1 = teleShootTargetZone.getText().toString() + " ,";
+ if (checked) {
+ if (shotFrom.isEmpty()) {
+ shotFrom = s1;
+ } else {
+ shotFrom = shotFrom + s1;
+ }
+ } else {
+ if (shotFrom.contains(s1)) {
+ int start = shotFrom.indexOf(s1);
+ shotFrom = shotFrom.substring(0, start) + shotFrom.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.tele_shoot_field_front:
+ s1 = teleShootFieldFront.getText().toString() + " ,";
+ if (checked) {
+ if (shotFrom.isEmpty()) {
+ shotFrom = s1;
+ } else {
+ shotFrom = shotFrom + s1;
+ }
+ } else {
+ if (shotFrom.contains(s1)) {
+ int start = shotFrom.indexOf(s1);
+ shotFrom = shotFrom.substring(0, start) + shotFrom.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.tele_shoot_field_diagonal:
+ s1 = teleShootFieldDiagonal.getText().toString() + " ,";
+ if (checked) {
+ if (shotFrom.isEmpty()) {
+ shotFrom = s1;
+ } else {
+ shotFrom = shotFrom + s1;
+ }
+ } else {
+ if (shotFrom.contains(s1)) {
+ int start = shotFrom.indexOf(s1);
+ shotFrom = shotFrom.substring(0, start) + shotFrom.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.tele_shoot_trench_near:
+ s1 = teleShootTrenchNear.getText().toString() + " ,";
+ if (checked) {
+ if (shotFrom.isEmpty()) {
+ shotFrom = s1;
+ } else {
+ shotFrom = shotFrom + s1;
+ }
+ } else {
+ if (shotFrom.contains(s1)) {
+ int start = shotFrom.indexOf(s1);
+ shotFrom = shotFrom.substring(0, start) + shotFrom.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.tele_shoot_trench_far:
+ s1 = teleShootTrenchFar.getText().toString() + " ,";
+ if (checked) {
+ if (shotFrom.isEmpty()) {
+ shotFrom = s1;
+ } else {
+ shotFrom = shotFrom + s1;
+ }
+ } else {
+ if (shotFrom.contains(s1)) {
+ int start = shotFrom.indexOf(s1);
+ shotFrom = shotFrom.substring(0, start) + shotFrom.substring(start + s1.length());
+ }
+ }
+ break;
+ case R.id.tele_shoot_other:
+ s1 = teleShootOther.getText().toString() + " ,";
+ if (checked) {
+ if (shotFrom.isEmpty()) {
+ shotFrom = s1;
+ } else {
+ shotFrom = shotFrom + s1;
+ }
+ } else {
+ if (shotFrom.contains(s1)) {
+ int start = shotFrom.indexOf(s1);
+ shotFrom = shotFrom.substring(0, start) + shotFrom.substring(start + s1.length());
+ }
+ }
+ break;
+ }
+ }
+
+
+ /*This method will look at all of the text/number input fields and set error
+ *for validation of data entry
+ */
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ if (keyCode != KeyEvent.KEYCODE_SPACE && keyCode != KeyEvent.KEYCODE_TAB) {
+ TextInputEditText inputEditText = (TextInputEditText) v;
+
+ if (inputEditText != null) {
+
+ switch (inputEditText.getId()) {
+
+ case R.id.teleop_high_attempts_input:
+ teleopHighAttemptInputLayout.setError(null);
+ break;
+
+ case R.id.teleop_high_made_input:
+ teleopHighMadeInputLayout.setError(null);
+ break;
+
+ case R.id.teleop_low_attempt_input:
+ teleopLowAttemptInputLayout.setError(null);
+ break;
+
+ case R.id.teleop_low_made_input:
+ teleopLowMadeInputLayout.setError(null);
+ break;
+
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * This method will verify that all fields are filled and highlight error to user
+ * along with change focus to first blank input area. The radio button values are obtained
+ * A file is created on the dvice to send the data to. We add the teleop data to the arraylist
+ * delimited by commas. We create our message by concatenating the teleop data to the end of
+ * the auton data. The data is then output to the file we created. We send a message to the user
+ * about the saved message. We send a result back to the auton activity upon completion.
+ * We then clear the data of the teleop activity and finish it to close and return
+ * to the auton activty to clear its data*/
+
+ public void saveData(View view) throws IOException {
+ String state = Environment.getExternalStorageState();
+ boolean allInputsPassed = false;
+
+ if (StringUtils.isEmptyOrNull(getTextInputLayoutString(teleopHighAttemptInputLayout))) {
+ teleopHighAttemptInputLayout.setError(getText(R.string.teleopCargoShipHatchPanelError));
+ ViewUtils.requestFocus(teleopHighAttemptInputLayout, this);
+ } else if (endGameLocationSpinner.getSelectedItem().toString().isEmpty()){
+ setSpinnerError(endGameLocationSpinner, "Please select an end game location.");
+ } else if (StringUtils.isEmptyOrNull(getTextInputLayoutString(teleopHighMadeInputLayout))) {
+ teleopHighMadeInputLayout.setError(getText(R.string.teleopCargoInCargoShipError));
+ ViewUtils.requestFocus(teleopHighMadeInputLayout, this);
+ } else if (StringUtils.isEmptyOrNull(getTextInputLayoutString(teleopLowAttemptInputLayout))) {
+ teleopLowAttemptInputLayout.setError(getText(R.string.hatchPanelTopError));
+ ViewUtils.requestFocus(teleopLowAttemptInputLayout, this);
+ } else if (StringUtils.isEmptyOrNull(getTextInputLayoutString(teleopLowMadeInputLayout))) {
+ teleopLowMadeInputLayout.setError(getText(R.string.cargoTopError));
+ ViewUtils.requestFocus(teleopLowMadeInputLayout, this);
+ } /*else if(typeOfBotSpinner.getSelectedItem().toString( ).equals("")){
+
+ setSpinnerError(typeOfBotSpinner,"Select bot type");
+ ViewUtils.requestFocus(typeOfBotSpinner, this);
+
+ }*/ else {
+ allInputsPassed = true;
+ }
+ if (!allInputsPassed) {
+ return;
+ }
+
+ final RadioButton controlPanelRadingRadioBtn = findViewById(controlPanelRadingRadioGroup.getCheckedRadioButtonId());
+ final RadioButton counterDefenseEffectivenessRadiobtn = findViewById(counterDefenseEffectiveness.getCheckedRadioButtonId());
+ final RadioButton overallEffectivenessRadiobtn = findViewById(overallEffectivenessRadioGoup.getCheckedRadioButtonId());
+ final RadioButton trainedDriveTeamRadiobtn = findViewById(trainedDriveTeamRadioGoup.getCheckedRadioButtonId());
+ final RadioButton powerCellPickUpRadioBtn = findViewById(powerCellPickupRadioGroup.getCheckedRadioButtonId());
+ final RadioButton lowPortDumpRadioBtn = findViewById(lowPortDumpRadioGroup.getCheckedRadioButtonId());
+ final RadioButton underTrenchRadioBtn = findViewById(underTrenchRadioGroup.getCheckedRadioButtonId());
+ final RadioButton defenseRatingRadioBtn = findViewById(defenseRatingRadioGroup.getCheckedRadioButtonId());
+ final RadioButton powerCellPlacementRatingRadioBtn = findViewById(powerCellPlacementRatingRadioGroup.getCheckedRadioButtonId());
+ final RadioButton climbTimeRadiobtn = findViewById(climbTimeRadioGroup.getCheckedRadioButtonId());
+ final RadioButton cycleTimeRadiobtn = findViewById(cycleTimeRadioGroup.getCheckedRadioButtonId());
+
+
+
+ if(PermissionUtils.getPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+ if (Environment.MEDIA_MOUNTED.equals(state)) {
+ File dir = new File(Environment.getExternalStorageDirectory() + "/Scouting");
+ dir.mkdirs();
+
+ File file = new File(dir, "Match" + Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID) + ".csv");
+
+ teleopDataStringList.add(getTextInputLayoutString(teleopHighAttemptInputLayout));
+ teleopDataStringList.add(getTextInputLayoutString(teleopHighMadeInputLayout));
+ teleopDataStringList.add(getTextInputLayoutString(teleopLowAttemptInputLayout));
+ teleopDataStringList.add(getTextInputLayoutString(teleopLowMadeInputLayout));
+ teleopDataStringList.add(getTextInputLayoutString(teleopTrapAttemptInputLayout));
+ teleopDataStringList.add(getTextInputLayoutString(teleopTrapMadeInputLayout));
+// teleopDataStringList.add(cycleTimeRadiobtn.getText().toString());
+ teleopDataStringList.add(endGameLocationSpinner.getSelectedItem().toString());
+ teleopDataStringList.add(climbTimeRadiobtn.getText().toString());
+ teleopDataStringList.add(typeOfBot);
+ teleopDataStringList.add(shotFrom);
+ teleopDataStringList.add(powerCellPickUpRadioBtn.getText().toString());
+// teleopDataStringList.add(lowPortDumpRadioBtn.getText().toString());
+// teleopDataStringList.add(underTrenchRadioBtn.getText().toString());
+ teleopDataStringList.add(defenseRatingRadioBtn.getText().toString());
+ teleopDataStringList.add(counterDefenseEffectivenessRadiobtn.getText().toString());
+// teleopDataStringList.add(powerCellPlacementRatingRadioBtn.getText().toString());
+// teleopDataStringList.add(controlPanelRadingRadioBtn.getText().toString());
+
+ // teleopDataStringList.add(cycleTimeSpinner.getSelectedItem().toString());
+ teleopDataStringList.add(overallEffectivenessRadiobtn.getText().toString());
+ teleopDataStringList.add(trainedDriveTeamRadiobtn.getText().toString());
+
+ teleopDataStringList.add(observations);
+
+ //teleopDataStringList.add(typeOfBotSpinner.getSelectedItem().toString());
+ teleopDataStringList.add(summaryInput.getText().toString());
+ teleopDataStringList.add(issuesInput.getText().toString());
+
+ teleopDataStringList.add(ScouterInitialsActivity.getInitials());
+
+ String message = auton + "|" + FormatStringUtils.addDelimiter(teleopDataStringList, "|") + "\n";
+
+ try {
+ FileOutputStream fileOutputStream = new FileOutputStream(file, true);
+ fileOutputStream.write(message.getBytes());
+ fileOutputStream.close();
+
+ Toast.makeText(getApplicationContext(), "Saved!", Toast.LENGTH_LONG).show();
+ } catch (IOException e) {
+ Toast.makeText(getApplicationContext(), "IOException! Go talk to the programmers!", Toast.LENGTH_LONG).show();
+ Log.d("Scouting", e.getMessage());
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), "SD card not found", Toast.LENGTH_LONG).show();
+ }
+
+ Intent intent = getIntent();
+ intent.putExtra("Key", value);
+ setResult(RESULT_OK, intent);
+
+ clearData(view);
+
+ finish();
+ }
+
+ teleopHighAttemptInputLayout.setError(null);
+ teleopHighMadeInput.setError(null);
+ teleopLowAttemptInputLayout.setError(null);
+ teleopLowMadeInputLayout.setError(null);
+
+
+ }
+
+ /*The method will clear all the data in the text fields, checkboxes, and
+ * set radio buttons to default*/
+ public void clearData(View view) {
+ teleopHighAttemptsInput.setText("" + teleopHighMissed);
+ teleopHighMadeInput.setText("" + teleopHighMade);
+ teleopLowAttemptInput.setText("" + teleopLowMissed);
+ teleopLowMadeInput.setText("" + teleopLowMade);
+
+ controlPanelRadingRadioGroup.clearCheck();
+ counterDefenseEffectiveness.clearCheck();
+ endGameLocationSpinner.setSelection(0);
+ climbTimeRadioGroup.clearCheck();
+ //cycleTimeSpinner.setSelection(0);
+ cycleTimeRadioGroup.clearCheck();
+ defenseRatingRadioGroup.clearCheck();
+ powerCellPlacementRatingRadioGroup.clearCheck();
+ overallEffectivenessRadioGoup.clearCheck();
+ trainedDriveTeamRadioGoup.clearCheck();
+ powerCellPickupRadioGroup.clearCheck();
+ lowPortDumpRadioGroup.clearCheck();
+ underTrenchRadioGroup.clearCheck();
+ observsmooth.setChecked(false);
+ observSlowedByRobot.setChecked(false);
+ observSlow.setChecked(false);
+ observPlayedDefense.setChecked(false);
+ observPenalties.setChecked(false);
+ observNotMuch.setChecked(false);
+ observJerky.setChecked(false);
+ observPanelIssues.setChecked(false);
+ observFellOver.setChecked(false);
+ observFellApart.setChecked(false);
+ observFast.setChecked(false);
+ observDns.setChecked(false);
+ observDiedMid.setChecked(false);
+ observDiedBack.setChecked(false);
+ observPowerCellPickup.setChecked(false);
+ observAverageSpeed.setChecked(false);
+ observPowerCellStuckIntake.setChecked(false);
+// observHungUpPowerCell.setChecked(false);
+// observFellOffSwitch.setChecked(false);
+ observHungUp.setChecked(false);
+ typeLowShooter.setChecked(false);
+ typeFeederBot.setChecked(false);
+ typeControlPanel.setChecked(false);
+ typeCounterDefenseBot.setChecked(false);
+ typeDefenseBot.setChecked(false);
+ teleShootTargetZone.setChecked(false);
+ teleShootFieldFront.setChecked(false);
+ teleShootFieldDiagonal.setChecked(false);
+ teleShootTrenchNear.setChecked(false);
+ teleShootTrenchFar.setChecked(false);
+ teleShootOther.setChecked(false);
+ // typeOfBotSpinner.setSelection(0);
+ summaryInput.setText(null);
+ issuesInput.setText(null);
+ teleopHighAttempt = 0;
+ teleopHighMissed =0;
+ teleopHighMade = 0;
+ teleopLowAttempt = 0;
+ teleopLowMissed = 0;
+ teleopLowMade = 0;
+
+ }
+
+ /* This method will change the text entered into the app into a string if it is not already*/
+ private String getTextInputLayoutString(@NonNull TextInputLayout textInputLayout) {
+ final EditText editText = textInputLayout.getEditText();
+ return editText != null && editText.getText() != null ? editText.getText().toString() : "";
+ }
+}
diff --git a/app/src/main/java/com/example/ncgears/scouting/customToast/CustomToast.java b/app/src/main/java/com/example/ncgears/scouting/customToast/CustomToast.java
new file mode 100644
index 0000000..709287f
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/customToast/CustomToast.java
@@ -0,0 +1,55 @@
+package com.example.ncgears.scouting.customToast;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.ncgears.scouting.R;
+
+public class CustomToast{
+
+ private static Toast currentToast;
+
+ public static void showShort(Context context, String message){
+ if(currentToast != null) currentToast.cancel();
+ LayoutInflater inflater = ((Activity)context).getLayoutInflater();
+ View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) ((Activity) context).findViewById(R.id.root));
+ TextView text = (TextView) layout.findViewById(R.id.message);
+
+ text.setText(message);
+
+ Toast toast = new Toast(context);
+
+ toast.setDuration(Toast.LENGTH_SHORT);
+
+ toast.setView(layout);
+ toast.show();
+ currentToast = toast;
+ }
+
+ public static void showLong(Context context, String message){
+ if(currentToast != null) currentToast.cancel();
+ LayoutInflater inflater = ((Activity)context).getLayoutInflater();
+ View layout = inflater.inflate(R.layout.custom_toast, (ViewGroup) ((Activity) context).findViewById(R.id.root));
+ TextView text = (TextView) layout.findViewById(R.id.message);
+
+ text.setText(message);
+
+ Toast toast = new Toast(context);
+
+ toast.setDuration(Toast.LENGTH_LONG);
+
+ toast.setView(layout);
+ toast.show();
+ currentToast = toast;
+ }
+
+ public static Toast getCurrentToast(){
+ return currentToast;
+ }
+
+}
diff --git a/app/src/main/java/com/example/ncgears/scouting/data/GetJasonData.java b/app/src/main/java/com/example/ncgears/scouting/data/GetJasonData.java
new file mode 100644
index 0000000..0c1bc93
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/data/GetJasonData.java
@@ -0,0 +1,112 @@
+package com.example.ncgears.scouting.data;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.os.AsyncTask;
+
+import com.example.ncgears.scouting.MainActivity;
+import com.example.ncgears.scouting.settings.settings.SettingsEntry;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+
+public class GetJasonData extends AsyncTask{
+
+ Context ctx;
+ String data = "";
+ String dataParsed = "";
+ String singleParsed = "";
+ String[] teams;
+
+
+ public GetJasonData(Context ctx){
+
+ this.ctx = ctx;
+
+ }
+
+
+ @Override
+ protected Void doInBackground(Void... voids) {
+
+
+
+ try {
+ URL url = new URL(SettingsEntry.teamsUrl);
+
+ HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
+ InputStream inputStream = httpURLConnection.getInputStream();
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String line = "";
+
+ while (line != null){
+
+ line = bufferedReader.readLine();
+ data = data + line;
+ }
+
+ JSONObject JO = new JSONObject(data);
+ JSONArray JA = JO.getJSONArray("valueRanges");
+ JSONObject Jobj = new JSONObject(JA.getString(0));
+ JSONArray Jarr = Jobj.getJSONArray("values");
+
+ TeamsDbHelper mDbHelper = new TeamsDbHelper(ctx);
+ SQLiteDatabase db = mDbHelper.getWritableDatabase();
+ ContentValues values = new ContentValues();
+
+
+ for(int i = 0; i < Jarr.length(); i++){
+
+
+ String teamNumber = Jarr.getJSONArray(i).getString(0);
+ String teamName = Jarr.getJSONArray(i).getString(1);
+ singleParsed = singleParsed + teamNumber + " | " + teamName + "\n";
+ values.put(TeamsContract.TeamEntry.COLUMN_TEAM_NUMBER, teamNumber);
+ values.put(TeamsContract.TeamEntry.COLUMN_TEAM_NAME, teamName);
+ TeamsDbHelper.setTeams(db, values);
+ }
+
+
+
+ db.close();
+
+
+
+
+ } catch (MalformedURLException e){
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+
+ @Override
+ protected void onPostExecute(Void aVoid){
+ super.onPostExecute(aVoid);
+
+
+ MainActivity.data.setText(singleParsed);
+
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/ncgears/scouting/data/TeamsContract.java b/app/src/main/java/com/example/ncgears/scouting/data/TeamsContract.java
new file mode 100644
index 0000000..b878981
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/data/TeamsContract.java
@@ -0,0 +1,22 @@
+package com.example.ncgears.scouting.data;
+
+import android.provider.BaseColumns;
+
+public class TeamsContract {
+
+ private TeamsContract(){}
+
+ public static final class TeamEntry implements BaseColumns {
+
+ // constant variable with Table Name
+ public static final String TABLE_NAME = "teams";
+
+ // constant variables of column names
+ public static final String _ID = BaseColumns._ID;
+ public static final String COLUMN_TEAM_NUMBER = "team_number";
+ public static final String COLUMN_TEAM_NAME = "team_name";
+
+
+ }
+
+}
diff --git a/app/src/main/java/com/example/ncgears/scouting/data/TeamsDbHelper.java b/app/src/main/java/com/example/ncgears/scouting/data/TeamsDbHelper.java
new file mode 100644
index 0000000..c7c1cfb
--- /dev/null
+++ b/app/src/main/java/com/example/ncgears/scouting/data/TeamsDbHelper.java
@@ -0,0 +1,129 @@
+package com.example.ncgears.scouting.data;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+import com.example.ncgears.scouting.data.TeamsContract.TeamEntry;
+
+import java.util.ArrayList;
+
+
+public class TeamsDbHelper extends SQLiteOpenHelper {
+
+ public static final String TAG = TeamsDbHelper.class.getSimpleName();
+ private static final String DATABASE_NAME = "teams.db";
+ private static final int DATABASE_VERSION = 1;
+
+
+ public TeamsDbHelper(Context context){
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+
+ Log.d(TAG, "TeamsDbHelper: Database Created.");
+ }
+
+
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+
+ createTable(db);
+
+ }
+
+ public static void createTable(SQLiteDatabase db){
+
+ String sql_create_teams_table = "CREATE TABLE "+ TeamEntry.TABLE_NAME +"("
+ + TeamEntry._ID +" Integer PRIMARY KEY AUTOINCREMENT, "
+ + TeamEntry.COLUMN_TEAM_NUMBER +" text NOT NULL, "
+ + TeamEntry.COLUMN_TEAM_NAME +" text);";
+
+ db.execSQL(sql_create_teams_table);
+
+ }
+
+ public static void dropTable(SQLiteDatabase db){
+
+
+
+ String sql_drop_table = "DROP TABLE if EXISTS " + TeamsContract.TeamEntry.TABLE_NAME + ";";
+
+
+ db.execSQL(sql_drop_table);
+
+
+
+
+ }
+
+
+ public static void setTeams(SQLiteDatabase db, ContentValues values){
+
+
+ long newIndex = db.insert(TeamsContract.TeamEntry.TABLE_NAME, null, values);
+
+ }
+
+ public static ArrayList getTeamNumbers(SQLiteDatabase db){
+
+ ArrayList result = new ArrayList();
+
+ Cursor cursor = db.rawQuery("SELECT "+ TeamEntry.COLUMN_TEAM_NUMBER + " FROM teams;",null);
+
+ int numberColumn = cursor.getColumnIndex(TeamEntry.COLUMN_TEAM_NUMBER);
+
+ cursor.moveToFirst();
+
+ if(cursor != null && (cursor.getCount() > 0)){
+
+ int i = 0;
+
+ do {
+
+ result.add(cursor.getString(numberColumn));
+
+ }while (cursor.moveToNext());
+
+ }
+
+ return result;
+
+ }
+
+ public static ArrayList getTeams(SQLiteDatabase db){
+
+ ArrayList result = new ArrayList();
+
+ Cursor cursor = db.rawQuery("SELECT * FROM teams;",null);
+
+ int numberColumn = cursor.getColumnIndex(TeamEntry.COLUMN_TEAM_NUMBER);
+ int nameColumn = cursor.getColumnIndex(TeamEntry.COLUMN_TEAM_NAME);
+
+ cursor.moveToFirst();
+
+ if(cursor != null && (cursor.getCount() > 0)){
+
+ int i = 0;
+
+ do {
+
+ result.add(cursor.getString(numberColumn) + " | " + cursor.getString(nameColumn));
+
+ }while (cursor.moveToNext());
+
+ }
+
+ return result;
+
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/utils/FormatStringUtils.java b/app/src/main/java/utils/FormatStringUtils.java
new file mode 100644
index 0000000..8845e81
--- /dev/null
+++ b/app/src/main/java/utils/FormatStringUtils.java
@@ -0,0 +1,23 @@
+package utils;
+
+import java.util.ArrayList;
+
+
+
+public class FormatStringUtils {
+
+ public static String addDelimiter(ArrayList strings, String delimiter) {
+
+ final StringBuilder stringBuilder = new StringBuilder();
+
+ for (int i = 0; i < strings.size(); i++) {
+ stringBuilder.append(strings.get(i));
+
+ if (i < strings.size() - 1) {
+ stringBuilder.append(delimiter);
+ }
+ }
+
+ return stringBuilder.toString();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/utils/PermissionUtils.java b/app/src/main/java/utils/PermissionUtils.java
new file mode 100644
index 0000000..dbdb3c3
--- /dev/null
+++ b/app/src/main/java/utils/PermissionUtils.java
@@ -0,0 +1,16 @@
+package utils;
+
+import android.app.Activity;
+import android.content.pm.PackageManager;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+
+public class PermissionUtils {
+ public static boolean getPermissions(Activity activity, String type) {
+ int permission = ContextCompat.checkSelfPermission(activity, type);
+ if (permission != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(activity, new String[]{type}, 1);
+ }
+ return permission == PackageManager.PERMISSION_GRANTED;
+ }
+}
diff --git a/app/src/main/java/utils/StringUtils.java b/app/src/main/java/utils/StringUtils.java
new file mode 100644
index 0000000..e377ab1
--- /dev/null
+++ b/app/src/main/java/utils/StringUtils.java
@@ -0,0 +1,7 @@
+package utils;
+
+public class StringUtils {
+ public static boolean isEmptyOrNull(String string){
+ return string == null || string.isEmpty();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/utils/ViewUtils.java b/app/src/main/java/utils/ViewUtils.java
new file mode 100644
index 0000000..de5bc1b
--- /dev/null
+++ b/app/src/main/java/utils/ViewUtils.java
@@ -0,0 +1,15 @@
+package utils;
+
+import android.app.Activity;
+import android.view.View;
+import android.view.WindowManager;
+
+public class ViewUtils {
+ public static boolean requestFocus(View v, Activity activity){
+ if(v.requestFocus()){
+ activity.getWindow().setSoftInputMode((WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE));
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..c7bd21d
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/custom_toast.xml b/app/src/main/res/drawable/custom_toast.xml
new file mode 100644
index 0000000..5d64170
--- /dev/null
+++ b/app/src/main/res/drawable/custom_toast.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..2408e30
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_auton.xml b/app/src/main/res/layout/activity_auton.xml
new file mode 100644
index 0000000..d79c7bd
--- /dev/null
+++ b/app/src/main/res/layout/activity_auton.xml
@@ -0,0 +1,516 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Begin of High Power Port counters
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ //End of High Power Port counters
+
+ //Begin of Low Power Port counters
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ///End of Lower Power Port Counters
+
+ // Start of Initiation Line Question
+
+
+
+
+
+
+
+
+
+
+
+ // End of Initiation Line Question
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..bfcc38f
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_pit.xml b/app/src/main/res/layout/activity_pit.xml
new file mode 100644
index 0000000..3f275e3
--- /dev/null
+++ b/app/src/main/res/layout/activity_pit.xml
@@ -0,0 +1,602 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_scouter_initials.xml b/app/src/main/res/layout/activity_scouter_initials.xml
new file mode 100644
index 0000000..f59b5d0
--- /dev/null
+++ b/app/src/main/res/layout/activity_scouter_initials.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_send_data.xml b/app/src/main/res/layout/activity_send_data.xml
new file mode 100644
index 0000000..456efe1
--- /dev/null
+++ b/app/src/main/res/layout/activity_send_data.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_teleop.xml b/app/src/main/res/layout/activity_teleop.xml
new file mode 100644
index 0000000..23c3b26
--- /dev/null
+++ b/app/src/main/res/layout/activity_teleop.xml
@@ -0,0 +1,1463 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/custom_toast.xml b/app/src/main/res/layout/custom_toast.xml
new file mode 100644
index 0000000..8439624
--- /dev/null
+++ b/app/src/main/res/layout/custom_toast.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml
new file mode 100644
index 0000000..d44a91e
--- /dev/null
+++ b/app/src/main/res/menu/main_menu.xml
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..bbd3e02
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..bbd3e02
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..ffbdd46
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..5f818a3
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..a08b160
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..ab9c25a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..0b5c0b4
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..f1db4ac
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6d33b8e
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..a390d1e
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..5356c58
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..0d22b67
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..801794e
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,9 @@
+
+
+ #317ac7
+ #094A8D
+ #33b850
+ #ffffff
+ #33b850
+ #317ac7
+
diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml
new file mode 100644
index 0000000..0d2c4cc
--- /dev/null
+++ b/app/src/main/res/values/ids.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..e9be95b
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,399 @@
+
+
+ Scouting 2024 Crescendo
+
+ Send Data
+ Submit
+
+ Authors 1918 Scouting
+
+ Revised 1/23/2024
+
+ Concatenate Match
+ Concatenate Pit
+ Enter concatenation folder name
+ Scouting
+ concatenateData
+ Send Robot Photos
+ Send Pit Data
+ Send Match Data
+
+
+
+ -
+ +
+
+
+
+ Team Number
+ Match Number
+ Starting Location (relative to the Power Port)
+ Moved off Hab?
+ No
+ Yes
+ How did the team play during SandStorm?
+
+ Cargo Ship: Hatch Panel
+
+ Cargo Ship: Cargo
+ Rocket: Lower Level Hatch Panel
+ Rocket: Lower Level Cargo
+ Rocket: Middle Level Hatch Panel
+ Rocket: Middle Level Cargo
+ Rocket: Upper Level Hatch Panel
+ Rocket: Upper Level Cargo
+ Save
+ Enter in team number
+
+ Enter in match number
+
+
+
+
+ Enter starting location
+ Cargo Ship
+ Rocket Ship
+
+
+
+ Hatch Panels on Cargo Ship
+ Cargo in Cargo Ship
+ Hatch Panel Top
+ Hatch Panel Middle
+ Hatch Panel Bottom
+ Cargo Top
+ Cargo Middle
+ Cargo Bottom
+ Where was the robot at end game? (select from drop down)
+ General Info
+
+ How did the robot interact with the Control Panel?
+ Rate the overall effectiveness of the robot during the match (1 = BAD, 5 = Excellent).
+ How trained did the drive team look (1 = BAD, 5 = Excellent)?
+ Rate the overall placement of cargo and hatch panels
+ Average Speed
+
+ Dropped a lot of hatches
+ Dropped a lot of cargo
+ Had a hard time placing hatches
+ Had a hard time placing cargo
+ How did the robot pick up hatch panels?
+ How did the robot pick up cargo?
+ N/A
+ At the port
+ Off the floor
+ N/A
+ At the port
+ Off the floor
+ Robot Observations
+ In summary what did the robot do well?
+ List any issues the robot had.
+ Enter Issues here
+ Enter Summary Here
+ Fast
+ Slow
+
+
+ Jerky
+ Smooth
+ Fell Over
+ Died during match
+ Died but came back
+ Got lots of penalties
+ Robot fell apart
+ Played defense most of the match
+ Didn\'t do much
+ Had hard time picking up hatch panels
+ Had hard time picking up notes
+ Had defense played against them
+ Didn\'t show up
+ How effective was the robot\'s defense?
+ If the robot played counter defense, rate the level of counter defense.
+ Had a hard time picking up Notes
+ Note stuck in intake
+
+
+
+ How effective was the robot while being defended?
+ Shut Down
+ Slowed Down
+
+ Not Effective
+ Not Effected
+ Type of Bot
+ Climb
+
+
+
+
+ Success
+
+ Fail
+
+
+ N/A
+ Climb Time once underneath the Stage
+ 0 - 10 seconds
+ 11 - 19 seconds
+
+
+
+ 20 + seconds
+ N/A
+ Can help others climb
+ Yes
+ No
+
+ On platform
+ Success
+ Fail
+
+ N/A
+ Defense
+ Effective
+ Ineffective
+
+ Fouled
+ N/A
+ Fouls
+ Move To Teleop
+ Scouter Initials
+
+
+
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ N/A
+ Match
+ Pit
+ Team Number
+
+
+ Yes
+ No
+ NA
+
+
+ Robot Weight
+ Drive Train
+
+
+ Programming Language
+ On what habitat platform do you prefer to start from?
+ What game piece do you preload?
+ What game piece was preloaded?
+ Hatch panel
+ Cargo
+ Nothing
+ Where on the field can your robot take Speaker shots from?
+ NA
+ Inner Port
+ Outer Port
+ Bottom Port
+ Where does your robot place hatch panels?
+ Cargo Ship
+ Rocket-Bottom
+ Rocket-middle
+ Rocket-top
+ N/A
+ Where does your robot place cargo?
+ What does your robot do at endgame?
+ What do you place on the cargo ship before the match?
+ Cargo
+ Hatch Panel
+ Nothing
+ Basic plan
+ How many power cells do you preload your robot with for Auto?
+ Yes
+ No
+ Spun 3-5 times
+ Set to color
+ Both
+ Where can the robot get Notes?
+ Fun Questions
+ Does Your Robot Have A Name? If so, What is it?
+ Robot Name (Leave Blank if None)
+
+
+
+ Attempted but failed
+
+
+
+ N/A
+
+
+ Java
+
+
+ C++
+
+ LabVIEW
+
+ Other
+
+
+
+ How much does your robot weigh?
+
+ What old arcade game would your robot be in?
+ Save
+ Take Photo
+ Select a team number
+ Enter Programming Language
+
+ Enter Robot Name
+ Enter Robot Weight
+ Enter Cargo Ship Hatch Panels
+ Enter Cargo Ship Cargo
+ Enter Top HatchPanels
+ Enter Middle Hatch Panels
+ Enter Bottom Hatch Panels
+
+ Enter Top Cargo
+
+
+ Enter Middle Cargo
+ Enter Bottom Cargo
+ Enter Scouter Initials
+ Both
+
+
+ Both
+ Import TEAMS
+ Does your robot move from the Alliance initiation line during auton
+ Can your robot drive through the trench?
+ Can your robot hang in endgame? If so, with how many other robots?"
+ Where can your robot score Notes?
+ N/A
+ Speaker
+ Amp
+ Trap
+ If your robot hangs, can it hang with multiple robots?
+ Can hang alone
+ Can hang with one other robot
+ Can hang with two other robots
+ What is your basic game plan during teleop?
+ Missed
+ Made
+ Missed
+ Made
+ Speaker
+ Amp
+ Trap
+ Did the robot\'s bumpers move completely out of the Starting Zone?
+ If the robot played defense, rate the level of defense.
+ Rate the overall effectiveness of the robot during the match.
+ Rate the overall cargo placement (1 = BAD, 5 = Excellent).
+ How good was the team with the control panel (1 = BAD, 5 = Excellent)?
+ Knocked a robot off the Stage
+ Missed Cargo mostly bounced out
+ Shot the wrong cargo into the hub
+ Fell while climbing
+ Where did the robot get Notes?
+ Floor pickup
+ Human Player Station
+ Both
+ Did the robot go under the trench?
+ Did the Robot dump all balls into the Low Power Port at once?
+ Type of Bot
+ Speaker scorer
+ Amp scorer
+ Trap scorer
+ Feeder bot
+ Control panel bot
+ Defense bot
+ Counter defense bot
+ Where did the robot take Speaker shots from?
+ Against the Subwoofer
+ From the Amp Zone
+ From the base of the Stage
+ From the Starting Zone
+ In the Trench in front of the Control Panel
+ From outside the Starting Zone
+ Where is your robot\'s favorite shot to take?
+ What are your robot\'s autonomous programs?
+ Post-Match Observations
+
+
+ -
+ - In Front
+ - Diagonal on Home Trench side
+ - Diagonal away from Home Trench side
+
+
+
+ -
+ - Autonomous
+ - Driver-Operated
+ - Didn\'t Move
+
+
+
+
+ - Offense great scorer (10+ elements)
+ - Offense medium scorer (6-9 elements)
+ - Offense low scorer (5 or less elements)
+ - Defense (go to other side of field)
+ - Counter defense (protect own alliance)
+ - Utility (play some offense, some defense)
+ - Missing or died
+
+
+
+
+ - C++
+ - Java
+ - LabView
+ - Python
+ - Other
+
+
+ - Arcade
+ - Mechanum
+ - Swerve
+ - Tank
+ - West Coast
+ - Other
+
+
+ - Lowest deck
+ - Middle deck
+ - Highest deck
+
+
+ - Cargo
+ - Hatch Panel
+ - Nothing
+
+
+ -
+ - Parked
+ - Onstage Alone
+ - Onstage With One Other Robot
+ - Onstage With Two Other Robots
+ - Outside the Stage
+
+
+
+ -
+ - Less than 5 seconds
+ - 5 to 10 Seconds
+ - 10 to 15 Seconds
+ - 20 + Seconds
+ - N/A
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..fba9ffd
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml
new file mode 100644
index 0000000..0065cf5
--- /dev/null
+++ b/app/src/main/res/xml/provider_paths.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..50e861c
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,28 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ jcenter()
+ maven { url "https://maven.google.com" }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.2.1'
+
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/dev instructions/Data Display.txt b/dev instructions/Data Display.txt
new file mode 100644
index 0000000..2b00835
--- /dev/null
+++ b/dev instructions/Data Display.txt
@@ -0,0 +1,3 @@
+To organize and our data, I created a SQL database using MySQL server and PopSQL and imported the data from the CSVs from each tablet. Alicia uses a different process that is more efficient using SQLite.
+
+To display our data, we use tableau. Good examples of those displays can be seen on NCGEARS Laptop 5. Here is a published vis from the 2024 Season: https://public.tableau.com/views/NCGEARSGVSU2024ScoutingFeed/Dashboard1?:language=en-US&publish=yes&:sid=&:display_count=n&:origin=viz_share_link
\ No newline at end of file
diff --git a/dev instructions/Importing Teams.txt b/dev instructions/Importing Teams.txt
new file mode 100644
index 0000000..ec1fec9
--- /dev/null
+++ b/dev instructions/Importing Teams.txt
@@ -0,0 +1,13 @@
+To import a set of teams for an event, create a google sheet with the teams following this format: https://docs.google.com/spreadsheets/d/1iH71bhqwwXhN5UFfaJnYUZU0hVWv2XBh9JCiLs95fLc/edit#gid=0
+
+Then, in the settings folder of the app in Android Studio, update the teamsUrl with that sheet. It should look like this:
+
+public static final String teamsUrl = "https://sheets.googleapis.com/v4/spreadsheets/ YOUR SPREADSHEET's ID /values:batchGet?majorDimension=ROWS&ranges=A2%3AB200&key=AIzaSyD-N8qhcwO6tdMFx6t3ZA6PvwSvb_1D9AE";
+
+using the example spreadsheet, this would look like:
+
+public static final String teamsUrl = "https://sheets.googleapis.com/v4/spreadsheets/1iH71bhqwwXhN5UFfaJnYUZU0hVWv2XBh9JCiLs95fLc/values:batchGet?majorDimension=ROWS&ranges=A2%3AB200&key=AIzaSyD-N8qhcwO6tdMFx6t3ZA6PvwSvb_1D9AE";
+
+
+
+Once that is done, you can push the code to the tablets, connect the wifi, and load the teams with the button on the main screen of the app.
\ No newline at end of file
diff --git a/dev instructions/Pulling scouting data.txt b/dev instructions/Pulling scouting data.txt
new file mode 100644
index 0000000..ffbf498
--- /dev/null
+++ b/dev instructions/Pulling scouting data.txt
@@ -0,0 +1,3 @@
+to get the scouting data, connect the tablet to your computer via usb. Go into the tablet's files, into the SCOUTING folder, and copy either the Matchdata or Pitdata file to your computer.
+
+AFTER THE EVENT, and ONLY after the event, delete the Matchdata and Pitdata files from the SCOUTING folder. This will clear the entire file for the next event. DO NOT do this during an event, only after.
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..7174358
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+android.defaults.buildfeatures.buildconfig=true
+android.nonFinalResIds=false
+android.nonTransitiveRClass=false
+org.gradle.jvmargs=-Xmx1536m
+org.gradle.jvmargs=-Xmx1920M \
+--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
+--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
+--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7454180
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..6b0bc23
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+T
\ No newline at end of file
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..c53aefa
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..107acd3
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'