Initial work on auto
This commit is contained in:
parent
94a8755bb0
commit
d1364bc3b2
113
AutoActivity.java
Normal file
113
AutoActivity.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package com.example.scoutingapp;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
public class AutoActivity extends AppCompatActivity {
|
||||||
|
private int l4Scored = 0;
|
||||||
|
private int l3Scored = 0;
|
||||||
|
private int l2Scored = 0;
|
||||||
|
private int l1Scored = 0;
|
||||||
|
private int processorScored = 0;
|
||||||
|
private int netScored = 0;
|
||||||
|
private int startingLocation;
|
||||||
|
|
||||||
|
private boolean reefPickup = false;
|
||||||
|
private boolean canLeave = false;
|
||||||
|
private boolean coralPickup = false;
|
||||||
|
|
||||||
|
private Button l4Button;
|
||||||
|
private Button l3Button;
|
||||||
|
private Button l2Button;
|
||||||
|
private Button l1Button;
|
||||||
|
private Button processorButton;
|
||||||
|
private Button netButton;
|
||||||
|
private Button nextButton;
|
||||||
|
|
||||||
|
private CheckBox canLeaveBox;
|
||||||
|
private CheckBox reefPickupBox;
|
||||||
|
private CheckBox coralPickupBox;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
setContentView(R.layout.activity_auto);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
l4Button = (Button) findViewById(R.id.button_L4);
|
||||||
|
l3Button = (Button) findViewById(R.id.button_L3);
|
||||||
|
l2Button = (Button) findViewById(R.id.button_L2);
|
||||||
|
l1Button = (Button) findViewById(R.id.button_L1);
|
||||||
|
processorButton = (Button) findViewById(R.id.button_Processor);
|
||||||
|
netButton = (Button) findViewById(R.id.button_Net);
|
||||||
|
|
||||||
|
l4Button.setOnClickListener((v) -> l4Scored++);
|
||||||
|
l4Button.setOnLongClickListener((v) -> {
|
||||||
|
l4Scored--;
|
||||||
|
//vibration
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
l3Button.setOnClickListener((v) -> l3Scored++);
|
||||||
|
l3Button.setOnLongClickListener((v) -> {
|
||||||
|
l3Scored--;
|
||||||
|
//vibration
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
l2Button.setOnClickListener((v) -> l2Scored++);
|
||||||
|
l2Button.setOnLongClickListener((v) -> {
|
||||||
|
l2Scored--;
|
||||||
|
//vibration
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
l1Button.setOnClickListener((v) -> l1Scored++);
|
||||||
|
l1Button.setOnLongClickListener((v) -> {
|
||||||
|
l1Scored--;
|
||||||
|
//vibration
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
processorButton.setOnClickListener((v) -> processorScored++);
|
||||||
|
processorButton.setOnLongClickListener((v) -> {
|
||||||
|
processorScored--;
|
||||||
|
//vibration
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
netButton.setOnClickListener((v) -> netScored++);
|
||||||
|
netButton.setOnLongClickListener((v) -> {
|
||||||
|
netScored--;
|
||||||
|
//vibration
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
canLeaveBox.setOnClickListener((v) -> canLeave = canLeaveBox.isChecked());
|
||||||
|
|
||||||
|
reefPickupBox.setOnClickListener((v) -> reefPickup = reefPickupBox.isChecked());
|
||||||
|
|
||||||
|
coralPickupBox.setOnClickListener((v) -> coralPickup = coralPickupBox.isChecked());
|
||||||
|
|
||||||
|
nextButton.setOnLongClickListener((v) -> {
|
||||||
|
//submit data
|
||||||
|
Intent intent = new Intent(this, TeleActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
129
activity_auto.xml
Normal file
129
activity_auto.xml
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?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:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".AutoActivity">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_L4"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="L4"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="40sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_algaeReef"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="Algae Removed From Reef"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/cb_coralPickup"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_coralPickup"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="Coral Pickup"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_L3"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="L3"
|
||||||
|
android:textSize="40sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/button_L4" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_L2"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="L2"
|
||||||
|
android:textSize="40sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/button_L3" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_L1"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="L1"
|
||||||
|
android:textSize="40sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/button_L2" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_Net"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="Net"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/button_Processor"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_Processor"
|
||||||
|
android:layout_width="150sp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="Processor"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_CanLeave"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:text="Can Leave"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/cb_algaeReef"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_Next"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="Next (Hold)"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="277dp"
|
||||||
|
android:layout_height="476dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/cb_CanLeave"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/button_L2"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.0"
|
||||||
|
tools:srcCompat="@tools:sample/avatars" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user