mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-08 16:28:00 -06:00
Work on adding practice mode
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
### TODO:
|
||||
##### Scouting:
|
||||
- Make practice mode??
|
||||
##### Data Analysis:
|
||||
- Statbotics intigration???
|
||||
##### Functionality:
|
||||
@@ -11,6 +10,7 @@
|
||||
|
||||
### In Progress:
|
||||
##### Scouting:
|
||||
- Make practice mode
|
||||
- Make scouting UI look much better
|
||||
##### Data Analysis:
|
||||
##### Functionality:
|
||||
|
||||
@@ -54,12 +54,9 @@ public class DataFragment extends Fragment {
|
||||
|
||||
binding.teamsButton.setOnClickListener(v -> {
|
||||
TeamSelectorFragment.setPits_mode(false);
|
||||
TeamSelectorFragment.setOnSelect(new TeamSelectorFragment.onTeamSelected() {
|
||||
@Override
|
||||
public void onSelect(TeamSelectorFragment self, frcTeam team) {
|
||||
TeamsFragment.setTeam(team);
|
||||
findNavController(self).navigate(R.id.action_navigation_team_selector_to_navigation_data_teams);
|
||||
}
|
||||
TeamSelectorFragment.setOnSelect((self, team) -> {
|
||||
TeamsFragment.setTeam(team);
|
||||
findNavController(self).navigate(R.id.action_navigation_team_selector_to_navigation_data_teams);
|
||||
});
|
||||
findNavController(this).navigate(R.id.action_navigation_data_to_navigation_team_selector);
|
||||
});
|
||||
|
||||
@@ -1,27 +1,35 @@
|
||||
package com.ridgebotics.ridgescout.ui.scouting;
|
||||
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static androidx.navigation.fragment.FragmentKt.findNavController;
|
||||
|
||||
import static com.ridgebotics.ridgescout.utility.DataManager.event;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ridgebotics.ridgescout.R;
|
||||
import com.ridgebotics.ridgescout.types.frcEvent;
|
||||
import com.ridgebotics.ridgescout.utility.fileEditor;
|
||||
import com.ridgebotics.ridgescout.utility.settingsManager;
|
||||
import com.ridgebotics.ridgescout.databinding.FragmentScoutingBinding;
|
||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||
import com.ridgebotics.ridgescout.ui.TeamSelectorFragment;
|
||||
import com.ridgebotics.ridgescout.utility.DataManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ScoutingFragment extends Fragment {
|
||||
|
||||
private FragmentScoutingBinding binding;
|
||||
@@ -38,6 +46,10 @@ public class ScoutingFragment extends Fragment {
|
||||
|
||||
DataManager.reload_event();
|
||||
|
||||
if(settingsManager.getCustomEvents()){
|
||||
binding.eventAddButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(event == null){
|
||||
binding.noEventError.setVisibility(View.VISIBLE);
|
||||
binding.matchScoutingButton.setEnabled(false);
|
||||
@@ -47,18 +59,23 @@ public class ScoutingFragment extends Fragment {
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
if(event.matches.isEmpty()){
|
||||
binding.matchScoutingButton.setEnabled(false);
|
||||
}
|
||||
|
||||
if(event.teams.isEmpty()){
|
||||
binding.pitScoutingButton.setEnabled(false);
|
||||
}
|
||||
|
||||
binding.matchScoutingButton.setOnClickListener(v -> {
|
||||
findNavController(this).navigate(R.id.action_navigation_scouting_to_navigation_match_scouting);
|
||||
});
|
||||
|
||||
binding.pitScoutingButton.setOnClickListener(v -> {
|
||||
TeamSelectorFragment.setPits_mode(true);
|
||||
TeamSelectorFragment.setOnSelect(new TeamSelectorFragment.onTeamSelected() {
|
||||
@Override
|
||||
public void onSelect(TeamSelectorFragment self, frcTeam team) {
|
||||
PitScoutingFragment.setTeam(team);
|
||||
findNavController(self).navigate(R.id.action_navigation_team_selector_to_navigation_pit_scouting);
|
||||
}
|
||||
TeamSelectorFragment.setOnSelect((self, team) -> {
|
||||
PitScoutingFragment.setTeam(team);
|
||||
findNavController(self).navigate(R.id.action_navigation_team_selector_to_navigation_pit_scouting);
|
||||
});
|
||||
findNavController(this).navigate(R.id.action_navigation_scouting_to_navigation_team_selector);
|
||||
});
|
||||
@@ -67,6 +84,41 @@ public class ScoutingFragment extends Fragment {
|
||||
findNavController(this).navigate(R.id.action_navigation_scouting_to_navigation_scouting_event);
|
||||
});
|
||||
|
||||
binding.eventAddButton.setOnClickListener(view -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle("Chose event name");
|
||||
|
||||
LinearLayout layout = new LinearLayout(getContext());
|
||||
layout.setOrientation(VERTICAL);
|
||||
EditText eventName = new EditText(getContext());
|
||||
eventName.setHint("Event Name");
|
||||
EditText eventCode = new EditText(getContext());
|
||||
eventCode.setHint("Event Code");
|
||||
layout.addView(eventName);
|
||||
layout.addView(eventCode);
|
||||
|
||||
|
||||
builder.setPositiveButton("Create", (dialog, which) -> {
|
||||
String name = eventName.getText().toString();
|
||||
String code = eventCode.getText().toString();
|
||||
if(name.isEmpty() || code.isEmpty()) return;
|
||||
|
||||
frcEvent event = new frcEvent();
|
||||
event.name = name;
|
||||
event.eventCode = code;
|
||||
event.teams = new ArrayList<>();
|
||||
event.matches = new ArrayList<>();
|
||||
|
||||
fileEditor.setEvent(event);
|
||||
|
||||
|
||||
});
|
||||
builder.setNeutralButton("Cancel", (dialog, which) -> {});
|
||||
|
||||
builder.setView(layout);
|
||||
builder.create().show();
|
||||
});
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ridgebotics.ridgescout.ui.settings;
|
||||
|
||||
import static com.ridgebotics.ridgescout.utility.settingsManager.AllyPosKey;
|
||||
import static com.ridgebotics.ridgescout.utility.settingsManager.CustomEventsKey;
|
||||
import static com.ridgebotics.ridgescout.utility.settingsManager.SelEVCodeKey;
|
||||
import static com.ridgebotics.ridgescout.utility.settingsManager.UnameKey;
|
||||
import static com.ridgebotics.ridgescout.utility.settingsManager.WifiModeKey;
|
||||
@@ -55,6 +56,7 @@ public class settingsFragment extends Fragment {
|
||||
SettingsManager manager = new SettingsManager(getContext());
|
||||
|
||||
|
||||
manager.addItem(new CheckboxSettingsItem(CustomEventsKey, "Custom Events"));
|
||||
|
||||
StringSettingsItem FTPServer = new StringSettingsItem(settingsManager.FTPServer, "FTP Server");
|
||||
manager.addItem(FTPServer);
|
||||
|
||||
@@ -104,26 +104,11 @@ public class TransferFragment extends Fragment {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle("Chose data");
|
||||
|
||||
builder.setNegativeButton("Pit data", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
CSVExport.exportPits(getContext());
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("Pit data", (dialog, which) -> CSVExport.exportPits(getContext()));
|
||||
|
||||
builder.setPositiveButton("Match data", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
CSVExport.exportMatches(getContext());
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton("Match data", (dialog, which) -> CSVExport.exportMatches(getContext()));
|
||||
|
||||
builder.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton("Cancel", (dialog, which) -> dialog.cancel());
|
||||
|
||||
builder.show();
|
||||
});
|
||||
|
||||
+3
-9
@@ -30,17 +30,11 @@ public class TransferSelectorFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = FragmentTransferSelectorBinding.inflate(inflater, container, false);
|
||||
|
||||
binding.codesButton.setOnClickListener(view -> {
|
||||
onselect.onSelectCodes(this);
|
||||
});
|
||||
binding.codesButton.setOnClickListener(view -> onselect.onSelectCodes(this));
|
||||
|
||||
binding.bluetoothButton.setOnClickListener(view -> {
|
||||
onselect.onSelectBluetooth(this);
|
||||
});
|
||||
binding.bluetoothButton.setOnClickListener(view -> onselect.onSelectBluetooth(this));
|
||||
|
||||
binding.fileBundleButton.setOnClickListener(view -> {
|
||||
onselect.onSelectFileBundle(this);
|
||||
});
|
||||
binding.fileBundleButton.setOnClickListener(view -> onselect.onSelectFileBundle(this));
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public class settingsManager {
|
||||
public static final String FTPEnabled = "ftp_enabled";
|
||||
public static final String FTPServer = "ftp_server";
|
||||
public static final String FTPSendMetaFiles = "ftp_send_meta_files";
|
||||
public static final String CustomEventsKey = "enable_custom_event";
|
||||
|
||||
public static Map defaults = getDefaults();
|
||||
private static Map getDefaults(){
|
||||
@@ -38,6 +39,7 @@ public class settingsManager {
|
||||
hm.put(FTPEnabled, false);
|
||||
hm.put(FTPServer, "0.0.0.0");
|
||||
hm.put(FTPSendMetaFiles, false);
|
||||
hm.put(CustomEventsKey, false);
|
||||
|
||||
return hm;
|
||||
}
|
||||
@@ -62,6 +64,8 @@ public class settingsManager {
|
||||
getEditor().putBoolean(FTPEnabled, (boolean) defaults.get( FTPEnabled )).apply();
|
||||
getEditor() .putString(FTPServer, (String) defaults.get( FTPServer )).apply();
|
||||
getEditor().putBoolean(FTPSendMetaFiles, (boolean) defaults.get( FTPSendMetaFiles )).apply();
|
||||
|
||||
getEditor().putBoolean(CustomEventsKey, (boolean) defaults.get( CustomEventsKey )).apply();
|
||||
}
|
||||
|
||||
// IDK why I decided to format these functions like this. It looks cool though.
|
||||
@@ -98,7 +102,12 @@ public class settingsManager {
|
||||
public static void setFTPServer(String str){ getEditor().putString( FTPServer,str).apply();}
|
||||
|
||||
public static boolean getFTPSendMetaFiles(){return prefs.getBoolean(FTPSendMetaFiles, (boolean) defaults.get(FTPSendMetaFiles));}
|
||||
public static void setFTPSendMetaFiles(String str){getEditor().putString(FTPSendMetaFiles,str).apply();}
|
||||
public static void setFTPSendMetaFiles(boolean bool){getEditor().putBoolean(FTPSendMetaFiles,bool).apply();}
|
||||
|
||||
|
||||
public static boolean getCustomEvents(){return prefs.getBoolean(CustomEventsKey, (boolean) defaults.get(FTPSendMetaFiles));}
|
||||
public static void setCustomEvents(boolean bool){getEditor().putBoolean(CustomEventsKey,bool).apply();}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,18 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/pitScoutingButton"
|
||||
app:layout_constraintVertical_bias="0.307" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/event_add_button"
|
||||
android:layout_width="58dp"
|
||||
android:layout_height="63dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="+"
|
||||
android:textSize="24sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/event_button"
|
||||
app:layout_constraintTop_toBottomOf="@+id/pitScoutingButton" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user