最新版本-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

@ -1,15 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

View File

@ -1,46 +1,46 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.upbot'
compileSdk 33
defaultConfig {
applicationId "com.example.upbot"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation(name: 'AMap3DMap_10.0.700_AMapSearch_9.7.2_AMapLocation_6.4.5_20240508', ext: 'aar')
//GoogleEasyPermission
implementation 'pub.devrel:easypermissions:3.0.0'
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.upbot'
compileSdk 33
defaultConfig {
applicationId "com.example.upbot"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation(name: 'AMap3DMap_10.0.700_AMapSearch_9.7.2_AMapLocation_6.4.5_20240508', ext: 'aar')
//GoogleEasyPermission
implementation 'pub.devrel:easypermissions:3.0.0'
}

View File

@ -1,21 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,20 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.example.upbot",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.example.upbot",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View File

@ -1,26 +1,26 @@
package com.example.upbot;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.upbot", appContext.getPackageName());
}
package com.example.upbot;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.upbot", appContext.getPackageName());
}
}

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"
android:exported="false" />
<activity
android:name=".SplashActivity"
<activity android:name=".MainActivity"
android:exported="false"/>
<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,181 +1,179 @@
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;
@SuppressLint("StaticFieldLeak")
public class ClientActivity extends AppCompatActivity {
private static EditText msgET;
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 TextView msgTV;
private static final String TAG="WifiDemoLogClientActivity";
@SuppressLint("HandlerLeak")
public static Handler handler = new Handler(Looper.myLooper()){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1){
stringBuffer.append(msg.obj);
stringBuffer.append("\n");
msgTV.setText(stringBuffer.toString());
}
}
};
@Override
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);
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);
}
private void setListener() {
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!UPbotComm.getInstance().getConnectStatus()) {
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.setEnabled(false);//连接只点一次
}
});
startRobot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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) {
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) {
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;
if(!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法停止", Toast.LENGTH_SHORT).show();
return;
}
sendCmdMsg(value,"正在停止机器人");
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
}
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();
}
package com.example.upbot;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.example.upbot.MSG.MSG_CMD;
import java.util.Objects;
@SuppressLint("StaticFieldLeak")
public class ClientActivity extends AppCompatActivity {
private static EditText msgET;
private static Button confirmBtn;
private static Button sendBtn;
private static EditText ipET;
private static final StringBuffer stringBuffer = new StringBuffer();
private static TextView msgTV;
// private static final String TAG="WifiDemoLogClientActivity";
@SuppressLint("HandlerLeak")
public static Handler handler = new Handler(Objects.requireNonNull(Looper.myLooper())) {
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if (msg.what == 1) {
stringBuffer.append(msg.obj);
stringBuffer.append("\n");
msgTV.setText(stringBuffer.toString());
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_client);
initView();
setListener();
}
private void initView() {
ipET = findViewById(R.id.ipET);
msgET = findViewById(R.id.msgET);
sendBtn = findViewById(R.id.btn_send);
confirmBtn = findViewById(R.id.btn_confirm);
msgTV = findViewById(R.id.msgTV);
}
private void setListener() {
sendBtn.setOnClickListener(v -> {
if (!UPbotComm.getInstance().getConnectStatus()) {
Toast.makeText(ClientActivity.this, "连接失败无法发送",
Toast.LENGTH_SHORT).show();
return;
}
UPbotComm.getInstance().sendMessage(msgET.getText().toString());
});
confirmBtn.setOnClickListener(v -> {
// 给定IP地址尝试连接
UPbotComm.getInstance().connect(ipET.getText().toString());
confirmBtn.setEnabled(false); // 连接只点一次
});
// 点击按钮启动机器人
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,"正在启动机器人");
});
// 全覆盖命令
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,"正则启动全覆盖割草");
});
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,"正在返回充电");
});
// 设定割草边界
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();
return;
}
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,"正在结束割草机器人程序");
});
}
// 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,141 +1,141 @@
package com.example.upbot;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
public class ESP8266ClientActivity extends AppCompatActivity {
private String mIp;//硬件的IP
private int mPort = 5000;//硬件的端口
private EditText et_ip;//输入硬件对应的IP
private EditText et_msg;//输入要发送的消息
private Button btn_confirm;//进行连接
private Button btn_send;//发送消息
// Socket mSocket = null;//连接成功可得到的Socket
// OutputStream outputStream = null;//定义输出流
// InputStream inputStream = null;//定义输入流
private StringBuffer sb = new StringBuffer();//消息
private TextView tv_msg;//显示消息
private boolean connectFlage = true;//连接成功或连接3s后变false
private TextView connetStatusTextView;//显示连接状态
private int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
private final String TAG = "WifiDemoLogESP8266ClientActivity";
private LocalBroadcastManager localBroadcastManager;//本地广播管理器
private MyLocalBroadcastReceiver localBroadcastReceiver;//广播接收者
private int connectingCount=0;//用来刷新 正在连接 与 正 在 连 接
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_esp8266_client);
initView();//初始化控件
setListener();//设置Button的点击事件
registerBroadcastReceiver();//广播注册
}
/**
*
*/
private void initView() {
et_ip = (EditText) findViewById(R.id.et_ipESP8266);
et_msg = (EditText) findViewById(R.id.et_msgESP8266);
btn_send = findViewById(R.id.btn_sendESP8266);
btn_confirm = findViewById(R.id.btn_confirmESP8266);
tv_msg = (TextView) findViewById(R.id.tv_msgESP8266);
connetStatusTextView = findViewById(R.id.connetStatusTV);
}
/**
* Button
*/
private void setListener() {
btn_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btn_confirm.setEnabled(false);//防止正在连接时再次点击连接
WiFiModeUtil.connectFlage=true;
mIp = et_ip.getText().toString();//得到IP
WiFiModeUtil.connetByTCP(mIp,mPort);//进行连接
}
});
btn_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (WiFiModeUtil.mSocket == null) {
Toast.makeText(ESP8266ClientActivity.this, "未连接任何设备~~", Toast.LENGTH_SHORT).show();
return;
}
WiFiModeUtil.sendData(et_msg.getText().toString());//发送数据
}
});
}
@Override
protected void onDestroy() {
localBroadcastManager.unregisterReceiver(localBroadcastReceiver);//注销广播
WiFiModeUtil.closeSocketAndStream();//关闭Socket释放资源
super.onDestroy();
}
/**
* 广
*/
private void registerBroadcastReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("WiFiModeUtil.Connecting");//正在连接
intentFilter.addAction("WiFiModeUtil.Connect.Succeed");//连接成功
intentFilter.addAction("WiFiModeUtil.Connect.Fail");//连接失败
intentFilter.addAction("WiFiModeUtil.Connect.ReceiveMessage");//接收到数据
intentFilter.addAction("WiFiModeUtil.Disconnected");//接收到数据
localBroadcastReceiver = new MyLocalBroadcastReceiver();
localBroadcastManager = LocalBroadcastManager.getInstance(this);
WiFiModeUtil.localBroadcastManager=localBroadcastManager;//给WiFiModeUtil工具类中的本地广播管理器赋值
localBroadcastManager.registerReceiver(localBroadcastReceiver,intentFilter);
}
/**
* 广
*/
class MyLocalBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case "WiFiModeUtil.Connecting":
connectingCount++;
if(connectingCount%2==0)
connetStatusTextView.setText("正在连接");
else
connetStatusTextView.setText("正 在 连 接");
break;
case "WiFiModeUtil.Connect.Succeed":
connetStatusTextView.setText("连接成功");
btn_confirm.setEnabled(true);
break;
case "WiFiModeUtil.Connect.Fail":
connetStatusTextView.setText("连接失败");
btn_confirm.setEnabled(true);
break;
case "WiFiModeUtil.Connect.ReceiveMessage":
tv_msg.setText(WiFiModeUtil.DataRecivice.toString());
break;
case "WiFiModeUtil.Disconnected":
tv_msg.setText("连接已断开,请重新进行连接");
break;
}
}
}
package com.example.upbot;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
public class ESP8266ClientActivity extends AppCompatActivity {
private String mIp;//硬件的IP
private int mPort = 5000;//硬件的端口
private EditText et_ip;//输入硬件对应的IP
private EditText et_msg;//输入要发送的消息
private Button btn_confirm;//进行连接
private Button btn_send;//发送消息
// Socket mSocket = null;//连接成功可得到的Socket
// OutputStream outputStream = null;//定义输出流
// InputStream inputStream = null;//定义输入流
private StringBuffer sb = new StringBuffer();//消息
private TextView tv_msg;//显示消息
private boolean connectFlage = true;//连接成功或连接3s后变false
private TextView connetStatusTextView;//显示连接状态
private int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
private final String TAG = "WifiDemoLogESP8266ClientActivity";
private LocalBroadcastManager localBroadcastManager;//本地广播管理器
private MyLocalBroadcastReceiver localBroadcastReceiver;//广播接收者
private int connectingCount=0;//用来刷新 正在连接 与 正 在 连 接
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_esp8266_client);
initView();//初始化控件
setListener();//设置Button的点击事件
registerBroadcastReceiver();//广播注册
}
/**
*
*/
private void initView() {
et_ip = (EditText) findViewById(R.id.et_ipESP8266);
et_msg = (EditText) findViewById(R.id.et_msgESP8266);
btn_send = findViewById(R.id.btn_sendESP8266);
btn_confirm = findViewById(R.id.btn_confirmESP8266);
tv_msg = (TextView) findViewById(R.id.tv_msgESP8266);
connetStatusTextView = findViewById(R.id.connetStatusTV);
}
/**
* Button
*/
private void setListener() {
btn_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
btn_confirm.setEnabled(false);//防止正在连接时再次点击连接
WiFiModeUtil.connectFlage=true;
mIp = et_ip.getText().toString();//得到IP
WiFiModeUtil.connetByTCP(mIp,mPort);//进行连接
}
});
btn_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (WiFiModeUtil.mSocket == null) {
Toast.makeText(ESP8266ClientActivity.this, "未连接任何设备~~", Toast.LENGTH_SHORT).show();
return;
}
WiFiModeUtil.sendData(et_msg.getText().toString());//发送数据
}
});
}
@Override
protected void onDestroy() {
localBroadcastManager.unregisterReceiver(localBroadcastReceiver);//注销广播
WiFiModeUtil.closeSocketAndStream();//关闭Socket释放资源
super.onDestroy();
}
/**
* 广
*/
private void registerBroadcastReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("WiFiModeUtil.Connecting");//正在连接
intentFilter.addAction("WiFiModeUtil.Connect.Succeed");//连接成功
intentFilter.addAction("WiFiModeUtil.Connect.Fail");//连接失败
intentFilter.addAction("WiFiModeUtil.Connect.ReceiveMessage");//接收到数据
intentFilter.addAction("WiFiModeUtil.Disconnected");//接收到数据
localBroadcastReceiver = new MyLocalBroadcastReceiver();
localBroadcastManager = LocalBroadcastManager.getInstance(this);
WiFiModeUtil.localBroadcastManager=localBroadcastManager;//给WiFiModeUtil工具类中的本地广播管理器赋值
localBroadcastManager.registerReceiver(localBroadcastReceiver,intentFilter);
}
/**
* 广
*/
class MyLocalBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case "WiFiModeUtil.Connecting":
connectingCount++;
if(connectingCount%2==0)
connetStatusTextView.setText("正在连接");
else
connetStatusTextView.setText("正 在 连 接");
break;
case "WiFiModeUtil.Connect.Succeed":
connetStatusTextView.setText("连接成功");
btn_confirm.setEnabled(true);
break;
case "WiFiModeUtil.Connect.Fail":
connetStatusTextView.setText("连接失败");
btn_confirm.setEnabled(true);
break;
case "WiFiModeUtil.Connect.ReceiveMessage":
tv_msg.setText(WiFiModeUtil.DataRecivice.toString());
break;
case "WiFiModeUtil.Disconnected":
tv_msg.setText("连接已断开,请重新进行连接");
break;
}
}
}
}

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

