Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d957a1db5e | |||
| 60d56473f5 | |||
| d607f95a8a | |||
| 62a4452581 | |||
| b62d04dac5 | |||
| 07c6e9a2aa | |||
| 9f5ebd4215 | |||
| 0a9f846e77 | |||
| f37f12178b | |||
| e537aab819 | |||
| 9607241c53 | |||
| 4764aea990 |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 162 KiB |
@@ -1,40 +1,28 @@
|
|||||||
# ScoutingApp2025
|

|
||||||
Ridgebotics 2025 scouting app in Android
|
|
||||||
|
|
||||||
## TODO:
|
#### Docs are yet to be written, but here is an overview of the main features currently included in the app:
|
||||||
#### Scouting:
|
- This project is written for Android! No need for some kind of janky laptop charging setup.
|
||||||
- Make the "Report" menu, A tool that lets users select data to display from the the teams and compare menus.
|
- Similar to ScoutingPASS, there are many diffrent types of fields that can be used to collect data.
|
||||||
- Make practice mode
|
- The app is designed to handle updates to the fields on the fly, without loosing any data!
|
||||||
#### Data Analysis:
|
- Unlike other scouting solutions, scouters can disable any field they did not measure, and disabled fields will not be included in any calculations.
|
||||||
- Statbotics intigration???
|
- Dynamic displays based off of the diffrent fields.
|
||||||
- AI overview of scouting data for a team???
|
- Data transfer including 2D codes, Bluetooth, and File Bundle.
|
||||||
- Make the "Compare" menu, cross comparing team's stats.
|
- Exporting using CSV.
|
||||||
#### Functionality:
|
|
||||||
- Add more types of data fields.
|
|
||||||
- Test the scouting app
|
|
||||||
- Deploy to F-Droid
|
|
||||||
|
|
||||||
## In Progress:
|
#### Things that are yet to be implemented:
|
||||||
#### Scouting:
|
- A page that lets users cross-compare scouting data between teams. (Compare)
|
||||||
#### Data Analysis:
|
- A page that lets scouters more easily make reports to the drive team before a match starts (Report)
|
||||||
#### Functionality:
|
- More types of fields
|
||||||
- Make server software to allow for easy sync over wifi - FTP
|
- Data cloud sync using an FTP server
|
||||||
|
- Deployment on F-Droid
|
||||||
|
|
||||||
## Done:
|
#### Things that may or may not be implemented:
|
||||||
#### Scouting:
|
- Practice mode
|
||||||
- Add an "unselect" option to all of the scouting fields
|
- Statbotics intgration
|
||||||
- When a field is created, make updated scouting data return null values, not the default value
|
- Scout error estimation using OPR-like calculation
|
||||||
- Fix scouting offset bug
|
- - Would most likely require Statbotics
|
||||||
#### Data Analysis:
|
|
||||||
- Add "history" view type to the teams view menu.
|
### Screenshots
|
||||||
- Sentiment analysis of text input type
|
|Match scouting interface|Field editor|Teams data viewer|
|
||||||
- Add CSV exporting of match scouting data.
|
|-|-|-|
|
||||||
#### Functionality:
|
||||
|
||||||
- Improve the code scanning progress indicator. It has a rounding error, I think.
|
|
||||||
- Fix navigation crashes.
|
|
||||||
- Make everything use Fragments instead of views that toggle visibility
|
|
||||||
- Make the file browser UI
|
|
||||||
- Bluetooth data sync
|
|
||||||
- Formalize error messages & stacktraces
|
|
||||||
- Make pit and match data field builder UIs. I don't want to have to keep editing a variable
|
|
||||||
- Make the system for blank and unselected fields better.
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
### TODO:
|
||||||
|
##### Scouting:
|
||||||
|
- Make practice mode??
|
||||||
|
##### Data Analysis:
|
||||||
|
- Statbotics intigration???
|
||||||
|
- Make the "Compare" menu, cross comparing team's stats.
|
||||||
|
##### Functionality:
|
||||||
|
- Add more types of data fields.
|
||||||
|
- Test the scouting app
|
||||||
|
- Write docs
|
||||||
|
|
||||||
|
### In Progress:
|
||||||
|
##### Scouting:
|
||||||
|
##### Data Analysis:
|
||||||
|
- AI overview of scouting data for a team???
|
||||||
|
- Make the "Report" menu, A tool that lets users select data to display from the the teams and compare menus.
|
||||||
|
##### Functionality:
|
||||||
|
- Make server software to allow for easy sync over wifi - FTP
|
||||||
|
- Deploy to F-Droid
|
||||||
|
|
||||||
|
### Done:
|
||||||
|
##### Scouting:
|
||||||
|
- Add an "unselect" option to all of the scouting fields
|
||||||
|
- When a field is created, make updated scouting data return null values, not the default value
|
||||||
|
- Fix scouting offset bug
|
||||||
|
##### Data Analysis:
|
||||||
|
- Add "history" view type to the teams view menu.
|
||||||
|
- Sentiment analysis of text input type
|
||||||
|
- Add CSV exporting of match scouting data.
|
||||||
|
##### Functionality:
|
||||||
|
- Improve the code scanning progress indicator. It has a rounding error, I think.
|
||||||
|
- Fix navigation crashes.
|
||||||
|
- Make everything use Fragments instead of views that toggle visibility
|
||||||
|
- Make the file browser UI
|
||||||
|
- Bluetooth data sync
|
||||||
|
- Formalize error messages & stacktraces
|
||||||
|
- Make pit and match data field builder UIs. I don't want to have to keep editing a variable
|
||||||
|
- Make the system for blank and unselected fields better.
|
||||||
@@ -16,12 +16,20 @@ android {
|
|||||||
namespace = "com.ridgebotics.ridgescout"
|
namespace = "com.ridgebotics.ridgescout"
|
||||||
compileSdk = 34
|
compileSdk = 34
|
||||||
|
|
||||||
|
dependenciesInfo {
|
||||||
|
// Disables dependency metadata when building APKs.
|
||||||
|
includeInApk = false
|
||||||
|
// Disables dependency metadata when building Android App Bundles.
|
||||||
|
includeInBundle = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.ridgebotics.ridgescout"
|
applicationId = "com.ridgebotics.ridgescout"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 2
|
versionCode = 4
|
||||||
versionName = "0.2"
|
versionName = "0.4"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -78,6 +86,8 @@ dependencies {
|
|||||||
|
|
||||||
implementation("org.tensorflow:tensorflow-lite-task-text:0.3.0")
|
implementation("org.tensorflow:tensorflow-lite-task-text:0.3.0")
|
||||||
|
|
||||||
|
implementation("com.squareup.okhttp3:okhttp:4.9.0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// implementation("com.github.DeveloperPaul123:SimpleBluetoothLibrary:1.5.1")
|
// implementation("com.github.DeveloperPaul123:SimpleBluetoothLibrary:1.5.1")
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 2,
|
"versionCode": 4,
|
||||||
"versionName": "0.2",
|
"versionName": "0.4",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ public class ExampleInstrumentedTest {
|
|||||||
public void useAppContext() {
|
public void useAppContext() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
assertEquals("com.astatin3.scoutingapp2025", appContext.getPackageName());
|
assertEquals("com.ridgebotics.ridgescout", appContext.getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />-->
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
@@ -29,8 +29,12 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.ScoutingApp2025"
|
android:theme="@style/Theme.RidgeScout"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
|
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
@@ -42,6 +46,8 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<action android:name="android.intent.action.GET_CONTENT" />
|
<action android:name="android.intent.action.GET_CONTENT" />
|
||||||
<category android:name="android.intent.category.OPEN_FILE" />
|
<category android:name="android.intent.category.OPEN_FILE" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
<data android:mimeType="*/*" />
|
<data android:mimeType="*/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.ridgebotics.ridgescout;
|
package com.ridgebotics.ridgescout;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.databinding.ActivityMainBinding;
|
||||||
import com.ridgebotics.ridgescout.scoutingData.fields;
|
import com.ridgebotics.ridgescout.scoutingData.fields;
|
||||||
import com.ridgebotics.ridgescout.utility.SentimentAnalysis;
|
import com.ridgebotics.ridgescout.utility.SentimentAnalysis;
|
||||||
import com.ridgebotics.ridgescout.utility.AlertManager;
|
import com.ridgebotics.ridgescout.utility.AlertManager;
|
||||||
@@ -18,9 +20,8 @@ import androidx.navigation.Navigation;
|
|||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.databinding.ActivityMainBinding;
|
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.google.android.material.navigation.NavigationBarView;
|
import com.google.android.material.navigation.NavigationBarView;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -38,7 +39,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
latestSettings.update();
|
|
||||||
|
settingsManager.prefs = this.getSharedPreferences(
|
||||||
|
"com.ridgebotics.ridgescout", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
if(!fileEditor.fileExist(fields.matchFieldsFilename)){
|
if(!fileEditor.fileExist(fields.matchFieldsFilename)){
|
||||||
fields.save(fields.matchFieldsFilename, fields.default_match_fields);
|
fields.save(fields.matchFieldsFilename, fields.default_match_fields);
|
||||||
@@ -66,30 +69,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
navView = findViewById(R.id.nav_view);
|
navView = findViewById(R.id.nav_view);
|
||||||
// appBarConfiguration = new AppBarConfiguration.Builder(
|
|
||||||
// R.id.navigation_scouting,
|
|
||||||
// R.id.navigation_match_scouting,
|
|
||||||
// R.id.navigation_team_selector,
|
|
||||||
// R.id.navigation_pit_scouting,
|
|
||||||
//
|
|
||||||
// R.id.navigation_data,
|
|
||||||
// R.id.navigation_data_status,
|
|
||||||
// R.id.navigation_data_teams,
|
|
||||||
// R.id.navigation_data_compile,
|
|
||||||
// R.id.navigation_data_fields_chooser,
|
|
||||||
// R.id.navigation_data_fields,
|
|
||||||
//
|
|
||||||
// R.id.navigation_transfer,
|
|
||||||
// R.id.navigation_file_selector,
|
|
||||||
// R.id.navigation_transfer_selector,
|
|
||||||
// R.id.navigation_code_generator,
|
|
||||||
// R.id.navigation_code_scanner,
|
|
||||||
// R.id.navigation_bluetooth_sender,
|
|
||||||
// R.id.navigation_bluetooth_receiver,
|
|
||||||
// R.id.navigation_tba,
|
|
||||||
//
|
|
||||||
// R.id.navigation_settings)
|
|
||||||
// .build();
|
|
||||||
|
|
||||||
appBarConfiguration = new AppBarConfiguration.Builder(
|
appBarConfiguration = new AppBarConfiguration.Builder(
|
||||||
R.id.navigation_scouting,
|
R.id.navigation_scouting,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.SettingsVersionStack;
|
|
||||||
|
|
||||||
public class latestSettings {
|
|
||||||
public static sv1 settings = new sv1();
|
|
||||||
public static void update(){
|
|
||||||
settings.init_settings();
|
|
||||||
settings.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.SettingsVersionStack;
|
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.utility.AlertManager;
|
|
||||||
import com.ridgebotics.ridgescout.utility.fileEditor;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
public abstract class settingsVersion {
|
|
||||||
private static final String settingsFilename = "settings.txt";
|
|
||||||
public abstract void defaultSettings();
|
|
||||||
public abstract int getVersion();
|
|
||||||
public abstract void update();
|
|
||||||
|
|
||||||
public static String get_settings_file_content(){
|
|
||||||
byte[] data = fileEditor.readFile(settingsFilename);
|
|
||||||
if(data == null){return "";}
|
|
||||||
return new String(data, StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int get_file_version(){
|
|
||||||
String[] fileContent = get_settings_file_content().split("\n");
|
|
||||||
try{
|
|
||||||
return Integer.parseInt(fileContent[0]);
|
|
||||||
}catch(Exception e){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_file_version(int version){
|
|
||||||
String[] fileContent = get_settings_file_content().split("\n");
|
|
||||||
String output = String.valueOf(version);
|
|
||||||
for(int i = 0; i < fileContent.length; i++){
|
|
||||||
output += ("\n" + fileContent[i]);
|
|
||||||
}
|
|
||||||
fileEditor.writeFile(settingsFilename, output.getBytes(StandardCharsets.UTF_8));
|
|
||||||
}
|
|
||||||
|
|
||||||
public String readTag(String search_tag){
|
|
||||||
String[] fileContent = get_settings_file_content().split("\n");
|
|
||||||
|
|
||||||
try{
|
|
||||||
for(String line : fileContent){
|
|
||||||
if(line.isEmpty()){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String[] split = line.split("=");
|
|
||||||
if(split[0].equals(search_tag)){
|
|
||||||
if(split[1].equals("<empty>")){
|
|
||||||
return "";
|
|
||||||
}else if(split[1].equals("<null>")){
|
|
||||||
return null;
|
|
||||||
}else {
|
|
||||||
return split[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
AlertManager.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init_settings(){
|
|
||||||
if(!fileEditor.fileExist(settingsFilename)){
|
|
||||||
fileEditor.createFile(settingsFilename);
|
|
||||||
|
|
||||||
set_file_version(getVersion());
|
|
||||||
defaultSettings();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String writeTag(String tag_name, String data){
|
|
||||||
final boolean already_exists = readTag(tag_name) != null;
|
|
||||||
|
|
||||||
if(data == null){
|
|
||||||
data = "<null>";
|
|
||||||
}else if(data.equals("")){
|
|
||||||
data = "<empty>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!already_exists){
|
|
||||||
String fileContent = get_settings_file_content();
|
|
||||||
String output = fileContent + "\n" + tag_name + "=" + data;
|
|
||||||
fileEditor.writeFile(settingsFilename, output.getBytes(StandardCharsets.UTF_8));
|
|
||||||
return output;
|
|
||||||
}else{
|
|
||||||
String[] fileContent = get_settings_file_content().split("\n");
|
|
||||||
try{
|
|
||||||
for(int i = 0; i < fileContent.length; i++){
|
|
||||||
if(fileContent[i].isEmpty()){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String[] split = fileContent[i].split("=");
|
|
||||||
if(split[0].equals(tag_name)){
|
|
||||||
fileContent[i] = tag_name + "=" + data;
|
|
||||||
String output = String.join("\n", fileContent);
|
|
||||||
fileEditor.writeFile(settingsFilename, output.getBytes(StandardCharsets.UTF_8));
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "No idea how this happened";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.SettingsVersionStack;
|
|
||||||
|
|
||||||
public class sv0 extends settingsVersion {
|
|
||||||
@Override
|
|
||||||
public int getVersion() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void update(){
|
|
||||||
// int file_version = get_file_version();
|
|
||||||
// if(file_version == getVersion()) {
|
|
||||||
// return;
|
|
||||||
// }else if(file_version < getVersion()){
|
|
||||||
// super.update();
|
|
||||||
// }
|
|
||||||
// set_file_version(getVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void defaultSettings() {
|
|
||||||
writeTag("username", "Username");
|
|
||||||
writeTag("selected_event_code", "unset");
|
|
||||||
// writeTag("practice_mode", "false");
|
|
||||||
writeTag("wifi_mode", "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_username(String name){
|
|
||||||
writeTag("username", name);
|
|
||||||
}
|
|
||||||
public String get_username(){
|
|
||||||
return readTag("username");
|
|
||||||
}
|
|
||||||
public void set_evcode(String evcode){
|
|
||||||
writeTag("selected_event_code", evcode);
|
|
||||||
}
|
|
||||||
public String get_evcode(){
|
|
||||||
return readTag("selected_event_code");
|
|
||||||
}
|
|
||||||
// public void set_practice_mode(boolean value) {
|
|
||||||
// writeTag("practice_mode", value ? "true" : "false");
|
|
||||||
// }
|
|
||||||
// public boolean get_practice_mode(){
|
|
||||||
// return readTag("practice_mode").equals("true");
|
|
||||||
// }
|
|
||||||
public void set_wifi_mode(boolean value){
|
|
||||||
writeTag("wifi_mode", value ? "true" : "false");
|
|
||||||
}
|
|
||||||
public boolean get_wifi_mode(){
|
|
||||||
return readTag("wifi_mode").equals("true");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.SettingsVersionStack;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class sv1 extends sv0 {
|
|
||||||
@Override
|
|
||||||
public int getVersion() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void update(){
|
|
||||||
int file_version = get_file_version();
|
|
||||||
if(file_version == getVersion()) {
|
|
||||||
return;
|
|
||||||
}else if(file_version < getVersion()){
|
|
||||||
super.update();
|
|
||||||
}
|
|
||||||
set_file_version(getVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void defaultSettings() {
|
|
||||||
writeTag("username", "Username");
|
|
||||||
writeTag("selected_event_code", "unset");
|
|
||||||
// writeTag("practice_mode", "false");
|
|
||||||
writeTag("wifi_mode", "false");
|
|
||||||
writeTag("team_num", "4388");
|
|
||||||
|
|
||||||
writeTag("match_num", "0");
|
|
||||||
writeTag("alliance_pos", "red-1");
|
|
||||||
writeTag("data_view_mode", "0");
|
|
||||||
writeTag("bt_uuid", UUID.randomUUID().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int get_match_num(){
|
|
||||||
return Integer.parseInt(readTag("match_num"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_match_num(int num){
|
|
||||||
writeTag("match_num", String.valueOf(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void set_evcode(String evcode){
|
|
||||||
set_match_num(0);
|
|
||||||
writeTag("selected_event_code", evcode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String get_alliance_pos(){
|
|
||||||
return readTag("alliance_pos");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_alliance_pos(String pos){
|
|
||||||
writeTag("alliance_pos", pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int get_team_num(){return Integer.parseInt(readTag("team_num"));}
|
|
||||||
public void set_team_num(String str){
|
|
||||||
|
|
||||||
if(str.isEmpty()) {
|
|
||||||
set_team_num(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_team_num(Integer.parseInt(str));
|
|
||||||
}
|
|
||||||
public void set_team_num(int num){writeTag("team_num", String.valueOf(num));}
|
|
||||||
|
|
||||||
public int get_data_view_mode(){
|
|
||||||
return Integer.parseInt(readTag("data_view_mode"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set_data_view_mode(int mode){
|
|
||||||
writeTag("data_view_mode", String.valueOf(mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUUID(UUID uuid){
|
|
||||||
writeTag("bt_uuid", uuid.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUUID(){
|
|
||||||
return UUID.fromString(readTag("bt_uuid"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ package com.ridgebotics.ridgescout.scoutingData;
|
|||||||
import com.ridgebotics.ridgescout.scoutingData.transfer.transferType;
|
import com.ridgebotics.ridgescout.scoutingData.transfer.transferType;
|
||||||
import com.ridgebotics.ridgescout.types.ScoutingArray;
|
import com.ridgebotics.ridgescout.types.ScoutingArray;
|
||||||
import com.ridgebotics.ridgescout.types.data.dataType;
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intArrType;
|
||||||
import com.ridgebotics.ridgescout.types.data.stringType;
|
import com.ridgebotics.ridgescout.types.data.stringType;
|
||||||
import com.ridgebotics.ridgescout.types.input.inputType;
|
import com.ridgebotics.ridgescout.types.input.inputType;
|
||||||
import com.ridgebotics.ridgescout.types.data.intType;
|
import com.ridgebotics.ridgescout.types.data.intType;
|
||||||
@@ -12,6 +13,7 @@ import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
|||||||
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class ScoutingDataWriter {
|
public class ScoutingDataWriter {
|
||||||
// private static final int int_type_id = 255;
|
// private static final int int_type_id = 255;
|
||||||
@@ -32,6 +34,9 @@ public class ScoutingDataWriter {
|
|||||||
bb.addString((String) data[i].forceGetValue());
|
bb.addString((String) data[i].forceGetValue());
|
||||||
System.out.println("Saved STR: " + data[i].getName() + ", ("+ data[i].get() +")");
|
System.out.println("Saved STR: " + data[i].getName() + ", ("+ data[i].get() +")");
|
||||||
break;
|
break;
|
||||||
|
case NUMARR:
|
||||||
|
bb.addIntArray((int[]) data[i].forceGetValue());
|
||||||
|
System.out.println("Saved INT Array: " + data[i].getName() + ", ("+ Arrays.toString((int[]) data[i].get()) +")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
byte[] bytes = bb.build();
|
byte[] bytes = bb.build();
|
||||||
@@ -73,6 +78,11 @@ public class ScoutingDataWriter {
|
|||||||
dataTypes[i].forceSetValue(objects.get(i+2).get());
|
dataTypes[i].forceSetValue(objects.get(i+2).get());
|
||||||
System.out.println("Loaded STR: " + values[version][i].name + ", ("+ dataTypes[i].get() +")");
|
System.out.println("Loaded STR: " + values[version][i].name + ", ("+ dataTypes[i].get() +")");
|
||||||
break;
|
break;
|
||||||
|
case 3: // Int array
|
||||||
|
dataTypes[i] = intArrType.newNull(values[version][i].name);
|
||||||
|
dataTypes[i].forceSetValue(objects.get(i+2).get());
|
||||||
|
System.out.println("Loaded intARR: " + values[version][i].name + ", ("+ Arrays.toString((int[])dataTypes[i].get()) +")");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.ridgebotics.ridgescout.scoutingData;
|
package com.ridgebotics.ridgescout.scoutingData;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.types.input.checkboxType;
|
||||||
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.fieldposType;
|
||||||
import com.ridgebotics.ridgescout.types.input.inputType;
|
import com.ridgebotics.ridgescout.types.input.inputType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.numberType;
|
||||||
import com.ridgebotics.ridgescout.types.input.tallyType;
|
import com.ridgebotics.ridgescout.types.input.tallyType;
|
||||||
import com.ridgebotics.ridgescout.types.input.textType;
|
import com.ridgebotics.ridgescout.types.input.textType;
|
||||||
import com.ridgebotics.ridgescout.types.input.sliderType;
|
import com.ridgebotics.ridgescout.types.input.sliderType;
|
||||||
@@ -20,6 +23,7 @@ public class fields {
|
|||||||
|
|
||||||
public static final inputType[][] default_match_fields = new inputType[][] {
|
public static final inputType[][] default_match_fields = new inputType[][] {
|
||||||
{
|
{
|
||||||
|
new fieldposType("Auto start pos", new int[]{0,0}),
|
||||||
new tallyType("Auto Notes", 0),
|
new tallyType("Auto Notes", 0),
|
||||||
new sliderType("Auto Performance", 5, 0, 10),
|
new sliderType("Auto Performance", 5, 0, 10),
|
||||||
new textType("Auto Comments", ""),
|
new textType("Auto Comments", ""),
|
||||||
@@ -30,16 +34,13 @@ public class fields {
|
|||||||
new textType("Overall Driving Comments", ""),
|
new textType("Overall Driving Comments", ""),
|
||||||
new sliderType("Score area (AMP <-> Speaker)", 5, 0, 10),
|
new sliderType("Score area (AMP <-> Speaker)", 5, 0, 10),
|
||||||
new dropdownType("End Condition", new String[]{"Nothing", "Attempted Climb", "Successful Climbed", "Climbed with multiple robots", "Climbed with trap"}, 0),
|
new dropdownType("End Condition", new String[]{"Nothing", "Attempted Climb", "Successful Climbed", "Climbed with multiple robots", "Climbed with trap"}, 0),
|
||||||
new dropdownType("Robot Condition", new String[]{"Everything was working", "Something seemed to be broken", "Something was broken", "Missing robot (Joe Johnson)"}, 0),
|
new dropdownType("Robot Condition", new String[]{"Everything was working", "Something was maybe broken", "Something was broken", "Robot was disabled for part of the match", "Missing robot (Joe Johnson)"}, 0),
|
||||||
new textType("Other Comments", "")
|
new textType("Other Comments", "")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final inputType[][] default_pit_fields = new inputType[][] {
|
public static final inputType[][] default_pit_fields = new inputType[][] {
|
||||||
{
|
{
|
||||||
new sliderType("How good is robot", 5, 0, 10),
|
|
||||||
new textType("notes", ""),
|
|
||||||
},{
|
|
||||||
new sliderType("How good is robot", 5, 0, 10),
|
new sliderType("How good is robot", 5, 0, 10),
|
||||||
new sliderType("Test", 1, 0, 10),
|
new sliderType("Test", 1, 0, 10),
|
||||||
new textType("notes", ""),
|
new textType("notes", ""),
|
||||||
@@ -113,6 +114,15 @@ public class fields {
|
|||||||
case inputType.tallyType:
|
case inputType.tallyType:
|
||||||
t = new tallyType();
|
t = new tallyType();
|
||||||
break;
|
break;
|
||||||
|
case inputType.numberType:
|
||||||
|
t = new numberType();
|
||||||
|
break;
|
||||||
|
case inputType.checkboxType:
|
||||||
|
t = new checkboxType();
|
||||||
|
break;
|
||||||
|
case inputType.fieldposType:
|
||||||
|
t = new fieldposType();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
t.decode((byte[]) obj.get());
|
t.decode((byte[]) obj.get());
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package com.ridgebotics.ridgescout.types.data;
|
|||||||
public abstract class dataType {
|
public abstract class dataType {
|
||||||
public enum valueTypes {
|
public enum valueTypes {
|
||||||
NUM,
|
NUM,
|
||||||
STRING
|
NUMARR,
|
||||||
|
STRING,
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object value;
|
private Object value;
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.ridgebotics.ridgescout.types.data;
|
||||||
|
|
||||||
|
public class intArrType extends dataType {
|
||||||
|
public static final int[] nullval = new int[]{255, 255};
|
||||||
|
// public static final int unselectedval = 1;
|
||||||
|
|
||||||
|
public valueTypes getValueType() {
|
||||||
|
return valueTypes.NUMARR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public Object getNullValue(){
|
||||||
|
// return nullval;
|
||||||
|
// }
|
||||||
|
// public Object getUnselectedValue(){
|
||||||
|
// return unselectedval;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public Object get(){
|
||||||
|
return (int[]) forceGetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(Object value){
|
||||||
|
forceSetValue((int[]) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public intArrType(String name, int[] value) {
|
||||||
|
super(name);
|
||||||
|
set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static intArrType newNull(String name){
|
||||||
|
return new intArrType(name, nullval);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static intType newUnselected(String name){
|
||||||
|
// final intType a = new intType(name, 0);
|
||||||
|
// a.forceSetValue(unselectedval);
|
||||||
|
// return a;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static boolean isNull(int[] obj){
|
||||||
|
return obj == nullval;
|
||||||
|
}
|
||||||
|
public boolean isNull() {
|
||||||
|
return isNull((int[]) forceGetValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static boolean isUnselected(int obj){
|
||||||
|
// return obj == unselectedval;
|
||||||
|
// }
|
||||||
|
// public boolean isUnselected() {
|
||||||
|
// return isUnselected((int) forceGetValue());
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -1,10 +1,17 @@
|
|||||||
package com.ridgebotics.ridgescout.types;
|
package com.ridgebotics.ridgescout.types;
|
||||||
|
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||||
|
|
||||||
|
import android.widget.TableRow;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import com.ridgebotics.ridgescout.utility.AlertManager;
|
import com.ridgebotics.ridgescout.utility.AlertManager;
|
||||||
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
||||||
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class frcEvent {
|
public class frcEvent {
|
||||||
|
|
||||||
@@ -76,4 +83,62 @@ public class frcEvent {
|
|||||||
matches.size()
|
matches.size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A func that will return every match a team is in.
|
||||||
|
public frcMatch[] getTeamMatches(int teamNum){
|
||||||
|
List<frcMatch> teamMatches = new ArrayList<>();
|
||||||
|
for(int i = 0; i < matches.size(); i++){
|
||||||
|
frcMatch match = matches.get(i);
|
||||||
|
boolean isTeamMatch = false;
|
||||||
|
isTeamMatch = IntStream.of(match.redAlliance).anyMatch(x -> x == teamNum);
|
||||||
|
isTeamMatch = isTeamMatch || IntStream.of(match.blueAlliance).anyMatch(x -> x == teamNum);
|
||||||
|
if(isTeamMatch)
|
||||||
|
teamMatches.add(match);
|
||||||
|
}
|
||||||
|
return teamMatches.toArray(new frcMatch[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// A func that will return the most recent match a team is in. (Not up until the current match)
|
||||||
|
public int getMostRecentTeamMatch(int teamNum, int curMatch){
|
||||||
|
frcMatch[] teamMatches = getTeamMatches(teamNum);
|
||||||
|
int maxMatch = - 1;
|
||||||
|
|
||||||
|
for(int i = 0; i < teamMatches.length; i++) {
|
||||||
|
if (teamMatches[i].matchIndex < curMatch &&
|
||||||
|
teamMatches[i].matchIndex > maxMatch) {
|
||||||
|
maxMatch = teamMatches[i].matchIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(maxMatch == -1)
|
||||||
|
return curMatch;
|
||||||
|
else
|
||||||
|
return maxMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public
|
||||||
|
|
||||||
|
// Returns the soonest match that there will be all the possible upcoming data on other teams
|
||||||
|
public void getReportMatches(int ourTeamNum){
|
||||||
|
frcMatch[] teamMatches = event.getTeamMatches(ourTeamNum);
|
||||||
|
|
||||||
|
for(int i = 0; i < teamMatches.length; i++){
|
||||||
|
int maxMatch = -1;
|
||||||
|
for(int a = 0; a < 6; a++){
|
||||||
|
int teamNum;
|
||||||
|
if(a < 3)
|
||||||
|
teamNum = teamMatches[i].redAlliance[a];
|
||||||
|
else
|
||||||
|
teamNum = teamMatches[i].blueAlliance[a-3];
|
||||||
|
|
||||||
|
if(teamNum == ourTeamNum)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int matchNum = event.getMostRecentTeamMatch(teamNum, teamMatches[i].matchIndex);
|
||||||
|
if(maxMatch < matchNum)
|
||||||
|
maxMatch = matchNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,4 +60,14 @@ public class frcMatch {
|
|||||||
return "frcMatch Num: " + matchIndex + ", Blue: " + Arrays.toString(blueAlliance) + ", Red: " + Arrays.toString(redAlliance);
|
return "frcMatch Num: " + matchIndex + ", Blue: " + Arrays.toString(blueAlliance) + ", Red: " + Arrays.toString(redAlliance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTeamAlliance(int teamNum){
|
||||||
|
if(redAlliance[0] == teamNum) return "red-1";
|
||||||
|
if(redAlliance[1] == teamNum) return "red-2";
|
||||||
|
if(redAlliance[2] == teamNum) return "red-3";
|
||||||
|
if(blueAlliance[0] == teamNum) return "blue-1";
|
||||||
|
if(blueAlliance[1] == teamNum) return "blue-2";
|
||||||
|
if(blueAlliance[2] == teamNum) return "blue-3";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
package com.ridgebotics.ridgescout.types.input;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
import com.github.mikephil.charting.charts.PieChart;
|
||||||
|
import com.github.mikephil.charting.components.Legend;
|
||||||
|
import com.github.mikephil.charting.data.Entry;
|
||||||
|
import com.github.mikephil.charting.data.LineData;
|
||||||
|
import com.github.mikephil.charting.data.LineDataSet;
|
||||||
|
import com.github.mikephil.charting.data.PieData;
|
||||||
|
import com.github.mikephil.charting.data.PieDataSet;
|
||||||
|
import com.github.mikephil.charting.data.PieEntry;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intType;
|
||||||
|
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
||||||
|
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||||
|
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
||||||
|
import com.skydoves.powerspinner.IconSpinnerItem;
|
||||||
|
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
||||||
|
import com.skydoves.powerspinner.PowerSpinnerView;
|
||||||
|
import com.skydoves.powerspinner.SpinnerGravity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class checkboxType extends inputType {
|
||||||
|
public int get_byte_id() {return checkboxType;}
|
||||||
|
public inputTypes getInputType(){return inputTypes.CHECKBOX;}
|
||||||
|
public dataType.valueTypes getValueType(){return dataType.valueTypes.NUM;}
|
||||||
|
public Object get_fallback_value(){return 0;}
|
||||||
|
public checkboxType(){};
|
||||||
|
public String get_type_name(){return "Checkbox";}
|
||||||
|
public checkboxType(String name, int isChecked){
|
||||||
|
super(name);
|
||||||
|
this.default_value = isChecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public byte[] encode() throws ByteBuilder.buildingException {
|
||||||
|
ByteBuilder bb = new ByteBuilder();
|
||||||
|
bb.addString(name);
|
||||||
|
bb.addInt((int)default_value);
|
||||||
|
return bb.build();
|
||||||
|
}
|
||||||
|
public void decode(byte[] bytes) throws BuiltByteParser.byteParsingExeption {
|
||||||
|
BuiltByteParser bbp = new BuiltByteParser(bytes);
|
||||||
|
ArrayList<BuiltByteParser.parsedObject> objects = bbp.parse();
|
||||||
|
|
||||||
|
name = (String) objects.get(0).get();
|
||||||
|
default_value = objects.get(1).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public PowerSpinnerView dropdown = null;
|
||||||
|
|
||||||
|
public CheckBox checkBox = null;
|
||||||
|
|
||||||
|
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||||
|
checkBox = new CheckBox(context);
|
||||||
|
checkBox.setText(name);
|
||||||
|
checkBox.setTextSize(24);
|
||||||
|
setViewValue(default_value);
|
||||||
|
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
onUpdate.apply(getViewValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return checkBox;
|
||||||
|
|
||||||
|
}
|
||||||
|
public void setViewValue(Object value) {
|
||||||
|
if(checkBox == null) return;
|
||||||
|
if(intType.isNull((int) value)){
|
||||||
|
nullify();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isBlank = false;
|
||||||
|
|
||||||
|
checkBox.setVisibility(View.VISIBLE);
|
||||||
|
checkBox.setChecked((int) value == 1);
|
||||||
|
}
|
||||||
|
public void nullify(){
|
||||||
|
isBlank = true;
|
||||||
|
checkBox.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
public dataType getViewValue(){
|
||||||
|
if(checkBox == null) return null;
|
||||||
|
if(checkBox.getVisibility() == View.GONE) return new intType(name, intType.nullval);
|
||||||
|
return new intType(name, checkBox.isChecked() ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_individual_view(LinearLayout parent, dataType data){
|
||||||
|
if(data.isNull()) return;
|
||||||
|
CheckBox cb = new CheckBox(parent.getContext());
|
||||||
|
cb.setText(name);
|
||||||
|
cb.setChecked((int) data.get() == 1);
|
||||||
|
cb.setEnabled(false);
|
||||||
|
parent.addView(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static int[] colors = {0x7f00ff00, 0x7f7f0000};
|
||||||
|
|
||||||
|
|
||||||
|
public void add_compiled_view(LinearLayout parent, dataType[] data){
|
||||||
|
PieChart chart = new PieChart(parent.getContext());
|
||||||
|
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
layout.height = 350;
|
||||||
|
chart.setLayoutParams(layout);
|
||||||
|
chart.setBackgroundColor(0xff252025);
|
||||||
|
parent.addView(chart);
|
||||||
|
|
||||||
|
int numTrue = 0;
|
||||||
|
int numFalse = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < data.length; i++)
|
||||||
|
if(!data[i].isNull()){
|
||||||
|
if((int) data[i].get() == 1)
|
||||||
|
numTrue += 1;
|
||||||
|
else
|
||||||
|
numFalse += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<PieEntry> entries = new ArrayList<>();
|
||||||
|
|
||||||
|
entries.add(new PieEntry((float) numTrue, "True"));
|
||||||
|
entries.add(new PieEntry((float) numFalse, "False"));
|
||||||
|
|
||||||
|
PieDataSet pieDataSet = new PieDataSet(entries, name);
|
||||||
|
pieDataSet.setColors(colors);
|
||||||
|
PieData pieData = new PieData(pieDataSet);
|
||||||
|
chart.setDrawHoleEnabled(false);
|
||||||
|
chart.setData(pieData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_history_view(LinearLayout parent, dataType[] data){
|
||||||
|
LineChart chart = new LineChart(parent.getContext());
|
||||||
|
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
layout.height = 350;
|
||||||
|
chart.setLayoutParams(layout);
|
||||||
|
chart.setBackgroundColor(0xff252025);
|
||||||
|
|
||||||
|
LineData lineData = new LineData();
|
||||||
|
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int a = 0; a < data.length; a++) {
|
||||||
|
if(data[a].isNull()) continue;
|
||||||
|
|
||||||
|
entries.add(
|
||||||
|
new Entry(a,
|
||||||
|
((int) data[a].get())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
LineDataSet dataSet = new LineDataSet(entries, "is checked");
|
||||||
|
dataSet.setColor(Color.RED);
|
||||||
|
dataSet.setValueTextColor(Color.BLACK);
|
||||||
|
dataSet.setDrawCircles(false);
|
||||||
|
dataSet.setDrawValues(false);
|
||||||
|
dataSet.setValueTextColor(Color.RED);
|
||||||
|
lineData.addDataSet(dataSet);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
chart.setData(lineData);
|
||||||
|
chart.invalidate();
|
||||||
|
|
||||||
|
chart.getDescription().setEnabled(false);
|
||||||
|
chart.setTouchEnabled(false);
|
||||||
|
chart.setDragEnabled(false);
|
||||||
|
chart.setScaleEnabled(false);
|
||||||
|
|
||||||
|
|
||||||
|
chart.getXAxis().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisLeft().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisRight().setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
chart.getAxisLeft().setAxisMinimum(0.f);
|
||||||
|
chart.getAxisLeft().setAxisMaximum(1.f);
|
||||||
|
|
||||||
|
chart.getAxisRight().setAxisMinimum(0.f);
|
||||||
|
chart.getAxisRight().setAxisMaximum(1.f);
|
||||||
|
|
||||||
|
Legend legend = chart.getLegend();
|
||||||
|
legend.setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
chart.invalidate();
|
||||||
|
parent.addView(chart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
package com.ridgebotics.ridgescout.types.input;
|
||||||
|
|
||||||
|
import static android.text.InputType.TYPE_CLASS_NUMBER;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
import com.github.mikephil.charting.components.Legend;
|
||||||
|
import com.github.mikephil.charting.data.Entry;
|
||||||
|
import com.github.mikephil.charting.data.LineData;
|
||||||
|
import com.github.mikephil.charting.data.LineDataSet;
|
||||||
|
import com.ridgebotics.ridgescout.R;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intArrType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intType;
|
||||||
|
import com.ridgebotics.ridgescout.ui.scouting.FieldPosView;
|
||||||
|
import com.ridgebotics.ridgescout.ui.scouting.MultiFieldPosView;
|
||||||
|
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
||||||
|
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class fieldposType extends inputType {
|
||||||
|
public int get_byte_id() {return fieldposType;}
|
||||||
|
public inputTypes getInputType(){return inputTypes.FIELDPOS;}
|
||||||
|
public dataType.valueTypes getValueType(){return dataType.valueTypes.NUM;}
|
||||||
|
public Object get_fallback_value(){return 0;}
|
||||||
|
public fieldposType(){}
|
||||||
|
public String get_type_name(){return "Field Pos";}
|
||||||
|
public fieldposType(String name, int[] default_value){
|
||||||
|
super(name);
|
||||||
|
this.default_value = default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public byte[] encode() throws ByteBuilder.buildingException {
|
||||||
|
ByteBuilder bb = new ByteBuilder();
|
||||||
|
bb.addString(name);
|
||||||
|
bb.addIntArray((int[]) default_value);
|
||||||
|
return bb.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decode(byte[] bytes) throws BuiltByteParser.byteParsingExeption {
|
||||||
|
BuiltByteParser bbp = new BuiltByteParser(bytes);
|
||||||
|
ArrayList<BuiltByteParser.parsedObject> objects = bbp.parse();
|
||||||
|
|
||||||
|
name = (String) objects.get(0).get();
|
||||||
|
default_value = objects.get(1).get();
|
||||||
|
System.out.println("Defalt value!!!!!" + default_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FieldPosView field = null;
|
||||||
|
|
||||||
|
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||||
|
field = new FieldPosView(context, pos -> {
|
||||||
|
onUpdate.apply(new intArrType(name, pos));
|
||||||
|
});
|
||||||
|
setViewValue(default_value);
|
||||||
|
return field;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewValue(Object value) {
|
||||||
|
if(field == null) return;
|
||||||
|
if(intArrType.isNull((int[]) value)){
|
||||||
|
nullify();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isBlank = false;
|
||||||
|
field.setVisibility(View.VISIBLE);
|
||||||
|
field.setPos((int[]) value);
|
||||||
|
}
|
||||||
|
public void nullify(){
|
||||||
|
isBlank = true;
|
||||||
|
field.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
public dataType getViewValue(){
|
||||||
|
if(field == null) return null;
|
||||||
|
if(field.getVisibility() == View.GONE) return intArrType.newNull(name);
|
||||||
|
return new intArrType(name, field.getPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_individual_view(LinearLayout parent, dataType data){
|
||||||
|
if(data.isNull()) return;
|
||||||
|
|
||||||
|
FieldPosView fp = new FieldPosView(parent.getContext());
|
||||||
|
fp.setEnabled(false);
|
||||||
|
fp.setPos((int[]) data.get());
|
||||||
|
|
||||||
|
parent.addView(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static float calculateMean(int[] data) {
|
||||||
|
float sum = 0;
|
||||||
|
for (int value : data) {
|
||||||
|
sum += (float) value;
|
||||||
|
}
|
||||||
|
return sum / data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float calculateStandardDeviation(int[] data, float mean) {
|
||||||
|
float sum = 0;
|
||||||
|
for (int value : data) {
|
||||||
|
sum += (float) Math.pow((float) value - mean, 2);
|
||||||
|
}
|
||||||
|
return (float) Math.sqrt(sum / (data.length - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Entry> generateNormalDistribution(float mean, float stdDev, int count, int scale) {
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
float y = (float) ((1 / (stdDev * Math.sqrt(2 * Math.PI)))
|
||||||
|
* Math.exp(-0.5 * Math.pow(((float) i - mean) / stdDev, 2)));
|
||||||
|
entries.add(new Entry((float) i, y*scale)); // Scale y for visibility
|
||||||
|
}
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int findMin(dataType[] data){
|
||||||
|
int min = (int)data[0].get();
|
||||||
|
for(int i = 1; i < data.length; i++)
|
||||||
|
if((int)data[i].get() < min)
|
||||||
|
min = (int)data[i].get();
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int findMax(dataType[] data){
|
||||||
|
int max = (int)data[0].get();
|
||||||
|
for(int i = 1; i < data.length; i++)
|
||||||
|
if((int)data[i].get() > max)
|
||||||
|
max = (int)data[i].get();
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_compiled_view(LinearLayout parent, dataType[] data){
|
||||||
|
MultiFieldPosView mfp = new MultiFieldPosView(parent.getContext());
|
||||||
|
for(int i = 0; i < data.length; i++){
|
||||||
|
if(data[i].isNull()) continue;
|
||||||
|
mfp.addPos((int[]) data[i].get());
|
||||||
|
}
|
||||||
|
parent.addView(mfp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_history_view(LinearLayout parent, dataType[] data){
|
||||||
|
LineChart chart = new LineChart(parent.getContext());
|
||||||
|
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
layout.height = 350;
|
||||||
|
chart.setLayoutParams(layout);
|
||||||
|
chart.setBackgroundColor(0xff252025);
|
||||||
|
|
||||||
|
int min = 0;
|
||||||
|
int max = 255;
|
||||||
|
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < data.length; i++){
|
||||||
|
if(data[i] == null) continue;
|
||||||
|
if(data[i].isNull()) continue;
|
||||||
|
|
||||||
|
entries.add(new Entry(i, 255-(float)((int[]) data[i].get())[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
LineDataSet dataSet = new LineDataSet(entries, "Field position Y value");
|
||||||
|
dataSet.setColor(Color.BLUE);
|
||||||
|
dataSet.setValueTextColor(Color.BLACK);
|
||||||
|
dataSet.setDrawCircles(false);
|
||||||
|
dataSet.setDrawValues(false);
|
||||||
|
|
||||||
|
LineData lineData = new LineData(dataSet);
|
||||||
|
|
||||||
|
chart.setData(lineData);
|
||||||
|
chart.invalidate();
|
||||||
|
|
||||||
|
chart.getDescription().setEnabled(false);
|
||||||
|
chart.setTouchEnabled(false);
|
||||||
|
chart.setDragEnabled(false);
|
||||||
|
chart.setScaleEnabled(false);
|
||||||
|
|
||||||
|
dataSet.setValueTextColor(Color.RED);
|
||||||
|
|
||||||
|
chart.getXAxis().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisLeft().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisRight().setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
Legend legend = chart.getLegend();
|
||||||
|
legend.setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
|
||||||
|
chart.getAxisLeft().setAxisMinimum(min);
|
||||||
|
chart.getAxisLeft().setAxisMaximum(max);
|
||||||
|
|
||||||
|
chart.getAxisRight().setAxisMinimum(min);
|
||||||
|
chart.getAxisRight().setAxisMaximum(max);
|
||||||
|
|
||||||
|
|
||||||
|
parent.addView(chart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -15,11 +15,18 @@ public abstract class inputType {
|
|||||||
public static final int dropdownType = 254;
|
public static final int dropdownType = 254;
|
||||||
public static final int notesType = 253;
|
public static final int notesType = 253;
|
||||||
public static final int tallyType = 252;
|
public static final int tallyType = 252;
|
||||||
|
public static final int numberType = 251;
|
||||||
|
public static final int checkboxType = 250;
|
||||||
|
public static final int fieldposType = 249;
|
||||||
|
|
||||||
public enum inputTypes {
|
public enum inputTypes {
|
||||||
SLIDER,
|
SLIDER,
|
||||||
DROPDOWN,
|
DROPDOWN,
|
||||||
NOTES_INPUT,
|
NOTES_INPUT,
|
||||||
TALLY
|
TALLY,
|
||||||
|
NUMBER,
|
||||||
|
CHECKBOX,
|
||||||
|
FIELDPOS
|
||||||
}
|
}
|
||||||
public String name;
|
public String name;
|
||||||
public Object default_value;
|
public Object default_value;
|
||||||
|
|||||||
@@ -0,0 +1,319 @@
|
|||||||
|
package com.ridgebotics.ridgescout.types.input;
|
||||||
|
|
||||||
|
import static android.text.InputType.TYPE_CLASS_NUMBER;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
import com.github.mikephil.charting.components.Legend;
|
||||||
|
import com.github.mikephil.charting.data.Entry;
|
||||||
|
import com.github.mikephil.charting.data.LineData;
|
||||||
|
import com.github.mikephil.charting.data.LineDataSet;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intType;
|
||||||
|
import com.ridgebotics.ridgescout.utility.BuiltByteParser;
|
||||||
|
import com.ridgebotics.ridgescout.utility.ByteBuilder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class numberType extends inputType {
|
||||||
|
public int get_byte_id() {return numberType;}
|
||||||
|
public inputTypes getInputType(){return inputTypes.NUMBER;}
|
||||||
|
public dataType.valueTypes getValueType(){return dataType.valueTypes.NUM;}
|
||||||
|
public Object get_fallback_value(){return 0;}
|
||||||
|
public numberType(){}
|
||||||
|
public String get_type_name(){return "Number";}
|
||||||
|
public numberType(String name, int default_value){
|
||||||
|
super(name);
|
||||||
|
this.default_value = default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public byte[] encode() throws ByteBuilder.buildingException {
|
||||||
|
ByteBuilder bb = new ByteBuilder();
|
||||||
|
bb.addString(name);
|
||||||
|
bb.addInt((int)default_value);
|
||||||
|
return bb.build();
|
||||||
|
}
|
||||||
|
public void decode(byte[] bytes) throws BuiltByteParser.byteParsingExeption {
|
||||||
|
BuiltByteParser bbp = new BuiltByteParser(bytes);
|
||||||
|
ArrayList<BuiltByteParser.parsedObject> objects = bbp.parse();
|
||||||
|
|
||||||
|
name = (String) objects.get(0).get();
|
||||||
|
default_value = objects.get(1).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public EditText num = null;
|
||||||
|
|
||||||
|
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||||
|
num = new EditText(context);
|
||||||
|
num.setInputType(TYPE_CLASS_NUMBER);
|
||||||
|
num.addTextChangedListener(new TextWatcher() {
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
onUpdate.apply(getViewValue());}
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||||
|
});
|
||||||
|
|
||||||
|
setViewValue(default_value);
|
||||||
|
|
||||||
|
return num;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewValue(Object value) {
|
||||||
|
if(num == null) return;
|
||||||
|
if(intType.isNull((int)value)){
|
||||||
|
nullify();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isBlank = false;
|
||||||
|
num.setVisibility(View.VISIBLE);
|
||||||
|
num.setText(String.valueOf(value));
|
||||||
|
}
|
||||||
|
public void nullify(){
|
||||||
|
isBlank = true;
|
||||||
|
num.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
public dataType getViewValue(){
|
||||||
|
if(num == null) return null;
|
||||||
|
if(num.getVisibility() == View.GONE) return intType.newNull(name);
|
||||||
|
return new intType(name, safeToInt(num.getText().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private int safeToInt(String num){
|
||||||
|
if(num.isEmpty())
|
||||||
|
return intType.nullval;
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(num);
|
||||||
|
}catch (NumberFormatException e){
|
||||||
|
return intType.nullval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_individual_view(LinearLayout parent, dataType data){
|
||||||
|
if(data.isNull()) return;
|
||||||
|
|
||||||
|
TextView tv = new TextView(parent.getContext());
|
||||||
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
));
|
||||||
|
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
|
tv.setText(String.valueOf((int) data.get()));
|
||||||
|
tv.setTextSize(24);
|
||||||
|
parent.addView(tv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static float calculateMean(int[] data) {
|
||||||
|
float sum = 0;
|
||||||
|
for (int value : data) {
|
||||||
|
sum += (float) value;
|
||||||
|
}
|
||||||
|
return sum / data.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float calculateStandardDeviation(int[] data, float mean) {
|
||||||
|
float sum = 0;
|
||||||
|
for (int value : data) {
|
||||||
|
sum += (float) Math.pow((float) value - mean, 2);
|
||||||
|
}
|
||||||
|
return (float) Math.sqrt(sum / (data.length - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Entry> generateNormalDistribution(float mean, float stdDev, int count, int scale) {
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
float y = (float) ((1 / (stdDev * Math.sqrt(2 * Math.PI)))
|
||||||
|
* Math.exp(-0.5 * Math.pow(((float) i - mean) / stdDev, 2)));
|
||||||
|
entries.add(new Entry((float) i, y*scale)); // Scale y for visibility
|
||||||
|
}
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int findMin(dataType[] data){
|
||||||
|
int min = (int)data[0].get();
|
||||||
|
for(int i = 1; i < data.length; i++)
|
||||||
|
if((int)data[i].get() < min)
|
||||||
|
min = (int)data[i].get();
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int findMax(dataType[] data){
|
||||||
|
int max = (int)data[0].get();
|
||||||
|
for(int i = 1; i < data.length; i++)
|
||||||
|
if((int)data[i].get() > max)
|
||||||
|
max = (int)data[i].get();
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add_compiled_view(LinearLayout parent, dataType[] data){
|
||||||
|
LineChart chart = new LineChart(parent.getContext());
|
||||||
|
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
layout.height = 350;
|
||||||
|
chart.setLayoutParams(layout);
|
||||||
|
chart.setBackgroundColor(0xff252025);
|
||||||
|
|
||||||
|
int min = findMin(data);
|
||||||
|
int max = findMax(data);
|
||||||
|
|
||||||
|
int[] values = new int[max-min+1];
|
||||||
|
|
||||||
|
for (int i = 0; i < data.length; i++)
|
||||||
|
if(data[i] != null && data[i].isNull())
|
||||||
|
values[(int) data[i].get()-min]++;
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<Integer> mean_temp = new ArrayList<>();
|
||||||
|
for (int i = 0; i < data.length; i++)
|
||||||
|
if((int)data[i].get() != 0)
|
||||||
|
mean_temp.add((int) data[i].get());
|
||||||
|
|
||||||
|
int[] mean_vals = mean_temp.stream().mapToInt(Integer::intValue).toArray();
|
||||||
|
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < values.length; i++)
|
||||||
|
entries.add(new Entry(i, values[i]));
|
||||||
|
|
||||||
|
|
||||||
|
LineDataSet dataSet = new LineDataSet(entries, name);
|
||||||
|
dataSet.setColor(Color.BLUE);
|
||||||
|
dataSet.setValueTextColor(Color.BLACK);
|
||||||
|
dataSet.setDrawCircles(false);
|
||||||
|
dataSet.setDrawValues(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Calculate mean and standard deviation
|
||||||
|
float mean = calculateMean(mean_vals);
|
||||||
|
float stdDev = calculateStandardDeviation(mean_vals, mean);
|
||||||
|
|
||||||
|
// Generate normal distribution curve
|
||||||
|
List<Entry> normalDistEntries = generateNormalDistribution(mean-min, stdDev, max-min+1, (max-min)/data.length);
|
||||||
|
|
||||||
|
|
||||||
|
LineDataSet normalDistSet = new LineDataSet(normalDistEntries, "Normal Distribution");
|
||||||
|
normalDistSet.setColor(Color.RED);
|
||||||
|
normalDistSet.setDrawCircles(false);
|
||||||
|
normalDistSet.setDrawValues(false);
|
||||||
|
normalDistSet.setLineWidth(2f);
|
||||||
|
|
||||||
|
LineData lineData = new LineData(dataSet, normalDistSet);
|
||||||
|
|
||||||
|
chart.setData(lineData);
|
||||||
|
chart.invalidate();
|
||||||
|
|
||||||
|
chart.getDescription().setEnabled(false);
|
||||||
|
chart.setTouchEnabled(false);
|
||||||
|
chart.setDragEnabled(false);
|
||||||
|
chart.setScaleEnabled(false);
|
||||||
|
|
||||||
|
dataSet.setValueTextColor(Color.RED);
|
||||||
|
|
||||||
|
chart.getXAxis().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisLeft().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisRight().setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
Legend legend = chart.getLegend();
|
||||||
|
legend.setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
parent.addView(chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_history_view(LinearLayout parent, dataType[] data){
|
||||||
|
LineChart chart = new LineChart(parent.getContext());
|
||||||
|
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
layout.height = 350;
|
||||||
|
chart.setLayoutParams(layout);
|
||||||
|
chart.setBackgroundColor(0xff252025);
|
||||||
|
|
||||||
|
int min = findMin(data);
|
||||||
|
int max = findMax(data);
|
||||||
|
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < data.length; i++){
|
||||||
|
if(data[i] == null) continue;
|
||||||
|
if(data[i].isNull()) continue;
|
||||||
|
|
||||||
|
entries.add(new Entry(i, (float)(int) data[i].get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LineDataSet dataSet = new LineDataSet(entries, name);
|
||||||
|
dataSet.setColor(Color.BLUE);
|
||||||
|
dataSet.setValueTextColor(Color.BLACK);
|
||||||
|
dataSet.setDrawCircles(false);
|
||||||
|
dataSet.setDrawValues(false);
|
||||||
|
|
||||||
|
LineData lineData = new LineData(dataSet);
|
||||||
|
|
||||||
|
chart.setData(lineData);
|
||||||
|
chart.invalidate();
|
||||||
|
|
||||||
|
chart.getDescription().setEnabled(false);
|
||||||
|
chart.setTouchEnabled(false);
|
||||||
|
chart.setDragEnabled(false);
|
||||||
|
chart.setScaleEnabled(false);
|
||||||
|
|
||||||
|
dataSet.setValueTextColor(Color.RED);
|
||||||
|
|
||||||
|
chart.getXAxis().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisLeft().setTextColor(Color.WHITE);
|
||||||
|
chart.getAxisRight().setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
Legend legend = chart.getLegend();
|
||||||
|
legend.setTextColor(Color.WHITE);
|
||||||
|
|
||||||
|
|
||||||
|
chart.getAxisLeft().setAxisMinimum(min);
|
||||||
|
chart.getAxisLeft().setAxisMaximum(max);
|
||||||
|
|
||||||
|
chart.getAxisRight().setAxisMinimum(min);
|
||||||
|
chart.getAxisRight().setAxisMaximum(max);
|
||||||
|
|
||||||
|
|
||||||
|
parent.addView(chart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentDataCompareBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentDataCompareBinding;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentDataReportBinding;
|
|
||||||
|
|
||||||
public class CompareFragment extends Fragment {
|
public class CompareFragment extends Fragment {
|
||||||
FragmentDataCompareBinding binding;
|
FragmentDataCompareBinding binding;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.R;
|
import com.ridgebotics.ridgescout.R;
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentDataBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentDataBinding;
|
||||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||||
import com.ridgebotics.ridgescout.ui.TeamSelectorFragment;
|
import com.ridgebotics.ridgescout.ui.TeamSelectorFragment;
|
||||||
@@ -33,7 +33,7 @@ public class DataFragment extends Fragment {
|
|||||||
binding = FragmentDataBinding.inflate(inflater, container, false);
|
binding = FragmentDataBinding.inflate(inflater, container, false);
|
||||||
View root = binding.getRoot();
|
View root = binding.getRoot();
|
||||||
|
|
||||||
String evcode = latestSettings.settings.get_evcode();
|
String evcode = settingsManager.getEVCode();
|
||||||
|
|
||||||
binding.fieldsButton.setOnClickListener(v -> {
|
binding.fieldsButton.setOnClickListener(v -> {
|
||||||
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_fields_chooser);
|
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_fields_chooser);
|
||||||
@@ -71,7 +71,7 @@ public class DataFragment extends Fragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
binding.reportButton.setOnClickListener(v -> {
|
binding.reportButton.setOnClickListener(v -> {
|
||||||
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_report);
|
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_data_report_selector);
|
||||||
});
|
});
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|||||||
@@ -8,8 +8,11 @@ import android.widget.EditText;
|
|||||||
import android.widget.TableLayout;
|
import android.widget.TableLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.types.input.checkboxType;
|
||||||
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.fieldposType;
|
||||||
import com.ridgebotics.ridgescout.types.input.inputType;
|
import com.ridgebotics.ridgescout.types.input.inputType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.numberType;
|
||||||
import com.ridgebotics.ridgescout.types.input.sliderType;
|
import com.ridgebotics.ridgescout.types.input.sliderType;
|
||||||
import com.ridgebotics.ridgescout.types.input.tallyType;
|
import com.ridgebotics.ridgescout.types.input.tallyType;
|
||||||
import com.ridgebotics.ridgescout.types.input.textType;
|
import com.ridgebotics.ridgescout.types.input.textType;
|
||||||
@@ -19,7 +22,8 @@ public class FieldEditorHelper {
|
|||||||
private enum parameterTypeEnum {
|
private enum parameterTypeEnum {
|
||||||
paramNumber,
|
paramNumber,
|
||||||
paramString,
|
paramString,
|
||||||
paramStringArray
|
paramStringArray,
|
||||||
|
paramNumberArray
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class parameterType {
|
public static class parameterType {
|
||||||
@@ -54,6 +58,15 @@ public class FieldEditorHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static class paramNumberArray extends parameterType{
|
||||||
|
// public int[] val;
|
||||||
|
// public paramNumberArray(String name, int[] val){
|
||||||
|
// this.name = name + " (Number array)";
|
||||||
|
// this.val = val;
|
||||||
|
// this.id = parameterTypeEnum.paramNumberArray;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public static final parameterType[] defaultSliderParams = new parameterType[]{
|
public static final parameterType[] defaultSliderParams = new parameterType[]{
|
||||||
new paramNumber("Min", 0),
|
new paramNumber("Min", 0),
|
||||||
new paramNumber("Max", 10),
|
new paramNumber("Max", 10),
|
||||||
@@ -69,6 +82,16 @@ public class FieldEditorHelper {
|
|||||||
public static final parameterType[] defaultTallyParams = new parameterType[]{
|
public static final parameterType[] defaultTallyParams = new parameterType[]{
|
||||||
new paramNumber("Default Value", 0)
|
new paramNumber("Default Value", 0)
|
||||||
};
|
};
|
||||||
|
public static final parameterType[] defaultNumberParams = new parameterType[]{
|
||||||
|
new paramNumber("Default Value", 0)
|
||||||
|
};
|
||||||
|
public static final parameterType[] defaultCheckboxParam = new parameterType[]{
|
||||||
|
new paramNumber("Default Value ( 1 or 0 )", 0)
|
||||||
|
};
|
||||||
|
public static final parameterType[] defaultFieldPosParam = new parameterType[]{
|
||||||
|
new paramNumber("Default X", 0),
|
||||||
|
new paramNumber("Default Y", 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
private static parameterType[] getSliderParams(sliderType s){
|
private static parameterType[] getSliderParams(sliderType s){
|
||||||
@@ -98,6 +121,25 @@ public class FieldEditorHelper {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static parameterType[] getNumberParams(numberType s){
|
||||||
|
return new parameterType[]{
|
||||||
|
new paramNumber("Default Value", (int) s.default_value)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static parameterType[] getCheckboxParam(checkboxType s){
|
||||||
|
return new parameterType[]{
|
||||||
|
new paramNumber("Default Value ( 1 or 0 )", (int) s.default_value)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static parameterType[] getFieldPosParam(fieldposType s){
|
||||||
|
return new parameterType[]{
|
||||||
|
new paramNumber("Default X", ((int[]) s.default_value)[0]),
|
||||||
|
new paramNumber("Default Y", ((int[]) s.default_value)[1])
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void setSliderParams(sliderType s, parameterType[] types){
|
public static void setSliderParams(sliderType s, parameterType[] types){
|
||||||
@@ -119,6 +161,22 @@ public class FieldEditorHelper {
|
|||||||
s.default_value = ((paramNumber) types[0]).val;
|
s.default_value = ((paramNumber) types[0]).val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setNumberParams(numberType s, parameterType[] types){
|
||||||
|
s.default_value = ((paramNumber) types[0]).val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCheckboxParam(checkboxType s, parameterType[] types){
|
||||||
|
s.default_value = ((paramNumber) types[0]).val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFieldPosParam(fieldposType s, parameterType[] types){
|
||||||
|
s.default_value = new int[]{
|
||||||
|
((paramNumber) types[0]).val,
|
||||||
|
((paramNumber) types[1]).val
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void setInputParameter(inputType t, parameterType[] types){
|
private static void setInputParameter(inputType t, parameterType[] types){
|
||||||
switch (t.getInputType()){
|
switch (t.getInputType()){
|
||||||
case TALLY:
|
case TALLY:
|
||||||
@@ -133,6 +191,15 @@ public class FieldEditorHelper {
|
|||||||
case NOTES_INPUT:
|
case NOTES_INPUT:
|
||||||
setTextParams((textType) t, types);
|
setTextParams((textType) t, types);
|
||||||
break;
|
break;
|
||||||
|
case NUMBER:
|
||||||
|
setNumberParams((numberType) t, types);
|
||||||
|
break;
|
||||||
|
case CHECKBOX:
|
||||||
|
setCheckboxParam((checkboxType) t, types);
|
||||||
|
break;
|
||||||
|
case FIELDPOS:
|
||||||
|
setFieldPosParam((fieldposType) t, types);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +215,12 @@ public class FieldEditorHelper {
|
|||||||
return getDropdownParams((dropdownType) t);
|
return getDropdownParams((dropdownType) t);
|
||||||
case NOTES_INPUT:
|
case NOTES_INPUT:
|
||||||
return getTextParams((textType) t);
|
return getTextParams((textType) t);
|
||||||
|
case NUMBER:
|
||||||
|
return getNumberParams((numberType) t);
|
||||||
|
case CHECKBOX:
|
||||||
|
return getCheckboxParam((checkboxType) t);
|
||||||
|
case FIELDPOS:
|
||||||
|
return getFieldPosParam((fieldposType) t);
|
||||||
}
|
}
|
||||||
return new parameterType[]{};
|
return new parameterType[]{};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ import androidx.navigation.Navigation;
|
|||||||
import com.ridgebotics.ridgescout.R;
|
import com.ridgebotics.ridgescout.R;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentDataFieldsBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentDataFieldsBinding;
|
||||||
import com.ridgebotics.ridgescout.scoutingData.fields;
|
import com.ridgebotics.ridgescout.scoutingData.fields;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.checkboxType;
|
||||||
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.fieldposType;
|
||||||
import com.ridgebotics.ridgescout.types.input.inputType;
|
import com.ridgebotics.ridgescout.types.input.inputType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.numberType;
|
||||||
import com.ridgebotics.ridgescout.types.input.sliderType;
|
import com.ridgebotics.ridgescout.types.input.sliderType;
|
||||||
import com.ridgebotics.ridgescout.types.input.tallyType;
|
import com.ridgebotics.ridgescout.types.input.tallyType;
|
||||||
import com.ridgebotics.ridgescout.types.input.textType;
|
import com.ridgebotics.ridgescout.types.input.textType;
|
||||||
@@ -381,6 +384,9 @@ public class FieldsFragment extends Fragment {
|
|||||||
iconSpinnerItems.add(new IconSpinnerItem("Text"));
|
iconSpinnerItems.add(new IconSpinnerItem("Text"));
|
||||||
iconSpinnerItems.add(new IconSpinnerItem("Dropdown"));
|
iconSpinnerItems.add(new IconSpinnerItem("Dropdown"));
|
||||||
iconSpinnerItems.add(new IconSpinnerItem("Tally"));
|
iconSpinnerItems.add(new IconSpinnerItem("Tally"));
|
||||||
|
iconSpinnerItems.add(new IconSpinnerItem("Number"));
|
||||||
|
iconSpinnerItems.add(new IconSpinnerItem("Checkbox"));
|
||||||
|
iconSpinnerItems.add(new IconSpinnerItem("Field Position"));
|
||||||
|
|
||||||
IconSpinnerAdapter iconSpinnerAdapter = new IconSpinnerAdapter(dropdown);
|
IconSpinnerAdapter iconSpinnerAdapter = new IconSpinnerAdapter(dropdown);
|
||||||
|
|
||||||
@@ -445,6 +451,24 @@ public class FieldsFragment extends Fragment {
|
|||||||
FieldEditorHelper.setTallyParams(tally, FieldEditorHelper.defaultTallyParams);
|
FieldEditorHelper.setTallyParams(tally, FieldEditorHelper.defaultTallyParams);
|
||||||
addField_Part_4(tally);
|
addField_Part_4(tally);
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
numberType num = new numberType();
|
||||||
|
num.name = title;
|
||||||
|
FieldEditorHelper.setNumberParams(num, FieldEditorHelper.defaultNumberParams);
|
||||||
|
addField_Part_4(num);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
checkboxType cb = new checkboxType();
|
||||||
|
cb.name = title;
|
||||||
|
FieldEditorHelper.setCheckboxParam(cb, FieldEditorHelper.defaultCheckboxParam);
|
||||||
|
addField_Part_4(cb);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
fieldposType fp = new fieldposType();
|
||||||
|
fp.name = title;
|
||||||
|
FieldEditorHelper.setFieldPosParam(fp, FieldEditorHelper.defaultFieldPosParam);
|
||||||
|
addField_Part_4(fp);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,89 @@
|
|||||||
package com.ridgebotics.ridgescout.ui.data;
|
package com.ridgebotics.ridgescout.ui.data;
|
||||||
|
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TableRow;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentDataReportBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentDataReportBinding;
|
||||||
|
import com.ridgebotics.ridgescout.types.frcMatch;
|
||||||
|
import com.ridgebotics.ridgescout.utility.DataManager;
|
||||||
|
import com.ridgebotics.ridgescout.utility.ollama.OllamaClient;
|
||||||
|
import com.ridgebotics.ridgescout.utility.ollama.PromptCreator;
|
||||||
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
|
|
||||||
public class ReportFragment extends Fragment {
|
public class ReportFragment extends Fragment {
|
||||||
FragmentDataReportBinding binding;
|
FragmentDataReportBinding binding;
|
||||||
|
|
||||||
|
private static frcMatch match;
|
||||||
|
public static void setMatch(frcMatch m){
|
||||||
|
match = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int ourTeamNum = settingsManager.getTeamNum();
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
binding = FragmentDataReportBinding.inflate(inflater, container, false);
|
binding = FragmentDataReportBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
|
binding.teamNumber.setText(String.valueOf(ourTeamNum));
|
||||||
|
|
||||||
|
binding.AyEyeBox.setVisibility(View.VISIBLE);
|
||||||
|
binding.AyEyeButton.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
DataManager.reload_event();
|
||||||
|
DataManager.reload_pit_fields();
|
||||||
|
DataManager.reload_match_fields();
|
||||||
|
|
||||||
|
binding.AyEyeBox.setText("TBD!\n This is meant to be a tool that lets scouters more easily write reports to the drive team before matches. There are some plans for LLM integration into this menu ");
|
||||||
|
|
||||||
|
// binding.AyEyeButton.setText("Create Prompt");
|
||||||
|
// binding.AyEyeButton.setOnClickListener(a ->{
|
||||||
|
// getPrompt();
|
||||||
|
// binding.AyEyeButton.setText("Generate Overview");
|
||||||
|
// binding.AyEyeButton.setOnClickListener(b ->{
|
||||||
|
// AIDataOverview();
|
||||||
|
// binding.AyEyeButton.setVisibility(View.GONE);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getPrompt(){
|
||||||
|
binding.AyEyeBox.setVisibility(View.VISIBLE);
|
||||||
|
String prompt = PromptCreator.genMatchPrompt(0);
|
||||||
|
binding.AyEyeBox.setText(prompt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AIDataOverview(){
|
||||||
|
String prompt = binding.AyEyeBox.getText().toString();
|
||||||
|
binding.AyEyeBox.setText("");
|
||||||
|
OllamaClient.run(prompt, new OllamaClient.ollamaListener() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
// System.out.println(response);
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
binding.AyEyeBox.setText(binding.AyEyeBox.getText()+response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
System.out.println(binding.AyEyeBox.getText());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.ridgebotics.ridgescout.ui.data;
|
||||||
|
|
||||||
|
import static androidx.navigation.fragment.FragmentKt.findNavController;
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.evcode;
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TableLayout;
|
||||||
|
import android.widget.TableRow;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.R;
|
||||||
|
import com.ridgebotics.ridgescout.databinding.FragmentDataReportSelectorBinding;
|
||||||
|
import com.ridgebotics.ridgescout.types.frcMatch;
|
||||||
|
import com.ridgebotics.ridgescout.utility.AlertManager;
|
||||||
|
import com.ridgebotics.ridgescout.utility.DataManager;
|
||||||
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
|
|
||||||
|
public class ReportSelectorFragment extends Fragment {
|
||||||
|
FragmentDataReportSelectorBinding binding;
|
||||||
|
|
||||||
|
private final int teamNum = settingsManager.getTeamNum();
|
||||||
|
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
binding = FragmentDataReportSelectorBinding.inflate(inflater, container, false);
|
||||||
|
binding.matchTable.setStretchAllColumns(true);
|
||||||
|
|
||||||
|
DataManager.reload_event();
|
||||||
|
frcMatch[] teamMatches = event.getTeamMatches(teamNum);
|
||||||
|
|
||||||
|
if(teamMatches.length == 0){
|
||||||
|
AlertManager.error("Team number " + teamNum + " could not be found in event " + evcode);
|
||||||
|
findNavController(this).navigate(R.id.action_navigation_data_report_selector_to_navigation_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < teamMatches.length; i++){
|
||||||
|
addTableRow(teamMatches[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
private void addTableRow(frcMatch match){
|
||||||
|
TableRow tr = new TableRow(getContext());
|
||||||
|
TableLayout.LayoutParams rowParams = new TableLayout.LayoutParams(
|
||||||
|
FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
);
|
||||||
|
rowParams.setMargins(20,20,20,20);
|
||||||
|
tr.setLayoutParams(rowParams);
|
||||||
|
tr.setPadding(20,20,20,20);
|
||||||
|
tr.setBackgroundColor(0x5000ff00);
|
||||||
|
binding.matchTable.addView(tr);
|
||||||
|
|
||||||
|
TextView tv = new TextView(getContext());
|
||||||
|
tv.setText("Match " + match.matchIndex);
|
||||||
|
tv.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||||
|
tr.addView(tv);
|
||||||
|
|
||||||
|
tv = new TextView(getContext());
|
||||||
|
tv.setText("Pos " + match.getTeamAlliance(teamNum));
|
||||||
|
tv.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||||
|
tr.addView(tv);
|
||||||
|
|
||||||
|
tr.setOnClickListener(v -> {
|
||||||
|
ReportFragment.setMatch(match);
|
||||||
|
findNavController(this).navigate(R.id.action_navigation_data_report_selector_to_navigation_data_report);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentDataTeamsBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentDataTeamsBinding;
|
||||||
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
||||||
import com.ridgebotics.ridgescout.types.data.dataType;
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
@@ -64,7 +64,7 @@ public class TeamsFragment extends Fragment {
|
|||||||
table.setStretchAllColumns(true);
|
table.setStretchAllColumns(true);
|
||||||
binding.teamsArea.addView(table);
|
binding.teamsArea.addView(table);
|
||||||
|
|
||||||
loadTeam(latestSettings.settings.get_data_view_mode());
|
loadTeam(settingsManager.getDataMode());
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ public class TeamsFragment extends Fragment {
|
|||||||
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
||||||
IconSpinnerItem newItem) {
|
IconSpinnerItem newItem) {
|
||||||
|
|
||||||
latestSettings.settings.set_data_view_mode(newIndex);
|
settingsManager.setDataMode(newIndex);
|
||||||
loadTeam(newIndex);
|
loadTeam(newIndex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.ridgebotics.ridgescout.ui.scouting;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.R;
|
||||||
|
|
||||||
|
public class FieldPosView extends FrameLayout {
|
||||||
|
private int x = -1;
|
||||||
|
private int y = -1;
|
||||||
|
private Paint paint;
|
||||||
|
private static final float POINT_RADIUS = 10f;
|
||||||
|
private ImageView imageView;
|
||||||
|
private boolean enabled = true;
|
||||||
|
|
||||||
|
public interface onTapListener {
|
||||||
|
void onUpdate(int[] pos);
|
||||||
|
};
|
||||||
|
|
||||||
|
public FieldPosView(Context context) {
|
||||||
|
super(context);
|
||||||
|
init(context, pos -> {});
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldPosView(Context context, onTapListener tapListener) {
|
||||||
|
super(context);
|
||||||
|
init(context, tapListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldPosView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init(context, pos -> {});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
private void init(Context context, onTapListener tl) {
|
||||||
|
// Initialize paint
|
||||||
|
paint = new Paint();
|
||||||
|
paint.setColor(Color.RED);
|
||||||
|
paint.setStyle(Paint.Style.FILL);
|
||||||
|
|
||||||
|
|
||||||
|
// Create and add ImageView
|
||||||
|
imageView = new ImageView(context);
|
||||||
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||||
|
LayoutParams.MATCH_PARENT,
|
||||||
|
LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
imageView.setLayoutParams(params);
|
||||||
|
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||||
|
imageView.setAdjustViewBounds(true);
|
||||||
|
addView(imageView);
|
||||||
|
|
||||||
|
// Set touch listener
|
||||||
|
setOnTouchListener((v, event) -> {
|
||||||
|
if (enabled && event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
x = (int) ((event.getX()/getWidth())*255);
|
||||||
|
y = (int) ((event.getY()/getHeight())*255);
|
||||||
|
tl.onUpdate(getPos());
|
||||||
|
invalidate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
setImageResource(R.drawable.field_2024);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPos(int[] pos){
|
||||||
|
if(pos.length == 0) return;
|
||||||
|
x = pos[0];
|
||||||
|
y = pos[1];
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
|
super.dispatchDraw(canvas);
|
||||||
|
if (x >= 0 && y >= 0) {
|
||||||
|
canvas.drawCircle(
|
||||||
|
((float) x /255)*getWidth(),
|
||||||
|
((float) y /255)*getHeight(),
|
||||||
|
POINT_RADIUS, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageResource(int resId) {
|
||||||
|
imageView.setImageResource(resId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageDrawable(Drawable drawable) {
|
||||||
|
imageView.setImageDrawable(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageBitmap(Bitmap bitmap) {
|
||||||
|
imageView.setImageBitmap(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getPos() {
|
||||||
|
return new int[]{
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentScoutingMatchBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentScoutingMatchBinding;
|
||||||
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
||||||
import com.ridgebotics.ridgescout.types.data.dataType;
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
@@ -41,8 +41,8 @@ public class MatchScoutingFragment extends Fragment {
|
|||||||
|
|
||||||
DataManager.reload_match_fields();
|
DataManager.reload_match_fields();
|
||||||
|
|
||||||
alliance_position = latestSettings.settings.get_alliance_pos();
|
alliance_position = settingsManager.getAllyPos();
|
||||||
username = latestSettings.settings.get_username();
|
username = settingsManager.getUsername();
|
||||||
|
|
||||||
binding.username.setText(username);
|
binding.username.setText(username);
|
||||||
binding.alliancePosText.setText(alliance_position);
|
binding.alliancePosText.setText(alliance_position);
|
||||||
@@ -64,12 +64,12 @@ public class MatchScoutingFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cur_match_num = latestSettings.settings.get_match_num();
|
cur_match_num = settingsManager.getMatchNum();
|
||||||
update_match_num();
|
update_match_num();
|
||||||
|
|
||||||
binding.nextButton.setOnClickListener(v -> {
|
binding.nextButton.setOnClickListener(v -> {
|
||||||
if(edited) save();
|
if(edited) save();
|
||||||
latestSettings.settings.set_match_num(cur_match_num+1);
|
settingsManager.setMatchNum(cur_match_num+1);
|
||||||
cur_match_num += 1;
|
cur_match_num += 1;
|
||||||
update_match_num();
|
update_match_num();
|
||||||
update_scouting_data();
|
update_scouting_data();
|
||||||
@@ -83,7 +83,7 @@ public class MatchScoutingFragment extends Fragment {
|
|||||||
if(edited) save();
|
if(edited) save();
|
||||||
|
|
||||||
alliance_position = incrementMatchPos(alliance_position);
|
alliance_position = incrementMatchPos(alliance_position);
|
||||||
latestSettings.settings.set_alliance_pos(alliance_position);
|
settingsManager.setAllyPos(alliance_position);
|
||||||
binding.alliancePosText.setText(alliance_position);
|
binding.alliancePosText.setText(alliance_position);
|
||||||
|
|
||||||
update_match_num();
|
update_match_num();
|
||||||
@@ -93,7 +93,7 @@ public class MatchScoutingFragment extends Fragment {
|
|||||||
|
|
||||||
binding.backButton.setOnClickListener(v -> {
|
binding.backButton.setOnClickListener(v -> {
|
||||||
if(edited) save();
|
if(edited) save();
|
||||||
latestSettings.settings.set_match_num(cur_match_num-1);
|
settingsManager.setMatchNum(cur_match_num-1);
|
||||||
cur_match_num -= 1;
|
cur_match_num -= 1;
|
||||||
update_match_num();
|
update_match_num();
|
||||||
update_scouting_data();
|
update_scouting_data();
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.ridgebotics.ridgescout.ui.scouting;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MultiFieldPosView extends FrameLayout {
|
||||||
|
private Paint paint;
|
||||||
|
private static final float POINT_RADIUS = 10f;
|
||||||
|
private ImageView imageView;
|
||||||
|
private List<Integer[]> points = new ArrayList<>();
|
||||||
|
|
||||||
|
public MultiFieldPosView(Context context) {
|
||||||
|
super(context);
|
||||||
|
init(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiFieldPosView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
|
private void init(Context context) {
|
||||||
|
// Initialize paint
|
||||||
|
paint = new Paint();
|
||||||
|
paint.setColor(Color.RED);
|
||||||
|
paint.setStyle(Paint.Style.FILL);
|
||||||
|
|
||||||
|
|
||||||
|
// Create and add ImageView
|
||||||
|
imageView = new ImageView(context);
|
||||||
|
LayoutParams params = new LayoutParams(
|
||||||
|
LayoutParams.MATCH_PARENT,
|
||||||
|
LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
imageView.setLayoutParams(params);
|
||||||
|
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||||
|
imageView.setAdjustViewBounds(true);
|
||||||
|
addView(imageView);
|
||||||
|
|
||||||
|
setImageResource(R.drawable.field_2024);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPos(int[] pos){
|
||||||
|
if(pos.length != 2) return;
|
||||||
|
points.add(new Integer[]{
|
||||||
|
pos[0],
|
||||||
|
pos[1]
|
||||||
|
});
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
|
super.dispatchDraw(canvas);
|
||||||
|
for(int i = 0; i < points.size(); i++){
|
||||||
|
int x = points.get(i)[0];
|
||||||
|
int y = points.get(i)[1];
|
||||||
|
if (x >= 0 && y >= 0) {
|
||||||
|
canvas.drawCircle(
|
||||||
|
((float) x / 255) * getWidth(),
|
||||||
|
((float) y / 255) * getHeight(),
|
||||||
|
POINT_RADIUS, paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageResource(int resId) {
|
||||||
|
imageView.setImageResource(resId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentScoutingPitBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentScoutingPitBinding;
|
||||||
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
||||||
import com.ridgebotics.ridgescout.types.data.dataType;
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
@@ -43,7 +43,7 @@ public class PitScoutingFragment extends Fragment {
|
|||||||
|
|
||||||
binding = FragmentScoutingPitBinding.inflate(inflater, container, false);
|
binding = FragmentScoutingPitBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
username = latestSettings.settings.get_username();
|
username = settingsManager.getUsername();
|
||||||
DataManager.reload_pit_fields();
|
DataManager.reload_pit_fields();
|
||||||
|
|
||||||
loadTeam();
|
loadTeam();
|
||||||
@@ -92,50 +92,6 @@ public class PitScoutingFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public void init(frcEvent event){
|
|
||||||
//
|
|
||||||
// evcode = event.eventCode;
|
|
||||||
// this.event = event;
|
|
||||||
// username = latestSettings.settings.get_username();
|
|
||||||
//
|
|
||||||
//// binding.eventcode.setText(evcode);
|
|
||||||
//
|
|
||||||
// binding.pitBackButton.setOnClickListener(view -> {
|
|
||||||
// if(edited) save();
|
|
||||||
// binding.pitTeamName.setVisibility(View.GONE);
|
|
||||||
// binding.pitTeamDescription.setVisibility(View.GONE);
|
|
||||||
// clear_fields();
|
|
||||||
// load_teams();
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// values = fields.load(fields.pitsFieldsFilename);
|
|
||||||
//
|
|
||||||
// if(values == null || values.length == 0){
|
|
||||||
// TextView tv = new TextView(getContext());
|
|
||||||
// tv.setText("Failed to load fields.\nTry to either download or create pit scouting fields.");
|
|
||||||
// tv.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
|
||||||
// binding.pitScoutArea.addView(tv);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// latest_values = values[values.length-1];
|
|
||||||
// transferValues = transferType.get_transfer_values(values);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void clear_fields(){
|
|
||||||
// int childCount = binding.pitScoutArea.getChildCount();
|
|
||||||
// View[] views = new View[childCount];
|
|
||||||
//
|
|
||||||
// for(int i = 0; i < childCount; i++){
|
|
||||||
// views[i] = binding.pitScoutArea.getChildAt(i);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for(int i = 0; i < childCount; i++){
|
|
||||||
// if(!views[i].isShown()) continue;
|
|
||||||
// binding.pitScoutArea.removeView(views[i]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void loadTeam(){
|
public void loadTeam(){
|
||||||
// clear_fields();
|
// clear_fields();
|
||||||
|
|
||||||
@@ -147,9 +103,6 @@ public class PitScoutingFragment extends Fragment {
|
|||||||
binding.pitTeamDescription.setText(team.getDescription());
|
binding.pitTeamDescription.setText(team.getDescription());
|
||||||
binding.pitBarTeamNum.setText(String.valueOf(team.teamNumber));
|
binding.pitBarTeamNum.setText(String.valueOf(team.teamNumber));
|
||||||
|
|
||||||
// binding.teamName.setText(team.teamName);
|
|
||||||
// binding.teamDescription.setText(team.getDescription());
|
|
||||||
|
|
||||||
filename = evcode + "-" + team.teamNumber + ".pitscoutdata";
|
filename = evcode + "-" + team.teamNumber + ".pitscoutdata";
|
||||||
|
|
||||||
boolean new_file = !fileEditor.fileExist(filename);
|
boolean new_file = !fileEditor.fileExist(filename);
|
||||||
@@ -195,11 +148,7 @@ public class PitScoutingFragment extends Fragment {
|
|||||||
|
|
||||||
int fi = i;
|
int fi = i;
|
||||||
tv.setOnClickListener(p -> {
|
tv.setOnClickListener(p -> {
|
||||||
// boolean blank = !latest_values[fi].getViewValue().isNull();
|
update_asm();
|
||||||
|
|
||||||
// System.out.println(blank);
|
|
||||||
|
|
||||||
asm.update();
|
|
||||||
|
|
||||||
if(!pit_latest_values[fi].isBlank){
|
if(!pit_latest_values[fi].isBlank){
|
||||||
tv.setBackgroundColor(0xffff0000);
|
tv.setBackgroundColor(0xffff0000);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.R;
|
import com.ridgebotics.ridgescout.R;
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentScoutingBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentScoutingBinding;
|
||||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||||
import com.ridgebotics.ridgescout.ui.TeamSelectorFragment;
|
import com.ridgebotics.ridgescout.ui.TeamSelectorFragment;
|
||||||
@@ -34,7 +34,7 @@ public class ScoutingFragment extends Fragment {
|
|||||||
|
|
||||||
binding.buttons.setVisibility(View.VISIBLE);
|
binding.buttons.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
String evcode = latestSettings.settings.get_evcode();
|
String evcode = settingsManager.getEVCode();
|
||||||
|
|
||||||
if(evcode.equals("unset")){
|
if(evcode.equals("unset")){
|
||||||
binding.noEventError.setVisibility(View.VISIBLE);
|
binding.noEventError.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class StatusFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
public static int color_found = 0x7f00ff00;
|
public static int color_found = 0x7f00ff00;
|
||||||
public static int color_not_found = 0x7f7f0000;
|
public static int color_not_found = 0x7f7f0000;
|
||||||
|
|
||||||
private void addTableText(TableRow tr, String textStr){
|
private void addTableText(TableRow tr, String textStr){
|
||||||
TextView text = new TextView(getContext());
|
TextView text = new TextView(getContext());
|
||||||
text.setTextSize(18);
|
text.setTextSize(18);
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentSettingsBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentSettingsBinding;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intType;
|
||||||
import com.ridgebotics.ridgescout.utility.fileEditor;
|
import com.ridgebotics.ridgescout.utility.fileEditor;
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
|
|
||||||
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
||||||
import com.skydoves.powerspinner.IconSpinnerItem;
|
import com.skydoves.powerspinner.IconSpinnerItem;
|
||||||
@@ -41,6 +42,17 @@ public class settingsFragment extends Fragment {
|
|||||||
dropdown.setAdapter(adapter);
|
dropdown.setAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int safeToInt(String num){
|
||||||
|
if(num.isEmpty())
|
||||||
|
return 0;
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(num);
|
||||||
|
}catch (NumberFormatException e){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
@@ -48,11 +60,11 @@ public class settingsFragment extends Fragment {
|
|||||||
View root = binding.getRoot();
|
View root = binding.getRoot();
|
||||||
|
|
||||||
EditText username = binding.username;
|
EditText username = binding.username;
|
||||||
username.setText(latestSettings.settings.get_username());
|
username.setText(settingsManager.getUsername());
|
||||||
username.addTextChangedListener(new TextWatcher() {
|
username.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
latestSettings.settings.set_username(username.getText().toString());
|
settingsManager.setUsername(username.getText().toString());
|
||||||
}
|
}
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||||
@@ -65,7 +77,7 @@ public class settingsFragment extends Fragment {
|
|||||||
|
|
||||||
List<IconSpinnerItem> iconSpinnerItems = new ArrayList<>();
|
List<IconSpinnerItem> iconSpinnerItems = new ArrayList<>();
|
||||||
|
|
||||||
String target_event_name = latestSettings.settings.get_evcode();
|
String target_event_name = settingsManager.getEVCode();
|
||||||
int target_index = -1;
|
int target_index = -1;
|
||||||
|
|
||||||
ArrayList<String> evlist = fileEditor.getEventList();
|
ArrayList<String> evlist = fileEditor.getEventList();
|
||||||
@@ -89,7 +101,7 @@ public class settingsFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
||||||
IconSpinnerItem newItem) {
|
IconSpinnerItem newItem) {
|
||||||
latestSettings.settings.set_evcode(newItem.getText().toString());
|
settingsManager.setEVCode(newItem.getText().toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -106,7 +118,7 @@ public class settingsFragment extends Fragment {
|
|||||||
|
|
||||||
List<IconSpinnerItem> alliance_pos_iconSpinnerItems = new ArrayList<>();
|
List<IconSpinnerItem> alliance_pos_iconSpinnerItems = new ArrayList<>();
|
||||||
|
|
||||||
String target_alliance_pos = latestSettings.settings.get_alliance_pos();
|
String target_alliance_pos = settingsManager.getAllyPos();
|
||||||
int alliance_pos_target_index = -1;
|
int alliance_pos_target_index = -1;
|
||||||
|
|
||||||
String[] alliance_pos_list = new String[]{"red-1", "red-2", "red-3",
|
String[] alliance_pos_list = new String[]{"red-1", "red-2", "red-3",
|
||||||
@@ -132,7 +144,7 @@ public class settingsFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
||||||
IconSpinnerItem newItem) {
|
IconSpinnerItem newItem) {
|
||||||
latestSettings.settings.set_alliance_pos(newItem.getText().toString());
|
settingsManager.setAllyPos(newItem.getText().toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,11 +171,11 @@ public class settingsFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
EditText team_num = binding.teamNumber;
|
EditText team_num = binding.teamNumber;
|
||||||
team_num.setText(String.valueOf(latestSettings.settings.get_team_num()));
|
team_num.setText(String.valueOf(settingsManager.getTeamNum()));
|
||||||
team_num.addTextChangedListener(new TextWatcher() {
|
team_num.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
latestSettings.settings.set_team_num(team_num.getText().toString());
|
settingsManager.setTeamNum(safeToInt(team_num.getText().toString()));
|
||||||
}
|
}
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||||
@@ -178,12 +190,12 @@ public class settingsFragment extends Fragment {
|
|||||||
wifi_mode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
wifi_mode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
|
||||||
latestSettings.settings.set_wifi_mode(isChecked);
|
settingsManager.setWifiMode(isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
wifi_mode.setChecked(latestSettings.settings.get_wifi_mode());
|
wifi_mode.setChecked(settingsManager.getWifiMode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -200,13 +212,13 @@ public class settingsFragment extends Fragment {
|
|||||||
alert.setCancelable(true);
|
alert.setCancelable(true);
|
||||||
|
|
||||||
alert.setPositiveButton("Ok", (dialog, which) -> {
|
alert.setPositiveButton("Ok", (dialog, which) -> {
|
||||||
latestSettings.settings.defaultSettings();
|
// settingsManager.settings.defaultSettings();
|
||||||
username.setText(latestSettings.settings.get_username());
|
username.setText(settingsManager.getUsername());
|
||||||
spinnerView.clearSelectedItem();
|
spinnerView.clearSelectedItem();
|
||||||
// practice_mode.setChecked(latestSettings.settings.get_practice_mode());
|
// practice_mode.setChecked(latestSettings.settings.get_practice_mode());
|
||||||
wifi_mode.setChecked(latestSettings.settings.get_wifi_mode());
|
wifi_mode.setChecked(settingsManager.getWifiMode());
|
||||||
alliance_pos_spinnerView.selectItemByIndex(0);
|
alliance_pos_spinnerView.selectItemByIndex(0);
|
||||||
team_num.setText(String.valueOf(latestSettings.settings.get_team_num()));
|
team_num.setText(String.valueOf(settingsManager.getTeamNum()));
|
||||||
});
|
});
|
||||||
|
|
||||||
alert.setNegativeButton("Cancel", null);
|
alert.setNegativeButton("Cancel", null);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.R;
|
import com.ridgebotics.ridgescout.R;
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentTransferBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentTransferBinding;
|
||||||
import com.ridgebotics.ridgescout.ui.transfer.bluetooth.BluetoothSenderFragment;
|
import com.ridgebotics.ridgescout.ui.transfer.bluetooth.BluetoothSenderFragment;
|
||||||
import com.ridgebotics.ridgescout.ui.transfer.codes.CodeGeneratorView;
|
import com.ridgebotics.ridgescout.ui.transfer.codes.CodeGeneratorView;
|
||||||
@@ -45,7 +45,7 @@ public class TransferFragment extends Fragment {
|
|||||||
|
|
||||||
binding = FragmentTransferBinding.inflate(inflater, container, false);
|
binding = FragmentTransferBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
evcode = latestSettings.settings.get_evcode();
|
evcode = settingsManager.getEVCode();
|
||||||
|
|
||||||
binding.downloadButton.setOnClickListener(v -> {
|
binding.downloadButton.setOnClickListener(v -> {
|
||||||
start_download();
|
start_download();
|
||||||
@@ -106,7 +106,7 @@ public class TransferFragment extends Fragment {
|
|||||||
builder.show();
|
builder.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!latestSettings.settings.get_wifi_mode())
|
if(!settingsManager.getWifiMode())
|
||||||
binding.TBAButton.setEnabled(false);
|
binding.TBAButton.setEnabled(false);
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ public class BluetoothReceiver {
|
|||||||
permissionsNeeded.add(Manifest.permission.BLUETOOTH_ADMIN);
|
permissionsNeeded.add(Manifest.permission.BLUETOOTH_ADMIN);
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
// if (ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
permissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
// permissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ public class BluetoothReceiver {
|
|||||||
boolean hasBasicPermissions = ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED &&
|
boolean hasBasicPermissions = ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED &&
|
||||||
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;
|
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
return hasBasicPermissions && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
// return hasBasicPermissions && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||||
} else {
|
// } else {
|
||||||
return hasBasicPermissions;
|
return hasBasicPermissions;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class BluetoothSender {
|
|||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
permissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
// permissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,11 +89,11 @@ public class BluetoothSender {
|
|||||||
boolean hasBasicPermissions = ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED &&
|
boolean hasBasicPermissions = ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED &&
|
||||||
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;
|
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
return hasBasicPermissions && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
// return hasBasicPermissions && ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||||
} else {
|
// } else {
|
||||||
return hasBasicPermissions;
|
return hasBasicPermissions;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ridgebotics.ridgescout.utility;
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class BuiltByteParser {
|
public class BuiltByteParser {
|
||||||
public static final Integer boolType = 0;
|
public static final Integer boolType = 0;
|
||||||
@@ -121,6 +122,7 @@ public class BuiltByteParser {
|
|||||||
|
|
||||||
intArrayObject ia = new intArrayObject();
|
intArrayObject ia = new intArrayObject();
|
||||||
ia.arr = intArr;
|
ia.arr = intArr;
|
||||||
|
System.out.println(Arrays.toString(intArr));
|
||||||
objects.add(ia);
|
objects.add(ia);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.ridgebotics.ridgescout.utility;
|
package com.ridgebotics.ridgescout.utility;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
|
||||||
import com.ridgebotics.ridgescout.scoutingData.fields;
|
import com.ridgebotics.ridgescout.scoutingData.fields;
|
||||||
import com.ridgebotics.ridgescout.scoutingData.transfer.transferType;
|
import com.ridgebotics.ridgescout.scoutingData.transfer.transferType;
|
||||||
import com.ridgebotics.ridgescout.types.frcEvent;
|
import com.ridgebotics.ridgescout.types.frcEvent;
|
||||||
@@ -15,7 +14,7 @@ public class DataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getevcode() {
|
public static String getevcode() {
|
||||||
return latestSettings.settings.get_evcode();
|
return settingsManager.getEVCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static inputType[][] match_values;
|
public static inputType[][] match_values;
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import android.content.Context;
|
|||||||
import com.ridgebotics.ridgescout.types.frcEvent;
|
import com.ridgebotics.ridgescout.types.frcEvent;
|
||||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||||
|
|
||||||
import com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -268,8 +266,8 @@ public final class fileEditor {
|
|||||||
public static boolean setEvent(frcEvent event){
|
public static boolean setEvent(frcEvent event){
|
||||||
final String filename = (event.eventCode + ".eventdata");
|
final String filename = (event.eventCode + ".eventdata");
|
||||||
|
|
||||||
if(latestSettings.settings.get_evcode().equals("unset")){
|
if(settingsManager.getEVCode().equals("unset")){
|
||||||
latestSettings.settings.set_evcode(event.eventCode);
|
settingsManager.setEVCode(event.eventCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return writeFile(filename, event.encode());
|
return writeFile(filename, event.encode());
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.ridgebotics.ridgescout.utility.ollama;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.utility.AlertManager;
|
||||||
|
//import com.ridgebotics.ridgescout.utility.ollama.types.Messages;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okhttp3.Call;
|
||||||
|
import okhttp3.Callback;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
|
public class OllamaClient {
|
||||||
|
private static final String MODEL_KEY = "llama3";
|
||||||
|
private static final String OLLAMA_URL_KEY = "http://199.204.135.71:11434";
|
||||||
|
|
||||||
|
private static final String GENERATE_PATH = "/api/generate";
|
||||||
|
|
||||||
|
public interface ollamaListener {
|
||||||
|
void onResponse(String response);
|
||||||
|
void onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String promptToJson(String prompt){
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jobj = new JSONObject();
|
||||||
|
jobj.put("model", "llama3");
|
||||||
|
jobj.put("prompt", prompt);
|
||||||
|
return jobj.toString();
|
||||||
|
} catch (JSONException e){
|
||||||
|
AlertManager.error(e);
|
||||||
|
}
|
||||||
|
return "{}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void run(String prompt, ollamaListener listener){
|
||||||
|
// ChatRequest chatRequest = new ChatRequest(MODEL_KEY, llamaMessages.messages,true);
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(promptToJson(prompt), MediaType.parse("application/json"));
|
||||||
|
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(OLLAMA_URL_KEY+GENERATE_PATH)
|
||||||
|
.post(body)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
new OkHttpClient().newCall(request).enqueue(new Callback() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call call, @NonNull IOException e) {
|
||||||
|
AlertManager.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
|
responseStreamer(response, listener);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void responseStreamer(Response r, ollamaListener listener){
|
||||||
|
String line;
|
||||||
|
ResponseBody body = r.body();
|
||||||
|
if(body == null)
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
while ((line = body.source().readUtf8Line()) != null) {
|
||||||
|
// System.out.println(line);
|
||||||
|
JSONObject json = new JSONObject(line);
|
||||||
|
|
||||||
|
listener.onResponse(json.getString("response"));
|
||||||
|
if(json.getBoolean("done"))
|
||||||
|
listener.onComplete();
|
||||||
|
}
|
||||||
|
} catch (IOException | NumberFormatException | IllegalStateException | JSONException e) {
|
||||||
|
// addMessage(chatResponse,fullResponse.toString(),stopButton,sendButton);
|
||||||
|
AlertManager.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package com.ridgebotics.ridgescout.utility.ollama;
|
||||||
|
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.evcode;
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.match_latest_values;
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.pit_latest_values;
|
||||||
|
|
||||||
|
import com.ridgebotics.ridgescout.scoutingData.ScoutingDataWriter;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.dataType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.intType;
|
||||||
|
import com.ridgebotics.ridgescout.types.data.stringType;
|
||||||
|
import com.ridgebotics.ridgescout.types.frcMatch;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.dropdownType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.inputType;
|
||||||
|
import com.ridgebotics.ridgescout.types.input.sliderType;
|
||||||
|
import com.ridgebotics.ridgescout.utility.DataManager;
|
||||||
|
import com.ridgebotics.ridgescout.utility.fileEditor;
|
||||||
|
|
||||||
|
public class PromptCreator {
|
||||||
|
private static String fieldSummary(inputType field){
|
||||||
|
String summary = field.name + ": ";
|
||||||
|
switch (field.getInputType()){
|
||||||
|
case DROPDOWN:
|
||||||
|
summary += "The index of a dropdown with the possible options: [" +String.join(", ", ((dropdownType) field).text_options) + "]";
|
||||||
|
break;
|
||||||
|
case SLIDER:
|
||||||
|
sliderType slider = (sliderType) field;
|
||||||
|
summary += "A slider with the range ["+slider.min+","+slider.max+"]";
|
||||||
|
break;
|
||||||
|
case TALLY:
|
||||||
|
summary += "A tally counter";
|
||||||
|
break;
|
||||||
|
case NOTES_INPUT:
|
||||||
|
summary += "Raw text input";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String genMatchPrompt(int matchIndex){
|
||||||
|
String prompt = "Below is a list of data collected from an FRC match. Generate a qualitative and concise summary of the teams listed, using both numerical and textual data collected in the summary. Additionally, rank the teams in order of their performance.\n\n";
|
||||||
|
|
||||||
|
frcMatch curmatch = event.matches.get(matchIndex);
|
||||||
|
|
||||||
|
prompt += "## Pit scouting\n"; prompt += "This is a list of the different fields that are present in the pit scouting data:\n";
|
||||||
|
|
||||||
|
for(int i = 0; i < pit_latest_values.length; i++){
|
||||||
|
prompt += (i+1) + ") " + fieldSummary(pit_latest_values[i]) + "\n";
|
||||||
|
}
|
||||||
|
prompt += ("\nData:\n");
|
||||||
|
|
||||||
|
for(int a = 0; a < 6; a++){
|
||||||
|
int teamNum = 0;
|
||||||
|
if(a < 3)
|
||||||
|
teamNum = curmatch.redAlliance[a];
|
||||||
|
else
|
||||||
|
teamNum = curmatch.blueAlliance[a-3];
|
||||||
|
|
||||||
|
prompt += "\nTeam " + teamNum + " pit scout data:\n";
|
||||||
|
|
||||||
|
String filename = evcode+"-"+teamNum+".pitscoutdata";
|
||||||
|
|
||||||
|
if (!fileEditor.fileExist(filename)) continue;
|
||||||
|
|
||||||
|
ScoutingDataWriter.ParsedScoutingDataResult psdr = ScoutingDataWriter.load(filename, DataManager.pit_values, DataManager.pit_transferValues);
|
||||||
|
dataType[] types = psdr.data.array;
|
||||||
|
for(int i = 0; i < types.length; i++) {
|
||||||
|
boolean isNull = true;
|
||||||
|
switch (types[i].getValueType()){
|
||||||
|
case NUM:
|
||||||
|
isNull = intType.isNull((int) types[i].get());
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
isNull = stringType.isNull((String) types[i].get());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(isNull){
|
||||||
|
prompt += match_latest_values[i].name + ": null\n";
|
||||||
|
}else{
|
||||||
|
prompt += match_latest_values[i].name + ": " + types[i].get() + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt += "\n## Match scouting\n";
|
||||||
|
prompt += "This is a list of the different fields that are present in the match scouting data:\n";
|
||||||
|
|
||||||
|
for(int i = 0; i < match_latest_values.length; i++){
|
||||||
|
prompt += (i+1) + ") " + fieldSummary(match_latest_values[i]) + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt += ("\nData:\n");
|
||||||
|
|
||||||
|
for(int a = 0; a < 6; a++){
|
||||||
|
int teamNum = 0;
|
||||||
|
if(a < 3)
|
||||||
|
teamNum = curmatch.redAlliance[a];
|
||||||
|
else
|
||||||
|
teamNum = curmatch.blueAlliance[a-3];
|
||||||
|
|
||||||
|
prompt += "\nTeam " + teamNum + " Match scout data for match " + curmatch.matchIndex +":\n";
|
||||||
|
|
||||||
|
frcMatch[] matchNums = event.getTeamMatches(teamNum);
|
||||||
|
|
||||||
|
for(int b = 0; b < matchNums.length; b++) {
|
||||||
|
frcMatch match = matchNums[b];
|
||||||
|
|
||||||
|
String alliance = "";
|
||||||
|
int alliancePos = 0;
|
||||||
|
|
||||||
|
for(int c = 0; c < 6; c++) {
|
||||||
|
if(c<3){
|
||||||
|
if(match.redAlliance[c] != teamNum) continue;
|
||||||
|
alliance = "red";
|
||||||
|
alliancePos = c+1;
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
if(match.blueAlliance[c-3] != teamNum) continue;
|
||||||
|
alliance = "blue";
|
||||||
|
alliancePos = c-2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String filename = evcode + "-" + match.matchIndex + "-" + alliance + "-" + alliancePos + "-" + teamNum + ".matchscoutdata";
|
||||||
|
|
||||||
|
if (!fileEditor.fileExist(filename)) continue;
|
||||||
|
|
||||||
|
ScoutingDataWriter.ParsedScoutingDataResult psdr = ScoutingDataWriter.load(filename, DataManager.match_values, DataManager.match_transferValues);
|
||||||
|
dataType[] types = psdr.data.array;
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
boolean isNull = true;
|
||||||
|
switch (types[i].getValueType()){
|
||||||
|
case NUM:
|
||||||
|
isNull = intType.isNull((int) types[i].get());
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
isNull = stringType.isNull((String) types[i].get());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(isNull){
|
||||||
|
prompt += match_latest_values[i].name + ": null\n";
|
||||||
|
}else{
|
||||||
|
prompt += match_latest_values[i].name + ": " + types[i].get() + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prompt += "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prompt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.ridgebotics.ridgescout.utility;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class settingsManager {
|
||||||
|
public static SharedPreferences prefs;
|
||||||
|
public static SharedPreferences.Editor editor;
|
||||||
|
|
||||||
|
public static final String UnameKey = "username";
|
||||||
|
public static final String SelEVCodeKey = "selected_event_code";
|
||||||
|
public static final String WifiModeKey = "wifi_mode";
|
||||||
|
public static final String TeamNumKey = "team_num";
|
||||||
|
public static final String MatchNumKey = "match_num";
|
||||||
|
public static final String AllyPosKey = "alliance_pos";
|
||||||
|
public static final String DataModeKey = "data_view_mode";
|
||||||
|
public static final String BtUUIDKey = "bt_uuid";
|
||||||
|
|
||||||
|
public static Map defaults = getDefaults();
|
||||||
|
private static Map getDefaults(){
|
||||||
|
Map<String, Object> hm = new HashMap<>();
|
||||||
|
|
||||||
|
hm.put(UnameKey, "Username");
|
||||||
|
hm.put(SelEVCodeKey, "unset");
|
||||||
|
hm.put(WifiModeKey, false);
|
||||||
|
hm.put(TeamNumKey, 4388);
|
||||||
|
hm.put(MatchNumKey, 0);
|
||||||
|
hm.put(AllyPosKey, "red-1");
|
||||||
|
hm.put(DataModeKey, 0);
|
||||||
|
hm.put(BtUUIDKey, UUID.randomUUID().toString());
|
||||||
|
|
||||||
|
return hm;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SharedPreferences.Editor getEditor(){
|
||||||
|
if(editor == null) editor = prefs.edit();
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDK why I decided to format these functions like this. It looks cool though.
|
||||||
|
public static String getUsername(){return prefs.getString( UnameKey, (String) defaults.get(UnameKey));}
|
||||||
|
public static void setUsername(String str){ getEditor().putString( UnameKey,str).apply();}
|
||||||
|
|
||||||
|
public static String getEVCode(){return prefs.getString( SelEVCodeKey, (String) defaults.get(SelEVCodeKey));}
|
||||||
|
public static void setEVCode(String str){ getEditor().putString( SelEVCodeKey,str).apply();}
|
||||||
|
|
||||||
|
public static boolean getWifiMode(){return prefs.getBoolean( WifiModeKey, (boolean) defaults.get(WifiModeKey));}
|
||||||
|
public static void setWifiMode(boolean bool){getEditor().putBoolean( WifiModeKey,bool).apply();}
|
||||||
|
|
||||||
|
public static int getTeamNum(){return prefs.getInt( TeamNumKey, (int) defaults.get(TeamNumKey));}
|
||||||
|
public static void setTeamNum(int num){ getEditor().putInt( TeamNumKey,num).apply();}
|
||||||
|
|
||||||
|
public static int getMatchNum(){return prefs.getInt( MatchNumKey, (int) defaults.get(MatchNumKey));}
|
||||||
|
public static void setMatchNum(int num){ getEditor().putInt( MatchNumKey,num).apply();}
|
||||||
|
|
||||||
|
public static String getAllyPos(){return prefs.getString( AllyPosKey, (String) defaults.get(AllyPosKey));}
|
||||||
|
public static void setAllyPos(String str){ getEditor().putString( AllyPosKey,str).apply();}
|
||||||
|
|
||||||
|
public static int getDataMode(){return prefs.getInt( DataModeKey, (int) defaults.get(DataModeKey));}
|
||||||
|
public static void setDataMode(int num){ getEditor().putInt( DataModeKey,num).apply();}
|
||||||
|
|
||||||
|
public static String getBtUUID(){return prefs.getString( BtUUIDKey, (String) defaults.get(BtUUIDKey));}
|
||||||
|
public static void setBtUUID(String str){ getEditor().putString( BtUUIDKey,str).apply();}
|
||||||
|
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 2.2 MiB |
@@ -1,18 +1,59 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView3"
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/team_number"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="TBD"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="34sp"
|
android:text="1234"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:textSize="24sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/AyEyeButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="AyEye" />
|
||||||
|
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:id="@+id/teamMatchesTable"
|
||||||
|
android:layout_width="409dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="1dp"
|
||||||
|
android:layout_marginEnd="1dp"
|
||||||
|
android:stretchColumns="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/team_number">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/team_number">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/AyEyeBox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
</EditText>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
</ScrollView>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:id="@+id/match_table"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -26,7 +26,11 @@
|
|||||||
app:popExitAnim="@anim/pop_exit_anim" />
|
app:popExitAnim="@anim/pop_exit_anim" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_navigation_scouting_to_navigation_scouting_status"
|
android:id="@+id/action_navigation_scouting_to_navigation_scouting_status"
|
||||||
app:destination="@id/navigation_scouting_status" />
|
app:destination="@id/navigation_scouting_status"
|
||||||
|
app:enterAnim="@anim/enter_anim"
|
||||||
|
app:exitAnim="@anim/exit_anim"
|
||||||
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
|
app:popExitAnim="@anim/pop_exit_anim"/>
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
@@ -77,13 +81,6 @@
|
|||||||
app:exitAnim="@anim/exit_anim"
|
app:exitAnim="@anim/exit_anim"
|
||||||
app:popEnterAnim="@anim/enter_anim"
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
app:popExitAnim="@anim/pop_exit_anim" />
|
app:popExitAnim="@anim/pop_exit_anim" />
|
||||||
<action
|
|
||||||
android:id="@+id/action_navigation_data_to_navigation_data_report"
|
|
||||||
app:destination="@id/navigation_data_report"
|
|
||||||
app:enterAnim="@anim/enter_anim"
|
|
||||||
app:exitAnim="@anim/exit_anim"
|
|
||||||
app:popEnterAnim="@anim/enter_anim"
|
|
||||||
app:popExitAnim="@anim/pop_exit_anim" />
|
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_navigation_data_to_navigation_data_fields_chooser"
|
android:id="@+id/action_navigation_data_to_navigation_data_fields_chooser"
|
||||||
app:destination="@id/navigation_data_fields_chooser"
|
app:destination="@id/navigation_data_fields_chooser"
|
||||||
@@ -91,13 +88,20 @@
|
|||||||
app:exitAnim="@anim/exit_anim"
|
app:exitAnim="@anim/exit_anim"
|
||||||
app:popEnterAnim="@anim/enter_anim"
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
app:popExitAnim="@anim/pop_exit_anim" />
|
app:popExitAnim="@anim/pop_exit_anim" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_navigation_data_to_navigation_data_report_selector"
|
||||||
|
app:destination="@id/navigation_data_report_selector"
|
||||||
|
app:enterAnim="@anim/enter_anim"
|
||||||
|
app:exitAnim="@anim/exit_anim"
|
||||||
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
|
app:popExitAnim="@anim/pop_exit_anim"/>
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_navigation_data_to_navigation_data_compare"
|
android:id="@+id/action_navigation_data_to_navigation_data_compare"
|
||||||
app:destination="@id/navigation_data_compare"
|
app:destination="@id/navigation_data_compare"
|
||||||
app:enterAnim="@anim/enter_anim"
|
app:enterAnim="@anim/enter_anim"
|
||||||
app:exitAnim="@anim/exit_anim"
|
app:exitAnim="@anim/exit_anim"
|
||||||
app:popEnterAnim="@anim/enter_anim"
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
app:popExitAnim="@anim/pop_exit_anim" />
|
app:popExitAnim="@anim/pop_exit_anim"/>
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
@@ -143,7 +147,27 @@
|
|||||||
tools:layout="@layout/fragment_data_fields">
|
tools:layout="@layout/fragment_data_fields">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_navigation_data_fields_to_navigation_data_fields_chooser"
|
android:id="@+id/action_navigation_data_fields_to_navigation_data_fields_chooser"
|
||||||
app:destination="@id/navigation_data_fields_chooser" />
|
app:destination="@id/navigation_data_fields_chooser"
|
||||||
|
app:enterAnim="@anim/enter_anim"
|
||||||
|
app:exitAnim="@anim/exit_anim"
|
||||||
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
|
app:popExitAnim="@anim/pop_exit_anim" />
|
||||||
|
</fragment>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/navigation_data_report_selector"
|
||||||
|
android:name="com.ridgebotics.ridgescout.ui.data.ReportSelectorFragment"
|
||||||
|
tools:layout="@layout/fragment_data_report_selector">
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_navigation_data_report_selector_to_navigation_data_report"
|
||||||
|
app:destination="@id/navigation_data_report"
|
||||||
|
app:enterAnim="@anim/enter_anim"
|
||||||
|
app:exitAnim="@anim/exit_anim"
|
||||||
|
app:popEnterAnim="@anim/enter_anim"
|
||||||
|
app:popExitAnim="@anim/pop_exit_anim"/>
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_navigation_data_report_selector_to_navigation_data"
|
||||||
|
app:destination="@id/navigation_data" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.ScoutingApp2025" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.RidgeScout" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/main_200</item>
|
<item name="colorPrimary">@color/main_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/main_700</item>
|
<item name="colorPrimaryVariant">@color/main_700</item>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.ScoutingApp2025" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.RidgeScout" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/main_500</item>
|
<item name="colorPrimary">@color/main_500</item>
|
||||||
<item name="colorPrimaryVariant">@color/main_700</item>
|
<item name="colorPrimaryVariant">@color/main_700</item>
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<network-security-config>
|
||||||
|
<base-config cleartextTrafficPermitted="true">
|
||||||
|
<trust-anchors>
|
||||||
|
<certificates src="system" />
|
||||||
|
</trust-anchors>
|
||||||
|
</base-config>
|
||||||
|
</network-security-config>
|
||||||
|
Before Width: | Height: | Size: 373 KiB After Width: | Height: | Size: 373 KiB |
|
After Width: | Height: | Size: 59 KiB |
@@ -21,6 +21,6 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "ScoutingApp2025"
|
rootProject.name = "RidgeScout"
|
||||||
include(":app")
|
include(":app")
|
||||||
|
|
||||||
|
|||||||