mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 00:37:59 -06:00
Make use sharedprefrences
This commit is contained in:
@@ -3,11 +3,9 @@ Ridgebotics 2025 scouting app in Android
|
|||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
#### Scouting:
|
#### Scouting:
|
||||||
- Make the "Report" menu, A tool that lets users select data to display from the the teams and compare menus.
|
|
||||||
- Make practice mode??
|
- Make practice mode??
|
||||||
#### Data Analysis:
|
#### Data Analysis:
|
||||||
- Statbotics intigration???
|
- Statbotics intigration???
|
||||||
- AI overview of scouting data for a team???
|
|
||||||
- Make the "Compare" menu, cross comparing team's stats.
|
- Make the "Compare" menu, cross comparing team's stats.
|
||||||
#### Functionality:
|
#### Functionality:
|
||||||
- Add more types of data fields.
|
- Add more types of data fields.
|
||||||
@@ -16,9 +14,12 @@ Ridgebotics 2025 scouting app in Android
|
|||||||
## In Progress:
|
## In Progress:
|
||||||
#### Scouting:
|
#### Scouting:
|
||||||
#### Data Analysis:
|
#### 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:
|
#### Functionality:
|
||||||
- Make server software to allow for easy sync over wifi - FTP
|
- Make server software to allow for easy sync over wifi - FTP
|
||||||
- Deploy to F-Droid
|
- Deploy to F-Droid
|
||||||
|
-
|
||||||
|
|
||||||
## Done:
|
## Done:
|
||||||
#### Scouting:
|
#### Scouting:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@@ -20,7 +21,7 @@ import androidx.navigation.ui.NavigationUI;
|
|||||||
|
|
||||||
import com.ridgebotics.ridgescout.databinding.ActivityMainBinding;
|
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,13 @@ 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);
|
||||||
|
|
||||||
|
// latestSettings.test();
|
||||||
|
|
||||||
|
// latestSettings.update();
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-110
@@ -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"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.ridgebotics.ridgescout.types;
|
package com.ridgebotics.ridgescout.types;
|
||||||
|
|
||||||
|
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||||
|
|
||||||
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 +80,37 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.ridgebotics.ridgescout.ui.data;
|
package com.ridgebotics.ridgescout.ui.data;
|
||||||
|
|
||||||
import static com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings.settings;
|
|
||||||
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;
|
||||||
@@ -13,14 +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;
|
|
||||||
import com.ridgebotics.ridgescout.types.frcMatch;
|
|
||||||
import com.ridgebotics.ridgescout.utility.AlertManager;
|
|
||||||
import com.ridgebotics.ridgescout.utility.DataManager;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.ridgebotics.ridgescout.ui.data;
|
package com.ridgebotics.ridgescout.ui.data;
|
||||||
|
|
||||||
import static com.ridgebotics.ridgescout.SettingsVersionStack.latestSettings.settings;
|
|
||||||
import static com.ridgebotics.ridgescout.types.input.inputType.dropdownType;
|
|
||||||
import static com.ridgebotics.ridgescout.utility.DataManager.evcode;
|
import static com.ridgebotics.ridgescout.utility.DataManager.evcode;
|
||||||
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
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.match_latest_values;
|
||||||
import static com.ridgebotics.ridgescout.utility.DataManager.pit_latest_values;
|
import static com.ridgebotics.ridgescout.utility.DataManager.pit_latest_values;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -28,7 +25,9 @@ import com.ridgebotics.ridgescout.types.input.inputType;
|
|||||||
import com.ridgebotics.ridgescout.types.input.sliderType;
|
import com.ridgebotics.ridgescout.types.input.sliderType;
|
||||||
import com.ridgebotics.ridgescout.utility.DataManager;
|
import com.ridgebotics.ridgescout.utility.DataManager;
|
||||||
import com.ridgebotics.ridgescout.utility.fileEditor;
|
import com.ridgebotics.ridgescout.utility.fileEditor;
|
||||||
import com.ridgebotics.ridgescout.utility.ollama.OllamaTest;
|
import com.ridgebotics.ridgescout.utility.ollama.OllamaClient;
|
||||||
|
import com.ridgebotics.ridgescout.utility.ollama.PromptCreator;
|
||||||
|
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,42 +50,25 @@ public class ReportFragment extends Fragment {
|
|||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// public frcMatch[] getTeamMatches(int teamNum){
|
||||||
|
// List<frcMatch> teamMatches = new ArrayList<>();
|
||||||
|
// for(int i = 0; i < event.matches.size(); i++){
|
||||||
|
// frcMatch match = event.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]);
|
||||||
|
// }
|
||||||
|
|
||||||
public frcMatch[] getTeamMatches(int teamNum){
|
|
||||||
List<frcMatch> teamMatches = new ArrayList<>();
|
|
||||||
for(int i = 0; i < event.matches.size(); i++){
|
|
||||||
frcMatch match = event.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]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private 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 void getReportMatches(){
|
public void getReportMatches(){
|
||||||
// String out = "";
|
// String out = "";
|
||||||
int ourTeamNum = settings.get_team_num();
|
int ourTeamNum = settingsManager.getTeamNum();
|
||||||
frcMatch[] teamMatches = getTeamMatches(ourTeamNum);
|
frcMatch[] teamMatches = event.getTeamMatches(ourTeamNum);
|
||||||
|
|
||||||
TableRow tr = new TableRow(getContext());
|
TableRow tr = new TableRow(getContext());
|
||||||
|
|
||||||
@@ -119,7 +101,7 @@ public class ReportFragment extends Fragment {
|
|||||||
if(teamNum == ourTeamNum)
|
if(teamNum == ourTeamNum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int matchNum = getMostRecentTeamMatch(teamNum, teamMatches[i].matchIndex);
|
int matchNum = event.getMostRecentTeamMatch(teamNum, teamMatches[i].matchIndex);
|
||||||
if(maxMatch < matchNum)
|
if(maxMatch < matchNum)
|
||||||
maxMatch = matchNum;
|
maxMatch = matchNum;
|
||||||
}
|
}
|
||||||
@@ -134,127 +116,12 @@ public class ReportFragment extends Fragment {
|
|||||||
// AlertManager.error(out);
|
// AlertManager.error(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fieldSummary(inputType field){
|
|
||||||
String summary = field.name + ": ";
|
|
||||||
switch (field.getInputType()){
|
|
||||||
case DROPDOWN:
|
|
||||||
summary += "A 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AIDataOverview(){
|
private void AIDataOverview(){
|
||||||
String prompt = "Below is a list of data collected from an FRC match. Generate a qualitative and concise summary of the teams listed in the data collected.\n\n";
|
String prompt = PromptCreator.genMatchPrompt(0);
|
||||||
|
|
||||||
frcMatch curmatch = event.matches.get(0);
|
// System.out.println(prompt);
|
||||||
|
|
||||||
prompt += "## Pit scouting\n";
|
OllamaClient.run(prompt, new OllamaClient.ollamaListener() {
|
||||||
prompt += "This is a list of the different fields that are present in the pit scouting data:\n";
|
|
||||||
|
|
||||||
|
|
||||||
prompt += "1) Team number\n";
|
|
||||||
for(int i = 0; i < pit_latest_values.length; i++){
|
|
||||||
prompt += (i+2) + ") " + 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 += teamNum + ",";
|
|
||||||
|
|
||||||
String filename = evcode+"-"+teamNum+".pitscoutdata";
|
|
||||||
if(!fileEditor.fileExist(filename)){
|
|
||||||
prompt += ("null,".repeat(pit_latest_values.length));
|
|
||||||
}else{
|
|
||||||
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++) {
|
|
||||||
prompt += (types[i].get() + ",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prompt += "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
prompt += "\n## Match scouting\n";
|
|
||||||
prompt += "This is a list of the different fields that are present in the match scouting data:\n";
|
|
||||||
|
|
||||||
prompt += "1) Match number\n";
|
|
||||||
for(int i = 0; i < match_latest_values.length; i++){
|
|
||||||
prompt += (i+2) + ") " + 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 += "Team " + teamNum + " Match scout data:\n";
|
|
||||||
|
|
||||||
frcMatch[] matchNums = 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;
|
|
||||||
prompt += match.matchIndex + ",";
|
|
||||||
for (int i = 0; i < types.length; i++) {
|
|
||||||
prompt += (types[i].get() + ",");
|
|
||||||
}
|
|
||||||
prompt += "\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(prompt);
|
|
||||||
// binding.AyEyeBox.setText(prompt);
|
|
||||||
|
|
||||||
|
|
||||||
OllamaTest.run(prompt, new OllamaTest.ollamaListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
// System.out.println(response);
|
// System.out.println(response);
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import androidx.fragment.app.Fragment;
|
|||||||
|
|
||||||
import com.ridgebotics.ridgescout.databinding.FragmentSettingsBinding;
|
import com.ridgebotics.ridgescout.databinding.FragmentSettingsBinding;
|
||||||
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;
|
||||||
@@ -48,11 +48,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 +65,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 +89,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 +106,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 +132,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 +159,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(Integer.parseInt(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 +178,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 +200,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();
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
+2
-8
@@ -3,16 +3,12 @@ package com.ridgebotics.ridgescout.utility.ollama;
|
|||||||
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.ollama.types.ChatMessage;
|
//import com.ridgebotics.ridgescout.utility.ollama.types.Messages;
|
||||||
import com.ridgebotics.ridgescout.utility.ollama.types.ChatRequest;
|
|
||||||
import com.ridgebotics.ridgescout.utility.ollama.types.ChatResponse;
|
|
||||||
import com.ridgebotics.ridgescout.utility.ollama.types.Messages;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Callback;
|
import okhttp3.Callback;
|
||||||
@@ -23,7 +19,7 @@ import okhttp3.Response;
|
|||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
public class OllamaTest {
|
public class OllamaClient {
|
||||||
private static final String MODEL_KEY = "llama3";
|
private static final String MODEL_KEY = "llama3";
|
||||||
private static final String OLLAMA_URL_KEY = "http://199.204.135.71:11434";
|
private static final String OLLAMA_URL_KEY = "http://199.204.135.71:11434";
|
||||||
|
|
||||||
@@ -48,8 +44,6 @@ public class OllamaTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void run(String prompt, ollamaListener listener){
|
public static void run(String prompt, ollamaListener listener){
|
||||||
final Messages llamaMessages = new Messages();
|
|
||||||
llamaMessages.messages.add(new Messages.Message("user", "Test!"));
|
|
||||||
// ChatRequest chatRequest = new ChatRequest(MODEL_KEY, llamaMessages.messages,true);
|
// ChatRequest chatRequest = new ChatRequest(MODEL_KEY, llamaMessages.messages,true);
|
||||||
|
|
||||||
RequestBody body = RequestBody.create(promptToJson(prompt), MediaType.parse("application/json"));
|
RequestBody body = RequestBody.create(promptToJson(prompt), MediaType.parse("application/json"));
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
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.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 += "A 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 in the data collected.\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";
|
||||||
|
|
||||||
|
|
||||||
|
prompt += "1) Team number\n";
|
||||||
|
for(int i = 0; i < pit_latest_values.length; i++){
|
||||||
|
prompt += (i+2) + ") " + 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 += teamNum + ",";
|
||||||
|
|
||||||
|
String filename = evcode+"-"+teamNum+".pitscoutdata";
|
||||||
|
if(!fileEditor.fileExist(filename)){
|
||||||
|
prompt += ("null,".repeat(pit_latest_values.length));
|
||||||
|
}else{
|
||||||
|
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++) {
|
||||||
|
prompt += (types[i].get() + ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prompt += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
prompt += "\n## Match scouting\n";
|
||||||
|
prompt += "This is a list of the different fields that are present in the match scouting data:\n";
|
||||||
|
|
||||||
|
prompt += "1) Match number\n";
|
||||||
|
for(int i = 0; i < match_latest_values.length; i++){
|
||||||
|
prompt += (i+2) + ") " + 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 += "Team " + teamNum + " Match scout data:\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;
|
||||||
|
prompt += match.matchIndex + ",";
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
prompt += (types[i].get() + ",");
|
||||||
|
}
|
||||||
|
prompt += "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prompt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.utility.ollama.types;
|
|
||||||
// Credit to https://github.com/DataDropp/OllamaDroid
|
|
||||||
|
|
||||||
public class ChatMessage {
|
|
||||||
private final int profileImage;
|
|
||||||
private final String profileName;
|
|
||||||
private final String messageContent;
|
|
||||||
|
|
||||||
public ChatMessage(int profileImage, String profileName, String messageContent) {
|
|
||||||
this.profileImage = profileImage;
|
|
||||||
this.profileName = profileName;
|
|
||||||
this.messageContent = messageContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getProfileImage() {
|
|
||||||
return profileImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfileName() {
|
|
||||||
return profileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessageContent() {
|
|
||||||
return messageContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.utility.ollama.types;
|
|
||||||
// Credit to https://github.com/DataDropp/OllamaDroid
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ChatRequest {
|
|
||||||
public String model;
|
|
||||||
public ArrayList<Messages.Message> messages;
|
|
||||||
public boolean stream;
|
|
||||||
public ChatRequest(String model, ArrayList<Messages.Message> message, boolean stream){
|
|
||||||
this.model = model;
|
|
||||||
this.messages = message;
|
|
||||||
this.stream = stream;
|
|
||||||
}
|
|
||||||
public String toJson(){
|
|
||||||
return "{\n" +
|
|
||||||
" \"model\": \"llama3\",\n" +
|
|
||||||
" \"prompt\": \"Why is the sky blue?\"\n" +
|
|
||||||
"}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.utility.ollama.types;
|
|
||||||
// Credit to https://github.com/DataDropp/OllamaDroid
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class ChatResponse {
|
|
||||||
public String model;
|
|
||||||
public Date created_at;
|
|
||||||
public Messages.Message message;
|
|
||||||
public boolean done;
|
|
||||||
public long total_duration;
|
|
||||||
public int load_duration;
|
|
||||||
public int prompt_eval_count;
|
|
||||||
public int prompt_eval_duration;
|
|
||||||
public int eval_count;
|
|
||||||
public long eval_duration;
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.utility.ollama.types;
|
|
||||||
// Credit to https://github.com/DataDropp/OllamaDroid
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class Messages {
|
|
||||||
public ArrayList<Message> messages = new ArrayList<>();
|
|
||||||
public static class Message {
|
|
||||||
public String role;
|
|
||||||
public String content;
|
|
||||||
public Message(String role, String string) {
|
|
||||||
this.role = role;
|
|
||||||
this.content = string;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.ridgebotics.ridgescout.utility.ollama.types;
|
|
||||||
// Credit to https://github.com/DataDropp/OllamaDroid
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class OllamaModels {
|
|
||||||
public ArrayList<OllamaModel> models;
|
|
||||||
public class OllamaModel {
|
|
||||||
|
|
||||||
public String name;
|
|
||||||
public String modified_at;
|
|
||||||
public Object size;
|
|
||||||
public String digest;
|
|
||||||
public Details details;
|
|
||||||
|
|
||||||
private class Details {
|
|
||||||
public String format;
|
|
||||||
public String family;
|
|
||||||
public Object families;
|
|
||||||
public String parameter_size;
|
|
||||||
public String quantization_level;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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();}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user