mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Match Scouting Indicator Overhaul
Redo of the UI for the scouting indicator and overall enhancement of the UI
This commit is contained in:
+16
-15
@@ -49,8 +49,9 @@ public class MatchScoutingFragment extends Fragment {
|
||||
alliance_position = SettingsManager.getAllyPos();
|
||||
username = SettingsManager.getUsername();
|
||||
|
||||
binding.username.setText(username);
|
||||
binding.alliancePosText.setText(alliance_position);
|
||||
binding.bindicator.setUsername(username);
|
||||
binding.bindicator.setAlliancePos(alliance_position);
|
||||
binding.bindicator.bringToFront();
|
||||
|
||||
binding.matchTeamCard.setVisibility(View.GONE);
|
||||
clear_fields();
|
||||
@@ -66,7 +67,7 @@ public class MatchScoutingFragment extends Fragment {
|
||||
|
||||
|
||||
|
||||
binding.nextButton.setOnClickListener(v -> {
|
||||
binding.bindicator.match_indicator_next_button.setOnClickListener(v -> {
|
||||
if(edited) save();
|
||||
SettingsManager.setMatchNum(cur_match_num+1);
|
||||
cur_match_num += 1;
|
||||
@@ -75,21 +76,21 @@ public class MatchScoutingFragment extends Fragment {
|
||||
});
|
||||
|
||||
if(SettingsManager.getEnableQuickAlliancePosChange())
|
||||
binding.fileIndicator.setOnClickListener(v -> {
|
||||
binding.bindicator.setOnClickListener(v -> {
|
||||
// if(e.getAction() != MotionEvent.ACTION_MOVE) return true;
|
||||
// System.out.println(e.getAxisValue(0));
|
||||
if(edited) save();
|
||||
|
||||
alliance_position = incrementMatchPos(alliance_position);
|
||||
SettingsManager.setAllyPos(alliance_position);
|
||||
binding.alliancePosText.setText(alliance_position);
|
||||
binding.bindicator.setAlliancePos(alliance_position);
|
||||
|
||||
update_match_num();
|
||||
update_scouting_data();
|
||||
// return true;
|
||||
});
|
||||
|
||||
binding.backButton.setOnClickListener(v -> {
|
||||
binding.bindicator.match_indicator_back_button.setOnClickListener(v -> {
|
||||
if(edited) save();
|
||||
SettingsManager.setMatchNum(cur_match_num-1);
|
||||
cur_match_num -= 1;
|
||||
@@ -159,7 +160,7 @@ public class MatchScoutingFragment extends Fragment {
|
||||
}
|
||||
|
||||
public void set_indicator_color(int color){
|
||||
binding.fileIndicator.setBackgroundColor(color);
|
||||
binding.bindicator.setColor(color);
|
||||
}
|
||||
|
||||
public void update_asm(){
|
||||
@@ -239,18 +240,18 @@ public class MatchScoutingFragment extends Fragment {
|
||||
|
||||
edited = false;
|
||||
|
||||
binding.matchnum.setText(String.valueOf(cur_match_num+1));
|
||||
binding.bindicator.setMatchNum(String.valueOf(cur_match_num+1));
|
||||
|
||||
if(cur_match_num <= 0){
|
||||
binding.backButton.setVisibility(View.GONE);
|
||||
binding.bindicator.match_indicator_back_button.setVisibility(View.GONE);
|
||||
}else{
|
||||
binding.backButton.setVisibility(View.VISIBLE);
|
||||
binding.bindicator.match_indicator_back_button.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(cur_match_num >= event.matches.size()-1){
|
||||
binding.nextButton.setVisibility(View.GONE);
|
||||
binding.bindicator.match_indicator_next_button.setVisibility(View.GONE);
|
||||
}else{
|
||||
binding.nextButton.setVisibility(View.VISIBLE);
|
||||
binding.bindicator.match_indicator_next_button.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +273,7 @@ public class MatchScoutingFragment extends Fragment {
|
||||
break;
|
||||
}
|
||||
|
||||
binding.barTeamNum.setText(String.valueOf(team_num));
|
||||
binding.bindicator.setTeamNum(String.valueOf(team_num));
|
||||
|
||||
frcTeam team = null;
|
||||
for(int i=0; i < event.teams.size(); i++){
|
||||
@@ -385,7 +386,7 @@ public class MatchScoutingFragment extends Fragment {
|
||||
|
||||
private void enableRescoutButton(){
|
||||
set_indicator_color(rescout ? rescout_color : saved_color);
|
||||
binding.fileIndicator.setOnLongClickListener(v -> {
|
||||
binding.bindicator.setOnLongClickListener(v -> {
|
||||
rescout = !rescout;
|
||||
if(rescout){
|
||||
set_indicator_color(rescout_color);
|
||||
@@ -402,6 +403,6 @@ public class MatchScoutingFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void disableRescoutButton(){
|
||||
binding.fileIndicator.setOnLongClickListener(null);
|
||||
binding.bindicator.setOnLongClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.ridgebotics.ridgescout.ui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.ridgebotics.ridgescout.R;
|
||||
import com.ridgebotics.ridgescout.types.frcTeam;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
// A view for displaying information about a team.
|
||||
public class MatchScoutingIndicator extends RelativeLayout {
|
||||
public MatchScoutingIndicator(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public MatchScoutingIndicator(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public TextView match_indicator_alliance_pos_text;
|
||||
public TextView match_indicator_bar_team_num;
|
||||
public TextView match_indicator_matchnum;
|
||||
public TextView match_indicator_username;
|
||||
public ImageButton match_indicator_back_button;
|
||||
public ImageButton match_indicator_next_button;
|
||||
private ConstraintLayout box;
|
||||
private View coloredBackground;
|
||||
|
||||
public void init(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_match_scouting_indicator, this, true);
|
||||
match_indicator_back_button = findViewById(R.id.match_indicator_back_button);
|
||||
match_indicator_next_button = findViewById(R.id.match_indicator_next_button);
|
||||
match_indicator_alliance_pos_text = findViewById(R.id.match_indicator_alliance_pos_text);
|
||||
match_indicator_username = findViewById(R.id.match_indicator_username);
|
||||
match_indicator_matchnum = findViewById(R.id.match_indicator_matchnum);
|
||||
match_indicator_bar_team_num = findViewById(R.id.match_indicator_bar_team_num);
|
||||
box = findViewById(R.id.file_indicator_box);
|
||||
coloredBackground = findViewById(R.id.match_indicator_background);
|
||||
}
|
||||
|
||||
public void setUsername(String username){
|
||||
match_indicator_username.setText(username);
|
||||
}
|
||||
|
||||
public void setAlliancePos(String alliancePos){
|
||||
match_indicator_alliance_pos_text.setText(alliancePos);
|
||||
}
|
||||
|
||||
public void setMatchNum(String matchNum){
|
||||
match_indicator_matchnum.setText(matchNum);
|
||||
}
|
||||
|
||||
public void setTeamNum(String teamNum){
|
||||
match_indicator_bar_team_num.setText(teamNum);
|
||||
}
|
||||
|
||||
public void setColor(int color){
|
||||
Drawable drawable = box.getBackground();
|
||||
drawable.mutate();
|
||||
drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(color,hsv);
|
||||
|
||||
coloredBackground.setBackgroundColor(
|
||||
Color.HSVToColor(220, new float[]{
|
||||
hsv[0],
|
||||
Math.min(hsv[1], 0.75f),
|
||||
Math.min(hsv[2], 0.5f)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="800dp"
|
||||
android:height="800dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M14,5v10l-9,-5 9,-5z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="800dp"
|
||||
android:height="800dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M15,10l-9,5V5l9,5z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -5,16 +5,28 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<com.ridgebotics.ridgescout.ui.views.MatchScoutingIndicator
|
||||
android:id="@+id/bindicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/MatchScoutArea"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="48dp">
|
||||
|
||||
@@ -25,16 +37,15 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/border"
|
||||
android:padding="10dp"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/scouting_notice_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:text="Scouting Notice">
|
||||
</TextView>
|
||||
android:text="Scouting Notice"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"></TextView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -46,75 +57,4 @@
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/file_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#60ff0000"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Next"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alliance_pos_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Temp"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/matchnum"
|
||||
app:layout_constraintStart_toEndOf="@+id/back_button"
|
||||
app:layout_constraintTop_toBottomOf="@id/username" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Temp"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toStartOf="@+id/matchnum"
|
||||
app:layout_constraintStart_toEndOf="@+id/back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/matchnum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Temp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bar_team_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Temp"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/next_button"
|
||||
app:layout_constraintStart_toEndOf="@+id/matchnum"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/file_indicator_box"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/border"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<View
|
||||
android:id="@+id/match_indicator_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/match_indicator_back_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/triangle_left"
|
||||
android:text="Back"
|
||||
android:background="@color/zxing_transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/match_indicator_next_button"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/triangle_right"
|
||||
android:text="Next"
|
||||
android:background="@color/zxing_transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/match_indicator_alliance_pos_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:text="Temp"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/match_indicator_next_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/match_indicator_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="Temp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/match_indicator_back_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/match_indicator_matchnum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Temp"
|
||||
android:textAlignment="center"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/match_indicator_bar_team_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Temp"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/match_indicator_matchnum"
|
||||
app:layout_constraintStart_toEndOf="@+id/match_indicator_matchnum"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user