mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-08 16:28:00 -06:00
Sentiment analysis AI stuff, History view for data
This commit is contained in:
@@ -27,7 +27,7 @@ jobs:
|
|||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|
||||||
- name: Upload APK
|
- name: Upload APK
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-apk
|
name: build-apk
|
||||||
path: ./**/*.apk
|
path: ./**/*.apk
|
||||||
@@ -19,8 +19,6 @@ Ridgebotics 2025 scouting app in Android
|
|||||||
## In Progress:
|
## In Progress:
|
||||||
#### Scouting:
|
#### Scouting:
|
||||||
#### Data Analysis:
|
#### Data Analysis:
|
||||||
- Add "history" view type to the teams view menu.
|
|
||||||
- Sentiment analysis of text input type
|
|
||||||
- Make a word cloud for the compiled mode of text input type
|
- Make a word cloud for the compiled mode of text input type
|
||||||
#### Functionality:
|
#### Functionality:
|
||||||
- Make pit and match data field builder UIs. I don't want to have to keep editing a variable
|
- Make pit and match data field builder UIs. I don't want to have to keep editing a variable
|
||||||
@@ -30,6 +28,8 @@ Ridgebotics 2025 scouting app in Android
|
|||||||
#### Scouting:
|
#### Scouting:
|
||||||
- Add an "unselect" option to all of the scouting fields
|
- Add an "unselect" option to all of the scouting fields
|
||||||
#### Data Analysis:
|
#### Data Analysis:
|
||||||
|
- Add "history" view type to the teams view menu.
|
||||||
|
- Sentiment analysis of text input type
|
||||||
#### Functionality:
|
#### Functionality:
|
||||||
- Make the file browser UI
|
- Make the file browser UI
|
||||||
- Bluetooth data sync
|
- Bluetooth data sync
|
||||||
|
|||||||
+17
-1
@@ -1,5 +1,9 @@
|
|||||||
|
import com.android.build.api.dsl.AaptOptions
|
||||||
|
import com.android.build.api.dsl.AndroidResources
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.androidApplication)
|
alias(libs.plugins.androidApplication)
|
||||||
|
// id("com.google.gms.google-services")
|
||||||
}
|
}
|
||||||
|
|
||||||
//allprojects {
|
//allprojects {
|
||||||
@@ -35,6 +39,9 @@ android {
|
|||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding = true
|
||||||
}
|
}
|
||||||
|
aaptOptions {
|
||||||
|
noCompress("tflite");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -63,7 +70,16 @@ dependencies {
|
|||||||
implementation("com.github.skydoves:powerspinner:1.2.7")
|
implementation("com.github.skydoves:powerspinner:1.2.7")
|
||||||
implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
|
implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
|
||||||
|
|
||||||
implementation("com.github.douglasjunior:AndroidBluetoothLibrary:0.4.0")
|
|
||||||
|
|
||||||
|
|
||||||
|
// implementation("com.google.firebase:firebase-ml-modeldownloader:24.1.2")
|
||||||
|
// implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
|
||||||
|
|
||||||
|
implementation("org.tensorflow:tensorflow-lite-task-text:0.3.0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// implementation("com.github.DeveloperPaul123:SimpleBluetoothLibrary:1.5.1")
|
// implementation("com.github.DeveloperPaul123:SimpleBluetoothLibrary:1.5.1")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,16 +1,14 @@
|
|||||||
package com.astatin3.scoutingapp2025;
|
package com.astatin3.scoutingapp2025;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.astatin3.scoutingapp2025.scoutingData.fields;
|
import com.astatin3.scoutingapp2025.scoutingData.fields;
|
||||||
|
import com.astatin3.scoutingapp2025.ui.data.sentimentAnalysis;
|
||||||
import com.astatin3.scoutingapp2025.utility.AlertManager;
|
import com.astatin3.scoutingapp2025.utility.AlertManager;
|
||||||
import com.astatin3.scoutingapp2025.utility.fileEditor;
|
import com.astatin3.scoutingapp2025.utility.fileEditor;
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
@@ -43,6 +41,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AlertManager.init(this);
|
AlertManager.init(this);
|
||||||
|
sentimentAnalysis.init(this);
|
||||||
|
|
||||||
Objects.requireNonNull(getSupportActionBar()).hide();
|
Objects.requireNonNull(getSupportActionBar()).hide();
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class sv1 extends sv0 {
|
|||||||
|
|
||||||
writeTag("match_num", "0");
|
writeTag("match_num", "0");
|
||||||
writeTag("alliance_pos", "red-1");
|
writeTag("alliance_pos", "red-1");
|
||||||
writeTag("compiled_mode", "false");
|
writeTag("data_view_mode", "0");
|
||||||
writeTag("bt_uuid", UUID.randomUUID().toString());
|
writeTag("bt_uuid", UUID.randomUUID().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,12 +66,12 @@ public class sv1 extends sv0 {
|
|||||||
}
|
}
|
||||||
public void set_team_num(int num){writeTag("team_num", String.valueOf(num));}
|
public void set_team_num(int num){writeTag("team_num", String.valueOf(num));}
|
||||||
|
|
||||||
public boolean get_compiled_mode(){
|
public int get_data_view_mode(){
|
||||||
return readTag("compiled_mode").equals("true");
|
return Integer.parseInt(readTag("data_view_mode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set_compiled_mode(boolean state){
|
public void set_data_view_mode(int mode){
|
||||||
writeTag("compiled_mode", state ? "true" : "false");
|
writeTag("data_view_mode", String.valueOf(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUUID(UUID uuid){
|
public void setUUID(UUID uuid){
|
||||||
|
|||||||
@@ -15,14 +15,19 @@ import com.astatin3.scoutingapp2025.R;
|
|||||||
import com.astatin3.scoutingapp2025.types.data.dataType;
|
import com.astatin3.scoutingapp2025.types.data.dataType;
|
||||||
import com.astatin3.scoutingapp2025.types.data.intType;
|
import com.astatin3.scoutingapp2025.types.data.intType;
|
||||||
import com.astatin3.scoutingapp2025.types.data.stringType;
|
import com.astatin3.scoutingapp2025.types.data.stringType;
|
||||||
|
import com.astatin3.scoutingapp2025.ui.data.sentimentAnalysis;
|
||||||
import com.astatin3.scoutingapp2025.utility.BuiltByteParser;
|
import com.astatin3.scoutingapp2025.utility.BuiltByteParser;
|
||||||
import com.astatin3.scoutingapp2025.utility.ByteBuilder;
|
import com.astatin3.scoutingapp2025.utility.ByteBuilder;
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
import com.github.mikephil.charting.charts.PieChart;
|
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.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.PieData;
|
||||||
import com.github.mikephil.charting.data.PieDataSet;
|
import com.github.mikephil.charting.data.PieDataSet;
|
||||||
import com.github.mikephil.charting.data.PieEntry;
|
import com.github.mikephil.charting.data.PieEntry;
|
||||||
|
import com.github.mikephil.charting.interfaces.datasets.IDataSet;
|
||||||
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
||||||
import com.skydoves.powerspinner.IconSpinnerItem;
|
import com.skydoves.powerspinner.IconSpinnerItem;
|
||||||
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
||||||
@@ -46,6 +51,11 @@ public class dropdownType extends inputType {
|
|||||||
this.text_options = text_options;
|
this.text_options = text_options;
|
||||||
this.default_value = defaultSelIndex;
|
this.default_value = defaultSelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public byte[] encode() throws ByteBuilder.buildingException {
|
public byte[] encode() throws ByteBuilder.buildingException {
|
||||||
ByteBuilder bb = new ByteBuilder();
|
ByteBuilder bb = new ByteBuilder();
|
||||||
bb.addString(name);
|
bb.addString(name);
|
||||||
@@ -62,6 +72,10 @@ public class dropdownType extends inputType {
|
|||||||
text_options = (String[]) objects.get(2).get();
|
text_options = (String[]) objects.get(2).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PowerSpinnerView dropdown = null;
|
public PowerSpinnerView dropdown = null;
|
||||||
|
|
||||||
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||||
@@ -126,6 +140,12 @@ public class dropdownType extends inputType {
|
|||||||
if(dropdown.getVisibility() == View.GONE) return new intType(name, intType.nulval);
|
if(dropdown.getVisibility() == View.GONE) return new intType(name, intType.nulval);
|
||||||
return new intType(name, dropdown.getSelectedIndex());
|
return new intType(name, dropdown.getSelectedIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void add_individual_view(LinearLayout parent, dataType data){
|
public void add_individual_view(LinearLayout parent, dataType data){
|
||||||
if(data.isNull()) return;
|
if(data.isNull()) return;
|
||||||
TextView tv = new TextView(parent.getContext());
|
TextView tv = new TextView(parent.getContext());
|
||||||
@@ -139,6 +159,14 @@ public class dropdownType extends inputType {
|
|||||||
tv.setTextSize(18);
|
tv.setTextSize(18);
|
||||||
parent.addView(tv);
|
parent.addView(tv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static int[] generateEquidistantColors(int N) {
|
private static int[] generateEquidistantColors(int N) {
|
||||||
int[] colors = new int[N];
|
int[] colors = new int[N];
|
||||||
float[] hsv = new float[3]; // Hue, Saturation, Value
|
float[] hsv = new float[3]; // Hue, Saturation, Value
|
||||||
@@ -182,5 +210,76 @@ public class dropdownType extends inputType {
|
|||||||
chart.setDrawHoleEnabled(false);
|
chart.setDrawHoleEnabled(false);
|
||||||
chart.setData(pieData);
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int[] colors = generateEquidistantColors(text_options.length);
|
||||||
|
|
||||||
|
LineData lineData = new LineData();
|
||||||
|
|
||||||
|
for(int i = 0; i < text_options.length; i++){
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int a = 0; a < data.length; a++) {
|
||||||
|
if(data[a] == null) continue;
|
||||||
|
|
||||||
|
entries.add(
|
||||||
|
new Entry(a,
|
||||||
|
((int) data[a].get()) == i ? 1.f : 0.f
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
LineDataSet dataSet = new LineDataSet(entries, text_options[i]);
|
||||||
|
dataSet.setColor(colors[i]);
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,16 +33,26 @@ public abstract class inputType {
|
|||||||
public inputType(String name){
|
public inputType(String name){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract String get_type_name();
|
||||||
|
|
||||||
public abstract byte[] encode() throws ByteBuilder.buildingException;
|
public abstract byte[] encode() throws ByteBuilder.buildingException;
|
||||||
public abstract void decode(byte[] bytes) throws BuiltByteParser.byteParsingExeption;
|
public abstract void decode(byte[] bytes) throws BuiltByteParser.byteParsingExeption;
|
||||||
|
|
||||||
|
|
||||||
public abstract View createView(Context context, Function<dataType, Integer> onUpdate);
|
public abstract View createView(Context context, Function<dataType, Integer> onUpdate);
|
||||||
public boolean isBlank = false;
|
public boolean isBlank = false;
|
||||||
public abstract void nullify();
|
public abstract void nullify();
|
||||||
public void setViewValue(dataType type){setViewValue(type.get());}
|
public void setViewValue(dataType type){setViewValue(type.get());}
|
||||||
public abstract void setViewValue(Object value);
|
public abstract void setViewValue(Object value);
|
||||||
public abstract dataType getViewValue();
|
public abstract dataType getViewValue();
|
||||||
public abstract void add_individual_view(LinearLayout parent, dataType data);
|
|
||||||
public abstract void add_compiled_view(LinearLayout parent, dataType[] data);
|
|
||||||
public abstract String get_type_name();
|
|
||||||
|
|
||||||
|
|
||||||
|
public abstract void add_individual_view(LinearLayout parent, dataType data);
|
||||||
|
|
||||||
|
|
||||||
|
public abstract void add_compiled_view(LinearLayout parent, dataType[] data);
|
||||||
|
|
||||||
|
|
||||||
|
public abstract void add_history_view(LinearLayout parent, dataType[] data);
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,10 @@ public class sliderType extends inputType {
|
|||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public byte[] encode() throws ByteBuilder.buildingException {
|
public byte[] encode() throws ByteBuilder.buildingException {
|
||||||
ByteBuilder bb = new ByteBuilder();
|
ByteBuilder bb = new ByteBuilder();
|
||||||
bb.addString(name);
|
bb.addString(name);
|
||||||
@@ -59,6 +63,9 @@ public class sliderType extends inputType {
|
|||||||
max = (int) objects.get(3).get();
|
max = (int) objects.get(3).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Slider slider = null;
|
public Slider slider = null;
|
||||||
|
|
||||||
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||||
@@ -96,6 +103,12 @@ public class sliderType extends inputType {
|
|||||||
isBlank = true;
|
isBlank = true;
|
||||||
slider.setVisibility(View.GONE);
|
slider.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void add_individual_view(LinearLayout parent, dataType data){
|
public void add_individual_view(LinearLayout parent, dataType data){
|
||||||
if(data.isNull()) return;
|
if(data.isNull()) return;
|
||||||
Slider slider = new Slider(parent.getContext());
|
Slider slider = new Slider(parent.getContext());
|
||||||
@@ -111,6 +124,12 @@ public class sliderType extends inputType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private float calculateMean(int[] data) {
|
private float calculateMean(int[] data) {
|
||||||
float sum = 0;
|
float sum = 0;
|
||||||
for (int value : data) {
|
for (int value : data) {
|
||||||
@@ -138,8 +157,6 @@ public class sliderType extends inputType {
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void add_compiled_view(LinearLayout parent, dataType[] data){
|
public void add_compiled_view(LinearLayout parent, dataType[] data){
|
||||||
LineChart chart = new LineChart(parent.getContext());
|
LineChart chart = new LineChart(parent.getContext());
|
||||||
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
|
||||||
@@ -191,13 +208,8 @@ public class sliderType extends inputType {
|
|||||||
normalDistSet.setDrawValues(false);
|
normalDistSet.setDrawValues(false);
|
||||||
normalDistSet.setLineWidth(2f);
|
normalDistSet.setLineWidth(2f);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LineData lineData = new LineData(dataSet, normalDistSet);
|
LineData lineData = new LineData(dataSet, normalDistSet);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
chart.setData(lineData);
|
chart.setData(lineData);
|
||||||
chart.invalidate();
|
chart.invalidate();
|
||||||
|
|
||||||
@@ -217,4 +229,61 @@ public class sliderType extends inputType {
|
|||||||
|
|
||||||
parent.addView(chart);
|
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);
|
||||||
|
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < data.length; i++){
|
||||||
|
if(data[i] == null) 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.astatin3.scoutingapp2025.types.input;
|
package com.astatin3.scoutingapp2025.types.input;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -13,10 +14,18 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.astatin3.scoutingapp2025.types.data.dataType;
|
import com.astatin3.scoutingapp2025.types.data.dataType;
|
||||||
import com.astatin3.scoutingapp2025.types.data.stringType;
|
import com.astatin3.scoutingapp2025.types.data.stringType;
|
||||||
|
import com.astatin3.scoutingapp2025.ui.data.sentimentAnalysis;
|
||||||
|
import com.astatin3.scoutingapp2025.utility.AlertManager;
|
||||||
import com.astatin3.scoutingapp2025.utility.BuiltByteParser;
|
import com.astatin3.scoutingapp2025.utility.BuiltByteParser;
|
||||||
import com.astatin3.scoutingapp2025.utility.ByteBuilder;
|
import com.astatin3.scoutingapp2025.utility.ByteBuilder;
|
||||||
|
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 java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class textType extends inputType {
|
public class textType extends inputType {
|
||||||
@@ -30,6 +39,13 @@ public class textType extends inputType {
|
|||||||
this.default_value = default_text;
|
this.default_value = default_text;
|
||||||
}
|
}
|
||||||
public String get_type_name(){return "Text";}
|
public String get_type_name(){return "Text";}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public byte[] encode() throws ByteBuilder.buildingException {
|
public byte[] encode() throws ByteBuilder.buildingException {
|
||||||
ByteBuilder bb = new ByteBuilder();
|
ByteBuilder bb = new ByteBuilder();
|
||||||
bb.addString(name);
|
bb.addString(name);
|
||||||
@@ -44,6 +60,19 @@ public class textType extends inputType {
|
|||||||
default_value = objects.get(1).get();
|
default_value = objects.get(1).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public EditText text = null;
|
public EditText text = null;
|
||||||
|
|
||||||
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
public View createView(Context context, Function<dataType, Integer> onUpdate){
|
||||||
@@ -78,6 +107,10 @@ public class textType extends inputType {
|
|||||||
if(text.getVisibility() == View.GONE) return new stringType(name, stringType.nulval);
|
if(text.getVisibility() == View.GONE) return new stringType(name, stringType.nulval);
|
||||||
return new stringType(name, text.getText().toString());
|
return new stringType(name, text.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void add_individual_view(LinearLayout parent, dataType data){
|
public void add_individual_view(LinearLayout parent, dataType data){
|
||||||
if(data.isNull()) return;
|
if(data.isNull()) return;
|
||||||
TextView tv = new TextView(parent.getContext());
|
TextView tv = new TextView(parent.getContext());
|
||||||
@@ -90,17 +123,109 @@ public class textType extends inputType {
|
|||||||
tv.setTextSize(18);
|
tv.setTextSize(18);
|
||||||
parent.addView(tv);
|
parent.addView(tv);
|
||||||
}
|
}
|
||||||
public void add_compiled_view(LinearLayout parent, dataType[] data){
|
|
||||||
// if(data.get().equals(stringType.nulval)) return;
|
|
||||||
TextView tv = new TextView(parent.getContext());
|
|
||||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float positive_mean = 0;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
TextView positive_text;
|
||||||
|
|
||||||
|
public void add_compiled_view(LinearLayout parent, dataType[] data) {
|
||||||
|
positive_mean = 0;
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
positive_text = new TextView(parent.getContext());
|
||||||
|
positive_text.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
));
|
));
|
||||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
positive_text.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
tv.setText("<add word cloud thing here>");
|
positive_text.setTextSize(20);
|
||||||
tv.setTextSize(20);
|
parent.addView(positive_text);
|
||||||
parent.addView(tv);
|
|
||||||
|
for (int i = 0; i < data.length; i++){
|
||||||
|
if (!data[i].isNull()) {
|
||||||
|
sentimentAnalysis.analyse((String) data[i].get(), new sentimentAnalysis.resultCallback() {
|
||||||
|
@Override
|
||||||
|
public void onFinish(float sentiment) {
|
||||||
|
positive_mean += sentiment;
|
||||||
|
count++;
|
||||||
|
|
||||||
|
positive_text.setText("Sentiment: " + (positive_mean / count));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
List<Entry> entries = new ArrayList<>();
|
||||||
|
for (int i = 0; i < data.length; i++) {
|
||||||
|
if(data[i] == null) continue;
|
||||||
|
|
||||||
|
entries.add(
|
||||||
|
new Entry(i,
|
||||||
|
sentimentAnalysis.analyse_sync( (String) data[i].get() )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
LineDataSet dataSet = new LineDataSet(entries, "Sentiment");
|
||||||
|
dataSet.setColor(Color.BLUE);
|
||||||
|
dataSet.setValueTextColor(Color.BLACK);
|
||||||
|
dataSet.setDrawCircles(false);
|
||||||
|
dataSet.setDrawValues(false);
|
||||||
|
dataSet.setValueTextColor(Color.RED);
|
||||||
|
|
||||||
|
|
||||||
|
LineData lineData = new LineData(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,57 @@
|
|||||||
|
package com.astatin3.scoutingapp2025.ui.data;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.astatin3.scoutingapp2025.utility.AlertManager;
|
||||||
|
|
||||||
|
import org.tensorflow.lite.support.label.Category;
|
||||||
|
import org.tensorflow.lite.task.text.nlclassifier.NLClassifier;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class sentimentAnalysis {
|
||||||
|
private static NLClassifier textClassifier;
|
||||||
|
|
||||||
|
public static void init(Context context){
|
||||||
|
try {
|
||||||
|
textClassifier = NLClassifier.createFromFile(context, "text_classification_v2.tflite");
|
||||||
|
} catch (Exception e) {
|
||||||
|
AlertManager.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface resultCallback {
|
||||||
|
public void onFinish(float data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void analyse(String input, resultCallback result){
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<Category> results = textClassifier.classify(input);
|
||||||
|
|
||||||
|
for(int i = 0; i < results.size(); i++){
|
||||||
|
Category cat = results.get(i);
|
||||||
|
switch (cat.getLabel()){
|
||||||
|
case "Positive":
|
||||||
|
result.onFinish(cat.getScore());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float analyse_sync(String input){
|
||||||
|
List<Category> results = textClassifier.classify(input);
|
||||||
|
|
||||||
|
for(int i = 0; i < results.size(); i++){
|
||||||
|
Category cat = results.get(i);
|
||||||
|
switch (cat.getLabel()){
|
||||||
|
case "Positive":
|
||||||
|
return cat.getScore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import android.widget.TableRow;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||||
@@ -23,10 +24,18 @@ import com.astatin3.scoutingapp2025.types.data.dataType;
|
|||||||
import com.astatin3.scoutingapp2025.types.frcEvent;
|
import com.astatin3.scoutingapp2025.types.frcEvent;
|
||||||
import com.astatin3.scoutingapp2025.types.frcTeam;
|
import com.astatin3.scoutingapp2025.types.frcTeam;
|
||||||
import com.astatin3.scoutingapp2025.types.input.inputType;
|
import com.astatin3.scoutingapp2025.types.input.inputType;
|
||||||
|
import com.astatin3.scoutingapp2025.utility.AlertManager;
|
||||||
import com.astatin3.scoutingapp2025.utility.fileEditor;
|
import com.astatin3.scoutingapp2025.utility.fileEditor;
|
||||||
import com.google.android.material.divider.MaterialDivider;
|
import com.google.android.material.divider.MaterialDivider;
|
||||||
|
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.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class teamsView extends ConstraintLayout {
|
public class teamsView extends ConstraintLayout {
|
||||||
public teamsView(@NonNull Context context) {
|
public teamsView(@NonNull Context context) {
|
||||||
@@ -115,12 +124,12 @@ public class teamsView extends ConstraintLayout {
|
|||||||
|
|
||||||
frcTeam finalTeam = team;
|
frcTeam finalTeam = team;
|
||||||
tr.setOnClickListener(v -> {
|
tr.setOnClickListener(v -> {
|
||||||
loadTeam(finalTeam, latestSettings.settings.get_compiled_mode());
|
loadTeam(finalTeam, latestSettings.settings.get_data_view_mode());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadTeam(frcTeam team, boolean compiled_mode) {
|
public void loadTeam(frcTeam team, int mode) {
|
||||||
binding.teamsArea.removeAllViews();
|
binding.teamsArea.removeAllViews();
|
||||||
|
|
||||||
LinearLayout ll = new LinearLayout(getContext());
|
LinearLayout ll = new LinearLayout(getContext());
|
||||||
@@ -131,22 +140,53 @@ public class teamsView extends ConstraintLayout {
|
|||||||
ll.setOrientation(LinearLayout.VERTICAL);
|
ll.setOrientation(LinearLayout.VERTICAL);
|
||||||
binding.teamsArea.addView(ll);
|
binding.teamsArea.addView(ll);
|
||||||
|
|
||||||
CheckBox cb = new CheckBox(getContext());
|
|
||||||
cb.setLayoutParams(new FrameLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
PowerSpinnerView dropdown = new PowerSpinnerView(getContext());
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
));
|
List<IconSpinnerItem> iconSpinnerItems = new ArrayList<>();
|
||||||
cb.setText("Compiled mode");
|
|
||||||
cb.setChecked(compiled_mode);
|
iconSpinnerItems.add(new IconSpinnerItem("Individual"));
|
||||||
ll.addView(cb);
|
iconSpinnerItems.add(new IconSpinnerItem("Compiled"));
|
||||||
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
iconSpinnerItems.add(new IconSpinnerItem("History"));
|
||||||
|
|
||||||
|
IconSpinnerAdapter iconSpinnerAdapter = new IconSpinnerAdapter(dropdown);
|
||||||
|
dropdown.setSpinnerAdapter(iconSpinnerAdapter);
|
||||||
|
dropdown.setItems(iconSpinnerItems);
|
||||||
|
|
||||||
|
dropdown.selectItemByIndex(0);
|
||||||
|
|
||||||
|
dropdown.setPadding(15,15,15,15);
|
||||||
|
dropdown.setBackgroundColor(0xf0000000);
|
||||||
|
dropdown.setTextColor(0xff00ff00);
|
||||||
|
dropdown.setTextSize(15);
|
||||||
|
dropdown.setArrowGravity(SpinnerGravity.END);
|
||||||
|
dropdown.setArrowPadding(8);
|
||||||
|
dropdown.setSpinnerItemHeight(46);
|
||||||
|
dropdown.setSpinnerPopupElevation(14);
|
||||||
|
|
||||||
|
|
||||||
|
dropdown.selectItemByIndex(mode);
|
||||||
|
|
||||||
|
|
||||||
|
dropdown.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener<IconSpinnerItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
||||||
latestSettings.settings.set_compiled_mode(isChecked);
|
IconSpinnerItem newItem) {
|
||||||
loadTeam(team, isChecked);
|
|
||||||
|
latestSettings.settings.set_data_view_mode(newIndex);
|
||||||
|
loadTeam(team, newIndex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ll.addView(dropdown);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TextView tv = new TextView(getContext());
|
TextView tv = new TextView(getContext());
|
||||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
@@ -178,7 +218,7 @@ public class teamsView extends ConstraintLayout {
|
|||||||
ll.addView(tv);
|
ll.addView(tv);
|
||||||
|
|
||||||
add_pit_data(ll, team);
|
add_pit_data(ll, team);
|
||||||
add_match_data(ll, team, compiled_mode);
|
add_match_data(ll, team, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add_pit_data(LinearLayout ll, frcTeam team){
|
public void add_pit_data(LinearLayout ll, frcTeam team){
|
||||||
@@ -248,7 +288,10 @@ public class teamsView extends ConstraintLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add_match_data(LinearLayout ll, frcTeam team, boolean compiled_mode){
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_match_data(LinearLayout ll, frcTeam team, int mode){
|
||||||
String[] files = fileEditor.getMatchesByTeamNum(evcode, team.teamNumber);
|
String[] files = fileEditor.getMatchesByTeamNum(evcode, team.teamNumber);
|
||||||
|
|
||||||
ll.addView(new MaterialDivider(getContext()));
|
ll.addView(new MaterialDivider(getContext()));
|
||||||
@@ -266,6 +309,8 @@ public class teamsView extends ConstraintLayout {
|
|||||||
|
|
||||||
ll.addView(new MaterialDivider(getContext()));
|
ll.addView(new MaterialDivider(getContext()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(files.length == 0){
|
if(files.length == 0){
|
||||||
tv = new TextView(getContext());
|
tv = new TextView(getContext());
|
||||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
@@ -279,71 +324,121 @@ public class teamsView extends ConstraintLayout {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!compiled_mode){
|
switch (mode){
|
||||||
for (int i = 0; i < files.length; i++) {
|
case 0:
|
||||||
String[] split = files[i].split("-");
|
add_individual_views(ll,files);
|
||||||
int match_num = Integer.parseInt(split[1]);
|
break;
|
||||||
|
case 1:
|
||||||
|
add_compiled_views(ll,files);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
add_history_views(ll,files);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_individual_views(LinearLayout ll, String[] files) {
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
String[] split = files[i].split("-");
|
||||||
|
int match_num = Integer.parseInt(split[1]);
|
||||||
|
|
||||||
|
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
|
||||||
|
|
||||||
|
TextView tv = new TextView(getContext());
|
||||||
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
));
|
||||||
|
tv.setPadding(0, 40, 0, 5);
|
||||||
|
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
|
tv.setText("M" + (match_num) + " " + split[2] + "-" + split[3] + " by " + psda.username);
|
||||||
|
tv.setTextSize(30);
|
||||||
|
ll.addView(tv);
|
||||||
|
|
||||||
|
for (int a = 0; a < psda.data.array.length; a++) {
|
||||||
tv = new TextView(getContext());
|
tv = new TextView(getContext());
|
||||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
));
|
));
|
||||||
tv.setPadding(0, 40, 0, 5);
|
|
||||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
tv.setText("M" + (match_num) + " " + split[2] + "-" + split[3] + " by " + psda.username);
|
tv.setText(psda.data.array[a].name);
|
||||||
tv.setTextSize(30);
|
tv.setTextSize(25);
|
||||||
|
|
||||||
|
if (psda.data.array[a].isNull()) {
|
||||||
|
tv.setBackgroundColor(0xffff0000);
|
||||||
|
tv.setTextColor(0xff000000);
|
||||||
|
}
|
||||||
|
|
||||||
ll.addView(tv);
|
ll.addView(tv);
|
||||||
|
|
||||||
for (int a = 0; a < psda.data.array.length; a++) {
|
|
||||||
tv = new TextView(getContext());
|
|
||||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
));
|
|
||||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
|
||||||
tv.setText(psda.data.array[a].name);
|
|
||||||
tv.setTextSize(25);
|
|
||||||
|
|
||||||
if(psda.data.array[a].isNull()){
|
latest_match_values[a].add_individual_view(ll, psda.data.array[a]);
|
||||||
tv.setBackgroundColor(0xffff0000);
|
|
||||||
tv.setTextColor(0xff000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
ll.addView(tv);
|
|
||||||
|
|
||||||
|
|
||||||
latest_match_values[a].add_individual_view(ll, psda.data.array[a]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
dataType[][] data = new dataType[latest_match_values.length][files.length];
|
|
||||||
for (int i = 0; i < files.length; i++) {
|
|
||||||
|
|
||||||
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
|
|
||||||
for (int a = 0; a < data.length; a++) {
|
|
||||||
data[a][i] = psda.data.array[a];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < latest_match_values.length; i++){
|
|
||||||
tv = new TextView(getContext());
|
|
||||||
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
));
|
|
||||||
tv.setPadding(0, 20, 0, 5);
|
|
||||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
|
||||||
tv.setText(latest_match_values[i].name);
|
|
||||||
tv.setTextSize(30);
|
|
||||||
ll.addView(tv);
|
|
||||||
|
|
||||||
latest_match_values[i].add_compiled_view(ll, data[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_compiled_views(LinearLayout ll, String[] files){
|
||||||
|
dataType[][] data = new dataType[latest_match_values.length][files.length];
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
|
||||||
|
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
|
||||||
|
for (int a = 0; a < data.length; a++) {
|
||||||
|
data[a][i] = psda.data.array[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < latest_match_values.length; i++){
|
||||||
|
TextView tv = new TextView(getContext());
|
||||||
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
));
|
||||||
|
tv.setPadding(0, 20, 0, 5);
|
||||||
|
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
|
tv.setText(latest_match_values[i].name);
|
||||||
|
tv.setTextSize(30);
|
||||||
|
ll.addView(tv);
|
||||||
|
|
||||||
|
latest_match_values[i].add_compiled_view(ll, data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void add_history_views(LinearLayout ll, String[] files){
|
||||||
|
dataType[][] data = new dataType[latest_match_values.length][files.length];
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
|
||||||
|
ScoutingDataWriter.ParsedScoutingDataResult psda = ScoutingDataWriter.load(files[i], match_values, match_transferValues);
|
||||||
|
for (int a = 0; a < data.length; a++) {
|
||||||
|
data[a][i] = psda.data.array[a];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < latest_match_values.length; i++){
|
||||||
|
TextView tv = new TextView(getContext());
|
||||||
|
tv.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
));
|
||||||
|
tv.setPadding(0, 20, 0, 5);
|
||||||
|
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
|
tv.setText(latest_match_values[i].name);
|
||||||
|
tv.setTextSize(30);
|
||||||
|
ll.addView(tv);
|
||||||
|
|
||||||
|
latest_match_values[i].add_history_view(ll, data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.astatin3.scoutingapp2025.MainActivity;
|
|
||||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||||
import com.astatin3.scoutingapp2025.databinding.FragmentScoutingBinding;
|
import com.astatin3.scoutingapp2025.databinding.FragmentScoutingBinding;
|
||||||
import com.astatin3.scoutingapp2025.types.frcEvent;
|
import com.astatin3.scoutingapp2025.types.frcEvent;
|
||||||
|
import com.astatin3.scoutingapp2025.ui.data.sentimentAnalysis;
|
||||||
import com.astatin3.scoutingapp2025.utility.fileEditor;
|
import com.astatin3.scoutingapp2025.utility.fileEditor;
|
||||||
|
|
||||||
public class scoutingFragment extends Fragment {
|
public class scoutingFragment extends Fragment {
|
||||||
@@ -32,7 +32,6 @@ public class scoutingFragment extends Fragment {
|
|||||||
binding.matchScoutingView.setVisibility(View.GONE);
|
binding.matchScoutingView.setVisibility(View.GONE);
|
||||||
binding.pitScoutingView.setVisibility(View.GONE);
|
binding.pitScoutingView.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
||||||
String evcode = latestSettings.settings.get_evcode();
|
String evcode = latestSettings.settings.get_evcode();
|
||||||
|
|
||||||
if(evcode.equals("unset")){
|
if(evcode.equals("unset")){
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ public class TransferFragment extends Fragment {
|
|||||||
|
|
||||||
evcode = latestSettings.settings.get_evcode();
|
evcode = latestSettings.settings.get_evcode();
|
||||||
|
|
||||||
|
binding.downloadButton.setOnClickListener(v -> {
|
||||||
|
start_download();
|
||||||
|
submenu = true;
|
||||||
|
});
|
||||||
|
|
||||||
binding.TBAButton.setOnClickListener(v -> {
|
binding.TBAButton.setOnClickListener(v -> {
|
||||||
binding.noEventError.setVisibility(View.GONE);
|
binding.noEventError.setVisibility(View.GONE);
|
||||||
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
|
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
|
||||||
@@ -77,7 +82,7 @@ public class TransferFragment extends Fragment {
|
|||||||
if(evcode.equals("unset")){
|
if(evcode.equals("unset")){
|
||||||
binding.noEventError.setVisibility(View.VISIBLE);
|
binding.noEventError.setVisibility(View.VISIBLE);
|
||||||
binding.uploadButton.setVisibility(View.GONE);
|
binding.uploadButton.setVisibility(View.GONE);
|
||||||
binding.downloadButton.setVisibility(View.GONE);
|
binding.downloadButton.setVisibility(View.VISIBLE);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,11 +91,6 @@ public class TransferFragment extends Fragment {
|
|||||||
submenu = true;
|
submenu = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.downloadButton.setOnClickListener(v -> {
|
|
||||||
start_download();
|
|
||||||
submenu = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
if(!latestSettings.settings.get_wifi_mode())
|
if(!latestSettings.settings.get_wifi_mode())
|
||||||
binding.TBAButton.setVisibility(View.GONE);
|
binding.TBAButton.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.io.PrintWriter;
|
|||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
public class AlertManager {
|
public class AlertManager {
|
||||||
private static Context context;
|
public static Context context;
|
||||||
|
|
||||||
public static void init(Context c){
|
public static void init(Context c){
|
||||||
context = c;
|
context = c;
|
||||||
@@ -53,6 +53,7 @@ public class AlertManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void error(Exception e) {
|
public static void error(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
((Activity) context).runOnUiThread(new Runnable() {
|
((Activity) context).runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
|
|||||||
@@ -143,10 +143,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="60dp"
|
android:layout_marginBottom="60dp"
|
||||||
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
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"
|
||||||
|
tools:visibility="gone">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/add_button"
|
android:id="@+id/add_button"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.androidApplication) apply false
|
alias(libs.plugins.androidApplication) apply false
|
||||||
|
// id("com.google.gms.google-services") version "4.4.2" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
Reference in New Issue
Block a user