@ -1,306 +1,293 @@
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;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
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;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps.AMap;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.MapView;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.MyLocationStyle;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
public class MainActivity extends AppCompatActivity implements AMapLocationListener, LocationSource{
private MyLocationStyle myLocationStyle = new MyLocationStyle();
//声明AMapLocationClient类对象
public AMapLocationClient mLocationClient = null;
//声明AMapLocationClientOption对象
public AMapLocationClientOption mLocationOption = null;
//请求权限码
private static final int REQUEST_PERMISSIONS = 9527;
//内容
private MapView mapView;
//地图控制器
private AMap aMap = null;
//位置更改监听
private OnLocationChangedListener mListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);
initLocation();
initMap(savedInstanceState);
checkingAndroidVersion();
findViewById(R.id.base_config_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this, ServiceActivity.class);
startActivity(intent);
}
});
findViewById(R.id.mowing_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,ClientActivity.class);
startActivity(intent);
}
});
findViewById(R.id.client_mode_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,ESP8266ClientActivity.class);
startActivity(intent);
}
});
findViewById(R.id.robot_start).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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) {
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) {
mListener = onLocationChangedListener;
if (mLocationClient != null) {
mLocationClient.startLocation();//启动定位
}
}
/**
*
*/
@Override
public void deactivate() {
mListener = null;
if (mLocationClient != null) {
mLocationClient.stopLocation();
mLocationClient.onDestroy();
}
mLocationClient = null;
}
/**
*
* @param savedInstanceState
*/
private void initMap(Bundle savedInstanceState) {
mapView = findViewById(R.id.map_view);
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
mapView.onCreate(savedInstanceState);
//初始化地图控制器对象
aMap = mapView.getMap();
//设置最小缩放等级为16 ,缩放级别范围为[3, 20]
aMap.setMinZoomLevel(12);
// 自定义定位蓝点图标
myLocationStyle.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.baseline_location_on_24));
// 自定义精度范围的圆形边框颜色 都为0则透明
myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
// 自定义精度范围的圆形边框宽度 0 无宽度
myLocationStyle.strokeWidth(0);
// 设置圆形的填充颜色 都为0则透明
myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
//设置定位蓝点的Style
aMap.setMyLocationStyle(myLocationStyle);
// 设置定位监听
aMap.setLocationSource(this);
// 设置为true表示显示定位层并可触发定位false表示隐藏定位层并不可触发定位默认是false
aMap.setMyLocationEnabled(true);
}
/**
*
*/
private void initLocation() {
//初始化定位
try {
mLocationClient = new AMapLocationClient(getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
if (mLocationClient != null) {
//设置定位回调监听
mLocationClient.setLocationListener(this);
//初始化AMapLocationClientOption对象
mLocationOption = new AMapLocationClientOption();
//设置定位模式为AMapLocationMode.Hight_Accuracy高精度模式。
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//获取最近3s内精度最高的一次定位结果
//设置setOnceLocationLatest(boolean b)接口为true启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为truesetOnceLocation(boolean b)接口也会被设置为true反之不会默认为false。
mLocationOption.setOnceLocationLatest(true);
//设置是否返回地址信息(默认返回地址信息)
mLocationOption.setNeedAddress(true);
//设置定位请求超时时间单位是毫秒默认30000毫秒建议超时时间不要低于8000毫秒。
mLocationOption.setHttpTimeOut(20000);
//关闭缓存机制,高精度定位会产生缓存。
mLocationOption.setLocationCacheEnable(false);
//给定位客户端对象设置定位参数
mLocationClient.setLocationOption(mLocationOption);
}
}
/**
*
*
* @param aMapLocation
*/
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (aMapLocation != null) {
if (aMapLocation.getErrorCode() == 0) {
//地址
String address = aMapLocation.getAddress();
double latitude = aMapLocation.getLatitude();
double longitude = aMapLocation.getLongitude();
StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append("纬度:").append(latitude).append("\n");
stringBuffer.append("经度:").append(longitude).append("\n");
stringBuffer.append("地址:").append(address).append("\n");
Log.d("MainActivity",stringBuffer.toString());
showMsg(address);
mLocationClient.stopLocation();
if (mListener != null){
mListener.onLocationChanged(aMapLocation);
}
} else {
//定位失败时可通过ErrCode错误码信息来确定失败的原因errInfo是错误信息详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ aMapLocation.getErrorCode() + ", errInfo:"
+ aMapLocation.getErrorInfo());
}
}
}
/**
* Android
*/
private void checkingAndroidVersion() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
//Android6.0及以上先获取权限再定位
requestPermission();
}else {
//Android6.0以下直接定位
mLocationClient.startLocation();
}
}
/**
*
*/
@AfterPermissionGranted(REQUEST_PERMISSIONS)
private void requestPermission() {
String[] permissions = new String[]{
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.READ_PHONE_STATE",
"android.permission.WRITE_EXTERNAL_STORAGE"
};
if (EasyPermissions.hasPermissions(this, permissions)) {
//true 有权限 开始定位
showMsg("已获得权限,可以定位啦!");
mLocationClient.startLocation();
} else {
//false 无权限
EasyPermissions.requestPermissions(this, "需要权限", REQUEST_PERMISSIONS, permissions);
}
}
/**
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//设置权限请求结果
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
/**
* Toast
* @param msg
*/
private void showMsg(String msg){
Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume() {
super.onResume();
//在activity执行onResume时执行mMapView.onResume (),重新绘制加载地图
mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
//在activity执行onPause时执行mMapView.onPause (),暂停地图的绘制
mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState),保存地图当前的状态
mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
//销毁定位客户端,同时销毁本地定位服务。
mLocationClient.onDestroy();
mapView.onDestroy();
}
package com.example.upbot;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps.AMap;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.MapView;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.MyLocationStyle;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
public class MainActivity extends AppCompatActivity implements AMapLocationListener, LocationSource{
private MyLocationStyle myLocationStyle = new MyLocationStyle();
//声明AMapLocationClient类对象
public AMapLocationClient mLocationClient = null;
//声明AMapLocationClientOption对象
public AMapLocationClientOption mLocationOption = null;
//请求权限码
private static final int REQUEST_PERMISSIONS = 9527;
//内容
private MapView mapView;
//地图控制器
private AMap aMap = null;
//位置更改监听
private OnLocationChangedListener mListener;
private ActionBar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);
initLocation();
initMap(savedInstanceState);
checkingAndroidVersion();
findViewById(R.id.base_config_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this, ServiceActivity.class);
startActivity(intent);
}
});
findViewById(R.id.mowing_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,ClientActivity.class);
startActivity(intent);
}
});
findViewById(R.id.client_mode_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,ESP8266ClientActivity.class);
startActivity(intent);
}
});
findViewById(R.id.imageView).setOnClickListener(v -> {
Intent intent=new Intent(MainActivity.this,RobotActivity.class);
startActivity(intent);
});
findViewById(R.id.tv_setting_main).setOnClickListener(v -> {
Intent intent=new Intent(MainActivity.this,EditActivity.class);
startActivity(intent);
});
}
public void activate(OnLocationChangedListener onLocationChangedListener) {
mListener = onLocationChangedListener;
if (mLocationClient != null) {
mLocationClient.startLocation();//启动定位
}
}
/**
*
*/
@Override
public void deactivate() {
mListener = null;
if (mLocationClient != null) {
mLocationClient.stopLocation();
mLocationClient.onDestroy();
}
mLocationClient = null;
}
/**
*
* @param savedInstanceState
*/
private void initMap(Bundle savedInstanceState) {
mapView = findViewById(R.id.map_view);
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
mapView.onCreate(savedInstanceState);
//初始化地图控制器对象
aMap = mapView.getMap();
//设置最小缩放等级为16 ,缩放级别范围为[3, 20]
aMap.setMinZoomLevel(12);
// 自定义定位蓝点图标
myLocationStyle.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.baseline_location_on_24));
// 自定义精度范围的圆形边框颜色 都为0则透明
myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
// 自定义精度范围的圆形边框宽度 0 无宽度
myLocationStyle.strokeWidth(0);
// 设置圆形的填充颜色 都为0则透明
myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
//设置定位蓝点的Style
aMap.setMyLocationStyle(myLocationStyle);
// 设置定位监听
aMap.setLocationSource(this);
// 设置为true表示显示定位层并可触发定位false表示隐藏定位层并不可触发定位默认是false
aMap.setMyLocationEnabled(true);
}
/**
*
*/
private void initLocation() {
//初始化定位
try {
mLocationClient = new AMapLocationClient(getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
if (mLocationClient != null) {
//设置定位回调监听
mLocationClient.setLocationListener(this);
//初始化AMapLocationClientOption对象
mLocationOption = new AMapLocationClientOption();
//设置定位模式为AMapLocationMode.Hight_Accuracy高精度模式。
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//获取最近3s内精度最高的一次定位结果
//设置setOnceLocationLatest(boolean b)接口为true启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为truesetOnceLocation(boolean b)接口也会被设置为true反之不会默认为false。
mLocationOption.setOnceLocationLatest(true);
//设置是否返回地址信息(默认返回地址信息)
mLocationOption.setNeedAddress(true);
//设置定位请求超时时间单位是毫秒默认30000毫秒建议超时时间不要低于8000毫秒。
mLocationOption.setHttpTimeOut(20000);
//关闭缓存机制,高精度定位会产生缓存。
mLocationOption.setLocationCacheEnable(false);
//给定位客户端对象设置定位参数
mLocationClient.setLocationOption(mLocationOption);
}
}
/**
*
*
* @param aMapLocation
*/
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (aMapLocation != null) {
if (aMapLocation.getErrorCode() == 0) {
//地址
String address = aMapLocation.getAddress();
double latitude = aMapLocation.getLatitude();
double longitude = aMapLocation.getLongitude();
StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append("纬度:").append(latitude).append("\n");
stringBuffer.append("经度:").append(longitude).append("\n");
stringBuffer.append("地址:").append(address).append("\n");
Log.d("MainActivity",stringBuffer.toString());
showMsg(address);
mLocationClient.stopLocation();
if (mListener != null){
mListener.onLocationChanged(aMapLocation);
}
} else {
//定位失败时可通过ErrCode错误码信息来确定失败的原因errInfo是错误信息详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ aMapLocation.getErrorCode() + ", errInfo:"
+ aMapLocation.getErrorInfo());
}
}
}
/**
* Android
*/
private void checkingAndroidVersion() {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
//Android6.0及以上先获取权限再定位
requestPermission();
}else {
//Android6.0以下直接定位
mLocationClient.startLocation();
}
}
/**
*
*/
@AfterPermissionGranted(REQUEST_PERMISSIONS)
private void requestPermission() {
String[] permissions = new String[]{
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.READ_PHONE_STATE",
"android.permission.WRITE_EXTERNAL_STORAGE"
};
if (EasyPermissions.hasPermissions(this, permissions)) {
//true 有权限 开始定位
showMsg("已获得权限,可以定位啦!");
mLocationClient.startLocation();
} else {
//false 无权限
EasyPermissions.requestPermissions(this, "需要权限", REQUEST_PERMISSIONS, permissions);
}
}
/**
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//设置权限请求结果
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
/**
* Toast
* @param msg
*/
private void showMsg(String msg){
Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume() {
super.onResume();
//在activity执行onResume时执行mMapView.onResume (),重新绘制加载地图
mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
//在activity执行onPause时执行mMapView.onPause (),暂停地图的绘制
mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState),保存地图当前的状态
mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
//销毁定位客户端,同时销毁本地定位服务。
mLocationClient.onDestroy();
mapView.onDestroy();
}
}

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

@ -1,205 +1,205 @@
package com.example.upbot;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class ServiceActivity extends AppCompatActivity {
private Button clearBtn;
private Button showIPBtn;
private TextView ipTV;
private TextView msgTV;
private ServerSocket mServerSocket;
private Socket mSocket;
private StringBuffer stringBuffer = new StringBuffer();
private final String TAG = "WifiDemoLogServiceActivity";
@SuppressLint("HandlerLeak")
public Handler handler = new Handler(Looper.myLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1) {
stringBuffer.append(msg.obj);
stringBuffer.append("\n");
msgTV.setText(stringBuffer.toString());
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_service);
initView();
setListener();
try {
mServerSocket = new ServerSocket(5000);//端口号5000
} catch (IOException e) {
e.printStackTrace();
}
//启动服务线程
SocketAcceptThread socketAcceptThread = new SocketAcceptThread();
socketAcceptThread.start();
}
/**
*
*/
private void initView() {
clearBtn = findViewById(R.id.clearBtn);
showIPBtn = findViewById(R.id.showIPBtn);
ipTV = findViewById(R.id.ipTV);
msgTV = findViewById(R.id.msgTV);
}
/**
*
*/
private void setListener() {
clearBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stringBuffer.setLength(0);
msgTV.setText("");
}
});
showIPBtn.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View v) {
ipTV.setText(getLocalIpAddress(ServiceActivity.this) + ":5000");
}
});
}
/**
* 线
* Socket
*/
class SocketAcceptThread extends Thread {
@Override
public void run() {
try {
//等待客户端的连接Accept会阻塞直到建立连接
//所以需要放在子线程中运行
mSocket = mServerSocket.accept();
} catch (IOException e) {
e.printStackTrace();
return;
}
//启动消息接收线程
startReader(mSocket);
}
}
/**
* Socket
*/
private void startReader(final Socket socket) {
new Thread() {
@Override
public void run() {
DataInputStream reader;
try {
// 获取读取流
reader = new DataInputStream(socket.getInputStream());
while (true) {
// 读取数据
String msg = reader.readUTF();
Log.d(TAG, "客户端的信息:" + msg);
//告知客户端消息收到
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
writer.writeUTF("收到:" + msg); // 写一个UTF-8的信息
//发消息更新UI
Message message = new Message();
message.what = 1;
message.obj=msg;
handler.sendMessage(message);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
@Override
protected void onDestroy() {
if (mServerSocket != null) {
try {
mServerSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(mSocket!=null){
try {
mSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
super.onDestroy();
}
/**
* ipip
*
* @param ipInt
* @return
*/
public static String int2ip(int ipInt) {
StringBuilder sb = new StringBuilder();
sb.append(ipInt & 0xFF).append(".");
sb.append((ipInt >> 8) & 0xFF).append(".");
sb.append((ipInt >> 16) & 0xFF).append(".");
sb.append((ipInt >> 24) & 0xFF);
return sb.toString();
}
/**
* ip
*
* @param context
* @return
*/
public static String getLocalIpAddress(Context context) {
try {
WifiManager wifiManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int i = wifiInfo.getIpAddress();
return int2ip(i);
} catch (Exception ex) {
return " 获取IP出错鸟!!!!请保证是WIFI,或者请重新打开网络!\n" + ex.getMessage();
}
// return null;
}
package com.example.upbot;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class ServiceActivity extends AppCompatActivity {
private Button clearBtn;
private Button showIPBtn;
private TextView ipTV;
private TextView msgTV;
private ServerSocket mServerSocket;
private Socket mSocket;
private StringBuffer stringBuffer = new StringBuffer();
private final String TAG = "WifiDemoLogServiceActivity";
@SuppressLint("HandlerLeak")
public Handler handler = new Handler(Looper.myLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1) {
stringBuffer.append(msg.obj);
stringBuffer.append("\n");
msgTV.setText(stringBuffer.toString());
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_service);
initView();
setListener();
try {
mServerSocket = new ServerSocket(5000);//端口号5000
} catch (IOException e) {
e.printStackTrace();
}
//启动服务线程
SocketAcceptThread socketAcceptThread = new SocketAcceptThread();
socketAcceptThread.start();
}
/**
*
*/
private void initView() {
clearBtn = findViewById(R.id.clearBtn);
showIPBtn = findViewById(R.id.showIPBtn);
ipTV = findViewById(R.id.ipTV);
msgTV = findViewById(R.id.msgTV);
}
/**
*
*/
private void setListener() {
clearBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stringBuffer.setLength(0);
msgTV.setText("");
}
});
showIPBtn.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View v) {
ipTV.setText(getLocalIpAddress(ServiceActivity.this) + ":5000");
}
});
}
/**
* 线
* Socket
*/
class SocketAcceptThread extends Thread {
@Override
public void run() {
try {
//等待客户端的连接Accept会阻塞直到建立连接
//所以需要放在子线程中运行
mSocket = mServerSocket.accept();
} catch (IOException e) {
e.printStackTrace();
return;
}
//启动消息接收线程
startReader(mSocket);
}
}
/**
* Socket
*/
private void startReader(final Socket socket) {
new Thread() {
@Override
public void run() {
DataInputStream reader;
try {
// 获取读取流
reader = new DataInputStream(socket.getInputStream());
while (true) {
// 读取数据
String msg = reader.readUTF();
Log.d(TAG, "客户端的信息:" + msg);
//告知客户端消息收到
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
writer.writeUTF("收到:" + msg); // 写一个UTF-8的信息
//发消息更新UI
Message message = new Message();
message.what = 1;
message.obj=msg;
handler.sendMessage(message);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
@Override
protected void onDestroy() {
if (mServerSocket != null) {
try {
mServerSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(mSocket!=null){
try {
mSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
super.onDestroy();
}
/**
* ipip
*
* @param ipInt
* @return
*/
public static String int2ip(int ipInt) {
StringBuilder sb = new StringBuilder();
sb.append(ipInt & 0xFF).append(".");
sb.append((ipInt >> 8) & 0xFF).append(".");
sb.append((ipInt >> 16) & 0xFF).append(".");
sb.append((ipInt >> 24) & 0xFF);
return sb.toString();
}
/**
* ip
*
* @param context
* @return
*/
public static String getLocalIpAddress(Context context) {
try {
WifiManager wifiManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int i = wifiInfo.getIpAddress();
return int2ip(i);
} catch (Exception ex) {
return " 获取IP出错鸟!!!!请保证是WIFI,或者请重新打开网络!\n" + ex.getMessage();
}
// return null;
}
}

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();
status = true;
} 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(){
@ -125,11 +116,11 @@ public class UPbotComm {
String msg = reader.readUTF();
Message message = new Message();
message.what = 1;
message.obj=msg;
message.obj = msg;
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

@ -1,258 +1,258 @@
package com.example.upbot;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
/**
* 广Action:"WiFiModeUtil.Connecting"
* 广Action:"WiFiModeUtil.Connect.Fail"
* 广Action:"WiFiModeUtil.Connect.Succeed"
* 广Action:"WiFiModeUtil.Connect.ReceiveMessage"
* 广Action:"WiFiModeUtil.Disconnected"
*/
public class WiFiModeUtil {
private static String mIp;//硬件的IP
private static int mPort = 5000;//硬件的端口
public static Socket mSocket = null;//连接成功可得到的Socket
public static OutputStream outputStream = null;//定义输出流
public static InputStream inputStream = null;//定义输入流
public static StringBuffer DataRecivice = new StringBuffer();//数据
public static List<String> DataList=new ArrayList<>();//数据
public static boolean connectFlage = true;//连接成功或连接3s后变false
// private static int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
private static final String TAG = "WifiDemoLogESP8266ClientActivity";
/**
* 广 :
* WiFiModeUtil.localBroadcastManager=localBroadcastManager;
*
*/
public static LocalBroadcastManager localBroadcastManager;
/**
* Handler
*/
@SuppressLint("HandlerLeak")
public static Handler mHandler = new Handler(Looper.myLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0://接收到数据
DataRecivice.append(msg.obj.toString());
DataRecivice.append("\n");
DataList.add(msg.obj.toString());//添加数据
Intent intent = new Intent("WiFiModeUtil.Connect.ReceiveMessage");
localBroadcastManager.sendBroadcast(intent);//发送收到数据广播
break;
case 1://连接成功
Intent intent2 = new Intent("WiFiModeUtil.Connect.Succeed");
localBroadcastManager.sendBroadcast(intent2);//发送连接成功广播
readData();//开启接收线程
connectFlage = true;
break;
case 2://连接断开
Intent intent3 = new Intent("WiFiModeUtil.Disconnected");
localBroadcastManager.sendBroadcast(intent3);//发送连接失败广播
connectFlage = true;
break;
}
}
};
/***
* 3s
* 3s
* 3s
*/
private final static CountDownTimer tcpClientCountDownTimer = new CountDownTimer(3000, 300) {
@Override
public void onTick(long millisUntilFinished) {//每隔300ms进入
if (connectFlage) {
Intent intent = new Intent("WiFiModeUtil.Connecting");
localBroadcastManager.sendBroadcast(intent);
}
}
@Override
public void onFinish() {//3s后进入(没有取消定时器的情况下)
if (connectFlage) {
connectFlage = false;//连接失败
closeSocketAndStream();
}
tcpClientCountDownTimer.cancel();//关掉定时器
Intent intent = new Intent("WiFiModeUtil.Connect.Fail");
localBroadcastManager.sendBroadcast(intent);
Log.d(TAG,"连接失败");
}
};
/**
* Socket
*/
public static void closeSocketAndStream() {
if (outputStream != null) {
try {
outputStream.close();
Log.d(TAG,"关闭输出流");
} catch (IOException e) {
e.printStackTrace();
}
outputStream = null;
}
if (inputStream != null) {
try {
inputStream.close();
Log.d(TAG,"关闭输入流");
} catch (IOException e) {
e.printStackTrace();
}
inputStream = null;
}
if (mSocket != null) {
try {
mSocket.close();
Log.d(TAG,"关闭Socket");
} catch (IOException e) {
e.printStackTrace();
}
mSocket = null;
}
}
/**
*
*/
static class ConnectSeverThread extends Thread {
@Override
public void run() {
Log.d(TAG,"连接线程开启");
while (connectFlage) {
try {
Log.d(TAG,"正在连接...");
mSocket = new Socket(mIp, mPort);//进行连接
connectFlage = false;//已连接
tcpClientCountDownTimer.cancel();//关掉计时器
/*连接成功更新显示连接状态的UI*/
Message msg = new Message();
msg.what = 1;
mHandler.sendMessage(msg);
Log.d(TAG,"连接成功");
inputStream = mSocket.getInputStream();//获取输入流
Log.d(TAG,"获取输入流");
outputStream = mSocket.getOutputStream();////获取输出流
Log.d(TAG,"获取输出流");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG,"连接过程中出错");
}
}
}
}
/**
* IPTCP
* 200ms 广
* 3 广
* 广
*
* @param IPAdress
*/
public static void connetByTCP(String IPAdress,int Port) {
mIp = IPAdress;
mPort=Port;
ConnectSeverThread connectSeverThread = new ConnectSeverThread();
connectSeverThread.start();
tcpClientCountDownTimer.start();
}
/**
*
*/
public static void sendData(String data) {
if(mSocket!=null){
byte[] sendByte = data.getBytes();
new Thread() {
@Override
public void run() {
try {
Log.d(TAG,"发送线程开启 正在发送中...");
DataOutputStream writer = new DataOutputStream(outputStream);
writer.write(sendByte, 0, sendByte.length);
Log.d(TAG,"已发送数据:"+data);
} catch (IOException e) {
e.printStackTrace();
}
Log.d(TAG,"发送线程结束");
}
}.start();
}
}
/**
*
*
*/
public static void readData() {
new Thread() {
@Override
public void run() {
Log.d(TAG,"接收线程开启");
try {
while (true) {
Thread.sleep(200);
//如果连接断开 尝试重连
try {
/*
sendUrgentData()
SocketSO_OOBINLINE
SO_OOBINLINE
*/
mSocket.sendUrgentData(0xFF);//发送1个字节的紧急数据默认情况下服务器端没有开启紧急数据处理不影响正常通信
} catch (Exception ex) {
Log.d(TAG,"连接已断开,请重新进行连接");
Message msg=new Message();
msg.what=2;
msg.obj="连接已断开,请重新进行连接";
mHandler.sendMessage(msg);
}
DataInputStream reader = new DataInputStream(inputStream);
byte[] buffer = new byte[1024];
int len;
while ((len = reader.read(buffer)) != -1) {
String data = new String(buffer, 0, len);
Log.d(TAG,"接收到数据:"+data);
Message msg = new Message();
msg.what = 0;
msg.obj = data;
mHandler.sendMessage(msg);
}
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
Log.d(TAG,"接收线程结束");
}
}.start();
}
}
package com.example.upbot;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
/**
* 广Action:"WiFiModeUtil.Connecting"
* 广Action:"WiFiModeUtil.Connect.Fail"
* 广Action:"WiFiModeUtil.Connect.Succeed"
* 广Action:"WiFiModeUtil.Connect.ReceiveMessage"
* 广Action:"WiFiModeUtil.Disconnected"
*/
public class WiFiModeUtil {
private static String mIp;//硬件的IP
private static int mPort = 5000;//硬件的端口
public static Socket mSocket = null;//连接成功可得到的Socket
public static OutputStream outputStream = null;//定义输出流
public static InputStream inputStream = null;//定义输入流
public static StringBuffer DataRecivice = new StringBuffer();//数据
public static List<String> DataList=new ArrayList<>();//数据
public static boolean connectFlage = true;//连接成功或连接3s后变false
// private static int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
private static final String TAG = "WifiDemoLogESP8266ClientActivity";
/**
* 广 :
* WiFiModeUtil.localBroadcastManager=localBroadcastManager;
*
*/
public static LocalBroadcastManager localBroadcastManager;
/**
* Handler
*/
@SuppressLint("HandlerLeak")
public static Handler mHandler = new Handler(Looper.myLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0://接收到数据
DataRecivice.append(msg.obj.toString());
DataRecivice.append("\n");
DataList.add(msg.obj.toString());//添加数据
Intent intent = new Intent("WiFiModeUtil.Connect.ReceiveMessage");
localBroadcastManager.sendBroadcast(intent);//发送收到数据广播
break;
case 1://连接成功
Intent intent2 = new Intent("WiFiModeUtil.Connect.Succeed");
localBroadcastManager.sendBroadcast(intent2);//发送连接成功广播
readData();//开启接收线程
connectFlage = true;
break;
case 2://连接断开
Intent intent3 = new Intent("WiFiModeUtil.Disconnected");
localBroadcastManager.sendBroadcast(intent3);//发送连接失败广播
connectFlage = true;
break;
}
}
};
/***
* 3s
* 3s
* 3s
*/
private final static CountDownTimer tcpClientCountDownTimer = new CountDownTimer(3000, 300) {
@Override
public void onTick(long millisUntilFinished) {//每隔300ms进入
if (connectFlage) {
Intent intent = new Intent("WiFiModeUtil.Connecting");
localBroadcastManager.sendBroadcast(intent);
}
}
@Override
public void onFinish() {//3s后进入(没有取消定时器的情况下)
if (connectFlage) {
connectFlage = false;//连接失败
closeSocketAndStream();
}
tcpClientCountDownTimer.cancel();//关掉定时器
Intent intent = new Intent("WiFiModeUtil.Connect.Fail");
localBroadcastManager.sendBroadcast(intent);
Log.d(TAG,"连接失败");
}
};
/**
* Socket
*/
public static void closeSocketAndStream() {
if (outputStream != null) {
try {
outputStream.close();
Log.d(TAG,"关闭输出流");
} catch (IOException e) {
e.printStackTrace();
}
outputStream = null;
}
if (inputStream != null) {
try {
inputStream.close();
Log.d(TAG,"关闭输入流");
} catch (IOException e) {
e.printStackTrace();
}
inputStream = null;
}
if (mSocket != null) {
try {
mSocket.close();
Log.d(TAG,"关闭Socket");
} catch (IOException e) {
e.printStackTrace();
}
mSocket = null;
}
}
/**
*
*/
static class ConnectSeverThread extends Thread {
@Override
public void run() {
Log.d(TAG,"连接线程开启");
while (connectFlage) {
try {
Log.d(TAG,"正在连接...");
mSocket = new Socket(mIp, mPort);//进行连接
connectFlage = false;//已连接
tcpClientCountDownTimer.cancel();//关掉计时器
/*连接成功更新显示连接状态的UI*/
Message msg = new Message();
msg.what = 1;
mHandler.sendMessage(msg);
Log.d(TAG,"连接成功");
inputStream = mSocket.getInputStream();//获取输入流
Log.d(TAG,"获取输入流");
outputStream = mSocket.getOutputStream();////获取输出流
Log.d(TAG,"获取输出流");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG,"连接过程中出错");
}
}
}
}
/**
* IPTCP
* 200ms 广
* 3 广
* 广
*
* @param IPAdress
*/
public static void connetByTCP(String IPAdress,int Port) {
mIp = IPAdress;
mPort=Port;
ConnectSeverThread connectSeverThread = new ConnectSeverThread();
connectSeverThread.start();
tcpClientCountDownTimer.start();
}
/**
*
*/
public static void sendData(String data) {
if(mSocket!=null){
byte[] sendByte = data.getBytes();
new Thread() {
@Override
public void run() {
try {
Log.d(TAG,"发送线程开启 正在发送中...");
DataOutputStream writer = new DataOutputStream(outputStream);
writer.write(sendByte, 0, sendByte.length);
Log.d(TAG,"已发送数据:"+data);
} catch (IOException e) {
e.printStackTrace();
}
Log.d(TAG,"发送线程结束");
}
}.start();
}
}
/**
*
*
*/
public static void readData() {
new Thread() {
@Override
public void run() {
Log.d(TAG,"接收线程开启");
try {
while (true) {
Thread.sleep(200);
//如果连接断开 尝试重连
try {
/*
sendUrgentData()
SocketSO_OOBINLINE
SO_OOBINLINE
*/
mSocket.sendUrgentData(0xFF);//发送1个字节的紧急数据默认情况下服务器端没有开启紧急数据处理不影响正常通信
} catch (Exception ex) {
Log.d(TAG,"连接已断开,请重新进行连接");
Message msg=new Message();
msg.what=2;
msg.obj="连接已断开,请重新进行连接";
mHandler.sendMessage(msg);
}
DataInputStream reader = new DataInputStream(inputStream);
byte[] buffer = new byte[1024];
int len;
while ((len = reader.read(buffer)) != -1) {
String data = new String(buffer, 0, len);
Log.d(TAG,"接收到数据:"+data);
Message msg = new Message();
msg.what = 0;
msg.obj = data;
mHandler.sendMessage(msg);
}
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
Log.d(TAG,"接收线程结束");
}
}.start();
}
}

View File

@ -1,30 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@ -1,5 +1,5 @@
<vector android:height="24dp" android:tint="#263483"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
</vector>
<vector android:height="24dp" android:tint="#263483"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
</vector>

View File

@ -1,5 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#9E8A8A" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.97,0.89 1.66,0.89L22,21c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM9,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM14,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM19,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
</vector>
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#9E8A8A" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.97,0.89 1.66,0.89L22,21c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM9,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM14,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM19,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
</vector>

View File

@ -1,170 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@ -1,323 +1,366 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
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"
android:background="@color/toolbar_color"
app:navigationIcon="@drawable/iv_back"
app:title="机器人控制"
app:titleMarginStart="80dp"
app:titleTextColor="@color/white"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:layout_marginRight="10dp"
>
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="启动机器人"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/start_robot_iv" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
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:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
>
<ImageView
android:id="@+id/imageView4"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/path_plan" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="全覆盖割草"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView4" />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="上次割草: 3天前"
app:layout_constraintStart_toStartOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
android:layout_marginEnd="10dp"
>
<TextView
android:id="@+id/tv_charge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="@string/back_charging"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_charge" />
<TextView
android:id="@+id/charge_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/last_charging"
app:layout_constraintStart_toStartOf="@+id/tv_charge"
app:layout_constraintTop_toBottomOf="@+id/tv_charge" />
<ImageView
android:id="@+id/iv_charge"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_charge" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/rounded_corner_bg"
>
<ImageView
android:id="@+id/iv_stop_robot"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/iv_finish" />
<TextView
android:id="@+id/tv_lawn_patrol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="@string/finish"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_stop_robot" />
<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"
app:layout_constraintStart_toStartOf="@+id/tv_lawn_patrol"
app:layout_constraintTop_toBottomOf="@+id/tv_lawn_patrol" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_base_init"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/ripple_effect"
android:clickable="true"> <!-- 点击效果 -->
<TextView
android:id="@+id/tv_base_init"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="基站初始化"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_base_init" />
<TextView
android:id="@+id/base_init_state_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="基站状态:未初始化"
app:layout_constraintStart_toStartOf="@+id/tv_base_init"
app:layout_constraintTop_toBottomOf="@+id/tv_base_init" />
<ImageView
android:id="@+id/iv_base_init"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/base_station_init" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_range_setting"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ripple_effect">
<ImageView
android:id="@+id/iv_geofencing_range"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/geofencing_range" />
<TextView
android:id="@+id/tv_ranging_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="@string/boundary_setting"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_geofencing_range" />
<TextView
android:id="@+id/tv_geofencing_range_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/weilan"
app:layout_constraintStart_toStartOf="@+id/tv_ranging_setting"
app:layout_constraintTop_toBottomOf="@+id/tv_ranging_setting" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<EditText
android:id="@+id/ipET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/ip"
/>
<Button
android:id="@+id/btn_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_server"
android:gravity="center" />
<EditText
android:id="@+id/msgET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/msg"/>
<Button
android:id="@+id/btn_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/send_msg"
android:gravity="center"
android:backgroundTint="#1E88E5"/>
<TextView
android:id="@+id/msgTV"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F0F0F0"
tools:context=".ClientActivity">
<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">
<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"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
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/ripple_effect">
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="启动机器人"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView5" />
<TextView
android:id="@+id/textView12"
android:layout_width="wrap_content"
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/imageView5"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_start" />
</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/ripple_effect">
<ImageView
android:id="@+id/imageView4"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/path_plan" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="全覆盖割草"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView4" />
<TextView
android:id="@+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="上次割草: 3天前"
app:layout_constraintStart_toStartOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
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/ripple_effect">
<TextView
android:id="@+id/tv_charge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="返回充电"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_charge" />
<TextView
android:id="@+id/charge_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="上次充电: 一周前"
app:layout_constraintStart_toStartOf="@+id/tv_charge"
app:layout_constraintTop_toBottomOf="@+id/tv_charge" />
<ImageView
android:id="@+id/iv_charge"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/robot_charge" />
</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/ripple_effect"
>
<ImageView
android:id="@+id/iv_lawn_patrol"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/iv_finish" />
<TextView
android:id="@+id/tv_lawn_patrol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="结束程序"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
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="点击关闭割草机"
app:layout_constraintStart_toStartOf="@+id/tv_lawn_patrol"
app:layout_constraintTop_toBottomOf="@+id/tv_lawn_patrol" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_base_init"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/ripple_effect"
android:clickable="true"> <!-- 点击效果 -->
<TextView
android:id="@+id/tv_base_init"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="10dp"
android:text="基站初始化"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_base_init" />
<TextView
android:id="@+id/base_init_state_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="基站状态:未初始化"
app:layout_constraintStart_toStartOf="@+id/tv_base_init"
app:layout_constraintTop_toBottomOf="@+id/tv_base_init" />
<ImageView
android:id="@+id/iv_base_init"
android:layout_width="67dp"
android:layout_height="63dp"
android:layout_marginStart="12dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/base_station_init" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/btn_range_setting"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ripple_effect">
<ImageView
android:id="@+id/iv_geofencing_range"
android:layout_width="80dp"
android:layout_height="63dp"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/geofencing_range" />
<TextView
android:id="@+id/tv_ranging_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:text="@string/geofencing_range_text"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_geofencing_range" />
<TextView
android:id="@+id/tv_geofencing_range_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/geofencing_range_state_text"
app:layout_constraintStart_toStartOf="@+id/tv_ranging_setting"
app:layout_constraintTop_toBottomOf="@+id/tv_ranging_setting" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<EditText
android:id="@+id/ipET"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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: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/debug_data_send_hint"/>
<Button
android:id="@+id/btn_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/debug_data_send"
android:gravity="center"
android:backgroundTint="#1E88E5"/>
<TextView
android:id="@+id/msgTV"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>

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

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ESP8266ClientActivity">
<EditText
android:id="@+id/et_ipESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ip"
/>
<Button
android:id="@+id/btn_confirmESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="confirm"
android:gravity="center"
android:backgroundTint="#dddddd"/>
<EditText
android:id="@+id/et_msgESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="msg"/>
<Button
android:id="@+id/btn_sendESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="send"
android:gravity="center"
android:backgroundTint="#dddddd"/>
<TextView
android:gravity="center"
android:text="未连接"
android:layout_width="match_parent"
android:layout_height="20dp"
android:id="@+id/connetStatusTV"/>
<TextView
android:scrollbars="vertical"
android:id="@+id/tv_msgESP8266"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ESP8266ClientActivity">
<EditText
android:id="@+id/et_ipESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ip"
/>
<Button
android:id="@+id/btn_confirmESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="confirm"
android:gravity="center"
android:backgroundTint="#dddddd"/>
<EditText
android:id="@+id/et_msgESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="msg"/>
<Button
android:id="@+id/btn_sendESP8266"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="send"
android:gravity="center"
android:backgroundTint="#dddddd"/>
<TextView
android:gravity="center"
android:text="未连接"
android:layout_width="match_parent"
android:layout_height="20dp"
android:id="@+id/connetStatusTV"/>
<TextView
android:scrollbars="vertical"
android:id="@+id/tv_msgESP8266"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>

View File

@ -1,327 +1,327 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#F0F0F0"
android:orientation="vertical"
tools:context=".MainActivity">
<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">
<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>
<com.amap.api.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="10dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageButton
android:id="@+id/robot_start"
android:layout_width="180dp"
android:layout_height="160dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="0dp"
android:background="@drawable/robot_medium" />
<TextView
android:id="@+id/textView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentStart="true"
android:layout_marginStart="23dp"
android:layout_marginBottom="0dp"
android:gravity="center_vertical"
android:text="86"
android:textColor="#1E1E1E"
android:textSize="40sp"
android:textStyle="bold|italic" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginBottom="22dp"
app:srcCompat="@drawable/battery" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView2"
android:layout_marginStart="0dp"
android:layout_marginBottom="5dp"
android:layout_toEndOf="@+id/textView"
android:text="%"
android:textColor="#1C1B1B"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
app:srcCompat="@drawable/wifi" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView3"
app:srcCompat="@drawable/satellite" />
<ImageView
android:id="@+id/iv_uwb_state"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView6"
app:srcCompat="@drawable/uwb" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_left"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/base_config_layout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/rounded_corner_bg">
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="基站配置"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView12"
app:layout_constraintTop_toBottomOf="@+id/imageView12" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="当前共有3个基站在线"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
<ImageView
android:id="@+id/imageView12"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/base_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/client_mode_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_bg">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="割草作业区"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView11"
app:layout_constraintTop_toBottomOf="@+id/imageView11" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="共13个区域"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView6"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<ImageView
android:id="@+id/imageView11"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/mowgin_working" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_right"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mowing_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView9"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/target" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/robot_function"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView9"
app:layout_constraintTop_toBottomOf="@+id/imageView9" />
<TextView
android:id="@+id/tv_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="高尔夫球场"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<ImageView
android:id="@+id/iv_mapping_history"
android:layout_width="189dp"
android:layout_height="78dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.514"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/mowing_mapping" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="3天前"
android:textSize="8sp"
app:layout_constraintStart_toStartOf="@+id/tv_location"
app:layout_constraintTop_toBottomOf="@+id/tv_location" />
<ImageView
android:id="@+id/imageView10"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginEnd="20dp"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView3"
app:srcCompat="@drawable/icon_dot" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#F0F0F0"
android:orientation="vertical"
tools:context=".MainActivity">
<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">
<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>
<com.amap.api.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="10dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView"
android:layout_width="180dp"
android:layout_height="160dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="0dp"
app:srcCompat="@drawable/robot_medium" />
<TextView
android:id="@+id/textView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentStart="true"
android:layout_marginStart="23dp"
android:layout_marginBottom="0dp"
android:gravity="center_vertical"
android:text="86"
android:textColor="#1E1E1E"
android:textSize="40sp"
android:textStyle="bold|italic" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="50dp"
android:layout_height="25dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="20dp"
android:layout_marginBottom="22dp"
app:srcCompat="@drawable/battery" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView2"
android:layout_marginStart="0dp"
android:layout_marginBottom="5dp"
android:layout_toEndOf="@+id/textView"
android:text="%"
android:textColor="#1C1B1B"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
app:srcCompat="@drawable/wifi" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView3"
app:srcCompat="@drawable/satellite" />
<ImageView
android:id="@+id/iv_uwb_state"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="@+id/imageView6"
app:srcCompat="@drawable/uwb" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_left"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/base_config_layout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/rounded_corner_bg">
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="基站配置"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView12"
app:layout_constraintTop_toBottomOf="@+id/imageView12" />
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="当前共有3个基站在线"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/textView8" />
<ImageView
android:id="@+id/imageView12"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/base_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/client_mode_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_bg">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="割草作业区"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView11"
app:layout_constraintTop_toBottomOf="@+id/imageView11" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="共13个区域"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView6"
app:layout_constraintTop_toBottomOf="@+id/textView6" />
<ImageView
android:id="@+id/imageView11"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/mowgin_working" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_right"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mowing_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView9"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/target" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="最后作业"
android:textColor="#1E1E1E"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="@+id/imageView9"
app:layout_constraintTop_toBottomOf="@+id/imageView9" />
<TextView
android:id="@+id/tv_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="高尔夫球场"
android:textSize="10sp"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toBottomOf="@+id/textView3" />
<ImageView
android:id="@+id/iv_mapping_history"
android:layout_width="189dp"
android:layout_height="78dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.514"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/mowing_mapping" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="3天前"
android:textSize="8sp"
app:layout_constraintStart_toStartOf="@+id/tv_location"
app:layout_constraintTop_toBottomOf="@+id/tv_location" />
<ImageView
android:id="@+id/imageView10"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginEnd="20dp"
app:layout_constraintBottom_toBottomOf="@+id/textView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView3"
app:srcCompat="@drawable/icon_dot" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

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

@ -1,256 +1,256 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F0F0F0"
tools:context=".ServiceActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView8"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 1号"
app:layout_constraintStart_toEndOf="@+id/imageView8"
app:layout_constraintTop_toTopOf="@+id/imageView8" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="90%"
app:layout_constraintBottom_toBottomOf="@+id/imageView14"
app:layout_constraintStart_toEndOf="@+id/imageView14" />
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView15"
app:layout_constraintStart_toEndOf="@+id/textView15" />
<ImageView
android:id="@+id/imageView13"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView14"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView8"
app:layout_constraintTop_toBottomOf="@+id/textView14"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView82"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView142"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 2号"
app:layout_constraintStart_toEndOf="@+id/imageView82"
app:layout_constraintTop_toTopOf="@+id/imageView82" />
<TextView
android:id="@+id/textView152"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="98%"
app:layout_constraintBottom_toBottomOf="@+id/imageView142"
app:layout_constraintStart_toEndOf="@+id/imageView142" />
<TextView
android:id="@+id/textView162"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView152"
app:layout_constraintStart_toEndOf="@+id/textView152" />
<ImageView
android:id="@+id/imageView132"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView142"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView82"
app:layout_constraintTop_toBottomOf="@+id/textView142"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView83"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView143"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 3号"
app:layout_constraintStart_toEndOf="@+id/imageView83"
app:layout_constraintTop_toTopOf="@+id/imageView83" />
<TextView
android:id="@+id/textView153"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="78%"
app:layout_constraintBottom_toBottomOf="@+id/imageView143"
app:layout_constraintStart_toEndOf="@+id/imageView143" />
<TextView
android:id="@+id/textView163"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView153"
app:layout_constraintStart_toEndOf="@+id/textView153" />
<ImageView
android:id="@+id/imageView133"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView143"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView83"
app:layout_constraintTop_toBottomOf="@+id/textView143"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/showIPBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="显示IP"
android:gravity="center"
android:padding="15dp" />
<Button
android:id="@+id/clearBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="清屏"
android:gravity="center"
android:padding="15dp"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<TextView
android:id="@+id/ipTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<TextView
android:id="@+id/msgTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_margin="10dp"/>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F0F0F0"
tools:context=".ServiceActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView8"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 1号"
app:layout_constraintStart_toEndOf="@+id/imageView8"
app:layout_constraintTop_toTopOf="@+id/imageView8" />
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="90%"
app:layout_constraintBottom_toBottomOf="@+id/imageView14"
app:layout_constraintStart_toEndOf="@+id/imageView14" />
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView15"
app:layout_constraintStart_toEndOf="@+id/textView15" />
<ImageView
android:id="@+id/imageView13"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView14"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView8"
app:layout_constraintTop_toBottomOf="@+id/textView14"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView82"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView142"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 2号"
app:layout_constraintStart_toEndOf="@+id/imageView82"
app:layout_constraintTop_toTopOf="@+id/imageView82" />
<TextView
android:id="@+id/textView152"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="98%"
app:layout_constraintBottom_toBottomOf="@+id/imageView142"
app:layout_constraintStart_toEndOf="@+id/imageView142" />
<TextView
android:id="@+id/textView162"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView152"
app:layout_constraintStart_toEndOf="@+id/textView152" />
<ImageView
android:id="@+id/imageView132"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView142"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView82"
app:layout_constraintTop_toBottomOf="@+id/textView142"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_bg">
<ImageView
android:id="@+id/imageView83"
android:layout_width="70dp"
android:layout_height="57dp"
android:layout_marginStart="15dp"
android:layout_marginTop="21dp"
android:layout_marginBottom="21dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/uwb_base_blue" />
<TextView
android:id="@+id/textView143"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="UWB基站 : 3号"
app:layout_constraintStart_toEndOf="@+id/imageView83"
app:layout_constraintTop_toTopOf="@+id/imageView83" />
<TextView
android:id="@+id/textView153"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="78%"
app:layout_constraintBottom_toBottomOf="@+id/imageView143"
app:layout_constraintStart_toEndOf="@+id/imageView143" />
<TextView
android:id="@+id/textView163"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="坐标 x:240,y:180,z:240"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/textView153"
app:layout_constraintStart_toEndOf="@+id/textView153" />
<ImageView
android:id="@+id/imageView133"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/setting" />
<ImageView
android:id="@+id/imageView143"
android:layout_width="23dp"
android:layout_height="21dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toEndOf="@+id/imageView83"
app:layout_constraintTop_toBottomOf="@+id/textView143"
app:srcCompat="@drawable/uwb_battery" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/showIPBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="显示IP"
android:gravity="center"
android:padding="15dp" />
<Button
android:id="@+id/clearBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="清屏"
android:gravity="center"
android:padding="15dp"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<TextView
android:id="@+id/ipTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"/>
<TextView
android:id="@+id/msgTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_margin="10dp"/>
</LinearLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher" />
<foreground android:drawable="@drawable/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher" />
<foreground android:drawable="@drawable/ic_launcher" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,16 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WiFiDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WiFiDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</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>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</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="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

@ -1,27 +1,23 @@
<resources>
<string name="app_name">UPBot</string>
<string name="service">基站配置</string>
<string name="client">割草</string>
<string name="custom">设置</string>
<string name="shen_an_team">深安实验室研发出品</string>
<string name="shen_an_team_en">\@ShenAn Technology Co.,Ltd</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>
<string name="setting">设置</string>
<resources>
<string name="app_name">UPBot</string>
<string name="service">基站配置</string>
<string name="client">割草</string>
<string name="custom">设置</string>
<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="search">搜索</string>
<string name="message">消息</string>
<string name="about">关于</string>
<string name="setting">设置</string>
</resources>

View File

@ -1,16 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.UPBot" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.UPBot" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

@ -1,17 +1,17 @@
package com.example.upbot;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
package com.example.upbot;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -1,11 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.0' apply false
}
allprojects {
repositories {
google()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.0' apply false
}
allprojects {
repositories {
google()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon
}
}

View File

@ -1,21 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

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

View File

@ -1,185 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

View File

@ -1,17 +1,17 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
//dependencyResolutionManagement {
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// repositories {
// google()
// mavenCentral()
// }
//}
rootProject.name = "UPBot"
include ':app'
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
//dependencyResolutionManagement {
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// repositories {
// google()
// mavenCentral()
// }
//}
rootProject.name = "UPBot"
include ':app'