最新版本-6.27

master
Tushida 2024-06-27 20:06:47 +08:00
parent 4e6115b7ec
commit fb4d02268c
42 changed files with 2910 additions and 2857 deletions

View File

@ -7,11 +7,16 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <!-- 用于读取手机当前的状态 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 用于写入缓存数据到扩展存储卡 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 用于申请调用A-GPS模块 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 用于访问GPS定位 -->
<uses-permission android:name="android.permission.INTERNET" />
<!--用于读取手机当前的状态-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--用于写入缓存数据到扩展存储卡-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--用于申请调用A-GPS模块-->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<!--用于进行网络定位-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!--用于访问GPS定位-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
@ -40,11 +45,9 @@
<activity
android:name=".ServiceActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
<activity android:name=".MainActivity"
android:exported="false"/>
<activity
android:name=".SplashActivity"
<activity android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -52,10 +55,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="0daf67ccbd867127479dbbb10f105999" />
<meta-data android:name="com.amap.api.v2.apikey" android:value="0daf67ccbd867127479dbbb10f105999"/>
</application>
</manifest>

View File

@ -1,28 +1,23 @@
package com.example.upbot;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import com.example.upbot.MSG.MSG_CMD;
import java.util.Objects;
@SuppressLint("StaticFieldLeak")
public class ClientActivity extends AppCompatActivity {
@ -30,24 +25,15 @@ public class ClientActivity extends AppCompatActivity {
private static Button confirmBtn;
private static Button sendBtn;
private static EditText ipET;
private static ImageView startRobot;
private static ImageView imageView4;
private static ImageView iv_charge;
private static ImageView iv_stop_robot;
private static StringBuffer stringBuffer = new StringBuffer();
private static final StringBuffer stringBuffer = new StringBuffer();
private static TextView msgTV;
private static final String TAG="WifiDemoLogClientActivity";
// private static final String TAG="WifiDemoLogClientActivity";
@SuppressLint("HandlerLeak")
public static Handler handler = new Handler(Looper.myLooper()){
public static Handler handler = new Handler(Objects.requireNonNull(Looper.myLooper())) {
@Override
public void handleMessage(Message msg) {
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if (msg.what == 1) {
stringBuffer.append(msg.obj);
@ -61,121 +47,133 @@ public class ClientActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_client);
Toolbar toolbar = findViewById(R.id.toolBar_client);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Drawable overflowIcon = ContextCompat.getDrawable(this, R.drawable.baseline_more_vert_24);
if (overflowIcon != null) {
toolbar.setOverflowIcon(overflowIcon);
}
initView();
setListener();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home){
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
private void initView() {
ipET = (EditText) findViewById(R.id.ipET);
msgET = (EditText) findViewById(R.id.msgET);
ipET = findViewById(R.id.ipET);
msgET = findViewById(R.id.msgET);
sendBtn = findViewById(R.id.btn_send);
confirmBtn = findViewById(R.id.btn_confirm);
msgTV = (TextView) findViewById(R.id.msgTV);
startRobot = (ImageView) findViewById(R.id.start_robot_iv);
imageView4 = (ImageView) findViewById(R.id.imageView4);
iv_charge = (ImageView) findViewById(R.id.iv_charge);
iv_stop_robot = (ImageView) findViewById(R.id.iv_stop_robot);
msgTV = findViewById(R.id.msgTV);
}
private void setListener() {
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendBtn.setOnClickListener(v -> {
if (!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法发送", Toast.LENGTH_SHORT).show();
Toast.makeText(ClientActivity.this, "连接失败无法发送",
Toast.LENGTH_SHORT).show();
return;
}
UPbotComm.getInstance().sendMessage(msgET.getText().toString());
}
});
confirmBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!UPbotComm.getInstance().connect(ipET.getText().toString())) {
Toast.makeText(ClientActivity.this, "未进行连接", Toast.LENGTH_SHORT).show();
return;
}else{
Toast.makeText(ClientActivity.this, "连接成功", Toast.LENGTH_SHORT).show();
}
confirmBtn.setOnClickListener(v -> {
// 给定IP地址尝试连接
UPbotComm.getInstance().connect(ipET.getText().toString());
confirmBtn.setEnabled(false); // 连接只点一次
}
});
startRobot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// 点击按钮启动机器人
findViewById(R.id.btn_run_robot).setOnClickListener(v -> {
// 参考UPbot通信协议
// sendUPbotCmd((byte) 0x00, "正在启动机器人");
byte start = MSG_CMD.START_ROBOT;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法启动", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(start,"正在启动机器人");
}
});
imageView4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// 全覆盖命令
findViewById(R.id.btn_full_coverage).setOnClickListener(v -> {
// 参考UPbot通信协议
// sendUPbotCmd((byte) 0x02, "正在启动全覆盖割草");
byte value = MSG_CMD.START_COVER_SERVICE;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法覆盖", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(value,"正则启动全覆盖割草");
}
});
iv_charge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
findViewById(R.id.btn_retrun_charge).setOnClickListener(v -> {
// 参考UPbot通信协议
// sendUPbotCmd((byte) 0x07, "正在启动返回充电");
byte value = MSG_CMD.CHARGING;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法充电", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(value,"正在返回充电");
}
});
iv_stop_robot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
byte value = MSG_CMD.STOP_MOWING;
// 设定割草边界
findViewById(R.id.btn_range_setting).setOnClickListener(v -> {
// 参考Docs/UPbot通信协议
// sendUPbotCmd((byte) 0x05, "正在启动边界设定");
byte value = MSG_CMD.BOUNDARY_SETTING;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法停止", Toast.LENGTH_SHORT).show();
Toast.makeText(ClientActivity.this, "连接失败无法设定边界", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(value,"正在停止机器人");
sendCmdMsg(value,"正在启动边界设定");
});
// 启动基站初始化
findViewById(R.id.btn_base_init).setOnClickListener(v -> {
// sendUPbotCmd((byte) 0x10, "正在启动基站初始化");
byte value = MSG_CMD.BASE_INIT;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法启动基站初始化", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(value,"正在启动基站初始化");
});
//结束机器人
findViewById(R.id.btn_finish_robot).setOnClickListener(v -> {
byte value = MSG_CMD.STOP_MOWING;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法结束割草机器人程序", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(value,"正在结束割草机器人程序");
});
}
@Override
protected void onDestroy() {
super.onDestroy();
}
// void sendUPbotCmd(byte cmdType, String toastString){
// byte[] cmd = {0x5B, 0x01, 0x00, 0x01, cmdType, 0x00};
// // 根据cmd 计算校验和
// calculateAndSetChecksum(cmd);
// // 调用UPbotComm发送命令
// UPbotComm.getInstance().sendMessage(cmd);
// // 通知命令发送
// Toast.makeText(ClientActivity.this, toastString,
// Toast.LENGTH_SHORT).show();
// }
private void sendCmdMsg(byte cmd, String toast) {
byte[] result = SendMsg.sendCmdMsg(cmd);
UPbotComm.getInstance().sendMessage(result);
Toast.makeText(ClientActivity.this, toast, Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
/**
* bytesn-1
*/
// public static void calculateAndSetChecksum(byte[] bytes) {
// int sum = 0;
// for (int i = 0; i < bytes.length - 1; i++) {
// sum += bytes[i] & 0xFF; // 将字节转换为无符号值
// }
// byte checksum = (byte) (sum & 0xFF); // 取结果的低 8 位
// bytes[bytes.length - 1] = checksum; // 将校验和写入最后一位
// }
}

View File

@ -1,43 +1,19 @@
package com.example.upbot;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
public class EditActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
Toolbar toolbar = findViewById(R.id.toolBar_edit);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Drawable overflowIcon = ContextCompat.getDrawable(this, R.drawable.baseline_more_vert_24);
if (overflowIcon != null) {
toolbar.setOverflowIcon(overflowIcon);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home){
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View File

@ -33,4 +33,6 @@ public class MSG_CMD {
public static final byte PAUSE_MOWING = 0x09;
// public static final String PAUSE_MOWING = "0x09";
public static final byte BASE_INIT = 0x10;
}

View File

@ -2,7 +2,6 @@ package com.example.upbot;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
@ -14,8 +13,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
@ -47,6 +44,8 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
//位置更改监听
private OnLocationChangedListener mListener;
private ActionBar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -81,28 +80,16 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
}
});
findViewById(R.id.robot_start).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
findViewById(R.id.imageView).setOnClickListener(v -> {
Intent intent=new Intent(MainActivity.this,RobotActivity.class);
startActivity(intent);
}
});
findViewById(R.id.tv_setting_main).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
findViewById(R.id.tv_setting_main).setOnClickListener(v -> {
Intent intent=new Intent(MainActivity.this,EditActivity.class);
startActivity(intent);
}
});
findViewById(R.id.iv_three_main).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
}
public void activate(OnLocationChangedListener onLocationChangedListener) {

View File

@ -1,10 +1,5 @@
package com.example.upbot;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Menu;
@ -12,6 +7,11 @@ import android.view.MenuItem;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
public class RobotActivity extends AppCompatActivity {
private ImageButton btn_quiet, btn_standard, btn_strong, btn_super, btn_water_less, btn_water_medium, btn_water_high;
@ -22,17 +22,6 @@ public class RobotActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_robot);
Toolbar toolbar = findViewById(R.id.toolBar_robot);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Drawable overflowIcon = ContextCompat.getDrawable(this, R.drawable.baseline_more_vert_24);
if (overflowIcon != null) {
toolbar.setOverflowIcon(overflowIcon);
}
initViews();
setListeners();
}
@ -152,12 +141,4 @@ public class RobotActivity extends AppCompatActivity {
}
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home){
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View File

@ -5,9 +5,6 @@ package com.example.upbot;
import com.example.upbot.MSG.Head;
import com.example.upbot.MSG.MsgId;
import java.util.zip.CRC32;
import java.util.zip.Checksum;
public class SendMsg {
public static byte[] sendCmdMsg(byte value){
Head head = new Head();

View File

@ -25,7 +25,7 @@ public class SplashActivity extends AppCompatActivity {
public void run() {
super.run();
try {
sleep(3000);//使程序休眠3
sleep(1000);//使程序休眠1
Intent intent=new Intent(getApplicationContext(),MainActivity.class);
startActivity(intent);
finish();

View File

@ -5,13 +5,11 @@ import static com.example.upbot.ClientActivity.handler;
import android.annotation.SuppressLint;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Arrays;
public class UPbotComm {
@SuppressLint("StaticFieldLeak")
@ -23,10 +21,9 @@ public class UPbotComm {
@SuppressLint("StaticFieldLeak")
private UPbotComm() {
}
public SocketConnectThread threadInit(){
static String TAG = "UPBotComm";
public void threadInit(){
socketConnectThread = new SocketConnectThread();
return socketConnectThread;
}
public static UPbotComm getInstance() {
if (instance == null) {
@ -39,27 +36,18 @@ public class UPbotComm {
return instance;
}
class SocketConnectThread extends Thread{
@Override
public void run(){
try {
//指定ip地址和端口号
Log.d("UPBOTCOMM", ip);
Log.d(TAG, ip);
mSocket = new Socket(ip, 19890);
if(mSocket != null){
status = true;
}
//获取输出流、输入流
// mOutStream = mSocket.getOutputStream();
// mInStream = mSocket.getInputStream();
} catch (Exception e) {
e.printStackTrace();
Log.d(TAG, "打开socket失败");
status = false;
}
startReader(mSocket);
}
}
public boolean connect(String Uip){
ip = Uip;
@ -71,7 +59,7 @@ public class UPbotComm {
}
/**
*
* @param msg
* @param msg : the string data which to send
*/
public void sendMessage(final String msg) {
if (msg.isEmpty() || !status){
@ -84,13 +72,14 @@ public class UPbotComm {
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
writer.writeUTF(msg); // 写一个UTF-8的信息
} catch (IOException e) {
e.printStackTrace();
Log.e(TAG,"发送消息字符串时发生异常");
}
}
}.start();
}
public void sendMessage(final byte[] msg) {
if (msg == null || msg.length == 0 || !status) {
public void sendMessage(final byte[] data) {
if (data == null || data.length == 0 || !status) {
return;
}
new Thread() {
@ -98,9 +87,11 @@ public class UPbotComm {
public void run() {
try {
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
writer.write(msg);
// 写入字节数组
writer.write(data);
} catch (IOException e) {
e.printStackTrace();
// 使用日志记录器输出异常信息,指定了日志级别和消息
Log.e(TAG,"发送消息时发生异常");
}
}
}.start();
@ -110,7 +101,7 @@ public class UPbotComm {
return status;
}
/**
*
* :
*/
private void startReader(final Socket socket) {
new Thread(){
@ -129,7 +120,7 @@ public class UPbotComm {
handler.sendMessage(message);
}
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG, "Read data exception.");
}
}
}.start();
@ -139,7 +130,7 @@ public class UPbotComm {
try {
mSocket.close();
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG, "Release socket error");
}
}
}

View File

@ -8,16 +8,49 @@
android:orientation="vertical"
android:background="#F0F0F0"
tools:context=".ClientActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar_client"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
<androidx.constraintlayout.widget.ConstraintLayout
android:background="@color/toolbar_color"
app:navigationIcon="@drawable/iv_back"
app:title="机器人控制"
app:titleMarginStart="80dp"
app:titleTextColor="@color/white"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<ImageView
android:id="@+id/iv_three_main"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:background="@drawable/iv_three"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="@color/text_color"
android:text="机器人控制"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/tv_setting_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="设置"
android:textColor="@color/text_color"
android:textSize="20sp"
app:layout_constraintBaseline_toBaselineOf="@id/tv_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
@ -26,12 +59,12 @@
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_run_robot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:layout_marginRight="10dp"
>
android:background="@drawable/ripple_effect">
<TextView
android:id="@+id/textView11"
@ -43,7 +76,7 @@
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/start_robot_iv" />
app:layout_constraintTop_toBottomOf="@+id/imageView5" />
<TextView
android:id="@+id/textView12"
@ -51,13 +84,11 @@
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="状态:机器人已就绪"
app:layout_constraintStart_toStartOf="@+id/textView11"
app:layout_constraintTop_toBottomOf="@+id/textView11" />
<ImageView
android:id="@+id/start_robot_iv"
android:background="@drawable/robot_start"
android:id="@+id/imageView5"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
@ -68,11 +99,11 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_full_coverage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
>
android:background="@drawable/ripple_effect">
<ImageView
android:id="@+id/imageView4"
@ -118,12 +149,12 @@
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_retrun_charge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:layout_marginEnd="10dp"
>
android:background="@drawable/ripple_effect">
<TextView
android:id="@+id/tv_charge"
@ -131,7 +162,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="@string/back_charging"
android:text="返回充电"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
@ -142,7 +173,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/last_charging"
android:text="上次充电: 一周前"
app:layout_constraintStart_toStartOf="@+id/tv_charge"
app:layout_constraintTop_toBottomOf="@+id/tv_charge" />
@ -158,14 +189,15 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_finish_robot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:background="@drawable/ripple_effect"
>
<ImageView
android:id="@+id/iv_stop_robot"
android:id="@+id/iv_lawn_patrol"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
@ -180,18 +212,18 @@
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="@string/finish"
android:text="结束程序"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_stop_robot" />
app:layout_constraintTop_toBottomOf="@+id/iv_lawn_patrol" />
<TextView
android:id="@+id/tv_lawn_patrol_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/turn_off"
android:text="点击关闭割草机"
app:layout_constraintStart_toStartOf="@+id/tv_lawn_patrol"
app:layout_constraintTop_toBottomOf="@+id/tv_lawn_patrol" />
@ -271,7 +303,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="@string/boundary_setting"
android:text="@string/geofencing_range_text"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
@ -282,7 +314,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/weilan"
android:text="@string/geofencing_range_state_text"
app:layout_constraintStart_toStartOf="@+id/tv_ranging_setting"
app:layout_constraintTop_toBottomOf="@+id/tv_ranging_setting" />
@ -293,26 +325,37 @@
<EditText
android:id="@+id/ipET"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/ip"
/>
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:hint="ip"
android:text="192.168.3.145" />
<Button
android:id="@+id/btn_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_server"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/connect_server_text"
android:gravity="center" />
<EditText
android:id="@+id/msgET"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/msg"/>
android:hint="@string/debug_data_send_hint"/>
<Button
android:id="@+id/btn_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send_msg"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/debug_data_send"
android:gravity="center"
android:backgroundTint="#1E88E5"/>
<TextView

View File

@ -5,24 +5,53 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000"
android:background="@color/toolbar_color"
android:padding="16dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar_edit"
<androidx.constraintlayout.widget.ConstraintLayout
android:background="@color/toolbar_color"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/black"
app:navigationIcon="@drawable/iv_back"
app:subtitleTextColor="@color/white"
app:title="设置"
app:titleMarginStart="120dp"
app:titleTextColor="@color/white"/>
android:layout_height="?attr/actionBarSize">
<ImageView
android:id="@+id/iv_three_main"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:background="@drawable/iv_three"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="@color/white"
android:text="设置"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="@+id/tv_setting_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/baseline_more_vert_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- 功能设置模块 -->
<TextView
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="68dp"
android:textColor="@color/text_color"
android:text="功能设置"
android:textSize="15sp"
android:paddingLeft="10dp"
@ -34,7 +63,7 @@
android:padding="10dp"
android:textSize="20sp"
android:text="地图保存模式(实验功能)"
android:textColor="#FFFFFF"
android:textColor="@color/white"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24" />
<TextView
@ -42,7 +71,7 @@
android:layout_height="50dp"
android:text="定时割草"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -51,7 +80,7 @@
android:layout_height="50dp"
android:text="设备设置"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -60,7 +89,7 @@
android:layout_height="50dp"
android:text="割草记录"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -69,7 +98,7 @@
android:layout_height="50dp"
android:text="耗材计时"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -78,7 +107,7 @@
android:layout_height="50dp"
android:text="遥控器"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -98,7 +127,7 @@
android:paddingLeft="10dp"
android:paddingTop="30dp"
android:text="地图管理"
android:textColor="@color/text_color"
android:textColor="@color/white"
android:textSize="15sp"
tools:ignore="SmallSp" />
@ -107,7 +136,7 @@
android:layout_height="50dp"
android:text="区域编辑"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -116,7 +145,7 @@
android:layout_height="50dp"
android:text="虚拟墙/禁区"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
@ -125,7 +154,7 @@
android:layout_height="50dp"
android:text="重置地图"
android:textSize="20sp"
android:textColor="#FFFFFF"
android:textColor="@color/white"
android:padding="10dp"
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>

View File

@ -64,8 +64,8 @@
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageButton
android:id="@+id/robot_start"
<ImageView
android:id="@+id/imageView"
android:layout_width="180dp"
android:layout_height="160dp"
android:layout_alignParentTop="true"
@ -74,7 +74,7 @@
android:layout_marginTop="0dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="0dp"
android:background="@drawable/robot_medium" />
app:srcCompat="@drawable/robot_medium" />
<TextView
android:id="@+id/textView"
@ -270,7 +270,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/robot_function"
android:text="最后作业"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView9"

View File

@ -8,17 +8,70 @@
android:background="@drawable/back"
tools:context=".MainActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar_robot"
<androidx.constraintlayout.widget.ConstraintLayout
android:background="@color/toolbar_color"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/black"
app:navigationIcon="@drawable/iv_back"
app:subtitle="充电完成"
app:subtitleTextColor="@color/white"
app:title="小白"
app:titleMarginStart="120dp"
app:titleTextColor="@color/white"/>
android:layout_height="?attr/actionBarSize">
<ImageView
android:id="@+id/iv_three_main"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:background="@drawable/iv_three"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="小白"
android:textColor="@color/text_color"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/tv_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textColor="@color/text_color"
android:text="充电完成"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_setting_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="设置"
android:textColor="@color/text_color"
android:textSize="20sp"
app:layout_constraintBaseline_toBaselineOf="@id/tv_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"

View File

@ -2,14 +2,14 @@
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="purple_700">#0E5E9E</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#FF0000</color>
<color name="text_color">#AAA6A6</color>
<color name="text_white">#DCD5D5</color>
<color name="text_blue">#1296db</color>
<color name="toolbar_color">#0E5E9E</color>
<color name="text_color">#AAA6A6</color>
<color name="text_blue">#1296db</color>
<color name="text_white">#DCD5D5</color>
</resources>

View File

@ -6,20 +6,16 @@
<string name="shen_an_team">深安实验室研发出品</string>
<string name="shen_an_team_en">\@ShenAn Technology Co.,Ltd</string>
<!-- 机器人控制Activity-->
<string name="scan_date_text_info">上次巡逻: 1天前</string>
<string name="debug_data_send">调试信息发送</string>
<string name="debug_data_send_hint">调试命令</string>
<string name="connect_server_text">连接服务器</string>
<string name="geofencing_range_state_text">地理围栏:未设置</string>
<string name="geofencing_range_text">割草边界设定</string>
<string name="more">more\n</string>
<string name="boundary_setting">割草边界设定</string>
<string name="weilan">地理围栏:未设置</string>
<string name="back_charging">返回充电</string>
<string name="last_charging">上次充电: 一周前</string>
<string name="grass_garden">草坪巡逻</string>
<string name="last_garden">上次巡逻: 1天前</string>
<string name="connect_server">连接服务器</string>
<string name="ip">ip</string>
<string name="msg">msg</string>
<string name="send_msg">调试信息发送</string>
<string name="robot_function">机器人功能</string>
<string name="finish">结束程序</string>
<string name="turn_off">点击关闭割草机</string>
<string name="search">搜索</string>
<string name="message">消息</string>
<string name="about">关于</string>

View File

@ -1,6 +1,6 @@
#Tue May 28 16:29:54 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists