mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Compare commits
1 Commits
v2.1
...
recyclerview
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a644c6671 |
@@ -57,11 +57,13 @@ dependencies {
|
||||
implementation(libs.constraintlayout)
|
||||
implementation(libs.lifecycle.livedata.ktx)
|
||||
implementation(libs.lifecycle.viewmodel.ktx)
|
||||
implementation("androidx.navigation:navigation-fragment:2.8.9")
|
||||
implementation(libs.navigation.fragment.v289)
|
||||
implementation(libs.navigation.ui)
|
||||
implementation(libs.preference)
|
||||
// implementation(libs.support.annotations)
|
||||
// implementation(libs.asynclayoutinflator)
|
||||
|
||||
testImplementation(libs.junit)
|
||||
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
|
||||
|
||||
@@ -19,9 +19,12 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ridgebotics.ridgescout.R;
|
||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||
import com.ridgebotics.ridgescout.ui.views.FieldBorderedRow;
|
||||
import com.ridgebotics.ridgescout.ui.views.RecyclerList;
|
||||
import com.ridgebotics.ridgescout.ui.views.TeamListOption;
|
||||
import com.ridgebotics.ridgescout.utility.DataManager;
|
||||
import com.ridgebotics.ridgescout.utility.SettingsManager;
|
||||
@@ -44,7 +47,7 @@ public class DataFragment extends Fragment {
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
binding = FragmentDataBinding.inflate(inflater, container, false);
|
||||
binding.table.setStretchAllColumns(true);
|
||||
// binding.table.setStretchAllColumns(true);
|
||||
View root = binding.getRoot();
|
||||
|
||||
if(evcode == null || evcode.equals("unset") || event == null){
|
||||
@@ -86,35 +89,21 @@ public class DataFragment extends Fragment {
|
||||
|
||||
public void load_teams(){
|
||||
|
||||
int[] teamNums = new int[event.teams.size()];
|
||||
RecyclerList<frcTeam> list = new RecyclerList<>(getContext());
|
||||
binding.table.addView(list);
|
||||
// list.setView
|
||||
|
||||
for(int i = 0 ; i < event.teams.size(); i++){
|
||||
teamNums[i] = event.teams.get(i).teamNumber;
|
||||
}
|
||||
|
||||
Arrays.sort(teamNums);
|
||||
|
||||
for(int i = 0; i < event.teams.size(); i++){
|
||||
frcTeam team = null;
|
||||
for(int a = 0 ; a < event.teams.size(); a++){
|
||||
if(event.teams.get(a).teamNumber == teamNums[i]){
|
||||
team = event.teams.get(a);
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert team != null;
|
||||
|
||||
TeamListOption teamRow = new TeamListOption(getContext());
|
||||
binding.table.addView(teamRow);
|
||||
teamRow.fromTeam(team);
|
||||
|
||||
frcTeam finalTeam = team;
|
||||
teamRow.setOnClickListener(v -> {
|
||||
TeamsFragment.setTeam(finalTeam);
|
||||
list
|
||||
.setup(R.layout.view_team_option, TeamListOption::new)
|
||||
.withLinearLayout()
|
||||
.withDivider()
|
||||
.withItemClickListener((team, position) -> {
|
||||
TeamsFragment.setTeam(team);
|
||||
((DataParentFragment) getParentFragment()).moveToFragment(new TeamsFragment());
|
||||
// findNavController(this).navigate(R.id.action_navigation_data_parent_to_navigation_data_teams);
|
||||
});
|
||||
}
|
||||
|
||||
list.setItems(event.getTeamsSorted());
|
||||
|
||||
}
|
||||
public void load_fields(){
|
||||
DataManager.reload_match_fields();
|
||||
|
||||
@@ -51,89 +51,89 @@ public class PitSelectorFragment extends Fragment {
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
load_teams();
|
||||
// load_teams();
|
||||
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
public void load_teams(){
|
||||
// binding.pitFileIndicator.setVisibility(View.GONE);
|
||||
// binding.pitTeamName.setVisibility(View.GONE);
|
||||
// binding.pitTeamDescription.setVisibility(View.GONE);
|
||||
// public void load_teams(){
|
||||
//// binding.pitFileIndicator.setVisibility(View.GONE);
|
||||
//// binding.pitTeamName.setVisibility(View.GONE);
|
||||
//// binding.pitTeamDescription.setVisibility(View.GONE);
|
||||
////
|
||||
//// clear_fields();
|
||||
//
|
||||
// clear_fields();
|
||||
|
||||
|
||||
int[] teamNums = new int[event.teams.size()];
|
||||
|
||||
for(int i = 0 ; i < event.teams.size(); i++){
|
||||
teamNums[i] = event.teams.get(i).teamNumber;
|
||||
}
|
||||
|
||||
Arrays.sort(teamNums);
|
||||
|
||||
TableLayout table = new TableLayout(getContext());
|
||||
table.setStretchAllColumns(true);
|
||||
binding.teams.addView(table);
|
||||
|
||||
|
||||
for(int i = 0; i < event.teams.size(); i++){
|
||||
frcTeam team = null;
|
||||
for(int a = 0 ; a < event.teams.size(); a++){
|
||||
if(event.teams.get(a).teamNumber == teamNums[i]){
|
||||
team = event.teams.get(a);
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert team != null;
|
||||
|
||||
// TableRow tr = new TableRow(getContext());
|
||||
// TableLayout.LayoutParams rowParams = new TableLayout.LayoutParams(
|
||||
// FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
// FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
// );
|
||||
// rowParams.setMargins(20,20,20,20);
|
||||
// tr.setLayoutParams(rowParams);
|
||||
// tr.setPadding(20,20,20,20);
|
||||
// table.addView(tr);
|
||||
|
||||
TeamListOption teamRow = new TeamListOption(getContext());
|
||||
table.addView(teamRow);
|
||||
teamRow.fromTeam(team);
|
||||
|
||||
|
||||
String filename = evcode + "-" + team.teamNumber + ".pitscoutdata";
|
||||
|
||||
if (FileEditor.fileExist(filename)) {
|
||||
final boolean[] rescout = {DataManager.rescout_list.contains(filename)};
|
||||
|
||||
teamRow.setColor(DataManager.rescout_list.contains(filename) ? color_rescout : color_found);
|
||||
|
||||
teamRow.setOnLongClickListener(v -> {
|
||||
rescout[0] = !rescout[0];
|
||||
if(rescout[0]){
|
||||
DataManager.rescout_list.add(filename);
|
||||
teamRow.setColor(color_rescout);
|
||||
DataManager.save_rescout_list();
|
||||
}else{
|
||||
DataManager.rescout_list.remove(filename);
|
||||
teamRow.setColor(color_found);
|
||||
DataManager.save_rescout_list();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
teamRow.setColor(color_not_found);
|
||||
teamRow.setOnLongClickListener(v -> true);
|
||||
}
|
||||
|
||||
|
||||
frcTeam finalTeam = team;
|
||||
teamRow.setOnClickListener(v -> onSelect.onSelect(this, finalTeam));
|
||||
}
|
||||
}
|
||||
//
|
||||
// int[] teamNums = new int[event.teams.size()];
|
||||
//
|
||||
// for(int i = 0 ; i < event.teams.size(); i++){
|
||||
// teamNums[i] = event.teams.get(i).teamNumber;
|
||||
// }
|
||||
//
|
||||
// Arrays.sort(teamNums);
|
||||
//
|
||||
// TableLayout table = new TableLayout(getContext());
|
||||
// table.setStretchAllColumns(true);
|
||||
// binding.teams.addView(table);
|
||||
//
|
||||
//
|
||||
// for(int i = 0; i < event.teams.size(); i++){
|
||||
// frcTeam team = null;
|
||||
// for(int a = 0 ; a < event.teams.size(); a++){
|
||||
// if(event.teams.get(a).teamNumber == teamNums[i]){
|
||||
// team = event.teams.get(a);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// assert team != null;
|
||||
//
|
||||
//// TableRow tr = new TableRow(getContext());
|
||||
//// TableLayout.LayoutParams rowParams = new TableLayout.LayoutParams(
|
||||
//// FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
//// FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
//// );
|
||||
//// rowParams.setMargins(20,20,20,20);
|
||||
//// tr.setLayoutParams(rowParams);
|
||||
//// tr.setPadding(20,20,20,20);
|
||||
//// table.addView(tr);
|
||||
//
|
||||
// TeamListOption teamRow = new TeamListOption(getContext());
|
||||
// table.addView(teamRow);
|
||||
// teamRow.fromTeam(team);
|
||||
//
|
||||
//
|
||||
// String filename = evcode + "-" + team.teamNumber + ".pitscoutdata";
|
||||
//
|
||||
// if (FileEditor.fileExist(filename)) {
|
||||
// final boolean[] rescout = {DataManager.rescout_list.contains(filename)};
|
||||
//
|
||||
// teamRow.setColor(DataManager.rescout_list.contains(filename) ? color_rescout : color_found);
|
||||
//
|
||||
// teamRow.setOnLongClickListener(v -> {
|
||||
// rescout[0] = !rescout[0];
|
||||
// if(rescout[0]){
|
||||
// DataManager.rescout_list.add(filename);
|
||||
// teamRow.setColor(color_rescout);
|
||||
// DataManager.save_rescout_list();
|
||||
// }else{
|
||||
// DataManager.rescout_list.remove(filename);
|
||||
// teamRow.setColor(color_found);
|
||||
// DataManager.save_rescout_list();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
// });
|
||||
// } else {
|
||||
// teamRow.setColor(color_not_found);
|
||||
// teamRow.setOnLongClickListener(v -> true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// frcTeam finalTeam = team;
|
||||
// teamRow.setOnClickListener(v -> onSelect.onSelect(this, finalTeam));
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -19,34 +19,37 @@ import com.ridgebotics.ridgescout.R;
|
||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||
|
||||
// A view that acts as a row specifically to display a team and their icon in a list formmt.
|
||||
public class TeamListOption extends LinearLayout {
|
||||
public TeamListOption(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
public class TeamListOption extends RecyclerHolder<frcTeam> {
|
||||
|
||||
public TeamListOption(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
// public TeamListOption(Context context, @Nullable AttributeSet attrs) {
|
||||
// super(context, attrs);
|
||||
// init(context);
|
||||
// }
|
||||
//
|
||||
// public TeamListOption(Context context) {
|
||||
// super(context);
|
||||
// init(context);
|
||||
// }
|
||||
//
|
||||
private TextView teamNumber;
|
||||
private TextView teamName;
|
||||
|
||||
private ImageView teamLogo;
|
||||
private ConstraintLayout box;
|
||||
private View coloredBackground;
|
||||
//
|
||||
public TeamListOption(View view) {
|
||||
super(view);
|
||||
// LayoutInflater.from(context).inflate(R.layout.view_team_option, this, true);
|
||||
|
||||
public void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_team_option, this, true);
|
||||
|
||||
teamNumber = findViewById(R.id.field_option_type);
|
||||
teamName = findViewById(R.id.field_option_name);
|
||||
teamLogo = findViewById(R.id.team_option_logo);
|
||||
teamNumber = view.findViewById(R.id.field_option_type);
|
||||
teamName = view.findViewById(R.id.field_option_name);
|
||||
teamLogo = view.findViewById(R.id.team_option_logo);
|
||||
|
||||
|
||||
box = findViewById(R.id.team_option_box);
|
||||
coloredBackground = findViewById(R.id.team_option_background);
|
||||
box = view.findViewById(R.id.team_option_box);
|
||||
coloredBackground = view.findViewById(R.id.team_option_background);
|
||||
}
|
||||
|
||||
public void setTeamNumber(int num){
|
||||
@@ -59,6 +62,7 @@ public class TeamListOption extends LinearLayout {
|
||||
|
||||
public void setTeamLogo(Bitmap bitmap){
|
||||
teamLogo.setImageBitmap(bitmap);
|
||||
showLogo();
|
||||
}
|
||||
|
||||
public void hideLogo(){
|
||||
@@ -68,7 +72,8 @@ public class TeamListOption extends LinearLayout {
|
||||
teamLogo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void fromTeam(frcTeam team){
|
||||
@Override
|
||||
public void bind(frcTeam team, int position){
|
||||
setTeamNumber(team.teamNumber);
|
||||
setTeamName(team.teamName);
|
||||
|
||||
|
||||
@@ -17,36 +17,23 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
<LinearLayout
|
||||
android:id="@+id/table"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
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:paddingBottom="50dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/table"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.ridgebotics.ridgescout.ui.views.CustomSpinnerView
|
||||
android:id="@+id/data_type_dropdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</TableLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<com.ridgebotics.ridgescout.ui.views.CustomSpinnerView
|
||||
android:id="@+id/data_type_dropdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -30,11 +30,13 @@
|
||||
android:layout_height="54dp"
|
||||
android:layout_margin="2dp"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:srcCompat="@drawable/ic_robologo" />
|
||||
tools:srcCompat="@drawable/ic_robologo"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field_option_name"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[versions]
|
||||
agp = "8.11.1"
|
||||
asynclayoutinflator = "1.1.0"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.1.5"
|
||||
espressoCore = "3.5.1"
|
||||
@@ -10,11 +11,13 @@ lifecycleLivedataKtx = "2.6.1"
|
||||
lifecycleViewmodelKtx = "2.6.1"
|
||||
material3 = "1.3.1"
|
||||
navigationFragment = "2.6.0"
|
||||
navigationFragmentVersion = "2.8.9"
|
||||
navigationUi = "2.6.0"
|
||||
supportAnnotations = "28.0.0"
|
||||
preference = "1.2.1"
|
||||
|
||||
[libraries]
|
||||
asynclayoutinflator = { module = "androidx.asynclayoutinflator:asynclayoutinflator", version.ref = "asynclayoutinflator" }
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||
@@ -25,6 +28,7 @@ lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-lived
|
||||
lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }
|
||||
material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" }
|
||||
navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment", version.ref = "navigationFragment" }
|
||||
navigation-fragment-v289 = { module = "androidx.navigation:navigation-fragment", version.ref = "navigationFragmentVersion" }
|
||||
navigation-ui = { group = "androidx.navigation", name = "navigation-ui", version.ref = "navigationUi" }
|
||||
support-annotations = { group = "com.android.support", name = "support-annotations", version.ref = "supportAnnotations" }
|
||||
preference = { group = "androidx.preference", name = "preference", version.ref = "preference" }
|
||||
|
||||
Reference in New Issue
Block a user