最新版本-6.27
parent
4e6115b7ec
commit
fb4d02268c
|
@ -1,15 +1,15 @@
|
||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/caches
|
/.idea/caches
|
||||||
/.idea/libraries
|
/.idea/libraries
|
||||||
/.idea/modules.xml
|
/.idea/modules.xml
|
||||||
/.idea/workspace.xml
|
/.idea/workspace.xml
|
||||||
/.idea/navEditor.xml
|
/.idea/navEditor.xml
|
||||||
/.idea/assetWizardSettings.xml
|
/.idea/assetWizardSettings.xml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace 'com.example.upbot'
|
namespace 'com.example.upbot'
|
||||||
compileSdk 33
|
compileSdk 33
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.upbot"
|
applicationId "com.example.upbot"
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
flatDir {
|
flatDir {
|
||||||
dirs 'libs'
|
dirs 'libs'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation 'com.google.android.material:material:1.8.0'
|
implementation 'com.google.android.material:material:1.8.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
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')
|
implementation(name: 'AMap3DMap_10.0.700_AMapSearch_9.7.2_AMapLocation_6.4.5_20240508', ext: 'aar')
|
||||||
//Google推荐的EasyPermission库
|
//Google推荐的EasyPermission库
|
||||||
implementation 'pub.devrel:easypermissions:3.0.0'
|
implementation 'pub.devrel:easypermissions:3.0.0'
|
||||||
}
|
}
|
|
@ -1,21 +1,21 @@
|
||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# You can control the set of applied configuration files using the
|
# You can control the set of applied configuration files using the
|
||||||
# proguardFiles setting in build.gradle.
|
# proguardFiles setting in build.gradle.
|
||||||
#
|
#
|
||||||
# For more details, see
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# If your project uses WebView with JS, uncomment the following
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
# class:
|
# class:
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
# public *;
|
# public *;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
# Uncomment this to preserve the line number information for
|
||||||
# debugging stack traces.
|
# debugging stack traces.
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
Binary file not shown.
|
@ -1,20 +1,20 @@
|
||||||
{
|
{
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"artifactType": {
|
"artifactType": {
|
||||||
"type": "APK",
|
"type": "APK",
|
||||||
"kind": "Directory"
|
"kind": "Directory"
|
||||||
},
|
},
|
||||||
"applicationId": "com.example.upbot",
|
"applicationId": "com.example.upbot",
|
||||||
"variantName": "release",
|
"variantName": "release",
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"type": "SINGLE",
|
"type": "SINGLE",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 1,
|
"versionCode": 1,
|
||||||
"versionName": "1.0",
|
"versionName": "1.0",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"elementType": "File"
|
"elementType": "File"
|
||||||
}
|
}
|
|
@ -1,26 +1,26 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumented test, which will execute on an Android device.
|
* Instrumented test, which will execute on an Android device.
|
||||||
*
|
*
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class ExampleInstrumentedTest {
|
public class ExampleInstrumentedTest {
|
||||||
@Test
|
@Test
|
||||||
public void useAppContext() {
|
public void useAppContext() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
assertEquals("com.example.upbot", appContext.getPackageName());
|
assertEquals("com.example.upbot", appContext.getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,11 +7,16 @@
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_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.CHANGE_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" /> <!-- 用于读取手机当前的状态 -->
|
<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.READ_PHONE_STATE" />
|
||||||
<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.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" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
@ -40,11 +45,9 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".ServiceActivity"
|
android:name=".ServiceActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity android:name=".MainActivity"
|
||||||
android:name=".MainActivity"
|
android:exported="false"/>
|
||||||
android:exported="false" />
|
<activity android:name=".SplashActivity"
|
||||||
<activity
|
|
||||||
android:name=".SplashActivity"
|
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -52,10 +55,7 @@
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</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>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -1,181 +1,179 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.os.Bundle;
|
||||||
import android.os.Bundle;
|
import android.os.Handler;
|
||||||
import android.os.Handler;
|
import android.os.Looper;
|
||||||
import android.os.Looper;
|
import android.os.Message;
|
||||||
import android.os.Message;
|
import android.widget.Button;
|
||||||
import android.view.Menu;
|
import android.widget.EditText;
|
||||||
import android.view.MenuItem;
|
import android.widget.TextView;
|
||||||
import android.view.View;
|
import android.widget.Toast;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import androidx.annotation.NonNull;
|
||||||
import android.widget.ImageView;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import android.widget.TextView;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import android.widget.Toast;
|
|
||||||
|
import com.example.upbot.MSG.MSG_CMD;
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.ActionBar;
|
import java.util.Objects;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.core.content.ContextCompat;
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
public class ClientActivity extends AppCompatActivity {
|
||||||
import com.example.upbot.MSG.MSG_CMD;
|
private static EditText msgET;
|
||||||
|
private static Button confirmBtn;
|
||||||
|
private static Button sendBtn;
|
||||||
@SuppressLint("StaticFieldLeak")
|
private static EditText ipET;
|
||||||
public class ClientActivity extends AppCompatActivity {
|
private static final StringBuffer stringBuffer = new StringBuffer();
|
||||||
private static EditText msgET;
|
private static TextView msgTV;
|
||||||
private static Button confirmBtn;
|
|
||||||
private static Button sendBtn;
|
// private static final String TAG="WifiDemoLogClientActivity";
|
||||||
private static EditText ipET;
|
|
||||||
|
@SuppressLint("HandlerLeak")
|
||||||
private static ImageView startRobot;
|
public static Handler handler = new Handler(Objects.requireNonNull(Looper.myLooper())) {
|
||||||
|
@Override
|
||||||
private static ImageView imageView4;
|
public void handleMessage(@NonNull Message msg) {
|
||||||
|
super.handleMessage(msg);
|
||||||
private static ImageView iv_charge;
|
if (msg.what == 1) {
|
||||||
|
stringBuffer.append(msg.obj);
|
||||||
private static ImageView iv_stop_robot;
|
stringBuffer.append("\n");
|
||||||
|
msgTV.setText(stringBuffer.toString());
|
||||||
private static StringBuffer stringBuffer = new StringBuffer();
|
}
|
||||||
private static TextView msgTV;
|
}
|
||||||
|
};
|
||||||
private static final String TAG="WifiDemoLogClientActivity";
|
|
||||||
|
@Override
|
||||||
@SuppressLint("HandlerLeak")
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
public static Handler handler = new Handler(Looper.myLooper()){
|
super.onCreate(savedInstanceState);
|
||||||
@Override
|
setContentView(R.layout.activity_client);
|
||||||
public void handleMessage(Message msg) {
|
initView();
|
||||||
super.handleMessage(msg);
|
setListener();
|
||||||
if (msg.what == 1){
|
}
|
||||||
stringBuffer.append(msg.obj);
|
|
||||||
stringBuffer.append("\n");
|
private void initView() {
|
||||||
msgTV.setText(stringBuffer.toString());
|
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);
|
||||||
@Override
|
}
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
private void setListener() {
|
||||||
setContentView(R.layout.activity_client);
|
sendBtn.setOnClickListener(v -> {
|
||||||
Toolbar toolbar = findViewById(R.id.toolBar_client);
|
if (!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
setSupportActionBar(toolbar);
|
Toast.makeText(ClientActivity.this, "连接失败无法发送",
|
||||||
if (getSupportActionBar() != null){
|
Toast.LENGTH_SHORT).show();
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
return;
|
||||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
}
|
||||||
}
|
UPbotComm.getInstance().sendMessage(msgET.getText().toString());
|
||||||
Drawable overflowIcon = ContextCompat.getDrawable(this, R.drawable.baseline_more_vert_24);
|
});
|
||||||
if (overflowIcon != null) {
|
confirmBtn.setOnClickListener(v -> {
|
||||||
toolbar.setOverflowIcon(overflowIcon);
|
// 给定IP地址尝试连接
|
||||||
}
|
UPbotComm.getInstance().connect(ipET.getText().toString());
|
||||||
initView();
|
confirmBtn.setEnabled(false); // 连接只点一次
|
||||||
setListener();
|
});
|
||||||
}
|
|
||||||
@Override
|
// 点击按钮启动机器人
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
findViewById(R.id.btn_run_robot).setOnClickListener(v -> {
|
||||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
// 参考UPbot通信协议
|
||||||
return true;
|
// sendUPbotCmd((byte) 0x00, "正在启动机器人");
|
||||||
}
|
byte start = MSG_CMD.START_ROBOT;
|
||||||
|
if(!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
@Override
|
Toast.makeText(ClientActivity.this, "连接失败无法启动", Toast.LENGTH_SHORT).show();
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
return;
|
||||||
if (item.getItemId() == android.R.id.home){
|
}
|
||||||
onBackPressed();
|
sendCmdMsg(start,"正在启动机器人");
|
||||||
return true;
|
});
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
// 全覆盖命令
|
||||||
}
|
findViewById(R.id.btn_full_coverage).setOnClickListener(v -> {
|
||||||
private void initView() {
|
// 参考UPbot通信协议
|
||||||
ipET = (EditText) findViewById(R.id.ipET);
|
// sendUPbotCmd((byte) 0x02, "正在启动全覆盖割草");
|
||||||
msgET = (EditText) findViewById(R.id.msgET);
|
byte value = MSG_CMD.START_COVER_SERVICE;
|
||||||
sendBtn = findViewById(R.id.btn_send);
|
if(!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
confirmBtn = findViewById(R.id.btn_confirm);
|
Toast.makeText(ClientActivity.this, "连接失败无法覆盖", Toast.LENGTH_SHORT).show();
|
||||||
msgTV = (TextView) findViewById(R.id.msgTV);
|
return;
|
||||||
startRobot = (ImageView) findViewById(R.id.start_robot_iv);
|
}
|
||||||
imageView4 = (ImageView) findViewById(R.id.imageView4);
|
sendCmdMsg(value,"正则启动全覆盖割草");
|
||||||
iv_charge = (ImageView) findViewById(R.id.iv_charge);
|
});
|
||||||
iv_stop_robot = (ImageView) findViewById(R.id.iv_stop_robot);
|
|
||||||
}
|
findViewById(R.id.btn_retrun_charge).setOnClickListener(v -> {
|
||||||
|
// 参考UPbot通信协议
|
||||||
private void setListener() {
|
// sendUPbotCmd((byte) 0x07, "正在启动返回充电");
|
||||||
sendBtn.setOnClickListener(new View.OnClickListener() {
|
byte value = MSG_CMD.CHARGING;
|
||||||
@Override
|
if(!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
public void onClick(View v) {
|
Toast.makeText(ClientActivity.this, "连接失败无法充电", Toast.LENGTH_SHORT).show();
|
||||||
if(!UPbotComm.getInstance().getConnectStatus()) {
|
return;
|
||||||
Toast.makeText(ClientActivity.this, "连接失败无法发送", Toast.LENGTH_SHORT).show();
|
}
|
||||||
return;
|
sendCmdMsg(value,"正在返回充电");
|
||||||
}
|
});
|
||||||
UPbotComm.getInstance().sendMessage(msgET.getText().toString());
|
|
||||||
}
|
// 设定割草边界
|
||||||
});
|
findViewById(R.id.btn_range_setting).setOnClickListener(v -> {
|
||||||
confirmBtn.setOnClickListener(new View.OnClickListener() {
|
// 参考Docs/UPbot通信协议
|
||||||
@Override
|
// sendUPbotCmd((byte) 0x05, "正在启动边界设定");
|
||||||
public void onClick(View v) {
|
byte value = MSG_CMD.BOUNDARY_SETTING;
|
||||||
if(!UPbotComm.getInstance().connect(ipET.getText().toString())) {
|
if(!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
Toast.makeText(ClientActivity.this, "未进行连接", Toast.LENGTH_SHORT).show();
|
Toast.makeText(ClientActivity.this, "连接失败无法设定边界", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}else{
|
}
|
||||||
Toast.makeText(ClientActivity.this, "连接成功", Toast.LENGTH_SHORT).show();
|
sendCmdMsg(value,"正在启动边界设定");
|
||||||
}
|
});
|
||||||
confirmBtn.setEnabled(false);//连接只点一次
|
|
||||||
}
|
// 启动基站初始化
|
||||||
});
|
findViewById(R.id.btn_base_init).setOnClickListener(v -> {
|
||||||
startRobot.setOnClickListener(new View.OnClickListener() {
|
// sendUPbotCmd((byte) 0x10, "正在启动基站初始化");
|
||||||
@Override
|
byte value = MSG_CMD.BASE_INIT;
|
||||||
public void onClick(View view) {
|
if(!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
byte start = MSG_CMD.START_ROBOT;
|
Toast.makeText(ClientActivity.this, "连接失败无法启动基站初始化", Toast.LENGTH_SHORT).show();
|
||||||
if(!UPbotComm.getInstance().getConnectStatus()) {
|
return;
|
||||||
Toast.makeText(ClientActivity.this, "连接失败无法启动", Toast.LENGTH_SHORT).show();
|
}
|
||||||
return;
|
sendCmdMsg(value,"正在启动基站初始化");
|
||||||
}
|
});
|
||||||
sendCmdMsg(start,"正在启动机器人");
|
|
||||||
}
|
//结束机器人
|
||||||
});
|
findViewById(R.id.btn_finish_robot).setOnClickListener(v -> {
|
||||||
imageView4.setOnClickListener(new View.OnClickListener() {
|
byte value = MSG_CMD.STOP_MOWING;
|
||||||
@Override
|
if(!UPbotComm.getInstance().getConnectStatus()) {
|
||||||
public void onClick(View view) {
|
Toast.makeText(ClientActivity.this, "连接失败无法结束割草机器人程序", Toast.LENGTH_SHORT).show();
|
||||||
byte value = MSG_CMD.START_COVER_SERVICE;
|
return;
|
||||||
if(!UPbotComm.getInstance().getConnectStatus()) {
|
}
|
||||||
Toast.makeText(ClientActivity.this, "连接失败无法覆盖", Toast.LENGTH_SHORT).show();
|
sendCmdMsg(value,"正在结束割草机器人程序");
|
||||||
return;
|
});
|
||||||
}
|
}
|
||||||
sendCmdMsg(value,"正则启动全覆盖割草");
|
|
||||||
}
|
// void sendUPbotCmd(byte cmdType, String toastString){
|
||||||
});
|
// byte[] cmd = {0x5B, 0x01, 0x00, 0x01, cmdType, 0x00};
|
||||||
iv_charge.setOnClickListener(new View.OnClickListener() {
|
// // 根据cmd 计算校验和
|
||||||
@Override
|
// calculateAndSetChecksum(cmd);
|
||||||
public void onClick(View view) {
|
// // 调用UPbotComm发送命令
|
||||||
byte value = MSG_CMD.CHARGING;
|
// UPbotComm.getInstance().sendMessage(cmd);
|
||||||
if(!UPbotComm.getInstance().getConnectStatus()) {
|
// // 通知命令发送
|
||||||
Toast.makeText(ClientActivity.this, "连接失败无法充电", Toast.LENGTH_SHORT).show();
|
// Toast.makeText(ClientActivity.this, toastString,
|
||||||
return;
|
// Toast.LENGTH_SHORT).show();
|
||||||
}
|
// }
|
||||||
sendCmdMsg(value,"正在返回充电");
|
private void sendCmdMsg(byte cmd, String toast) {
|
||||||
}
|
byte[] result = SendMsg.sendCmdMsg(cmd);
|
||||||
});
|
UPbotComm.getInstance().sendMessage(result);
|
||||||
iv_stop_robot.setOnClickListener(new View.OnClickListener() {
|
Toast.makeText(ClientActivity.this, toast, Toast.LENGTH_SHORT).show();
|
||||||
@Override
|
}
|
||||||
public void onClick(View view) {
|
|
||||||
byte value = MSG_CMD.STOP_MOWING;
|
|
||||||
if(!UPbotComm.getInstance().getConnectStatus()) {
|
@Override
|
||||||
Toast.makeText(ClientActivity.this, "连接失败无法停止", Toast.LENGTH_SHORT).show();
|
protected void onDestroy() {
|
||||||
return;
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
sendCmdMsg(value,"正在停止机器人");
|
|
||||||
}
|
/**
|
||||||
});
|
* 计算bytes数组前n-1位的校验和并写入到最后一位
|
||||||
}
|
*/
|
||||||
@Override
|
// public static void calculateAndSetChecksum(byte[] bytes) {
|
||||||
protected void onDestroy() {
|
// int sum = 0;
|
||||||
super.onDestroy();
|
// for (int i = 0; i < bytes.length - 1; i++) {
|
||||||
}
|
// sum += bytes[i] & 0xFF; // 将字节转换为无符号值
|
||||||
|
// }
|
||||||
private void sendCmdMsg(byte cmd,String toast){
|
// byte checksum = (byte) (sum & 0xFF); // 取结果的低 8 位
|
||||||
byte[] result = SendMsg.sendCmdMsg(cmd);
|
// bytes[bytes.length - 1] = checksum; // 将校验和写入最后一位
|
||||||
UPbotComm.getInstance().sendMessage(result);
|
// }
|
||||||
Toast.makeText(ClientActivity.this, toast, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,141 +1,141 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
public class ESP8266ClientActivity extends AppCompatActivity {
|
public class ESP8266ClientActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private String mIp;//硬件的IP
|
private String mIp;//硬件的IP
|
||||||
private int mPort = 5000;//硬件的端口
|
private int mPort = 5000;//硬件的端口
|
||||||
private EditText et_ip;//输入硬件对应的IP
|
private EditText et_ip;//输入硬件对应的IP
|
||||||
private EditText et_msg;//输入要发送的消息
|
private EditText et_msg;//输入要发送的消息
|
||||||
private Button btn_confirm;//进行连接
|
private Button btn_confirm;//进行连接
|
||||||
private Button btn_send;//发送消息
|
private Button btn_send;//发送消息
|
||||||
// Socket mSocket = null;//连接成功可得到的Socket
|
// Socket mSocket = null;//连接成功可得到的Socket
|
||||||
// OutputStream outputStream = null;//定义输出流
|
// OutputStream outputStream = null;//定义输出流
|
||||||
// InputStream inputStream = null;//定义输入流
|
// InputStream inputStream = null;//定义输入流
|
||||||
private StringBuffer sb = new StringBuffer();//消息
|
private StringBuffer sb = new StringBuffer();//消息
|
||||||
private TextView tv_msg;//显示消息
|
private TextView tv_msg;//显示消息
|
||||||
private boolean connectFlage = true;//连接成功或连接3s后变false
|
private boolean connectFlage = true;//连接成功或连接3s后变false
|
||||||
private TextView connetStatusTextView;//显示连接状态
|
private TextView connetStatusTextView;//显示连接状态
|
||||||
private int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
|
private int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
|
||||||
|
|
||||||
private final String TAG = "WifiDemoLogESP8266ClientActivity";
|
private final String TAG = "WifiDemoLogESP8266ClientActivity";
|
||||||
private LocalBroadcastManager localBroadcastManager;//本地广播管理器
|
private LocalBroadcastManager localBroadcastManager;//本地广播管理器
|
||||||
private MyLocalBroadcastReceiver localBroadcastReceiver;//广播接收者
|
private MyLocalBroadcastReceiver localBroadcastReceiver;//广播接收者
|
||||||
private int connectingCount=0;//用来刷新 正在连接 与 正 在 连 接
|
private int connectingCount=0;//用来刷新 正在连接 与 正 在 连 接
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_esp8266_client);
|
setContentView(R.layout.activity_esp8266_client);
|
||||||
initView();//初始化控件
|
initView();//初始化控件
|
||||||
setListener();//设置Button的点击事件
|
setListener();//设置Button的点击事件
|
||||||
registerBroadcastReceiver();//广播注册
|
registerBroadcastReceiver();//广播注册
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化控件
|
* 初始化控件
|
||||||
*/
|
*/
|
||||||
private void initView() {
|
private void initView() {
|
||||||
et_ip = (EditText) findViewById(R.id.et_ipESP8266);
|
et_ip = (EditText) findViewById(R.id.et_ipESP8266);
|
||||||
et_msg = (EditText) findViewById(R.id.et_msgESP8266);
|
et_msg = (EditText) findViewById(R.id.et_msgESP8266);
|
||||||
btn_send = findViewById(R.id.btn_sendESP8266);
|
btn_send = findViewById(R.id.btn_sendESP8266);
|
||||||
btn_confirm = findViewById(R.id.btn_confirmESP8266);
|
btn_confirm = findViewById(R.id.btn_confirmESP8266);
|
||||||
tv_msg = (TextView) findViewById(R.id.tv_msgESP8266);
|
tv_msg = (TextView) findViewById(R.id.tv_msgESP8266);
|
||||||
connetStatusTextView = findViewById(R.id.connetStatusTV);
|
connetStatusTextView = findViewById(R.id.connetStatusTV);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置Button的点击事件
|
* 设置Button的点击事件
|
||||||
*/
|
*/
|
||||||
private void setListener() {
|
private void setListener() {
|
||||||
btn_confirm.setOnClickListener(new View.OnClickListener() {
|
btn_confirm.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
btn_confirm.setEnabled(false);//防止正在连接时再次点击连接
|
btn_confirm.setEnabled(false);//防止正在连接时再次点击连接
|
||||||
WiFiModeUtil.connectFlage=true;
|
WiFiModeUtil.connectFlage=true;
|
||||||
mIp = et_ip.getText().toString();//得到IP
|
mIp = et_ip.getText().toString();//得到IP
|
||||||
WiFiModeUtil.connetByTCP(mIp,mPort);//进行连接
|
WiFiModeUtil.connetByTCP(mIp,mPort);//进行连接
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btn_send.setOnClickListener(new View.OnClickListener() {
|
btn_send.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (WiFiModeUtil.mSocket == null) {
|
if (WiFiModeUtil.mSocket == null) {
|
||||||
Toast.makeText(ESP8266ClientActivity.this, "未连接任何设备~~", Toast.LENGTH_SHORT).show();
|
Toast.makeText(ESP8266ClientActivity.this, "未连接任何设备~~", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WiFiModeUtil.sendData(et_msg.getText().toString());//发送数据
|
WiFiModeUtil.sendData(et_msg.getText().toString());//发送数据
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
localBroadcastManager.unregisterReceiver(localBroadcastReceiver);//注销广播
|
localBroadcastManager.unregisterReceiver(localBroadcastReceiver);//注销广播
|
||||||
WiFiModeUtil.closeSocketAndStream();//关闭Socket释放资源
|
WiFiModeUtil.closeSocketAndStream();//关闭Socket释放资源
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 广播注册
|
* 广播注册
|
||||||
*/
|
*/
|
||||||
private void registerBroadcastReceiver() {
|
private void registerBroadcastReceiver() {
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
IntentFilter intentFilter = new IntentFilter();
|
||||||
intentFilter.addAction("WiFiModeUtil.Connecting");//正在连接
|
intentFilter.addAction("WiFiModeUtil.Connecting");//正在连接
|
||||||
intentFilter.addAction("WiFiModeUtil.Connect.Succeed");//连接成功
|
intentFilter.addAction("WiFiModeUtil.Connect.Succeed");//连接成功
|
||||||
intentFilter.addAction("WiFiModeUtil.Connect.Fail");//连接失败
|
intentFilter.addAction("WiFiModeUtil.Connect.Fail");//连接失败
|
||||||
intentFilter.addAction("WiFiModeUtil.Connect.ReceiveMessage");//接收到数据
|
intentFilter.addAction("WiFiModeUtil.Connect.ReceiveMessage");//接收到数据
|
||||||
intentFilter.addAction("WiFiModeUtil.Disconnected");//接收到数据
|
intentFilter.addAction("WiFiModeUtil.Disconnected");//接收到数据
|
||||||
localBroadcastReceiver = new MyLocalBroadcastReceiver();
|
localBroadcastReceiver = new MyLocalBroadcastReceiver();
|
||||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
||||||
WiFiModeUtil.localBroadcastManager=localBroadcastManager;//给WiFiModeUtil工具类中的本地广播管理器赋值
|
WiFiModeUtil.localBroadcastManager=localBroadcastManager;//给WiFiModeUtil工具类中的本地广播管理器赋值
|
||||||
localBroadcastManager.registerReceiver(localBroadcastReceiver,intentFilter);
|
localBroadcastManager.registerReceiver(localBroadcastReceiver,intentFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本地广播接收者
|
* 本地广播接收者
|
||||||
*/
|
*/
|
||||||
class MyLocalBroadcastReceiver extends BroadcastReceiver {
|
class MyLocalBroadcastReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
switch (intent.getAction()) {
|
switch (intent.getAction()) {
|
||||||
case "WiFiModeUtil.Connecting":
|
case "WiFiModeUtil.Connecting":
|
||||||
connectingCount++;
|
connectingCount++;
|
||||||
if(connectingCount%2==0)
|
if(connectingCount%2==0)
|
||||||
connetStatusTextView.setText("正在连接");
|
connetStatusTextView.setText("正在连接");
|
||||||
else
|
else
|
||||||
connetStatusTextView.setText("正 在 连 接");
|
connetStatusTextView.setText("正 在 连 接");
|
||||||
break;
|
break;
|
||||||
case "WiFiModeUtil.Connect.Succeed":
|
case "WiFiModeUtil.Connect.Succeed":
|
||||||
connetStatusTextView.setText("连接成功");
|
connetStatusTextView.setText("连接成功");
|
||||||
btn_confirm.setEnabled(true);
|
btn_confirm.setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case "WiFiModeUtil.Connect.Fail":
|
case "WiFiModeUtil.Connect.Fail":
|
||||||
connetStatusTextView.setText("连接失败");
|
connetStatusTextView.setText("连接失败");
|
||||||
btn_confirm.setEnabled(true);
|
btn_confirm.setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case "WiFiModeUtil.Connect.ReceiveMessage":
|
case "WiFiModeUtil.Connect.ReceiveMessage":
|
||||||
tv_msg.setText(WiFiModeUtil.DataRecivice.toString());
|
tv_msg.setText(WiFiModeUtil.DataRecivice.toString());
|
||||||
break;
|
break;
|
||||||
case "WiFiModeUtil.Disconnected":
|
case "WiFiModeUtil.Disconnected":
|
||||||
tv_msg.setText("连接已断开,请重新进行连接");
|
tv_msg.setText("连接已断开,请重新进行连接");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,43 +1,19 @@
|
||||||
package com.example.upbot;
|
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.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
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 {
|
public class EditActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_edit);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,4 +33,6 @@ public class MSG_CMD {
|
||||||
|
|
||||||
public static final byte PAUSE_MOWING = 0x09;
|
public static final byte PAUSE_MOWING = 0x09;
|
||||||
// public static final String PAUSE_MOWING = "0x09";
|
// public static final String PAUSE_MOWING = "0x09";
|
||||||
|
|
||||||
|
public static final byte BASE_INIT = 0x10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,306 +1,293 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.os.Build;
|
||||||
import android.os.Build;
|
import android.os.Bundle;
|
||||||
import android.os.Bundle;
|
import android.util.Log;
|
||||||
import android.util.Log;
|
import android.view.Menu;
|
||||||
import android.view.Menu;
|
import android.view.MenuItem;
|
||||||
import android.view.MenuItem;
|
import android.view.View;
|
||||||
import android.view.View;
|
import android.widget.Toast;
|
||||||
import android.widget.Toast;
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import com.amap.api.location.AMapLocation;
|
||||||
import androidx.core.content.ContextCompat;
|
import com.amap.api.location.AMapLocationClient;
|
||||||
|
import com.amap.api.location.AMapLocationClientOption;
|
||||||
import com.amap.api.location.AMapLocation;
|
import com.amap.api.location.AMapLocationListener;
|
||||||
import com.amap.api.location.AMapLocationClient;
|
import com.amap.api.maps.AMap;
|
||||||
import com.amap.api.location.AMapLocationClientOption;
|
import com.amap.api.maps.LocationSource;
|
||||||
import com.amap.api.location.AMapLocationListener;
|
import com.amap.api.maps.MapView;
|
||||||
import com.amap.api.maps.AMap;
|
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||||
import com.amap.api.maps.LocationSource;
|
import com.amap.api.maps.model.MyLocationStyle;
|
||||||
import com.amap.api.maps.MapView;
|
|
||||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||||
import com.amap.api.maps.model.MyLocationStyle;
|
import pub.devrel.easypermissions.EasyPermissions;
|
||||||
|
|
||||||
import pub.devrel.easypermissions.AfterPermissionGranted;
|
public class MainActivity extends AppCompatActivity implements AMapLocationListener, LocationSource{
|
||||||
import pub.devrel.easypermissions.EasyPermissions;
|
private MyLocationStyle myLocationStyle = new MyLocationStyle();
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements AMapLocationListener, LocationSource{
|
//声明AMapLocationClient类对象
|
||||||
private MyLocationStyle myLocationStyle = new MyLocationStyle();
|
public AMapLocationClient mLocationClient = null;
|
||||||
|
//声明AMapLocationClientOption对象
|
||||||
//声明AMapLocationClient类对象
|
public AMapLocationClientOption mLocationOption = null;
|
||||||
public AMapLocationClient mLocationClient = null;
|
//请求权限码
|
||||||
//声明AMapLocationClientOption对象
|
private static final int REQUEST_PERMISSIONS = 9527;
|
||||||
public AMapLocationClientOption mLocationOption = null;
|
//内容
|
||||||
//请求权限码
|
private MapView mapView;
|
||||||
private static final int REQUEST_PERMISSIONS = 9527;
|
|
||||||
//内容
|
//地图控制器
|
||||||
private MapView mapView;
|
private AMap aMap = null;
|
||||||
|
//位置更改监听
|
||||||
//地图控制器
|
private OnLocationChangedListener mListener;
|
||||||
private AMap aMap = null;
|
|
||||||
//位置更改监听
|
private ActionBar actionBar;
|
||||||
private OnLocationChangedListener mListener;
|
|
||||||
|
@Override
|
||||||
@Override
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
super.onCreate(savedInstanceState);
|
||||||
super.onCreate(savedInstanceState);
|
setContentView(R.layout.activity_main);
|
||||||
setContentView(R.layout.activity_main);
|
mapView = findViewById(R.id.map_view);
|
||||||
mapView = findViewById(R.id.map_view);
|
mapView.onCreate(savedInstanceState);
|
||||||
mapView.onCreate(savedInstanceState);
|
initLocation();
|
||||||
initLocation();
|
initMap(savedInstanceState);
|
||||||
initMap(savedInstanceState);
|
checkingAndroidVersion();
|
||||||
checkingAndroidVersion();
|
findViewById(R.id.base_config_layout).setOnClickListener(new View.OnClickListener() {
|
||||||
findViewById(R.id.base_config_layout).setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View view) {
|
||||||
public void onClick(View view) {
|
Intent intent=new Intent(MainActivity.this, ServiceActivity.class);
|
||||||
Intent intent=new Intent(MainActivity.this, ServiceActivity.class);
|
startActivity(intent);
|
||||||
startActivity(intent);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
findViewById(R.id.mowing_layout).setOnClickListener(new View.OnClickListener() {
|
||||||
findViewById(R.id.mowing_layout).setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View view) {
|
||||||
public void onClick(View view) {
|
Intent intent=new Intent(MainActivity.this,ClientActivity.class);
|
||||||
Intent intent=new Intent(MainActivity.this,ClientActivity.class);
|
startActivity(intent);
|
||||||
startActivity(intent);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
findViewById(R.id.client_mode_layout).setOnClickListener(new View.OnClickListener() {
|
||||||
findViewById(R.id.client_mode_layout).setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public void onClick(View view) {
|
||||||
public void onClick(View view) {
|
Intent intent=new Intent(MainActivity.this,ESP8266ClientActivity.class);
|
||||||
Intent intent=new Intent(MainActivity.this,ESP8266ClientActivity.class);
|
startActivity(intent);
|
||||||
startActivity(intent);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
findViewById(R.id.imageView).setOnClickListener(v -> {
|
||||||
findViewById(R.id.robot_start).setOnClickListener(new View.OnClickListener() {
|
Intent intent=new Intent(MainActivity.this,RobotActivity.class);
|
||||||
@Override
|
startActivity(intent);
|
||||||
public void onClick(View view) {
|
});
|
||||||
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);
|
||||||
|
});
|
||||||
findViewById(R.id.tv_setting_main).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
}
|
||||||
public void onClick(View view) {
|
|
||||||
Intent intent=new Intent(MainActivity.this,EditActivity.class);
|
public void activate(OnLocationChangedListener onLocationChangedListener) {
|
||||||
startActivity(intent);
|
mListener = onLocationChangedListener;
|
||||||
}
|
if (mLocationClient != null) {
|
||||||
});
|
mLocationClient.startLocation();//启动定位
|
||||||
|
}
|
||||||
findViewById(R.id.iv_three_main).setOnClickListener(new View.OnClickListener() {
|
}
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
/**
|
||||||
onBackPressed();
|
* 停止定位
|
||||||
}
|
*/
|
||||||
});
|
@Override
|
||||||
}
|
public void deactivate() {
|
||||||
|
mListener = null;
|
||||||
public void activate(OnLocationChangedListener onLocationChangedListener) {
|
if (mLocationClient != null) {
|
||||||
mListener = onLocationChangedListener;
|
mLocationClient.stopLocation();
|
||||||
if (mLocationClient != null) {
|
mLocationClient.onDestroy();
|
||||||
mLocationClient.startLocation();//启动定位
|
}
|
||||||
}
|
mLocationClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停止定位
|
* 初始化地图
|
||||||
*/
|
* @param savedInstanceState
|
||||||
@Override
|
*/
|
||||||
public void deactivate() {
|
private void initMap(Bundle savedInstanceState) {
|
||||||
mListener = null;
|
mapView = findViewById(R.id.map_view);
|
||||||
if (mLocationClient != null) {
|
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
|
||||||
mLocationClient.stopLocation();
|
mapView.onCreate(savedInstanceState);
|
||||||
mLocationClient.onDestroy();
|
//初始化地图控制器对象
|
||||||
}
|
aMap = mapView.getMap();
|
||||||
mLocationClient = null;
|
|
||||||
}
|
//设置最小缩放等级为16 ,缩放级别范围为[3, 20]
|
||||||
|
aMap.setMinZoomLevel(12);
|
||||||
/**
|
// 自定义定位蓝点图标
|
||||||
* 初始化地图
|
myLocationStyle.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.baseline_location_on_24));
|
||||||
* @param savedInstanceState
|
// 自定义精度范围的圆形边框颜色 都为0则透明
|
||||||
*/
|
myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
|
||||||
private void initMap(Bundle savedInstanceState) {
|
// 自定义精度范围的圆形边框宽度 0 无宽度
|
||||||
mapView = findViewById(R.id.map_view);
|
myLocationStyle.strokeWidth(0);
|
||||||
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
|
// 设置圆形的填充颜色 都为0则透明
|
||||||
mapView.onCreate(savedInstanceState);
|
myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
|
||||||
//初始化地图控制器对象
|
|
||||||
aMap = mapView.getMap();
|
//设置定位蓝点的Style
|
||||||
|
aMap.setMyLocationStyle(myLocationStyle);
|
||||||
//设置最小缩放等级为16 ,缩放级别范围为[3, 20]
|
|
||||||
aMap.setMinZoomLevel(12);
|
// 设置定位监听
|
||||||
// 自定义定位蓝点图标
|
aMap.setLocationSource(this);
|
||||||
myLocationStyle.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.baseline_location_on_24));
|
// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
|
||||||
// 自定义精度范围的圆形边框颜色 都为0则透明
|
aMap.setMyLocationEnabled(true);
|
||||||
myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
|
}
|
||||||
// 自定义精度范围的圆形边框宽度 0 无宽度
|
|
||||||
myLocationStyle.strokeWidth(0);
|
/**
|
||||||
// 设置圆形的填充颜色 都为0则透明
|
* 初始化定位
|
||||||
myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
|
*/
|
||||||
|
private void initLocation() {
|
||||||
//设置定位蓝点的Style
|
//初始化定位
|
||||||
aMap.setMyLocationStyle(myLocationStyle);
|
try {
|
||||||
|
mLocationClient = new AMapLocationClient(getApplicationContext());
|
||||||
// 设置定位监听
|
} catch (Exception e) {
|
||||||
aMap.setLocationSource(this);
|
e.printStackTrace();
|
||||||
// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
|
}
|
||||||
aMap.setMyLocationEnabled(true);
|
if (mLocationClient != null) {
|
||||||
}
|
//设置定位回调监听
|
||||||
|
mLocationClient.setLocationListener(this);
|
||||||
/**
|
//初始化AMapLocationClientOption对象
|
||||||
* 初始化定位
|
mLocationOption = new AMapLocationClientOption();
|
||||||
*/
|
//设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。
|
||||||
private void initLocation() {
|
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
|
||||||
//初始化定位
|
//获取最近3s内精度最高的一次定位结果:
|
||||||
try {
|
//设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。
|
||||||
mLocationClient = new AMapLocationClient(getApplicationContext());
|
mLocationOption.setOnceLocationLatest(true);
|
||||||
} catch (Exception e) {
|
//设置是否返回地址信息(默认返回地址信息)
|
||||||
e.printStackTrace();
|
mLocationOption.setNeedAddress(true);
|
||||||
}
|
//设置定位请求超时时间,单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
|
||||||
if (mLocationClient != null) {
|
mLocationOption.setHttpTimeOut(20000);
|
||||||
//设置定位回调监听
|
//关闭缓存机制,高精度定位会产生缓存。
|
||||||
mLocationClient.setLocationListener(this);
|
mLocationOption.setLocationCacheEnable(false);
|
||||||
//初始化AMapLocationClientOption对象
|
//给定位客户端对象设置定位参数
|
||||||
mLocationOption = new AMapLocationClientOption();
|
mLocationClient.setLocationOption(mLocationOption);
|
||||||
//设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。
|
}
|
||||||
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
|
}
|
||||||
//获取最近3s内精度最高的一次定位结果:
|
|
||||||
//设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。
|
/**
|
||||||
mLocationOption.setOnceLocationLatest(true);
|
* 接收异步返回的定位结果
|
||||||
//设置是否返回地址信息(默认返回地址信息)
|
*
|
||||||
mLocationOption.setNeedAddress(true);
|
* @param aMapLocation
|
||||||
//设置定位请求超时时间,单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
|
*/
|
||||||
mLocationOption.setHttpTimeOut(20000);
|
@Override
|
||||||
//关闭缓存机制,高精度定位会产生缓存。
|
public void onLocationChanged(AMapLocation aMapLocation) {
|
||||||
mLocationOption.setLocationCacheEnable(false);
|
if (aMapLocation != null) {
|
||||||
//给定位客户端对象设置定位参数
|
if (aMapLocation.getErrorCode() == 0) {
|
||||||
mLocationClient.setLocationOption(mLocationOption);
|
//地址
|
||||||
}
|
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");
|
||||||
* @param aMapLocation
|
stringBuffer.append("地址:").append(address).append("\n");
|
||||||
*/
|
Log.d("MainActivity",stringBuffer.toString());
|
||||||
@Override
|
showMsg(address);
|
||||||
public void onLocationChanged(AMapLocation aMapLocation) {
|
mLocationClient.stopLocation();
|
||||||
if (aMapLocation != null) {
|
if (mListener != null){
|
||||||
if (aMapLocation.getErrorCode() == 0) {
|
mListener.onLocationChanged(aMapLocation);
|
||||||
//地址
|
}
|
||||||
String address = aMapLocation.getAddress();
|
|
||||||
double latitude = aMapLocation.getLatitude();
|
} else {
|
||||||
double longitude = aMapLocation.getLongitude();
|
//定位失败时,可通过ErrCode(错误码)信息来确定失败的原因,errInfo是错误信息,详见错误码表。
|
||||||
StringBuilder stringBuffer = new StringBuilder();
|
Log.e("AmapError", "location Error, ErrCode:"
|
||||||
stringBuffer.append("纬度:").append(latitude).append("\n");
|
+ aMapLocation.getErrorCode() + ", errInfo:"
|
||||||
stringBuffer.append("经度:").append(longitude).append("\n");
|
+ aMapLocation.getErrorInfo());
|
||||||
stringBuffer.append("地址:").append(address).append("\n");
|
}
|
||||||
Log.d("MainActivity",stringBuffer.toString());
|
}
|
||||||
showMsg(address);
|
}
|
||||||
mLocationClient.stopLocation();
|
|
||||||
if (mListener != null){
|
/**
|
||||||
mListener.onLocationChanged(aMapLocation);
|
* 检查Android版本
|
||||||
}
|
*/
|
||||||
|
private void checkingAndroidVersion() {
|
||||||
} else {
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
|
||||||
//定位失败时,可通过ErrCode(错误码)信息来确定失败的原因,errInfo是错误信息,详见错误码表。
|
//Android6.0及以上先获取权限再定位
|
||||||
Log.e("AmapError", "location Error, ErrCode:"
|
requestPermission();
|
||||||
+ aMapLocation.getErrorCode() + ", errInfo:"
|
}else {
|
||||||
+ aMapLocation.getErrorInfo());
|
//Android6.0以下直接定位
|
||||||
}
|
mLocationClient.startLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查Android版本
|
* 动态请求权限
|
||||||
*/
|
*/
|
||||||
private void checkingAndroidVersion() {
|
@AfterPermissionGranted(REQUEST_PERMISSIONS)
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
|
private void requestPermission() {
|
||||||
//Android6.0及以上先获取权限再定位
|
String[] permissions = new String[]{
|
||||||
requestPermission();
|
"android.permission.ACCESS_COARSE_LOCATION",
|
||||||
}else {
|
"android.permission.ACCESS_FINE_LOCATION",
|
||||||
//Android6.0以下直接定位
|
"android.permission.READ_PHONE_STATE",
|
||||||
mLocationClient.startLocation();
|
"android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
if (EasyPermissions.hasPermissions(this, permissions)) {
|
||||||
/**
|
//true 有权限 开始定位
|
||||||
* 动态请求权限
|
showMsg("已获得权限,可以定位啦!");
|
||||||
*/
|
mLocationClient.startLocation();
|
||||||
@AfterPermissionGranted(REQUEST_PERMISSIONS)
|
} else {
|
||||||
private void requestPermission() {
|
//false 无权限
|
||||||
String[] permissions = new String[]{
|
EasyPermissions.requestPermissions(this, "需要权限", REQUEST_PERMISSIONS, permissions);
|
||||||
"android.permission.ACCESS_COARSE_LOCATION",
|
}
|
||||||
"android.permission.ACCESS_FINE_LOCATION",
|
}
|
||||||
"android.permission.READ_PHONE_STATE",
|
|
||||||
"android.permission.WRITE_EXTERNAL_STORAGE"
|
/**
|
||||||
};
|
* 请求权限结果
|
||||||
|
* @param requestCode
|
||||||
if (EasyPermissions.hasPermissions(this, permissions)) {
|
* @param permissions
|
||||||
//true 有权限 开始定位
|
* @param grantResults
|
||||||
showMsg("已获得权限,可以定位啦!");
|
*/
|
||||||
mLocationClient.startLocation();
|
@Override
|
||||||
} else {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
//false 无权限
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
EasyPermissions.requestPermissions(this, "需要权限", REQUEST_PERMISSIONS, permissions);
|
//设置权限请求结果
|
||||||
}
|
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求权限结果
|
/**
|
||||||
* @param requestCode
|
* Toast提示
|
||||||
* @param permissions
|
* @param msg 提示内容
|
||||||
* @param grantResults
|
*/
|
||||||
*/
|
private void showMsg(String msg){
|
||||||
@Override
|
Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
}
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
@Override
|
||||||
//设置权限请求结果
|
protected void onResume() {
|
||||||
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
|
super.onResume();
|
||||||
}
|
//在activity执行onResume时执行mMapView.onResume (),重新绘制加载地图
|
||||||
|
mapView.onResume();
|
||||||
|
}
|
||||||
/**
|
@Override
|
||||||
* Toast提示
|
protected void onPause() {
|
||||||
* @param msg 提示内容
|
super.onPause();
|
||||||
*/
|
//在activity执行onPause时执行mMapView.onPause (),暂停地图的绘制
|
||||||
private void showMsg(String msg){
|
mapView.onPause();
|
||||||
Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
|
}
|
||||||
}
|
@Override
|
||||||
@Override
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
protected void onResume() {
|
super.onSaveInstanceState(outState);
|
||||||
super.onResume();
|
//在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState),保存地图当前的状态
|
||||||
//在activity执行onResume时执行mMapView.onResume (),重新绘制加载地图
|
mapView.onSaveInstanceState(outState);
|
||||||
mapView.onResume();
|
}
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onDestroy() {
|
||||||
super.onPause();
|
super.onDestroy();
|
||||||
//在activity执行onPause时执行mMapView.onPause (),暂停地图的绘制
|
//销毁定位客户端,同时销毁本地定位服务。
|
||||||
mapView.onPause();
|
mLocationClient.onDestroy();
|
||||||
}
|
mapView.onDestroy();
|
||||||
@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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,10 +1,5 @@
|
||||||
package com.example.upbot;
|
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.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -12,6 +7,11 @@ import android.view.MenuItem;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
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 {
|
public class RobotActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private ImageButton btn_quiet, btn_standard, btn_strong, btn_super, btn_water_less, btn_water_medium, btn_water_high;
|
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) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_robot);
|
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();
|
initViews();
|
||||||
setListeners();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -5,9 +5,6 @@ package com.example.upbot;
|
||||||
import com.example.upbot.MSG.Head;
|
import com.example.upbot.MSG.Head;
|
||||||
import com.example.upbot.MSG.MsgId;
|
import com.example.upbot.MSG.MsgId;
|
||||||
|
|
||||||
import java.util.zip.CRC32;
|
|
||||||
import java.util.zip.Checksum;
|
|
||||||
|
|
||||||
public class SendMsg {
|
public class SendMsg {
|
||||||
public static byte[] sendCmdMsg(byte value){
|
public static byte[] sendCmdMsg(byte value){
|
||||||
Head head = new Head();
|
Head head = new Head();
|
||||||
|
|
|
@ -1,205 +1,205 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
public class ServiceActivity extends AppCompatActivity {
|
public class ServiceActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private Button clearBtn;
|
private Button clearBtn;
|
||||||
private Button showIPBtn;
|
private Button showIPBtn;
|
||||||
private TextView ipTV;
|
private TextView ipTV;
|
||||||
private TextView msgTV;
|
private TextView msgTV;
|
||||||
private ServerSocket mServerSocket;
|
private ServerSocket mServerSocket;
|
||||||
private Socket mSocket;
|
private Socket mSocket;
|
||||||
private StringBuffer stringBuffer = new StringBuffer();
|
private StringBuffer stringBuffer = new StringBuffer();
|
||||||
private final String TAG = "WifiDemoLogServiceActivity";
|
private final String TAG = "WifiDemoLogServiceActivity";
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("HandlerLeak")
|
@SuppressLint("HandlerLeak")
|
||||||
public Handler handler = new Handler(Looper.myLooper()) {
|
public Handler handler = new Handler(Looper.myLooper()) {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
super.handleMessage(msg);
|
super.handleMessage(msg);
|
||||||
if (msg.what == 1) {
|
if (msg.what == 1) {
|
||||||
stringBuffer.append(msg.obj);
|
stringBuffer.append(msg.obj);
|
||||||
stringBuffer.append("\n");
|
stringBuffer.append("\n");
|
||||||
msgTV.setText(stringBuffer.toString());
|
msgTV.setText(stringBuffer.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_service);
|
setContentView(R.layout.activity_service);
|
||||||
initView();
|
initView();
|
||||||
setListener();
|
setListener();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mServerSocket = new ServerSocket(5000);//端口号5000
|
mServerSocket = new ServerSocket(5000);//端口号5000
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//启动服务线程
|
//启动服务线程
|
||||||
SocketAcceptThread socketAcceptThread = new SocketAcceptThread();
|
SocketAcceptThread socketAcceptThread = new SocketAcceptThread();
|
||||||
socketAcceptThread.start();
|
socketAcceptThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得控件实例
|
* 获得控件实例
|
||||||
*/
|
*/
|
||||||
private void initView() {
|
private void initView() {
|
||||||
clearBtn = findViewById(R.id.clearBtn);
|
clearBtn = findViewById(R.id.clearBtn);
|
||||||
showIPBtn = findViewById(R.id.showIPBtn);
|
showIPBtn = findViewById(R.id.showIPBtn);
|
||||||
ipTV = findViewById(R.id.ipTV);
|
ipTV = findViewById(R.id.ipTV);
|
||||||
msgTV = findViewById(R.id.msgTV);
|
msgTV = findViewById(R.id.msgTV);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 为控件设置监听
|
* 为控件设置监听
|
||||||
*/
|
*/
|
||||||
private void setListener() {
|
private void setListener() {
|
||||||
clearBtn.setOnClickListener(new View.OnClickListener() {
|
clearBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
stringBuffer.setLength(0);
|
stringBuffer.setLength(0);
|
||||||
msgTV.setText("");
|
msgTV.setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
showIPBtn.setOnClickListener(new View.OnClickListener() {
|
showIPBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ipTV.setText(getLocalIpAddress(ServiceActivity.this) + ":5000");
|
ipTV.setText(getLocalIpAddress(ServiceActivity.this) + ":5000");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接线程
|
* 连接线程
|
||||||
* 得到Socket
|
* 得到Socket
|
||||||
*/
|
*/
|
||||||
class SocketAcceptThread extends Thread {
|
class SocketAcceptThread extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
//等待客户端的连接,Accept会阻塞,直到建立连接,
|
//等待客户端的连接,Accept会阻塞,直到建立连接,
|
||||||
//所以需要放在子线程中运行
|
//所以需要放在子线程中运行
|
||||||
mSocket = mServerSocket.accept();
|
mSocket = mServerSocket.accept();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//启动消息接收线程
|
//启动消息接收线程
|
||||||
startReader(mSocket);
|
startReader(mSocket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从参数的Socket里获取最新的消息
|
* 从参数的Socket里获取最新的消息
|
||||||
*/
|
*/
|
||||||
private void startReader(final Socket socket) {
|
private void startReader(final Socket socket) {
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DataInputStream reader;
|
DataInputStream reader;
|
||||||
try {
|
try {
|
||||||
// 获取读取流
|
// 获取读取流
|
||||||
reader = new DataInputStream(socket.getInputStream());
|
reader = new DataInputStream(socket.getInputStream());
|
||||||
while (true) {
|
while (true) {
|
||||||
// 读取数据
|
// 读取数据
|
||||||
String msg = reader.readUTF();
|
String msg = reader.readUTF();
|
||||||
Log.d(TAG, "客户端的信息:" + msg);
|
Log.d(TAG, "客户端的信息:" + msg);
|
||||||
|
|
||||||
//告知客户端消息收到
|
//告知客户端消息收到
|
||||||
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
|
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
|
||||||
writer.writeUTF("收到:" + msg); // 写一个UTF-8的信息
|
writer.writeUTF("收到:" + msg); // 写一个UTF-8的信息
|
||||||
|
|
||||||
//发消息更新UI
|
//发消息更新UI
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
message.what = 1;
|
message.what = 1;
|
||||||
message.obj=msg;
|
message.obj=msg;
|
||||||
handler.sendMessage(message);
|
handler.sendMessage(message);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if (mServerSocket != null) {
|
if (mServerSocket != null) {
|
||||||
try {
|
try {
|
||||||
mServerSocket.close();
|
mServerSocket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mSocket!=null){
|
if(mSocket!=null){
|
||||||
try {
|
try {
|
||||||
mSocket.close();
|
mSocket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将ip的整数形式转换成ip形式
|
* 将ip的整数形式转换成ip形式
|
||||||
*
|
*
|
||||||
* @param ipInt
|
* @param ipInt
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String int2ip(int ipInt) {
|
public static String int2ip(int ipInt) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(ipInt & 0xFF).append(".");
|
sb.append(ipInt & 0xFF).append(".");
|
||||||
sb.append((ipInt >> 8) & 0xFF).append(".");
|
sb.append((ipInt >> 8) & 0xFF).append(".");
|
||||||
sb.append((ipInt >> 16) & 0xFF).append(".");
|
sb.append((ipInt >> 16) & 0xFF).append(".");
|
||||||
sb.append((ipInt >> 24) & 0xFF);
|
sb.append((ipInt >> 24) & 0xFF);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前ip地址
|
* 获取当前ip地址
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getLocalIpAddress(Context context) {
|
public static String getLocalIpAddress(Context context) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
WifiManager wifiManager = (WifiManager) context
|
WifiManager wifiManager = (WifiManager) context
|
||||||
.getSystemService(Context.WIFI_SERVICE);
|
.getSystemService(Context.WIFI_SERVICE);
|
||||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||||
int i = wifiInfo.getIpAddress();
|
int i = wifiInfo.getIpAddress();
|
||||||
return int2ip(i);
|
return int2ip(i);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return " 获取IP出错鸟!!!!请保证是WIFI,或者请重新打开网络!\n" + ex.getMessage();
|
return " 获取IP出错鸟!!!!请保证是WIFI,或者请重新打开网络!\n" + ex.getMessage();
|
||||||
}
|
}
|
||||||
// return null;
|
// return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,7 +25,7 @@ public class SplashActivity extends AppCompatActivity {
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
try {
|
try {
|
||||||
sleep(3000);//使程序休眠3秒
|
sleep(1000);//使程序休眠1秒
|
||||||
Intent intent=new Intent(getApplicationContext(),MainActivity.class);
|
Intent intent=new Intent(getApplicationContext(),MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -5,13 +5,11 @@ import static com.example.upbot.ClientActivity.handler;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class UPbotComm {
|
public class UPbotComm {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
@ -23,10 +21,9 @@ public class UPbotComm {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private UPbotComm() {
|
private UPbotComm() {
|
||||||
}
|
}
|
||||||
|
static String TAG = "UPBotComm";
|
||||||
public SocketConnectThread threadInit(){
|
public void threadInit(){
|
||||||
socketConnectThread = new SocketConnectThread();
|
socketConnectThread = new SocketConnectThread();
|
||||||
return socketConnectThread;
|
|
||||||
}
|
}
|
||||||
public static UPbotComm getInstance() {
|
public static UPbotComm getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
@ -39,27 +36,18 @@ public class UPbotComm {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
class SocketConnectThread extends Thread{
|
class SocketConnectThread extends Thread{
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(){
|
public void run(){
|
||||||
try {
|
try {
|
||||||
//指定ip地址和端口号
|
//指定ip地址和端口号
|
||||||
Log.d("UPBOTCOMM", ip);
|
Log.d(TAG, ip);
|
||||||
mSocket = new Socket(ip, 19890);
|
mSocket = new Socket(ip, 19890);
|
||||||
|
status = true;
|
||||||
if(mSocket != null){
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取输出流、输入流
|
|
||||||
// mOutStream = mSocket.getOutputStream();
|
|
||||||
// mInStream = mSocket.getInputStream();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
Log.d(TAG, "打开socket失败");
|
||||||
|
status = false;
|
||||||
}
|
}
|
||||||
startReader(mSocket);
|
startReader(mSocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public boolean connect(String Uip){
|
public boolean connect(String Uip){
|
||||||
ip = 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) {
|
public void sendMessage(final String msg) {
|
||||||
if (msg.isEmpty() || !status){
|
if (msg.isEmpty() || !status){
|
||||||
|
@ -84,13 +72,14 @@ public class UPbotComm {
|
||||||
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
|
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
|
||||||
writer.writeUTF(msg); // 写一个UTF-8的信息
|
writer.writeUTF(msg); // 写一个UTF-8的信息
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
Log.e(TAG,"发送消息字符串时发生异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.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;
|
return;
|
||||||
}
|
}
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
@ -98,9 +87,11 @@ public class UPbotComm {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
|
DataOutputStream writer = new DataOutputStream(mSocket.getOutputStream());
|
||||||
writer.write(msg);
|
// 写入字节数组
|
||||||
|
writer.write(data);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
// 使用日志记录器输出异常信息,指定了日志级别和消息
|
||||||
|
Log.e(TAG,"发送消息时发生异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
@ -110,7 +101,7 @@ public class UPbotComm {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 接收消息
|
* 接收消息: 这里的写法有点怪怪的啊
|
||||||
*/
|
*/
|
||||||
private void startReader(final Socket socket) {
|
private void startReader(final Socket socket) {
|
||||||
new Thread(){
|
new Thread(){
|
||||||
|
@ -125,11 +116,11 @@ public class UPbotComm {
|
||||||
String msg = reader.readUTF();
|
String msg = reader.readUTF();
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
message.what = 1;
|
message.what = 1;
|
||||||
message.obj=msg;
|
message.obj = msg;
|
||||||
handler.sendMessage(message);
|
handler.sendMessage(message);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
Log.d(TAG, "Read data exception.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
@ -139,7 +130,7 @@ public class UPbotComm {
|
||||||
try {
|
try {
|
||||||
mSocket.close();
|
mSocket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
Log.d(TAG, "Release socket error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,258 +1,258 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正在连接广播Action:"WiFiModeUtil.Connecting"
|
* 正在连接广播Action:"WiFiModeUtil.Connecting"
|
||||||
* 连接失败广播Action:"WiFiModeUtil.Connect.Fail"
|
* 连接失败广播Action:"WiFiModeUtil.Connect.Fail"
|
||||||
* 连接成功广播Action:"WiFiModeUtil.Connect.Succeed"
|
* 连接成功广播Action:"WiFiModeUtil.Connect.Succeed"
|
||||||
* 收到数据广播Action:"WiFiModeUtil.Connect.ReceiveMessage"
|
* 收到数据广播Action:"WiFiModeUtil.Connect.ReceiveMessage"
|
||||||
* 连接断开广播Action:"WiFiModeUtil.Disconnected"
|
* 连接断开广播Action:"WiFiModeUtil.Disconnected"
|
||||||
*/
|
*/
|
||||||
public class WiFiModeUtil {
|
public class WiFiModeUtil {
|
||||||
private static String mIp;//硬件的IP
|
private static String mIp;//硬件的IP
|
||||||
private static int mPort = 5000;//硬件的端口
|
private static int mPort = 5000;//硬件的端口
|
||||||
public static Socket mSocket = null;//连接成功可得到的Socket
|
public static Socket mSocket = null;//连接成功可得到的Socket
|
||||||
public static OutputStream outputStream = null;//定义输出流
|
public static OutputStream outputStream = null;//定义输出流
|
||||||
public static InputStream inputStream = null;//定义输入流
|
public static InputStream inputStream = null;//定义输入流
|
||||||
public static StringBuffer DataRecivice = new StringBuffer();//数据
|
public static StringBuffer DataRecivice = new StringBuffer();//数据
|
||||||
public static List<String> DataList=new ArrayList<>();//数据
|
public static List<String> DataList=new ArrayList<>();//数据
|
||||||
public static boolean connectFlage = true;//连接成功或连接3s后变false
|
public static boolean connectFlage = true;//连接成功或连接3s后变false
|
||||||
// private static int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
|
// private static int ShowPointSum = 0;//连接时显示 连接中.. 后面点的计数
|
||||||
private static final String TAG = "WifiDemoLogESP8266ClientActivity";
|
private static final String TAG = "WifiDemoLogESP8266ClientActivity";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本地广播管理器 从外面用:
|
* 本地广播管理器 从外面用:
|
||||||
* WiFiModeUtil.localBroadcastManager=localBroadcastManager;
|
* WiFiModeUtil.localBroadcastManager=localBroadcastManager;
|
||||||
* 进行赋值
|
* 进行赋值
|
||||||
*/
|
*/
|
||||||
public static LocalBroadcastManager localBroadcastManager;
|
public static LocalBroadcastManager localBroadcastManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理消息的Handler
|
* 处理消息的Handler
|
||||||
*/
|
*/
|
||||||
@SuppressLint("HandlerLeak")
|
@SuppressLint("HandlerLeak")
|
||||||
public static Handler mHandler = new Handler(Looper.myLooper()) {
|
public static Handler mHandler = new Handler(Looper.myLooper()) {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
super.handleMessage(msg);
|
super.handleMessage(msg);
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case 0://接收到数据
|
case 0://接收到数据
|
||||||
DataRecivice.append(msg.obj.toString());
|
DataRecivice.append(msg.obj.toString());
|
||||||
DataRecivice.append("\n");
|
DataRecivice.append("\n");
|
||||||
DataList.add(msg.obj.toString());//添加数据
|
DataList.add(msg.obj.toString());//添加数据
|
||||||
Intent intent = new Intent("WiFiModeUtil.Connect.ReceiveMessage");
|
Intent intent = new Intent("WiFiModeUtil.Connect.ReceiveMessage");
|
||||||
localBroadcastManager.sendBroadcast(intent);//发送收到数据广播
|
localBroadcastManager.sendBroadcast(intent);//发送收到数据广播
|
||||||
break;
|
break;
|
||||||
case 1://连接成功
|
case 1://连接成功
|
||||||
Intent intent2 = new Intent("WiFiModeUtil.Connect.Succeed");
|
Intent intent2 = new Intent("WiFiModeUtil.Connect.Succeed");
|
||||||
localBroadcastManager.sendBroadcast(intent2);//发送连接成功广播
|
localBroadcastManager.sendBroadcast(intent2);//发送连接成功广播
|
||||||
readData();//开启接收线程
|
readData();//开启接收线程
|
||||||
connectFlage = true;
|
connectFlage = true;
|
||||||
break;
|
break;
|
||||||
case 2://连接断开
|
case 2://连接断开
|
||||||
Intent intent3 = new Intent("WiFiModeUtil.Disconnected");
|
Intent intent3 = new Intent("WiFiModeUtil.Disconnected");
|
||||||
localBroadcastManager.sendBroadcast(intent3);//发送连接失败广播
|
localBroadcastManager.sendBroadcast(intent3);//发送连接失败广播
|
||||||
connectFlage = true;
|
connectFlage = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 延时3s的定时器
|
* 延时3s的定时器
|
||||||
* 在开始连接时计时3s
|
* 在开始连接时计时3s
|
||||||
* 3s未连接上视为连接失败
|
* 3s未连接上视为连接失败
|
||||||
*/
|
*/
|
||||||
private final static CountDownTimer tcpClientCountDownTimer = new CountDownTimer(3000, 300) {
|
private final static CountDownTimer tcpClientCountDownTimer = new CountDownTimer(3000, 300) {
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {//每隔300ms进入
|
public void onTick(long millisUntilFinished) {//每隔300ms进入
|
||||||
if (connectFlage) {
|
if (connectFlage) {
|
||||||
Intent intent = new Intent("WiFiModeUtil.Connecting");
|
Intent intent = new Intent("WiFiModeUtil.Connecting");
|
||||||
localBroadcastManager.sendBroadcast(intent);
|
localBroadcastManager.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinish() {//3s后进入(没有取消定时器的情况下)
|
public void onFinish() {//3s后进入(没有取消定时器的情况下)
|
||||||
if (connectFlage) {
|
if (connectFlage) {
|
||||||
connectFlage = false;//连接失败
|
connectFlage = false;//连接失败
|
||||||
closeSocketAndStream();
|
closeSocketAndStream();
|
||||||
}
|
}
|
||||||
tcpClientCountDownTimer.cancel();//关掉定时器
|
tcpClientCountDownTimer.cancel();//关掉定时器
|
||||||
Intent intent = new Intent("WiFiModeUtil.Connect.Fail");
|
Intent intent = new Intent("WiFiModeUtil.Connect.Fail");
|
||||||
localBroadcastManager.sendBroadcast(intent);
|
localBroadcastManager.sendBroadcast(intent);
|
||||||
Log.d(TAG,"连接失败");
|
Log.d(TAG,"连接失败");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关掉Socket和输入输出流
|
* 关掉Socket和输入输出流
|
||||||
*/
|
*/
|
||||||
public static void closeSocketAndStream() {
|
public static void closeSocketAndStream() {
|
||||||
if (outputStream != null) {
|
if (outputStream != null) {
|
||||||
try {
|
try {
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
Log.d(TAG,"关闭输出流");
|
Log.d(TAG,"关闭输出流");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
outputStream = null;
|
outputStream = null;
|
||||||
}
|
}
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
try {
|
try {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
Log.d(TAG,"关闭输入流");
|
Log.d(TAG,"关闭输入流");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
inputStream = null;
|
inputStream = null;
|
||||||
}
|
}
|
||||||
if (mSocket != null) {
|
if (mSocket != null) {
|
||||||
try {
|
try {
|
||||||
mSocket.close();
|
mSocket.close();
|
||||||
Log.d(TAG,"关闭Socket");
|
Log.d(TAG,"关闭Socket");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
mSocket = null;
|
mSocket = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接服务器任务
|
* 连接服务器任务
|
||||||
*/
|
*/
|
||||||
static class ConnectSeverThread extends Thread {
|
static class ConnectSeverThread extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Log.d(TAG,"连接线程开启");
|
Log.d(TAG,"连接线程开启");
|
||||||
while (connectFlage) {
|
while (connectFlage) {
|
||||||
try {
|
try {
|
||||||
Log.d(TAG,"正在连接...");
|
Log.d(TAG,"正在连接...");
|
||||||
mSocket = new Socket(mIp, mPort);//进行连接
|
mSocket = new Socket(mIp, mPort);//进行连接
|
||||||
connectFlage = false;//已连接
|
connectFlage = false;//已连接
|
||||||
tcpClientCountDownTimer.cancel();//关掉计时器
|
tcpClientCountDownTimer.cancel();//关掉计时器
|
||||||
/*连接成功更新显示连接状态的UI*/
|
/*连接成功更新显示连接状态的UI*/
|
||||||
Message msg = new Message();
|
Message msg = new Message();
|
||||||
msg.what = 1;
|
msg.what = 1;
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
Log.d(TAG,"连接成功");
|
Log.d(TAG,"连接成功");
|
||||||
inputStream = mSocket.getInputStream();//获取输入流
|
inputStream = mSocket.getInputStream();//获取输入流
|
||||||
Log.d(TAG,"获取输入流");
|
Log.d(TAG,"获取输入流");
|
||||||
outputStream = mSocket.getOutputStream();////获取输出流
|
outputStream = mSocket.getOutputStream();////获取输出流
|
||||||
Log.d(TAG,"获取输出流");
|
Log.d(TAG,"获取输出流");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.d(TAG,"连接过程中出错");
|
Log.d(TAG,"连接过程中出错");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传入硬件服务端IP建立TCP连接
|
* 传入硬件服务端IP建立TCP连接
|
||||||
* 正在连接每200ms 发送一条‘正在连接’广播
|
* 正在连接每200ms 发送一条‘正在连接’广播
|
||||||
* 3秒后还未连接则连接失败 发送一条‘失败广播’
|
* 3秒后还未连接则连接失败 发送一条‘失败广播’
|
||||||
* 连接成功会 发送一条‘成功广播’
|
* 连接成功会 发送一条‘成功广播’
|
||||||
*
|
*
|
||||||
* @param IPAdress
|
* @param IPAdress
|
||||||
*/
|
*/
|
||||||
public static void connetByTCP(String IPAdress,int Port) {
|
public static void connetByTCP(String IPAdress,int Port) {
|
||||||
mIp = IPAdress;
|
mIp = IPAdress;
|
||||||
mPort=Port;
|
mPort=Port;
|
||||||
ConnectSeverThread connectSeverThread = new ConnectSeverThread();
|
ConnectSeverThread connectSeverThread = new ConnectSeverThread();
|
||||||
connectSeverThread.start();
|
connectSeverThread.start();
|
||||||
tcpClientCountDownTimer.start();
|
tcpClientCountDownTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向硬件发送数据
|
* 向硬件发送数据
|
||||||
*/
|
*/
|
||||||
public static void sendData(String data) {
|
public static void sendData(String data) {
|
||||||
if(mSocket!=null){
|
if(mSocket!=null){
|
||||||
byte[] sendByte = data.getBytes();
|
byte[] sendByte = data.getBytes();
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Log.d(TAG,"发送线程开启 正在发送中...");
|
Log.d(TAG,"发送线程开启 正在发送中...");
|
||||||
DataOutputStream writer = new DataOutputStream(outputStream);
|
DataOutputStream writer = new DataOutputStream(outputStream);
|
||||||
writer.write(sendByte, 0, sendByte.length);
|
writer.write(sendByte, 0, sendByte.length);
|
||||||
Log.d(TAG,"已发送数据:"+data);
|
Log.d(TAG,"已发送数据:"+data);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Log.d(TAG,"发送线程结束");
|
Log.d(TAG,"发送线程结束");
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接成功后开启
|
* 连接成功后开启
|
||||||
* 接收硬件发送的数据
|
* 接收硬件发送的数据
|
||||||
*/
|
*/
|
||||||
public static void readData() {
|
public static void readData() {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Log.d(TAG,"接收线程开启");
|
Log.d(TAG,"接收线程开启");
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
//如果连接断开 尝试重连
|
//如果连接断开 尝试重连
|
||||||
try {
|
try {
|
||||||
/*
|
/*
|
||||||
sendUrgentData()方法
|
sendUrgentData()方法
|
||||||
它会往输出流发送一个字节的数据,
|
它会往输出流发送一个字节的数据,
|
||||||
只要对方Socket的SO_OOBINLINE属性没有打开,
|
只要对方Socket的SO_OOBINLINE属性没有打开,
|
||||||
就会自动舍弃这个字节,
|
就会自动舍弃这个字节,
|
||||||
就会抛出异常,
|
就会抛出异常,
|
||||||
而SO_OOBINLINE属性默认情况下就是关闭的
|
而SO_OOBINLINE属性默认情况下就是关闭的
|
||||||
*/
|
*/
|
||||||
mSocket.sendUrgentData(0xFF);//发送1个字节的紧急数据,默认情况下,服务器端没有开启紧急数据处理,不影响正常通信
|
mSocket.sendUrgentData(0xFF);//发送1个字节的紧急数据,默认情况下,服务器端没有开启紧急数据处理,不影响正常通信
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.d(TAG,"连接已断开,请重新进行连接");
|
Log.d(TAG,"连接已断开,请重新进行连接");
|
||||||
Message msg=new Message();
|
Message msg=new Message();
|
||||||
msg.what=2;
|
msg.what=2;
|
||||||
msg.obj="连接已断开,请重新进行连接";
|
msg.obj="连接已断开,请重新进行连接";
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
DataInputStream reader = new DataInputStream(inputStream);
|
DataInputStream reader = new DataInputStream(inputStream);
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int len;
|
int len;
|
||||||
while ((len = reader.read(buffer)) != -1) {
|
while ((len = reader.read(buffer)) != -1) {
|
||||||
String data = new String(buffer, 0, len);
|
String data = new String(buffer, 0, len);
|
||||||
Log.d(TAG,"接收到数据:"+data);
|
Log.d(TAG,"接收到数据:"+data);
|
||||||
Message msg = new Message();
|
Message msg = new Message();
|
||||||
msg.what = 0;
|
msg.what = 0;
|
||||||
msg.obj = data;
|
msg.obj = data;
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Log.d(TAG,"接收线程结束");
|
Log.d(TAG,"接收线程结束");
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
android:width="108dp"
|
android:width="108dp"
|
||||||
android:height="108dp"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="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">
|
<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">
|
<aapt:attr name="android:fillColor">
|
||||||
<gradient
|
<gradient
|
||||||
android:endX="85.84757"
|
android:endX="85.84757"
|
||||||
android:endY="92.4963"
|
android:endY="92.4963"
|
||||||
android:startX="42.9492"
|
android:startX="42.9492"
|
||||||
android:startY="49.59793"
|
android:startY="49.59793"
|
||||||
android:type="linear">
|
android:type="linear">
|
||||||
<item
|
<item
|
||||||
android:color="#44000000"
|
android:color="#44000000"
|
||||||
android:offset="0.0" />
|
android:offset="0.0" />
|
||||||
<item
|
<item
|
||||||
android:color="#00000000"
|
android:color="#00000000"
|
||||||
android:offset="1.0" />
|
android:offset="1.0" />
|
||||||
</gradient>
|
</gradient>
|
||||||
</aapt:attr>
|
</aapt:attr>
|
||||||
</path>
|
</path>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="#FFFFFF"
|
||||||
android:fillType="nonZero"
|
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: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:strokeWidth="1"
|
||||||
android:strokeColor="#00000000" />
|
android:strokeColor="#00000000" />
|
||||||
</vector>
|
</vector>
|
|
@ -1,5 +1,5 @@
|
||||||
<vector android:height="24dp" android:tint="#263483"
|
<vector android:height="24dp" android:tint="#263483"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
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"/>
|
<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>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<vector android:autoMirrored="true" android:height="24dp"
|
<vector android:autoMirrored="true" android:height="24dp"
|
||||||
android:tint="#9E8A8A" android:viewportHeight="24"
|
android:tint="#9E8A8A" android:viewportHeight="24"
|
||||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
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"/>
|
<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>
|
||||||
|
|
|
@ -1,170 +1,170 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="108dp"
|
android:width="108dp"
|
||||||
android:height="108dp"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="108">
|
android:viewportHeight="108">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#3DDC84"
|
android:fillColor="#3DDC84"
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M9,0L9,108"
|
android:pathData="M9,0L9,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,0L19,108"
|
android:pathData="M19,0L19,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M29,0L29,108"
|
android:pathData="M29,0L29,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M39,0L39,108"
|
android:pathData="M39,0L39,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M49,0L49,108"
|
android:pathData="M49,0L49,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M59,0L59,108"
|
android:pathData="M59,0L59,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M69,0L69,108"
|
android:pathData="M69,0L69,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M79,0L79,108"
|
android:pathData="M79,0L79,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M89,0L89,108"
|
android:pathData="M89,0L89,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M99,0L99,108"
|
android:pathData="M99,0L99,108"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,9L108,9"
|
android:pathData="M0,9L108,9"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,19L108,19"
|
android:pathData="M0,19L108,19"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,29L108,29"
|
android:pathData="M0,29L108,29"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,39L108,39"
|
android:pathData="M0,39L108,39"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,49L108,49"
|
android:pathData="M0,49L108,49"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,59L108,59"
|
android:pathData="M0,59L108,59"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,69L108,69"
|
android:pathData="M0,69L108,69"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,79L108,79"
|
android:pathData="M0,79L108,79"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,89L108,89"
|
android:pathData="M0,89L108,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M0,99L108,99"
|
android:pathData="M0,99L108,99"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,29L89,29"
|
android:pathData="M19,29L89,29"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,39L89,39"
|
android:pathData="M19,39L89,39"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,49L89,49"
|
android:pathData="M19,49L89,49"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,59L89,59"
|
android:pathData="M19,59L89,59"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,69L89,69"
|
android:pathData="M19,69L89,69"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M19,79L89,79"
|
android:pathData="M19,79L89,79"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M29,19L29,89"
|
android:pathData="M29,19L29,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M39,19L39,89"
|
android:pathData="M39,19L39,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M49,19L49,89"
|
android:pathData="M49,19L49,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M59,19L59,89"
|
android:pathData="M59,19L59,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M69,19L69,89"
|
android:pathData="M69,19L69,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path
|
<path
|
||||||
android:fillColor="#00000000"
|
android:fillColor="#00000000"
|
||||||
android:pathData="M79,19L79,89"
|
android:pathData="M79,19L79,89"
|
||||||
android:strokeWidth="0.8"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" />
|
android:strokeColor="#33FFFFFF" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
@ -1,323 +1,366 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#F0F0F0"
|
android:background="#F0F0F0"
|
||||||
tools:context=".ClientActivity">
|
tools:context=".ClientActivity">
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
<androidx.appcompat.widget.Toolbar
|
android:background="@color/toolbar_color"
|
||||||
android:id="@+id/toolBar_client"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_width="match_parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_width="match_parent"
|
||||||
android:background="@color/toolbar_color"
|
android:layout_height="?attr/actionBarSize">
|
||||||
app:navigationIcon="@drawable/iv_back"
|
|
||||||
app:title="机器人控制"
|
<ImageView
|
||||||
app:titleMarginStart="80dp"
|
android:id="@+id/iv_three_main"
|
||||||
app:titleTextColor="@color/white"/>
|
android:layout_width="wrap_content"
|
||||||
<LinearLayout
|
android:layout_height="30dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_marginStart="28dp"
|
||||||
android:layout_height="150dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginTop="10dp"
|
android:background="@drawable/iv_three"
|
||||||
android:layout_marginEnd="10dp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_marginStart="10dp">
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/tv_title"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/rounded_corner_bg"
|
android:textSize="20sp"
|
||||||
android:layout_marginRight="10dp"
|
android:textColor="@color/text_color"
|
||||||
>
|
android:text="机器人控制"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
<TextView
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
android:id="@+id/textView11"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="12dp"
|
<TextView
|
||||||
android:layout_marginTop="10dp"
|
android:id="@+id/tv_setting_main"
|
||||||
android:text="启动机器人"
|
android:layout_width="wrap_content"
|
||||||
android:textColor="#1E1E1E"
|
android:layout_height="wrap_content"
|
||||||
android:textStyle="bold"
|
android:layout_marginTop="16dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_marginEnd="16dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/start_robot_iv" />
|
android:text="设置"
|
||||||
|
android:textColor="@color/text_color"
|
||||||
<TextView
|
android:textSize="20sp"
|
||||||
android:id="@+id/textView12"
|
app:layout_constraintBaseline_toBaselineOf="@id/tv_title"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_height="wrap_content"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:text="状态:机器人已就绪"
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
<LinearLayout
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView11"
|
android:layout_width="match_parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView11" />
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
<ImageView
|
android:layout_marginEnd="10dp"
|
||||||
android:id="@+id/start_robot_iv"
|
android:layout_marginStart="10dp">
|
||||||
android:background="@drawable/robot_start"
|
|
||||||
android:layout_width="67dp"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_height="63dp"
|
android:id="@+id/btn_run_robot"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="7dp"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_marginEnd="10dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_weight="1"
|
||||||
app:srcCompat="@drawable/robot_start" />
|
android:background="@drawable/ripple_effect">
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<TextView
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:id="@+id/textView11"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_marginStart="12dp"
|
||||||
android:background="@drawable/rounded_corner_bg"
|
android:layout_marginTop="10dp"
|
||||||
>
|
android:text="启动机器人"
|
||||||
|
android:textColor="#1E1E1E"
|
||||||
<ImageView
|
android:textStyle="bold"
|
||||||
android:id="@+id/imageView4"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_width="80dp"
|
app:layout_constraintTop_toBottomOf="@+id/imageView5" />
|
||||||
android:layout_height="63dp"
|
|
||||||
android:layout_marginStart="10dp"
|
<TextView
|
||||||
android:layout_marginTop="7dp"
|
android:id="@+id/textView12"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_width="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/path_plan" />
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="状态:机器人已就绪"
|
||||||
<TextView
|
app:layout_constraintStart_toStartOf="@+id/textView11"
|
||||||
android:id="@+id/textView4"
|
app:layout_constraintTop_toBottomOf="@+id/textView11" />
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
<ImageView
|
||||||
android:layout_marginStart="20dp"
|
android:id="@+id/imageView5"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_width="67dp"
|
||||||
android:text="全覆盖割草"
|
android:layout_height="63dp"
|
||||||
android:textColor="#1E1E1E"
|
android:layout_marginStart="12dp"
|
||||||
android:textStyle="bold"
|
android:layout_marginTop="7dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageView4" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/robot_start" />
|
||||||
<TextView
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/textView10"
|
|
||||||
android:layout_width="wrap_content"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/btn_full_coverage"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_width="match_parent"
|
||||||
android:text="上次割草: 3天前"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView4"
|
android:layout_weight="1"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
android:background="@drawable/ripple_effect">
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<ImageView
|
||||||
|
android:id="@+id/imageView4"
|
||||||
|
android:layout_width="80dp"
|
||||||
</LinearLayout>
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
<LinearLayout
|
android:layout_marginTop="7dp"
|
||||||
android:layout_width="match_parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_height="150dp"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_marginTop="10dp"
|
app:srcCompat="@drawable/path_plan" />
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_marginStart="10dp">
|
<TextView
|
||||||
|
android:id="@+id/textView4"
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_weight="1"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/rounded_corner_bg"
|
android:text="全覆盖割草"
|
||||||
android:layout_marginEnd="10dp"
|
android:textColor="#1E1E1E"
|
||||||
>
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<TextView
|
app:layout_constraintTop_toBottomOf="@+id/imageView4" />
|
||||||
android:id="@+id/tv_charge"
|
|
||||||
android:layout_width="wrap_content"
|
<TextView
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/textView10"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/back_charging"
|
android:layout_marginTop="15dp"
|
||||||
android:textColor="#1E1E1E"
|
android:text="上次割草: 3天前"
|
||||||
android:textStyle="bold"
|
app:layout_constraintStart_toStartOf="@+id/textView4"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/textView4" />
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_charge" />
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<TextView
|
|
||||||
android:id="@+id/charge_state"
|
|
||||||
android:layout_width="wrap_content"
|
</LinearLayout>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
<LinearLayout
|
||||||
android:text="@string/last_charging"
|
android:layout_width="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_charge"
|
android:layout_height="150dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_charge" />
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
<ImageView
|
android:layout_marginStart="10dp">
|
||||||
android:id="@+id/iv_charge"
|
|
||||||
android:layout_width="67dp"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_height="63dp"
|
android:id="@+id/btn_retrun_charge"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="7dp"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_marginRight="10dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_weight="1"
|
||||||
app:srcCompat="@drawable/robot_charge" />
|
android:background="@drawable/ripple_effect">
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<TextView
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:id="@+id/tv_charge"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_marginStart="12dp"
|
||||||
android:background="@drawable/rounded_corner_bg"
|
android:layout_marginTop="10dp"
|
||||||
>
|
android:text="返回充电"
|
||||||
|
android:textColor="#1E1E1E"
|
||||||
<ImageView
|
android:textStyle="bold"
|
||||||
android:id="@+id/iv_stop_robot"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_width="80dp"
|
app:layout_constraintTop_toBottomOf="@+id/iv_charge" />
|
||||||
android:layout_height="63dp"
|
|
||||||
android:layout_marginStart="10dp"
|
<TextView
|
||||||
android:layout_marginTop="7dp"
|
android:id="@+id/charge_state"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_width="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/iv_finish" />
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="上次充电: 一周前"
|
||||||
<TextView
|
app:layout_constraintStart_toStartOf="@+id/tv_charge"
|
||||||
android:id="@+id/tv_lawn_patrol"
|
app:layout_constraintTop_toBottomOf="@+id/tv_charge" />
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
<ImageView
|
||||||
android:layout_marginStart="20dp"
|
android:id="@+id/iv_charge"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_width="67dp"
|
||||||
android:text="@string/finish"
|
android:layout_height="63dp"
|
||||||
android:textColor="#1E1E1E"
|
android:layout_marginStart="12dp"
|
||||||
android:textStyle="bold"
|
android:layout_marginTop="7dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_stop_robot" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/robot_charge" />
|
||||||
<TextView
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:id="@+id/tv_lawn_patrol_date"
|
|
||||||
android:layout_width="wrap_content"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/btn_finish_robot"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_width="match_parent"
|
||||||
android:text="@string/turn_off"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_lawn_patrol"
|
android:layout_weight="1"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_lawn_patrol" />
|
android:background="@drawable/ripple_effect"
|
||||||
|
>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_lawn_patrol"
|
||||||
</LinearLayout>
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="63dp"
|
||||||
<LinearLayout
|
android:layout_marginStart="10dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_marginTop="7dp"
|
||||||
android:layout_height="150dp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_marginTop="10dp"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_marginEnd="10dp"
|
app:srcCompat="@drawable/iv_finish" />
|
||||||
android:layout_marginStart="10dp">
|
|
||||||
|
<TextView
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:id="@+id/tv_lawn_patrol"
|
||||||
android:id="@+id/btn_base_init"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_weight="1"
|
android:text="结束程序"
|
||||||
android:background="@drawable/ripple_effect"
|
android:textColor="#1E1E1E"
|
||||||
android:clickable="true"> <!-- 点击效果 -->
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<TextView
|
app:layout_constraintTop_toBottomOf="@+id/iv_lawn_patrol" />
|
||||||
android:id="@+id/tv_base_init"
|
|
||||||
android:layout_width="wrap_content"
|
<TextView
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/tv_lawn_patrol_date"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="基站初始化"
|
android:layout_marginTop="15dp"
|
||||||
android:textColor="#1E1E1E"
|
android:text="点击关闭割草机"
|
||||||
android:textStyle="bold"
|
app:layout_constraintStart_toStartOf="@+id/tv_lawn_patrol"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/tv_lawn_patrol" />
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_base_init" />
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<TextView
|
|
||||||
android:id="@+id/base_init_state_text"
|
|
||||||
android:layout_width="wrap_content"
|
</LinearLayout>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
<LinearLayout
|
||||||
android:text="基站状态:未初始化"
|
android:layout_width="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_base_init"
|
android:layout_height="150dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_base_init" />
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
<ImageView
|
android:layout_marginStart="10dp">
|
||||||
android:id="@+id/iv_base_init"
|
|
||||||
android:layout_width="67dp"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_height="63dp"
|
android:id="@+id/btn_base_init"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginTop="7dp"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_marginRight="10dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_weight="1"
|
||||||
app:srcCompat="@drawable/base_station_init" />
|
android:background="@drawable/ripple_effect"
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
android:clickable="true"> <!-- 点击效果 -->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<TextView
|
||||||
android:id="@+id/btn_range_setting"
|
android:id="@+id/tv_base_init"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_marginStart="12dp"
|
||||||
android:background="@drawable/ripple_effect">
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="基站初始化"
|
||||||
<ImageView
|
android:textColor="#1E1E1E"
|
||||||
android:id="@+id/iv_geofencing_range"
|
android:textStyle="bold"
|
||||||
android:layout_width="80dp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_height="63dp"
|
app:layout_constraintTop_toBottomOf="@+id/iv_base_init" />
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginTop="7dp"
|
<TextView
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:id="@+id/base_init_state_text"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:layout_width="wrap_content"
|
||||||
app:srcCompat="@drawable/geofencing_range" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
<TextView
|
android:text="基站状态:未初始化"
|
||||||
android:id="@+id/tv_ranging_setting"
|
app:layout_constraintStart_toStartOf="@+id/tv_base_init"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintTop_toBottomOf="@+id/tv_base_init" />
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="20dp"
|
<ImageView
|
||||||
android:layout_marginTop="10dp"
|
android:id="@+id/iv_base_init"
|
||||||
android:text="@string/boundary_setting"
|
android:layout_width="67dp"
|
||||||
android:textColor="#1E1E1E"
|
android:layout_height="63dp"
|
||||||
android:textStyle="bold"
|
android:layout_marginStart="12dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:layout_marginTop="7dp"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_geofencing_range" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
<TextView
|
app:srcCompat="@drawable/base_station_init" />
|
||||||
android:id="@+id/tv_geofencing_range_state"
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_marginTop="15dp"
|
android:id="@+id/btn_range_setting"
|
||||||
android:text="@string/weilan"
|
android:layout_width="match_parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_ranging_setting"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_ranging_setting" />
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/ripple_effect">
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_geofencing_range"
|
||||||
</LinearLayout>
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="63dp"
|
||||||
<EditText
|
android:layout_marginStart="10dp"
|
||||||
android:id="@+id/ipET"
|
android:layout_marginTop="7dp"
|
||||||
android:layout_width="match_parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_height="wrap_content"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:hint="@string/ip"
|
app:srcCompat="@drawable/geofencing_range" />
|
||||||
/>
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/btn_confirm"
|
android:id="@+id/tv_ranging_setting"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/connect_server"
|
android:layout_marginStart="20dp"
|
||||||
android:gravity="center" />
|
android:layout_marginTop="10dp"
|
||||||
<EditText
|
android:text="@string/geofencing_range_text"
|
||||||
android:id="@+id/msgET"
|
android:textColor="#1E1E1E"
|
||||||
android:layout_width="match_parent"
|
android:textStyle="bold"
|
||||||
android:layout_height="wrap_content"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:hint="@string/msg"/>
|
app:layout_constraintTop_toBottomOf="@+id/iv_geofencing_range" />
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_send"
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/tv_geofencing_range_state"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/send_msg"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:layout_marginTop="15dp"
|
||||||
android:backgroundTint="#1E88E5"/>
|
android:text="@string/geofencing_range_state_text"
|
||||||
<TextView
|
app:layout_constraintStart_toStartOf="@+id/tv_ranging_setting"
|
||||||
android:id="@+id/msgTV"
|
app:layout_constraintTop_toBottomOf="@+id/tv_ranging_setting" />
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
</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>
|
</LinearLayout>
|
|
@ -5,24 +5,53 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#000000"
|
android:background="@color/toolbar_color"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/toolBar_edit"
|
android:background="@color/toolbar_color"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize">
|
||||||
android:background="@color/black"
|
|
||||||
app:navigationIcon="@drawable/iv_back"
|
<ImageView
|
||||||
app:subtitleTextColor="@color/white"
|
android:id="@+id/iv_three_main"
|
||||||
app:title="设置"
|
android:layout_width="wrap_content"
|
||||||
app:titleMarginStart="120dp"
|
android:layout_height="30dp"
|
||||||
app:titleTextColor="@color/white"/>
|
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
|
<TextView
|
||||||
|
android:textColor="@color/white"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="68dp"
|
android:layout_height="68dp"
|
||||||
android:textColor="@color/text_color"
|
|
||||||
android:text="功能设置"
|
android:text="功能设置"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
|
@ -34,7 +63,7 @@
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:text="地图保存模式(实验功能)"
|
android:text="地图保存模式(实验功能)"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24" />
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -42,7 +71,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="定时割草"
|
android:text="定时割草"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -51,7 +80,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="设备设置"
|
android:text="设备设置"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -60,7 +89,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="割草记录"
|
android:text="割草记录"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -69,7 +98,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="耗材计时"
|
android:text="耗材计时"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -78,7 +107,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="遥控器"
|
android:text="遥控器"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -98,7 +127,7 @@
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingTop="30dp"
|
android:paddingTop="30dp"
|
||||||
android:text="地图管理"
|
android:text="地图管理"
|
||||||
android:textColor="@color/text_color"
|
android:textColor="@color/white"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
tools:ignore="SmallSp" />
|
tools:ignore="SmallSp" />
|
||||||
|
|
||||||
|
@ -107,7 +136,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="区域编辑"
|
android:text="区域编辑"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -116,7 +145,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="虚拟墙/禁区"
|
android:text="虚拟墙/禁区"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
@ -125,7 +154,7 @@
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="重置地图"
|
android:text="重置地图"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="@color/white"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
app:drawableEndCompat="@drawable/baseline_arrow_forward_ios_24"/>
|
||||||
|
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".ESP8266ClientActivity">
|
tools:context=".ESP8266ClientActivity">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_ipESP8266"
|
android:id="@+id/et_ipESP8266"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="ip"
|
android:hint="ip"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_confirmESP8266"
|
android:id="@+id/btn_confirmESP8266"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="confirm"
|
android:text="confirm"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:backgroundTint="#dddddd"/>
|
android:backgroundTint="#dddddd"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_msgESP8266"
|
android:id="@+id/et_msgESP8266"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="msg"/>
|
android:hint="msg"/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_sendESP8266"
|
android:id="@+id/btn_sendESP8266"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="send"
|
android:text="send"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:backgroundTint="#dddddd"/>
|
android:backgroundTint="#dddddd"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="未连接"
|
android:text="未连接"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:id="@+id/connetStatusTV"/>
|
android:id="@+id/connetStatusTV"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
android:id="@+id/tv_msgESP8266"
|
android:id="@+id/tv_msgESP8266"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,327 +1,327 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#F0F0F0"
|
android:background="#F0F0F0"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:background="@color/toolbar_color"
|
android:background="@color/toolbar_color"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize">
|
android:layout_height="?attr/actionBarSize">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_three_main"
|
android:id="@+id/iv_three_main"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="28dp"
|
android:layout_marginStart="28dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:background="@drawable/iv_three"
|
android:background="@drawable/iv_three"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textColor="@color/text_color"
|
android:textColor="@color/text_color"
|
||||||
android:text="深安割草机器人"
|
android:text="深安割草机器人"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_setting_main"
|
android:id="@+id/tv_setting_main"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:text="设置"
|
android:text="设置"
|
||||||
android:textColor="@color/text_color"
|
android:textColor="@color/text_color"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBaseline_toBaselineOf="@id/tv_title"
|
app:layout_constraintBaseline_toBaselineOf="@id/tv_title"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<com.amap.api.maps.MapView
|
<com.amap.api.maps.MapView
|
||||||
android:id="@+id/map_view"
|
android:id="@+id/map_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginBottom="10dp"/>
|
android:layout_marginBottom="10dp"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="140dp"
|
android:layout_height="140dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
<ImageButton
|
<ImageView
|
||||||
android:id="@+id/robot_start"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="180dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="160dp"
|
android:layout_height="160dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:background="@drawable/robot_medium" />
|
app:srcCompat="@drawable/robot_medium" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_above="@+id/imageView2"
|
android:layout_above="@+id/imageView2"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_marginStart="23dp"
|
android:layout_marginStart="23dp"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="86"
|
android:text="86"
|
||||||
android:textColor="#1E1E1E"
|
android:textColor="#1E1E1E"
|
||||||
android:textSize="40sp"
|
android:textSize="40sp"
|
||||||
android:textStyle="bold|italic" />
|
android:textStyle="bold|italic" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView2"
|
android:id="@+id/imageView2"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginBottom="22dp"
|
android:layout_marginBottom="22dp"
|
||||||
app:srcCompat="@drawable/battery" />
|
app:srcCompat="@drawable/battery" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView2"
|
android:id="@+id/textView2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/imageView2"
|
android:layout_above="@+id/imageView2"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_toEndOf="@+id/textView"
|
android:layout_toEndOf="@+id/textView"
|
||||||
android:text="%"
|
android:text="%"
|
||||||
android:textColor="#1C1B1B"
|
android:textColor="#1C1B1B"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView3"
|
android:id="@+id/imageView3"
|
||||||
android:layout_width="20dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
app:srcCompat="@drawable/wifi" />
|
app:srcCompat="@drawable/wifi" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView6"
|
android:id="@+id/imageView6"
|
||||||
android:layout_width="20dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_toEndOf="@+id/imageView3"
|
android:layout_toEndOf="@+id/imageView3"
|
||||||
app:srcCompat="@drawable/satellite" />
|
app:srcCompat="@drawable/satellite" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_uwb_state"
|
android:id="@+id/iv_uwb_state"
|
||||||
android:layout_width="20dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_toEndOf="@+id/imageView6"
|
android:layout_toEndOf="@+id/imageView6"
|
||||||
app:srcCompat="@drawable/uwb" />
|
app:srcCompat="@drawable/uwb" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="220dp"
|
android:layout_height="220dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layout_left"
|
android:id="@+id/layout_left"
|
||||||
android:layout_width="180dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/base_config_layout"
|
android:id="@+id/base_config_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView8"
|
android:id="@+id/textView8"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="基站配置"
|
android:text="基站配置"
|
||||||
android:textColor="#1E1E1E"
|
android:textColor="#1E1E1E"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="@+id/imageView12"
|
app:layout_constraintStart_toStartOf="@+id/imageView12"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageView12" />
|
app:layout_constraintTop_toBottomOf="@+id/imageView12" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView9"
|
android:id="@+id/textView9"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="当前共有3个基站在线"
|
android:text="当前共有3个基站在线"
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView8"
|
app:layout_constraintStart_toStartOf="@+id/textView8"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView12"
|
android:id="@+id/imageView12"
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/base_station" />
|
app:srcCompat="@drawable/base_station" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/client_mode_layout"
|
android:id="@+id/client_mode_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView6"
|
android:id="@+id/textView6"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="割草作业区"
|
android:text="割草作业区"
|
||||||
android:textColor="#1E1E1E"
|
android:textColor="#1E1E1E"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="@+id/imageView11"
|
app:layout_constraintStart_toStartOf="@+id/imageView11"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageView11" />
|
app:layout_constraintTop_toBottomOf="@+id/imageView11" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView7"
|
android:id="@+id/textView7"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="共13个区域"
|
android:text="共13个区域"
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView6"
|
app:layout_constraintStart_toStartOf="@+id/textView6"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView6" />
|
app:layout_constraintTop_toBottomOf="@+id/textView6" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView11"
|
android:id="@+id/imageView11"
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/mowgin_working" />
|
app:srcCompat="@drawable/mowgin_working" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layout_right"
|
android:id="@+id/layout_right"
|
||||||
android:layout_width="180dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/mowing_layout"
|
android:id="@+id/mowing_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView9"
|
android:id="@+id/imageView9"
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/target" />
|
app:srcCompat="@drawable/target" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView3"
|
android:id="@+id/textView3"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="@string/robot_function"
|
android:text="最后作业"
|
||||||
android:textColor="#1E1E1E"
|
android:textColor="#1E1E1E"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="@+id/imageView9"
|
app:layout_constraintStart_toStartOf="@+id/imageView9"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageView9" />
|
app:layout_constraintTop_toBottomOf="@+id/imageView9" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_location"
|
android:id="@+id/tv_location"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="高尔夫球场"
|
android:text="高尔夫球场"
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/textView3"
|
app:layout_constraintStart_toStartOf="@+id/textView3"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_mapping_history"
|
android:id="@+id/iv_mapping_history"
|
||||||
android:layout_width="189dp"
|
android:layout_width="189dp"
|
||||||
android:layout_height="78dp"
|
android:layout_height="78dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.514"
|
app:layout_constraintHorizontal_bias="0.514"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:srcCompat="@drawable/mowing_mapping" />
|
app:srcCompat="@drawable/mowing_mapping" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView5"
|
android:id="@+id/textView5"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="3天前"
|
android:text="3天前"
|
||||||
android:textSize="8sp"
|
android:textSize="8sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_location"
|
app:layout_constraintStart_toStartOf="@+id/tv_location"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_location" />
|
app:layout_constraintTop_toBottomOf="@+id/tv_location" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView10"
|
android:id="@+id/imageView10"
|
||||||
android:layout_width="10dp"
|
android:layout_width="10dp"
|
||||||
android:layout_height="10dp"
|
android:layout_height="10dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView3"
|
app:layout_constraintBottom_toBottomOf="@+id/textView3"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/textView3"
|
app:layout_constraintTop_toTopOf="@+id/textView3"
|
||||||
app:srcCompat="@drawable/icon_dot" />
|
app:srcCompat="@drawable/icon_dot" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -8,17 +8,70 @@
|
||||||
android:background="@drawable/back"
|
android:background="@drawable/back"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/toolBar_robot"
|
android:background="@color/toolbar_color"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize">
|
||||||
android:background="@color/black"
|
|
||||||
app:navigationIcon="@drawable/iv_back"
|
<ImageView
|
||||||
app:subtitle="充电完成"
|
android:id="@+id/iv_three_main"
|
||||||
app:subtitleTextColor="@color/white"
|
android:layout_width="wrap_content"
|
||||||
app:title="小白"
|
android:layout_height="30dp"
|
||||||
app:titleMarginStart="120dp"
|
android:layout_marginStart="28dp"
|
||||||
app:titleTextColor="@color/white"/>
|
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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,256 +1,256 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#F0F0F0"
|
android:background="#F0F0F0"
|
||||||
tools:context=".ServiceActivity">
|
tools:context=".ServiceActivity">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView8"
|
android:id="@+id/imageView8"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="57dp"
|
android:layout_height="57dp"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginTop="21dp"
|
android:layout_marginTop="21dp"
|
||||||
android:layout_marginBottom="21dp"
|
android:layout_marginBottom="21dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/uwb_base_blue" />
|
app:srcCompat="@drawable/uwb_base_blue" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView14"
|
android:id="@+id/textView14"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:text="UWB基站 : 1号"
|
android:text="UWB基站 : 1号"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView8"
|
app:layout_constraintStart_toEndOf="@+id/imageView8"
|
||||||
app:layout_constraintTop_toTopOf="@+id/imageView8" />
|
app:layout_constraintTop_toTopOf="@+id/imageView8" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView15"
|
android:id="@+id/textView15"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="90%"
|
android:text="90%"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/imageView14"
|
app:layout_constraintBottom_toBottomOf="@+id/imageView14"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView14" />
|
app:layout_constraintStart_toEndOf="@+id/imageView14" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView16"
|
android:id="@+id/textView16"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:text="坐标 x:240,y:180,z:240"
|
android:text="坐标 x:240,y:180,z:240"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView15"
|
app:layout_constraintBottom_toBottomOf="@+id/textView15"
|
||||||
app:layout_constraintStart_toEndOf="@+id/textView15" />
|
app:layout_constraintStart_toEndOf="@+id/textView15" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView13"
|
android:id="@+id/imageView13"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/setting" />
|
app:srcCompat="@drawable/setting" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView14"
|
android:id="@+id/imageView14"
|
||||||
android:layout_width="23dp"
|
android:layout_width="23dp"
|
||||||
android:layout_height="21dp"
|
android:layout_height="21dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView8"
|
app:layout_constraintStart_toEndOf="@+id/imageView8"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView14"
|
app:layout_constraintTop_toBottomOf="@+id/textView14"
|
||||||
app:srcCompat="@drawable/uwb_battery" />
|
app:srcCompat="@drawable/uwb_battery" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView82"
|
android:id="@+id/imageView82"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="57dp"
|
android:layout_height="57dp"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginTop="21dp"
|
android:layout_marginTop="21dp"
|
||||||
android:layout_marginBottom="21dp"
|
android:layout_marginBottom="21dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/uwb_base_blue" />
|
app:srcCompat="@drawable/uwb_base_blue" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView142"
|
android:id="@+id/textView142"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:text="UWB基站 : 2号"
|
android:text="UWB基站 : 2号"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView82"
|
app:layout_constraintStart_toEndOf="@+id/imageView82"
|
||||||
app:layout_constraintTop_toTopOf="@+id/imageView82" />
|
app:layout_constraintTop_toTopOf="@+id/imageView82" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView152"
|
android:id="@+id/textView152"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="98%"
|
android:text="98%"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/imageView142"
|
app:layout_constraintBottom_toBottomOf="@+id/imageView142"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView142" />
|
app:layout_constraintStart_toEndOf="@+id/imageView142" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView162"
|
android:id="@+id/textView162"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:text="坐标 x:240,y:180,z:240"
|
android:text="坐标 x:240,y:180,z:240"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView152"
|
app:layout_constraintBottom_toBottomOf="@+id/textView152"
|
||||||
app:layout_constraintStart_toEndOf="@+id/textView152" />
|
app:layout_constraintStart_toEndOf="@+id/textView152" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView132"
|
android:id="@+id/imageView132"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/setting" />
|
app:srcCompat="@drawable/setting" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView142"
|
android:id="@+id/imageView142"
|
||||||
android:layout_width="23dp"
|
android:layout_width="23dp"
|
||||||
android:layout_height="21dp"
|
android:layout_height="21dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView82"
|
app:layout_constraintStart_toEndOf="@+id/imageView82"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView142"
|
app:layout_constraintTop_toBottomOf="@+id/textView142"
|
||||||
app:srcCompat="@drawable/uwb_battery" />
|
app:srcCompat="@drawable/uwb_battery" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:background="@drawable/rounded_corner_bg">
|
android:background="@drawable/rounded_corner_bg">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView83"
|
android:id="@+id/imageView83"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="57dp"
|
android:layout_height="57dp"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginTop="21dp"
|
android:layout_marginTop="21dp"
|
||||||
android:layout_marginBottom="21dp"
|
android:layout_marginBottom="21dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/uwb_base_blue" />
|
app:srcCompat="@drawable/uwb_base_blue" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView143"
|
android:id="@+id/textView143"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:text="UWB基站 : 3号"
|
android:text="UWB基站 : 3号"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView83"
|
app:layout_constraintStart_toEndOf="@+id/imageView83"
|
||||||
app:layout_constraintTop_toTopOf="@+id/imageView83" />
|
app:layout_constraintTop_toTopOf="@+id/imageView83" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView153"
|
android:id="@+id/textView153"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="78%"
|
android:text="78%"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/imageView143"
|
app:layout_constraintBottom_toBottomOf="@+id/imageView143"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView143" />
|
app:layout_constraintStart_toEndOf="@+id/imageView143" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView163"
|
android:id="@+id/textView163"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:text="坐标 x:240,y:180,z:240"
|
android:text="坐标 x:240,y:180,z:240"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/textView153"
|
app:layout_constraintBottom_toBottomOf="@+id/textView153"
|
||||||
app:layout_constraintStart_toEndOf="@+id/textView153" />
|
app:layout_constraintStart_toEndOf="@+id/textView153" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView133"
|
android:id="@+id/imageView133"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/setting" />
|
app:srcCompat="@drawable/setting" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView143"
|
android:id="@+id/imageView143"
|
||||||
android:layout_width="23dp"
|
android:layout_width="23dp"
|
||||||
android:layout_height="21dp"
|
android:layout_height="21dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
app:layout_constraintStart_toEndOf="@+id/imageView83"
|
app:layout_constraintStart_toEndOf="@+id/imageView83"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView143"
|
app:layout_constraintTop_toBottomOf="@+id/textView143"
|
||||||
app:srcCompat="@drawable/uwb_battery" />
|
app:srcCompat="@drawable/uwb_battery" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/showIPBtn"
|
android:id="@+id/showIPBtn"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="显示IP"
|
android:text="显示IP"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="15dp" />
|
android:padding="15dp" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/clearBtn"
|
android:id="@+id/clearBtn"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="清屏"
|
android:text="清屏"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="15dp"
|
android:padding="15dp"
|
||||||
android:layout_marginLeft="5dp"/>
|
android:layout_marginLeft="5dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/ipTV"
|
android:id="@+id/ipTV"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"/>
|
android:layout_margin="10dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/msgTV"
|
android:id="@+id/msgTV"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
android:layout_margin="10dp"/>
|
android:layout_margin="10dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher" />
|
<background android:drawable="@drawable/ic_launcher" />
|
||||||
<foreground android:drawable="@drawable/ic_launcher" />
|
<foreground android:drawable="@drawable/ic_launcher" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
|
@ -1,16 +1,16 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.WiFiDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.WiFiDemo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/black</item>
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
|
@ -1,15 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="purple_200">#FFBB86FC</color>
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
<color name="purple_500">#FF6200EE</color>
|
<color name="purple_500">#FF6200EE</color>
|
||||||
<color name="purple_700">#FF3700B3</color>
|
<color name="purple_700">#0E5E9E</color>
|
||||||
<color name="teal_200">#FF03DAC5</color>
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
<color name="teal_700">#FF018786</color>
|
<color name="teal_700">#FF018786</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
<color name="red">#FF0000</color>
|
<color name="toolbar_color">#0E5E9E</color>
|
||||||
<color name="text_color">#AAA6A6</color>
|
<color name="text_color">#AAA6A6</color>
|
||||||
<color name="text_white">#DCD5D5</color>
|
<color name="text_blue">#1296db</color>
|
||||||
<color name="text_blue">#1296db</color>
|
<color name="text_white">#DCD5D5</color>
|
||||||
<color name="toolbar_color">#0E5E9E</color>
|
|
||||||
</resources>
|
</resources>
|
|
@ -1,27 +1,23 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">UPBot</string>
|
<string name="app_name">UPBot</string>
|
||||||
<string name="service">基站配置</string>
|
<string name="service">基站配置</string>
|
||||||
<string name="client">割草</string>
|
<string name="client">割草</string>
|
||||||
<string name="custom">设置</string>
|
<string name="custom">设置</string>
|
||||||
<string name="shen_an_team">深安实验室研发出品</string>
|
<string name="shen_an_team">深安实验室研发出品</string>
|
||||||
<string name="shen_an_team_en">\@ShenAn Technology Co.,Ltd</string>
|
<string name="shen_an_team_en">\@ShenAn Technology Co.,Ltd</string>
|
||||||
|
|
||||||
<string name="more">more\n</string>
|
<!-- 机器人控制Activity-->
|
||||||
<string name="boundary_setting">割草边界设定</string>
|
<string name="scan_date_text_info">上次巡逻: 1天前</string>
|
||||||
<string name="weilan">地理围栏:未设置</string>
|
<string name="debug_data_send">调试信息发送</string>
|
||||||
<string name="back_charging">返回充电</string>
|
<string name="debug_data_send_hint">调试命令</string>
|
||||||
<string name="last_charging">上次充电: 一周前</string>
|
<string name="connect_server_text">连接服务器</string>
|
||||||
<string name="grass_garden">草坪巡逻</string>
|
|
||||||
<string name="last_garden">上次巡逻: 1天前</string>
|
<string name="geofencing_range_state_text">地理围栏:未设置</string>
|
||||||
<string name="connect_server">连接服务器</string>
|
<string name="geofencing_range_text">割草边界设定</string>
|
||||||
<string name="ip">ip</string>
|
|
||||||
<string name="msg">msg</string>
|
<string name="more">more\n</string>
|
||||||
<string name="send_msg">调试信息发送</string>
|
<string name="search">搜索</string>
|
||||||
<string name="robot_function">机器人功能</string>
|
<string name="message">消息</string>
|
||||||
<string name="finish">结束程序</string>
|
<string name="about">关于</string>
|
||||||
<string name="turn_off">点击关闭割草机</string>
|
<string name="setting">设置</string>
|
||||||
<string name="search">搜索</string>
|
|
||||||
<string name="message">消息</string>
|
|
||||||
<string name="about">关于</string>
|
|
||||||
<string name="setting">设置</string>
|
|
||||||
</resources>
|
</resources>
|
|
@ -1,16 +1,16 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.UPBot" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
<style name="Theme.UPBot" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
<item name="colorOnPrimary">@color/white</item>
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
|
@ -1,13 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
Sample backup rules file; uncomment and customize as necessary.
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
See https://developer.android.com/guide/topics/data/autobackup
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
for details.
|
for details.
|
||||||
Note: This file is ignored for devices older that API 31
|
Note: This file is ignored for devices older that API 31
|
||||||
See https://developer.android.com/about/versions/12/backup-restore
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
-->
|
-->
|
||||||
<full-backup-content>
|
<full-backup-content>
|
||||||
<!--
|
<!--
|
||||||
<include domain="sharedpref" path="."/>
|
<include domain="sharedpref" path="."/>
|
||||||
<exclude domain="sharedpref" path="device.xml"/>
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
-->
|
-->
|
||||||
</full-backup-content>
|
</full-backup-content>
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
Sample data extraction rules file; uncomment and customize as necessary.
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
for details.
|
for details.
|
||||||
-->
|
-->
|
||||||
<data-extraction-rules>
|
<data-extraction-rules>
|
||||||
<cloud-backup>
|
<cloud-backup>
|
||||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
<include .../>
|
<include .../>
|
||||||
<exclude .../>
|
<exclude .../>
|
||||||
-->
|
-->
|
||||||
</cloud-backup>
|
</cloud-backup>
|
||||||
<!--
|
<!--
|
||||||
<device-transfer>
|
<device-transfer>
|
||||||
<include .../>
|
<include .../>
|
||||||
<exclude .../>
|
<exclude .../>
|
||||||
</device-transfer>
|
</device-transfer>
|
||||||
-->
|
-->
|
||||||
</data-extraction-rules>
|
</data-extraction-rules>
|
|
@ -1,17 +1,17 @@
|
||||||
package com.example.upbot;
|
package com.example.upbot;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
*
|
*
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
*/
|
*/
|
||||||
public class ExampleUnitTest {
|
public class ExampleUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void addition_isCorrect() {
|
public void addition_isCorrect() {
|
||||||
assertEquals(4, 2 + 2);
|
assertEquals(4, 2 + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '8.1.0' apply false
|
id 'com.android.application' version '8.1.0' apply false
|
||||||
}
|
}
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
// jcenter() // Warning: this repository is going to shut down soon
|
// jcenter() // Warning: this repository is going to shut down soon
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,21 +1,21 @@
|
||||||
# Project-wide Gradle settings.
|
# Project-wide Gradle settings.
|
||||||
# IDE (e.g. Android Studio) users:
|
# IDE (e.g. Android Studio) users:
|
||||||
# Gradle settings configured through the IDE *will override*
|
# Gradle settings configured through the IDE *will override*
|
||||||
# any settings specified in this file.
|
# any settings specified in this file.
|
||||||
# For more details on how to configure your build environment visit
|
# For more details on how to configure your build environment visit
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# 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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
# 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
|
# Android operating system, and which are packaged with your app's APK
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Enables namespacing of each library's R class so that its R class includes only the
|
# 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,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
|
@ -1,6 +1,6 @@
|
||||||
#Tue May 28 16:29:54 CST 2024
|
#Tue May 28 16:29:54 CST 2024
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,185 +1,185 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright 2015 the original author or authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
PRG="$0"
|
||||||
# Need this for relative symlinks.
|
# Need this for relative symlinks.
|
||||||
while [ -h "$PRG" ] ; do
|
while [ -h "$PRG" ] ; do
|
||||||
ls=`ls -ld "$PRG"`
|
ls=`ls -ld "$PRG"`
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
PRG="$link"
|
PRG="$link"
|
||||||
else
|
else
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
SAVED="`pwd`"
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
APP_HOME="`pwd -P`"
|
APP_HOME="`pwd -P`"
|
||||||
cd "$SAVED" >/dev/null
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
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.
|
# 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"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
CYGWIN* )
|
CYGWIN* )
|
||||||
cygwin=true
|
cygwin=true
|
||||||
;;
|
;;
|
||||||
Darwin* )
|
Darwin* )
|
||||||
darwin=true
|
darwin=true
|
||||||
;;
|
;;
|
||||||
MINGW* )
|
MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
NONSTOP* )
|
NONSTOP* )
|
||||||
nonstop=true
|
nonstop=true
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
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.
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
fi
|
fi
|
||||||
ulimit -n $MAX_FD
|
ulimit -n $MAX_FD
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
if $darwin; then
|
if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
SEP=""
|
SEP=""
|
||||||
for dir in $ROOTDIRSRAW ; do
|
for dir in $ROOTDIRSRAW ; do
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
SEP="|"
|
SEP="|"
|
||||||
done
|
done
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
fi
|
fi
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
i=0
|
i=0
|
||||||
for arg in "$@" ; do
|
for arg in "$@" ; do
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=`expr $i + 1`
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
0) set -- ;;
|
0) set -- ;;
|
||||||
1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Escape application args
|
||||||
save () {
|
save () {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=`save "$@"`
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# 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"
|
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" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//dependencyResolutionManagement {
|
//dependencyResolutionManagement {
|
||||||
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
// repositories {
|
// repositories {
|
||||||
// google()
|
// google()
|
||||||
// mavenCentral()
|
// mavenCentral()
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
rootProject.name = "UPBot"
|
rootProject.name = "UPBot"
|
||||||
include ':app'
|
include ':app'
|
||||||
|
|
Loading…
Reference in New Issue