From de127ac0c4b4803cce8a037c8d93840eeb192186 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期一, 13 一月 2025 13:02:34 +0800
Subject: [PATCH] #
---
app/src/main/java/com/example/agvcontroller/protocol/HandleCmdType.java | 4
app/src/main/java/com/example/agvcontroller/MainActivity.java | 613 ++++++++++++++++++++++++
app/src/main/res/layout/activity_main.xml | 835 ++++++++++++++++++++++++--------
3 files changed, 1,236 insertions(+), 216 deletions(-)
diff --git a/app/src/main/java/com/example/agvcontroller/MainActivity.java b/app/src/main/java/com/example/agvcontroller/MainActivity.java
index eda4c32..7b34b4c 100644
--- a/app/src/main/java/com/example/agvcontroller/MainActivity.java
+++ b/app/src/main/java/com/example/agvcontroller/MainActivity.java
@@ -1,5 +1,7 @@
package com.example.agvcontroller;
+import static android.content.ContentValues.TAG;
+
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
@@ -16,7 +18,10 @@
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.GridLayout;
import android.widget.RelativeLayout;
+import android.widget.Switch;
import com.example.agvcontroller.action.AllResetAction;
import com.example.agvcontroller.action.BackPaddle;
@@ -32,6 +37,7 @@
import com.example.agvcontroller.action.LiftResetAction;
import com.example.agvcontroller.action.LoadResetAction;
import com.example.agvcontroller.action.RotatopnLeftRight;
+import com.example.agvcontroller.action.SingleSwitchAction;
import com.example.agvcontroller.protocol.AgvAction;
import com.example.agvcontroller.action.HandOutAction;
import com.example.agvcontroller.socket.NettyServerHandler;
@@ -80,13 +86,43 @@
private Button liftResetBtn;
private Button allResetBtn;
+ private Switch switchBtn1; // 鍗曡酱浣胯兘
+ private Switch switchBtn2; // 鍗曡酱浣胯兘
+ private Switch switchBtn3; // 鍗曡酱浣胯兘
+ private Switch switchBtn4; // 鍗曡酱浣胯兘
+ private Switch switchBtn5; // 鍗曡酱浣胯兘
+ private Switch switchBtn6; // 鍗曡酱浣胯兘
+ private Switch switchBtn7; // 鍗曡酱浣胯兘
+ private Switch switchBtn8; // 鍗曡酱浣胯兘
+ private Switch switchBtn9; // 鍗曡酱浣胯兘
+
+ private Button axleFrontBtn1;
+ private Button axleBackBtn1;
+ private Button axleFrontBtn2;
+ private Button axleBackBtn2;
+ private Button axleFrontBtn3;
+ private Button axleBackBtn3;
+ private Button axleFrontBtn4;
+ private Button axleBackBtn4;
+ private Button axleFrontBtn5;
+ private Button axleBackBtn5;
+ private Button axleFrontBtn6;
+ private Button axleBackBtn6;
+ private Button axleFrontBtn7;
+ private Button axleBackBtn7;
+ private Button axleFrontBtn8;
+ private Button axleBackBtn8;
+ private Button axleFrontBtn9;
+ private Button axleBackBtn9;
+
+
private Button bodySwitchBtn; // 搴曠洏/璐у弶鍒囨崲
private Socket socket;
private String AgvNo = "1";
private RelativeLayout layout_bottom;
private RelativeLayout layout_top;
- private RelativeLayout layout_single;
+ private GridLayout layout_single;
private RelativeLayout layout_reset;
int liftHeight = 400;
@@ -315,6 +351,37 @@
layout_top = findViewById(R.id.layout_top);
layout_single = findViewById(R.id.layout_single);
layout_reset = findViewById(R.id.layout_reset);
+
+ switchBtn1 = findViewById(R.id.switch1);
+ switchBtn2 = findViewById(R.id.switch2);
+ switchBtn3 = findViewById(R.id.switch3);
+ switchBtn4 = findViewById(R.id.switch4);
+ switchBtn5 = findViewById(R.id.switch5);
+ switchBtn6 = findViewById(R.id.switch6);
+ switchBtn7 = findViewById(R.id.switch7);
+ switchBtn8 = findViewById(R.id.switch8);
+ switchBtn9 = findViewById(R.id.switch9);
+
+ axleFrontBtn1 =findViewById(R.id.btn_axle_1_front);
+ axleBackBtn1 =findViewById(R.id.btn_axle_1_back);
+ axleFrontBtn2 =findViewById(R.id.btn_axle_2_front);
+ axleBackBtn2 =findViewById(R.id.btn_axle_2_back);
+ axleFrontBtn3 =findViewById(R.id.btn_axle_3_front);
+ axleBackBtn3 =findViewById(R.id.btn_axle_3_back);
+ axleFrontBtn4 =findViewById(R.id.btn_axle_4_front);
+ axleBackBtn4 =findViewById(R.id.btn_axle_4_back);
+ axleFrontBtn5 =findViewById(R.id.btn_axle_5_front);
+ axleBackBtn5 =findViewById(R.id.btn_axle_5_back);
+ axleFrontBtn6 =findViewById(R.id.btn_axle_6_front);
+ axleBackBtn6 =findViewById(R.id.btn_axle_6_back);
+ axleFrontBtn7 =findViewById(R.id.btn_axle_7_front);
+ axleBackBtn7 =findViewById(R.id.btn_axle_7_back);
+ axleFrontBtn8 =findViewById(R.id.btn_axle_8_front);
+ axleBackBtn8 =findViewById(R.id.btn_axle_8_back);
+ axleFrontBtn9 =findViewById(R.id.btn_axle_9_front);
+ axleBackBtn9 =findViewById(R.id.btn_axle_9_back);
+
+
cameraResetBtn = findViewById(R.id.btn_camera_reset);
@@ -693,6 +760,550 @@
}
});
+ switchBtn1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(1)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ axleFrontBtn1.setVisibility(View.VISIBLE);
+ axleBackBtn1.setVisibility(View.VISIBLE);
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(1)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ axleFrontBtn1.setVisibility(View.GONE);
+ axleBackBtn1.setVisibility(View.GONE);
+ }
+ }
+ });
+
+ switchBtn2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(2)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(2)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(3)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(3)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(4)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(4)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(5)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(5)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn6.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(6)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(6)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn7.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(7)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(7)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn8.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(8)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(8)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+ switchBtn9.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.d(TAG, "onCheckedChanged: " + isChecked);
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0, 16);
+ if (isChecked) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(9)
+ .bodySync((action) -> action.setPwd((short) 0));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ } else {
+ AgvAction agvAction = new AgvAction<>(SingleSwitchAction.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(9)
+ .bodySync((action) -> action.setPwd((short) 1));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ }
+ });
+
+
+ axleFrontBtn2 =findViewById(R.id.btn_axle_2_front);
+ axleBackBtn2 =findViewById(R.id.btn_axle_2_back);
+ axleFrontBtn3 =findViewById(R.id.btn_axle_3_front);
+ axleBackBtn3 =findViewById(R.id.btn_axle_3_back);
+ axleFrontBtn4 =findViewById(R.id.btn_axle_4_front);
+ axleBackBtn4 =findViewById(R.id.btn_axle_4_back);
+ axleFrontBtn5 =findViewById(R.id.btn_axle_5_front);
+ axleBackBtn5 =findViewById(R.id.btn_axle_5_back);
+ axleFrontBtn6 =findViewById(R.id.btn_axle_6_front);
+ axleBackBtn6 =findViewById(R.id.btn_axle_6_back);
+ axleFrontBtn7 =findViewById(R.id.btn_axle_7_front);
+ axleBackBtn7 =findViewById(R.id.btn_axle_7_back);
+ axleFrontBtn8 =findViewById(R.id.btn_axle_8_front);
+ axleBackBtn8 =findViewById(R.id.btn_axle_8_back);
+ axleFrontBtn9 =findViewById(R.id.btn_axle_9_front);
+ axleBackBtn9 =findViewById(R.id.btn_axle_9_back);
+
+ axleFrontBtn1.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(1)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn1.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(1)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn2.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(2)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn2.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(2)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn3.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(3)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn3.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(3)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn4.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(4)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn4.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(4)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn5.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(5)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn5.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(5)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn6.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(6)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn6.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(6)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn7.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(7)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn7.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(7)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn8.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(8)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn8.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(8)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleFrontBtn9.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(9)
+ .bodySync((action) -> action.setPwd((short) 100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
+ axleBackBtn9.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ if (vibrator != null && vibrator.hasVibrator()) {
+ vibrator.vibrate(500);
+ }
+ String substring = String.valueOf(new SnowflakeIdWorker().nextId()).substring(0,16);
+ AgvAction agvAction = new AgvAction<>(HandForkRotatopn.class)
+ .setAgvNo(AgvNo)
+ .setSerialNo(substring)
+ .setVal(9)
+ .bodySync((action) -> action.setPwd((short) -100));
+ nettyServerHandler.sendMessageToClient(clientId, agvAction); // 鍙戦�佹秷鎭埌瀹㈡埛绔�
+ }
+ });
+
// 鐐瑰姩鎸夐挳
stopBtn.setOnTouchListener(new CarTouchButton());
goForwardBtn.setOnTouchListener(new CarTouchButton());
diff --git a/app/src/main/java/com/example/agvcontroller/protocol/HandleCmdType.java b/app/src/main/java/com/example/agvcontroller/protocol/HandleCmdType.java
index 291998d..1bb507d 100644
--- a/app/src/main/java/com/example/agvcontroller/protocol/HandleCmdType.java
+++ b/app/src/main/java/com/example/agvcontroller/protocol/HandleCmdType.java
@@ -22,7 +22,7 @@
public enum HandleCmdType {
- HAND_OUT(0x00, "閫�鍑烘墜鍔ㄦā寮�", HandOutAction.class),
+ HAND_OUT(0x02, "閫�鍑烘墜鍔ㄦā寮�", HandOutAction.class),
HAND_IN(0x01, "杩涘叆鎵嬪姩妯″紡", HandInAction.class),
@@ -30,7 +30,7 @@
SINGLE_SWITCH(0x8C , "鍗曡酱浣胯兘", SingleSwitchAction.class),
- SINGLE_SWITCH_RUN(0x8C , "寮哄埗鍗曡酱鐐瑰姩", SingleSwitchRunAction.class),
+ SINGLE_SWITCH_RUN(0x8D , "寮哄埗鍗曡酱鐐瑰姩", SingleSwitchRunAction.class),
FORCE_STOP(0xF0, "鎬ュ仠", ForceStopAction.class),
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index ccb3535..ca2b410 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -260,107 +260,516 @@
</RelativeLayout>
<!-- **************** 鍗曡酱 **************** -->
- <RelativeLayout
+
+ <GridLayout
android:id="@+id/layout_single"
+ android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
- android:visibility="gone">
+ android:rowCount="3"
+ android:columnCount="3">
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="10sp"
- android:layout_marginLeft="20sp"
- android:backgroundTint="#2196F3"
- android:text="杞� - 1"
- app:cornerRadius="5dp" />
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_1_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝h浆"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_1_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶈浆"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="宸﹁疆浣胯兘"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/btn_single_5"
- android:layout_marginTop="10sp"
- android:backgroundTint="#2196F3"
- android:text="杞� - 2"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_2_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝h浆"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_2_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶈浆"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍙宠疆浣胯兘"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_3"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_marginRight="20sp"
- android:layout_marginTop="10sp"
- android:backgroundTint="#2196F3"
- android:text="杞� - 3"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_3_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="涓婂崌"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_3_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="涓嬮檷"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍗囬檷浣胯兘"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_4"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/btn_single_1"
- android:layout_alignBottom="@+id/btn_single_5"
- android:backgroundTint="#2196F3"
- android:text="杞� - 4"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_4_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝e悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_4_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶅悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch4"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璐у弶鍥炶浆浣胯兘"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_5"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:backgroundTint="#2196F3"
- android:text="杞� - 5"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_5_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="浼稿嚭"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_5_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍥炵缉"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch5"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璐у弶浼哥缉浣胯兘"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_6"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/btn_single_3"
- android:layout_alignBottom="@+id/btn_single_5"
- android:backgroundTint="#2196F3"
- android:text="杞� - 6"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_6_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝e悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_6_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶅悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鎷ㄦ寚浣胯兘1"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_7"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/btn_single_1"
- android:layout_alignBottom="@+id/btn_single_8"
- android:backgroundTint="#2196F3"
- android:text="杞� - 7"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_7_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝e悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_7_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶅悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch7"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鎷ㄦ寚浣胯兘2"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_8"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_marginBottom="20sp"
- android:layout_alignLeft="@+id/btn_single_5"
- android:layout_marginTop="10sp"
- android:backgroundTint="#2196F3"
- android:text="杞� - 8"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_8_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝e悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_8_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶅悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch8"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鎷ㄦ寚浣胯兘3"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btn_single_9"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignLeft="@+id/btn_single_3"
- android:layout_alignBottom="@+id/btn_single_8"
- android:backgroundTint="#2196F3"
- android:text="杞� - 9"
- app:cornerRadius="5dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_rowWeight="1"
+ android:layout_columnWeight="1"
+ android:orientation="vertical"
+ android:gravity="center">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_9_front"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="姝e悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/btn_axle_9_back"
+ android:layout_width="wrap_content"
+ android:layout_height="40dp"
+ android:text="鍙嶅悜"
+ android:layout_centerHorizontal="true"
+ app:cornerRadius="5dp"
+ android:paddingLeft="10dp"
+ android:paddingRight="10dp"
+ android:minWidth="10dp"
+ android:textSize="10sp"
+ android:backgroundTint="#2196F3"
+ android:layout_marginBottom="10sp"
+ android:visibility="gone"/>
+ <Switch
+ android:id="@+id/switch9"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鎷ㄦ寚浣胯兘4"
+ android:textSize="12sp"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ />
- </RelativeLayout>
+ </LinearLayout>
+ </GridLayout>
+
+
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_2"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignLeft="@+id/btn_single_5"-->
+<!-- android:layout_marginTop="10sp"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 2"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_3"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignParentRight="true"-->
+<!-- android:layout_marginRight="20sp"-->
+<!-- android:layout_marginTop="10sp"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 3"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_4"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignLeft="@+id/btn_single_1"-->
+<!-- android:layout_alignBottom="@+id/btn_single_5"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 4"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_5"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_centerInParent="true"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 5"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_6"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignLeft="@+id/btn_single_3"-->
+<!-- android:layout_alignBottom="@+id/btn_single_5"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 6"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_7"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignLeft="@+id/btn_single_1"-->
+<!-- android:layout_alignBottom="@+id/btn_single_8"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 7"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_8"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignParentBottom="true"-->
+<!-- android:layout_marginBottom="20sp"-->
+<!-- android:layout_alignLeft="@+id/btn_single_5"-->
+<!-- android:layout_marginTop="10sp"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 8"-->
+<!-- app:cornerRadius="5dp" />-->
+
+<!-- <com.google.android.material.button.MaterialButton-->
+<!-- android:id="@+id/btn_single_9"-->
+<!-- android:layout_width="wrap_content"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_alignLeft="@+id/btn_single_3"-->
+<!-- android:layout_alignBottom="@+id/btn_single_8"-->
+<!-- android:backgroundTint="#2196F3"-->
+<!-- android:text="杞� - 9"-->
+<!-- app:cornerRadius="5dp" />-->
+
<!-- **************** 澶嶄綅 **************** -->
<RelativeLayout
@@ -480,145 +889,145 @@
android:padding="5dp">
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_1_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍓嶈繘"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_1_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍓嶈繘"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_1_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍚庨��"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_1_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍚庨��"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_2_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_2_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_2_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_2_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_3_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_3_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_3_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_3_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_4_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_4_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_4_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_4_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_5_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_5_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_5_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_6_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_5_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_6_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_6_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_7_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_6_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_7_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_7_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_8_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_7_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_8_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_8_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_9_front"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="宸︽棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_8_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_9_front"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="宸︽棆杞�"/>-->
- <com.example.customBtn.CustomBtn
- android:id="@+id/btn_axle_9_back"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_columnWeight="1"
- style="@style/CustomButtonStyle"
- android:text="鍙虫棆杞�"/>
+<!-- <com.example.customBtn.CustomBtn-->
+<!-- android:id="@+id/btn_axle_9_back"-->
+<!-- android:layout_width="0dp"-->
+<!-- android:layout_height="wrap_content"-->
+<!-- android:layout_columnWeight="1"-->
+<!-- style="@style/CustomButtonStyle"-->
+<!-- android:text="鍙虫棆杞�"/>-->
</GridLayout>
--
Gitblit v1.9.1