Worked on tele and auto functionality
This commit is contained in:
parent
4a12843824
commit
54bd17a079
@ -2,7 +2,8 @@ package com.example.scoutingapp;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.os.Vibrator;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
@ -19,24 +20,11 @@ public class AutoActivity extends AppCompatActivity {
|
|||||||
private int l1Scored = 0;
|
private int l1Scored = 0;
|
||||||
private int processorScored = 0;
|
private int processorScored = 0;
|
||||||
private int netScored = 0;
|
private int netScored = 0;
|
||||||
private int startingLocation;
|
|
||||||
|
|
||||||
private boolean reefPickup = false;
|
private boolean reefPickup = false;
|
||||||
private boolean canLeave = false;
|
private boolean canLeave = false;
|
||||||
private boolean coralPickup = 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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -48,52 +36,60 @@ public class AutoActivity extends AppCompatActivity {
|
|||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
l4Button = (Button) findViewById(R.id.button_L4);
|
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
||||||
l3Button = (Button) findViewById(R.id.button_L3);
|
|
||||||
l2Button = (Button) findViewById(R.id.button_L2);
|
Button l4Button = (Button) findViewById(R.id.button_L4);
|
||||||
l1Button = (Button) findViewById(R.id.button_L1);
|
Button l3Button = (Button) findViewById(R.id.button_L3);
|
||||||
processorButton = (Button) findViewById(R.id.button_Processor);
|
Button l2Button = (Button) findViewById(R.id.button_L2);
|
||||||
netButton = (Button) findViewById(R.id.button_Net);
|
Button l1Button = (Button) findViewById(R.id.button_L1);
|
||||||
|
Button processorButton = (Button) findViewById(R.id.button_Processor);
|
||||||
|
Button netButton = (Button) findViewById(R.id.button_Net);
|
||||||
|
Button nextButton = (Button) findViewById(R.id.button_Next);
|
||||||
|
|
||||||
|
CheckBox coralPickupBox = (CheckBox) findViewById(R.id.cb_coralPickup);
|
||||||
|
CheckBox reefPickupBox = (CheckBox) findViewById(R.id.cb_algaeReef);
|
||||||
|
CheckBox canLeaveBox = (CheckBox) findViewById(R.id.cb_CanLeave);
|
||||||
|
|
||||||
|
|
||||||
l4Button.setOnClickListener((v) -> l4Scored++);
|
l4Button.setOnClickListener((v) -> l4Scored++);
|
||||||
l4Button.setOnLongClickListener((v) -> {
|
l4Button.setOnLongClickListener((v) -> {
|
||||||
l4Scored--;
|
l4Scored--;
|
||||||
//vibration
|
vibrator.vibrate(250);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
l3Button.setOnClickListener((v) -> l3Scored++);
|
l3Button.setOnClickListener((v) -> l3Scored++);
|
||||||
l3Button.setOnLongClickListener((v) -> {
|
l3Button.setOnLongClickListener((v) -> {
|
||||||
l3Scored--;
|
l3Scored--;
|
||||||
//vibration
|
vibrator.vibrate(250);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
l2Button.setOnClickListener((v) -> l2Scored++);
|
l2Button.setOnClickListener((v) -> l2Scored++);
|
||||||
l2Button.setOnLongClickListener((v) -> {
|
l2Button.setOnLongClickListener((v) -> {
|
||||||
l2Scored--;
|
l2Scored--;
|
||||||
//vibration
|
vibrator.vibrate(250);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
l1Button.setOnClickListener((v) -> l1Scored++);
|
l1Button.setOnClickListener((v) -> l1Scored++);
|
||||||
l1Button.setOnLongClickListener((v) -> {
|
l1Button.setOnLongClickListener((v) -> {
|
||||||
l1Scored--;
|
l1Scored--;
|
||||||
//vibration
|
vibrator.vibrate(250);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
processorButton.setOnClickListener((v) -> processorScored++);
|
processorButton.setOnClickListener((v) -> processorScored++);
|
||||||
processorButton.setOnLongClickListener((v) -> {
|
processorButton.setOnLongClickListener((v) -> {
|
||||||
processorScored--;
|
processorScored--;
|
||||||
//vibration
|
vibrator.vibrate(250);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
netButton.setOnClickListener((v) -> netScored++);
|
netButton.setOnClickListener((v) -> netScored++);
|
||||||
netButton.setOnLongClickListener((v) -> {
|
netButton.setOnLongClickListener((v) -> {
|
||||||
netScored--;
|
netScored--;
|
||||||
//vibration
|
vibrator.vibrate(250);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -107,6 +103,7 @@ public class AutoActivity extends AppCompatActivity {
|
|||||||
//submit data
|
//submit data
|
||||||
Intent intent = new Intent(this, TeleActivity.class);
|
Intent intent = new Intent(this, TeleActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
Log.d("test", intent.toString());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.example.scoutingapp;
|
package com.example.scoutingapp;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -9,6 +14,16 @@ import androidx.core.view.ViewCompat;
|
|||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
public class TeleActivity extends AppCompatActivity {
|
public class TeleActivity 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 boolean reefPickup = false;
|
||||||
|
private boolean canLeave = false;
|
||||||
|
private boolean coralPickup = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -20,5 +35,73 @@ public class TeleActivity extends AppCompatActivity {
|
|||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button l4Button = (Button) findViewById(R.id.button_L4);
|
||||||
|
Button l3Button = (Button) findViewById(R.id.button_L3);
|
||||||
|
Button l2Button = (Button) findViewById(R.id.button_L2);
|
||||||
|
Button l1Button = (Button) findViewById(R.id.button_L1);
|
||||||
|
Button processorButton = (Button) findViewById(R.id.button_Processor);
|
||||||
|
Button netButton = (Button) findViewById(R.id.button_Net);
|
||||||
|
Button nextButton = (Button) findViewById(R.id.button_Next);
|
||||||
|
|
||||||
|
CheckBox coralPickupBox = (CheckBox) findViewById(R.id.cb_coralPickup);
|
||||||
|
CheckBox reefPickupBox = (CheckBox) findViewById(R.id.cb_algaeReef);
|
||||||
|
CheckBox canLeaveBox = (CheckBox) findViewById(R.id.cb_CanLeave);
|
||||||
|
|
||||||
|
|
||||||
|
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, EndActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user