mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-08 16:28:00 -06:00
Use the settings
This commit is contained in:
@@ -21,6 +21,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
latestSettings.update();
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
@@ -35,8 +36,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
|
||||
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
|
||||
NavigationUI.setupWithNavController(binding.navView, navController);
|
||||
|
||||
latestSettings settings = new latestSettings();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.astatin3.scoutingapp2025.SettingsVersionStack;
|
||||
|
||||
public class latestSettings {
|
||||
public static v2 settings = new v2();
|
||||
public latestSettings(){
|
||||
public static v0 settings = new v0();
|
||||
public static void update(){
|
||||
settings.init_settings();
|
||||
settings.update();
|
||||
}
|
||||
|
||||
+14
-9
@@ -44,7 +44,13 @@ public abstract class settingsVersion {
|
||||
}
|
||||
String[] split = line.split("=");
|
||||
if(split[0].equals(search_tag)){
|
||||
return split[1];
|
||||
if(split[1].equals("<empty>")){
|
||||
return "";
|
||||
}else if(split[1].equals("<null>")){
|
||||
return null;
|
||||
}else {
|
||||
return split[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
@@ -58,22 +64,21 @@ public abstract class settingsVersion {
|
||||
if(!fileEditor.fileExist(settingsFilename)){
|
||||
fileEditor.createFile(settingsFilename);
|
||||
|
||||
set_file_version(getVersion());
|
||||
defaultSettings();
|
||||
|
||||
set_file_version(getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
public String forceWriteTag(String tag_name, String data){
|
||||
String fileContent = get_settings_file_content();
|
||||
String output = fileContent + "\n" + tag_name + "=" + data;
|
||||
fileEditor.writeFile(settingsFilename, output.getBytes(StandardCharsets.UTF_8));
|
||||
return output;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -1,17 +1,51 @@
|
||||
package com.astatin3.scoutingapp2025.SettingsVersionStack;
|
||||
|
||||
public class v0 extends settingsVersion {
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void update(){
|
||||
set_file_version(getVersion());
|
||||
// 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() {
|
||||
forceWriteTag("test1", "value1");
|
||||
forceWriteTag("test2", "value2");
|
||||
forceWriteTag("test3", "value3");
|
||||
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,23 +0,0 @@
|
||||
package com.astatin3.scoutingapp2025.SettingsVersionStack;
|
||||
|
||||
public class v1 extends v0 {
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public void update(){
|
||||
if(get_file_version() < getVersion()){super.update();}
|
||||
set_file_version(getVersion());
|
||||
// writeTag("test1", "value_v1_1");
|
||||
writeTag("test2", "value_v1_2");
|
||||
writeTag("test3", "value_v1_3");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defaultSettings() {
|
||||
forceWriteTag("test1", "value1");
|
||||
forceWriteTag("test2", "value2");
|
||||
forceWriteTag("test3", "value3");
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.astatin3.scoutingapp2025.SettingsVersionStack;
|
||||
|
||||
public class v2 extends v1 {
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return 2;
|
||||
}
|
||||
@Override
|
||||
public void update(){
|
||||
if(get_file_version() < getVersion()){super.update();}
|
||||
set_file_version(getVersion());
|
||||
// writeTag("test1", "value_v2_1");
|
||||
// writeTag("test2", "value_v2_2");
|
||||
writeTag("test3", "value_v2 _3");
|
||||
}
|
||||
@Override
|
||||
public void defaultSettings() {
|
||||
forceWriteTag("test1", "value1");
|
||||
forceWriteTag("test2", "value2");
|
||||
forceWriteTag("test3", "value3");
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import android.content.Context;
|
||||
import com.astatin3.scoutingapp2025.types.frcEvent;
|
||||
import com.astatin3.scoutingapp2025.types.frcTeam;
|
||||
|
||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@@ -191,7 +193,11 @@ public final class fileEditor {
|
||||
|
||||
|
||||
public static boolean setEvent(frcEvent event){
|
||||
final String filename = (baseDir + event.eventCode + ".eventdata");
|
||||
final String filename = (event.eventCode + ".eventdata");
|
||||
|
||||
if(latestSettings.settings.get_evcode().equals("unset")){
|
||||
latestSettings.settings.set_evcode(event.eventCode);
|
||||
}
|
||||
|
||||
return writeFile(filename, event.encode());
|
||||
}
|
||||
|
||||
@@ -66,6 +66,6 @@ public class frcEvent {
|
||||
}
|
||||
@NonNull
|
||||
public String toString(){
|
||||
return "Name: " + name + ", Code: " + eventCode + " numTeams: " + teams.size() + " numMatches: " + matches.size();
|
||||
return "frcEvent Name: " + name + ", Code: " + eventCode + " numTeams: " + teams.size() + " numMatches: " + matches.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.astatin3.scoutingapp2025.types;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.astatin3.scoutingapp2025.BuiltByteParser;
|
||||
import com.astatin3.scoutingapp2025.ByteBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class frcMatch {
|
||||
public static final int typecode = 253;
|
||||
@@ -51,5 +54,9 @@ public class frcMatch {
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String toString(){
|
||||
return "frcMatch Num: " + matchIndex + ", Blue: " + Arrays.toString(blueAlliance) + ", Red: " + Arrays.toString(redAlliance);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.astatin3.scoutingapp2025.types;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.astatin3.scoutingapp2025.BuiltByteParser;
|
||||
import com.astatin3.scoutingapp2025.ByteBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class frcTeam {
|
||||
public static final int typecode = 252;
|
||||
@@ -16,7 +19,7 @@ public class frcTeam {
|
||||
public int startingYear = 0;
|
||||
|
||||
public String getDescription(){
|
||||
return teamName + " Started in " + startingYear + ", and is from " + school + " in " + city + ", " + stateOrProv + ", " + country;
|
||||
return teamName + " Started in " + startingYear + ", and are from " + school + " in " + city + ", " + stateOrProv + ", " + country;
|
||||
}
|
||||
|
||||
public byte[] encode(){
|
||||
@@ -56,4 +59,9 @@ public class frcTeam {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String toString(){
|
||||
return "frcTeam Num: " + teamNumber + ", " + getDescription();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.astatin3.scoutingapp2025.ui.scouting;
|
||||
package com.astatin3.scoutingapp2025.ui.data;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
@@ -13,23 +13,42 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||
import com.astatin3.scoutingapp2025.databinding.FragmentDataBinding;
|
||||
import com.astatin3.scoutingapp2025.fileEditor;
|
||||
import com.astatin3.scoutingapp2025.types.frcEvent;
|
||||
import com.astatin3.scoutingapp2025.types.frcTeam;
|
||||
|
||||
public class dataFragment extends Fragment {
|
||||
|
||||
private FragmentDataBinding binding;
|
||||
|
||||
private void setDropdownItems(Spinner dropdown, String[] items){
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireActivity(), android.R.layout.simple_spinner_item, items);
|
||||
dropdown.setAdapter(adapter);
|
||||
}
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
binding = FragmentDataBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
String evcode = latestSettings.settings.get_evcode();
|
||||
|
||||
if(evcode.equals("unset")){
|
||||
binding.noEventError.setVisibility(View.VISIBLE);
|
||||
binding.buttons.setVisibility(View.GONE);
|
||||
binding.matchTable.setVisibility(View.GONE);
|
||||
return root;
|
||||
}
|
||||
|
||||
frcEvent event = frcEvent.decode(fileEditor.readFile(evcode + ".eventdata"));
|
||||
|
||||
// for(frcTeam team : event.teams){
|
||||
// System.out.println(team.getDescription());
|
||||
// }
|
||||
|
||||
binding.overviewButton.setOnClickListener(v -> {
|
||||
binding.buttons.setVisibility(View.GONE);
|
||||
binding.overviewView.setVisibility(View.VISIBLE);
|
||||
binding.overviewView.start(binding, event);
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.astatin3.scoutingapp2025.ui.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.astatin3.scoutingapp2025.databinding.FragmentDataBinding;
|
||||
import com.astatin3.scoutingapp2025.fileEditor;
|
||||
import com.astatin3.scoutingapp2025.types.frcEvent;
|
||||
import com.astatin3.scoutingapp2025.types.frcMatch;
|
||||
import com.astatin3.scoutingapp2025.types.frcTeam;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
public class overviewView extends ScrollView {
|
||||
public overviewView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
public overviewView(Context context, AttributeSet attributeSet){
|
||||
super(context, attributeSet);
|
||||
}
|
||||
private void addTableText(TableRow tr, String textStr){
|
||||
TextView text = new TextView(getContext());
|
||||
text.setTextSize(18);
|
||||
text.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); // Text align center
|
||||
text.setText(textStr);
|
||||
tr.addView(text);
|
||||
}
|
||||
public void start(FragmentDataBinding binding, frcEvent event) {
|
||||
binding.matchTable.setStretchAllColumns(true);
|
||||
add_pit_scouting(binding, event);
|
||||
add_match_scouting(binding, event);
|
||||
}
|
||||
|
||||
public void add_pit_scouting(FragmentDataBinding binding, frcEvent event){
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setLayoutParams(new LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText("Pit Scouting");
|
||||
tv.setTextSize(28);
|
||||
binding.matchTable.addView(tv);
|
||||
|
||||
TableRow tr = null;
|
||||
for(int i=0; i < event.teams.size(); i++){
|
||||
frcTeam team = event.teams.get(i);
|
||||
if(i % 7 == 0){
|
||||
if(i != 0)
|
||||
binding.matchTable.addView(tr);
|
||||
tr = new TableRow(getContext());
|
||||
}
|
||||
|
||||
TextView text = new TextView(getContext());
|
||||
text.setTextSize(18);
|
||||
text.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||
|
||||
text.setText(String.valueOf(team.teamNumber));
|
||||
if(fileEditor.fileExist(event.eventCode + "-" + team.teamNumber + ".pitscoutdata")){
|
||||
text.setBackgroundColor(0x3000FF00);
|
||||
}else{
|
||||
text.setBackgroundColor(0x30FF0000);
|
||||
}
|
||||
tr.addView(text);
|
||||
}
|
||||
binding.matchTable.addView(tr);
|
||||
}
|
||||
|
||||
|
||||
public void add_match_scouting(FragmentDataBinding binding, frcEvent event){
|
||||
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setLayoutParams(new LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
));
|
||||
tv.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
tv.setText("Match Scouting");
|
||||
tv.setTextSize(28);
|
||||
binding.matchTable.addView(tv);
|
||||
|
||||
TableRow tr = new TableRow(getContext());
|
||||
addTableText(tr, "#");
|
||||
addTableText(tr, "Red-1");
|
||||
addTableText(tr, "Red-2");
|
||||
addTableText(tr, "Red-3");
|
||||
addTableText(tr, "Blue-1");
|
||||
addTableText(tr, "Blue-2");
|
||||
addTableText(tr, "Blue-3");
|
||||
binding.matchTable.addView(tr);
|
||||
|
||||
boolean toggle = false;
|
||||
for(frcMatch match : event.matches){
|
||||
|
||||
tr = new TableRow(getContext());
|
||||
addTableText(tr, String.valueOf(match.matchIndex));
|
||||
//
|
||||
for(int i=0;i<6;i++){
|
||||
TextView text = new TextView(getContext());
|
||||
text.setTextSize(18);
|
||||
text.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||
|
||||
int team_num;
|
||||
String alliance_position;
|
||||
|
||||
if(i < 3){
|
||||
team_num = match.redAlliance[i];
|
||||
alliance_position = "red-"+(i+1);
|
||||
}else{
|
||||
team_num = match.blueAlliance[i-3];
|
||||
alliance_position = "blue-"+(i-2);
|
||||
}
|
||||
|
||||
text.setText(String.valueOf(team_num));
|
||||
if(fileEditor.fileExist(event.eventCode + "-" + match.matchIndex + "-" + alliance_position + "-" + team_num + ".matchscoutdata")){
|
||||
text.setBackgroundColor(0x3000FF00);
|
||||
}else{
|
||||
text.setBackgroundColor(0x30FF0000);
|
||||
}
|
||||
tr.addView(text);
|
||||
}
|
||||
|
||||
// addTableText(tr, String.valueOf(match.matchIndex));
|
||||
// addTableText(tr, String.valueOf(match.blueAlliance[0]));
|
||||
// addTableText(tr, String.valueOf(match.blueAlliance[1]));
|
||||
// addTableText(tr, String.valueOf(match.blueAlliance[2]));
|
||||
// addTableText(tr, String.valueOf(match.redAlliance[0]));
|
||||
// addTableText(tr, String.valueOf(match.redAlliance[1]));
|
||||
// addTableText(tr, String.valueOf(match.redAlliance[2]));
|
||||
// if (toggle) {
|
||||
// tr.setBackgroundColor(0x30000000);
|
||||
// }
|
||||
//
|
||||
// toggle = !toggle;
|
||||
binding.matchTable.addView(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.astatin3.scoutingapp2025.ui.scouting;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
@@ -13,6 +12,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||
import com.astatin3.scoutingapp2025.databinding.FragmentScoutingBinding;
|
||||
import com.astatin3.scoutingapp2025.fileEditor;
|
||||
|
||||
@@ -26,6 +26,9 @@ public class scoutingFragment extends Fragment {
|
||||
binding = FragmentScoutingBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
if(latestSettings.settings.get_evcode().equals("unset")){
|
||||
binding.noEventError.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -2,21 +2,31 @@ package com.astatin3.scoutingapp2025.ui.settings;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.astatin3.scoutingapp2025.databinding.FragmentSettingsBinding;
|
||||
import com.astatin3.scoutingapp2025.fileEditor;
|
||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import com.skydoves.powerspinner.IconSpinnerAdapter;
|
||||
import com.skydoves.powerspinner.IconSpinnerItem;
|
||||
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
||||
import com.skydoves.powerspinner.PowerSpinnerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -48,12 +58,33 @@ public class settingsFragment extends Fragment {
|
||||
binding = FragmentSettingsBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
EditText username = binding.username;
|
||||
username.setText(latestSettings.settings.get_username());
|
||||
username.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
latestSettings.settings.set_username(username.getText().toString());
|
||||
}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
PowerSpinnerView spinnerView = binding.eventDropdown;
|
||||
|
||||
List<IconSpinnerItem> iconSpinnerItems = new ArrayList<>();
|
||||
|
||||
for(String name : fileEditor.getEventList()){
|
||||
iconSpinnerItems.add(new IconSpinnerItem(name));
|
||||
String target_event_name = latestSettings.settings.get_evcode();
|
||||
int target_index = -1;
|
||||
|
||||
ArrayList<String> evlist = fileEditor.getEventList();
|
||||
for(int i = 0; i < evlist.size(); i++){
|
||||
if(evlist.get(i).equals(target_event_name)){
|
||||
target_index = i;
|
||||
}
|
||||
iconSpinnerItems.add(new IconSpinnerItem(evlist.get(i)));
|
||||
}
|
||||
|
||||
IconSpinnerAdapter iconSpinnerAdapter = new IconSpinnerAdapter(spinnerView);
|
||||
@@ -61,11 +92,75 @@ public class settingsFragment extends Fragment {
|
||||
spinnerView.setItems(iconSpinnerItems);
|
||||
spinnerView.setLifecycleOwner(this);
|
||||
|
||||
if(!iconSpinnerItems.isEmpty()){
|
||||
spinnerView.selectItemByIndex(0);
|
||||
if(!iconSpinnerItems.isEmpty() && target_index != -1){
|
||||
spinnerView.selectItemByIndex(target_index);
|
||||
}
|
||||
|
||||
alert("test", latestSettings.settings.readTag("test2"));
|
||||
spinnerView.setOnSpinnerItemSelectedListener(new OnSpinnerItemSelectedListener<IconSpinnerItem>() {
|
||||
@Override
|
||||
public void onItemSelected(int oldIndex, @Nullable IconSpinnerItem oldItem, int newIndex,
|
||||
IconSpinnerItem newItem) {
|
||||
latestSettings.settings.set_evcode(newItem.getText().toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// CheckBox practice_mode = binding.practiceMode;
|
||||
// practice_mode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
// @Override
|
||||
// public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
|
||||
// latestSettings.settings.set_practice_mode(isChecked);
|
||||
// }
|
||||
//
|
||||
// });
|
||||
//
|
||||
// practice_mode.setChecked(latestSettings.settings.get_practice_mode());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CheckBox wifi_mode = binding.wifiMode;
|
||||
wifi_mode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
|
||||
latestSettings.settings.set_wifi_mode(isChecked);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
wifi_mode.setChecked(latestSettings.settings.get_wifi_mode());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Button reset_button = binding.resetButton;
|
||||
reset_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
|
||||
alert.setTitle("Warning");
|
||||
alert.setMessage("Do you really want to reset settings?");
|
||||
alert.setCancelable(true);
|
||||
|
||||
alert.setPositiveButton("Ok", (dialog, which) -> {
|
||||
latestSettings.settings.defaultSettings();
|
||||
username.setText(latestSettings.settings.get_username());
|
||||
spinnerView.clearSelectedItem();
|
||||
// practice_mode.setChecked(latestSettings.settings.get_practice_mode());
|
||||
wifi_mode.setChecked(latestSettings.settings.get_wifi_mode());
|
||||
});
|
||||
|
||||
alert.setNegativeButton("Cancel", null);
|
||||
alert.create().show();
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||
import com.astatin3.scoutingapp2025.databinding.FragmentTransferBinding;
|
||||
import com.astatin3.scoutingapp2025.fileEditor;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class TransferFragment extends Fragment {
|
||||
private FragmentTransferBinding binding;
|
||||
@@ -29,6 +31,7 @@ public class TransferFragment extends Fragment {
|
||||
binding = FragmentTransferBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
|
||||
binding.uploadButton.setOnClickListener(v -> {
|
||||
binding.selectLayout.setVisibility(View.GONE);
|
||||
binding.generatorLayout.setVisibility(View.VISIBLE);
|
||||
@@ -42,6 +45,10 @@ public class TransferFragment extends Fragment {
|
||||
binding.scannerLayout.setVisibility(View.VISIBLE);
|
||||
binding.scannerLayout.start(binding, getViewLifecycleOwner());
|
||||
});
|
||||
|
||||
if(!latestSettings.settings.get_wifi_mode())
|
||||
binding.TBAButton.setVisibility(View.GONE);
|
||||
|
||||
binding.TBAButton.setOnClickListener(v -> {
|
||||
AlertDialog.Builder alert = new AlertDialog.Builder(getContext());
|
||||
alert.setTitle("Warning");
|
||||
|
||||
@@ -61,6 +61,7 @@ public class scannerView extends ConstraintLayout {
|
||||
}
|
||||
|
||||
private float scale = 0;
|
||||
private final int downscale = 1;
|
||||
private FragmentTransferBinding binding;
|
||||
private LifecycleOwner lifecycle;
|
||||
|
||||
|
||||
@@ -1,6 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_event_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No match has been specified\nPlease select one"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.astatin3.scoutingapp2025.ui.data.overviewView
|
||||
android:id="@+id/overviewView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="60dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/matchTable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.astatin3.scoutingapp2025.ui.data.overviewView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="48dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/overviewButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Overview"
|
||||
android:textSize="34sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/searchButton"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.307" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/searchButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Search"
|
||||
android:textSize="34sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/compileButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Compile"
|
||||
android:textSize="34sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/searchButton"
|
||||
app:layout_constraintVertical_bias="0.689" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -9,4 +9,16 @@
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_event_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="No match has been specified\nPlease select one"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -10,7 +10,7 @@
|
||||
android:id="@+id/ScrollArea"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="57dp"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:fillViewport="true"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -28,8 +28,20 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- <CheckBox-->
|
||||
<!-- android:id="@+id/practice_mode"-->
|
||||
<!-- android:layout_width="412dp"-->
|
||||
<!-- android:layout_height="79dp"-->
|
||||
<!-- android:layout_marginTop="20dp"-->
|
||||
<!-- android:text="Practice Mode"-->
|
||||
<!-- android:textSize="24sp"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintHorizontal_bias="0.0"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/eventDropdown" />-->
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBox"
|
||||
android:id="@+id/wifi_mode"
|
||||
android:layout_width="412dp"
|
||||
android:layout_height="79dp"
|
||||
android:layout_marginTop="20dp"
|
||||
@@ -46,7 +58,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/black_2"
|
||||
android:gravity="center"
|
||||
android:hint="Events"
|
||||
android:hint="No events selected"
|
||||
android:padding="10dp"
|
||||
android:textColor="@color/main_500"
|
||||
android:textColorHint="@color/teal_700"
|
||||
@@ -63,7 +75,7 @@
|
||||
app:spinner_popup_elevation="14dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextText"
|
||||
android:id="@+id/username"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
@@ -87,7 +99,7 @@
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editTextText" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/username" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
@@ -104,6 +116,15 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/reset_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Reset Settings"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -10,7 +10,12 @@
|
||||
android:id="@+id/selectLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="gone">
|
||||
|
||||
<Button
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_data"
|
||||
android:name="com.astatin3.scoutingapp2025.ui.scouting.dataFragment"
|
||||
android:name="com.astatin3.scoutingapp2025.ui.data.dataFragment"
|
||||
android:label="@string/title_data"
|
||||
tools:layout="@layout/fragment_data" >
|
||||
</fragment>
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<string name="bottom_margin">48px</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user