Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0
# Conflicts: # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/SweeperFragment.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/presenter/SweeperPresenter.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java # app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java # app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java # app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java # core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java # core/function-impl/mogo-core-function-bindingcar/src/main/java/com/mogo/eagle/core/function/bindingcar/BindingcarProvider.java # core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt # core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java # core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt # core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java
This commit is contained in:
@@ -6,7 +6,7 @@ android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "com.zhidao.adas.client"
|
||||
minSdkVersion 21
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion 25
|
||||
multiDexEnabled true
|
||||
versionCode 1
|
||||
@@ -87,7 +87,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.gson
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':libraries:mogo-adas-data')
|
||||
implementation project(':libraries:mogo-adas-other')
|
||||
// implementation 'com.zhidao.support.adas:high:2.8.0.0'
|
||||
// implementation 'com.zhjt.mogo.adas.data:adas-data:2.6.6.0'
|
||||
// compileOnly project(':core:mogo-core-data')
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,2 +0,0 @@
|
||||
#### 说明
|
||||
# ADAS 连接状态 LIB
|
||||
@@ -1,106 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'maven'
|
||||
}
|
||||
//ext {
|
||||
// //自动驾驶产品版本号
|
||||
// AP_VERSION = "2.6.0"
|
||||
//}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
// versionCode Integer.valueOf(VERSION_CODE)
|
||||
// versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
//
|
||||
// buildConfigField "String", "AP_VERSION", "\"${AP_VERSION}\""
|
||||
versionCode rootProject.versionCode as int
|
||||
versionName rootProject.versionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDirs = ['libs']
|
||||
// java {
|
||||
// srcDir 'src/main/java'
|
||||
// }
|
||||
//
|
||||
// proto {
|
||||
// srcDir 'src/main/proto'
|
||||
// include '**/*.proto'
|
||||
// }
|
||||
}
|
||||
}
|
||||
//
|
||||
// protobuf {
|
||||
// protoc {
|
||||
// artifact = 'com.google.protobuf:protoc:3.6.1'
|
||||
// }
|
||||
//
|
||||
// generateProtoTasks {
|
||||
// all().each { task ->
|
||||
// task.builtins {
|
||||
// remove java
|
||||
// }
|
||||
// task.builtins {
|
||||
// java {}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
}
|
||||
|
||||
task androidSourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
//配置需要上传到maven仓库的文件
|
||||
artifacts {
|
||||
archives androidSourcesJar
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories.mavenDeployer {
|
||||
repository(url: RELEASE_REPOSITORY_URL) {
|
||||
authentication(userName: USERNAME, password: PASSWORD)
|
||||
}
|
||||
snapshotRepository(url: SNAPSHOT_REPOSITORY_URL) {
|
||||
authentication(userName: USERNAME, password: PASSWORD)
|
||||
}
|
||||
pom.groupId = ADAS_LIB_GROUP
|
||||
pom.artifactId = ADAS_LIB_POM_ARTIFACT_ID
|
||||
pom.version = versionName + ADAS_LIB_CHILD_VERSION
|
||||
pom.whenConfigured { pom ->
|
||||
pom.dependencies.forEach { dep ->
|
||||
if (dep.getVersion() == "unspecified") {
|
||||
println("--修改pom.xml中的dependies模块--->>" + dep.getArtifactId())
|
||||
if (dep.getArtifactId() == ADAS_DATA_LIB_POM_ARTIFACT_ID) {
|
||||
dep.setGroupId(ADAS_DATA_LIB_GROUP)
|
||||
dep.setVersion(versionName + ADAS_DATA_LIB_CHILD_VERSION)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.adas
|
||||
POM_ARTIFACT_ID=mogo-adas
|
||||
VERSION_CODE=1
|
||||
@@ -1,26 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----MogoMap-----
|
||||
-keep class com.mogo.map.MogoNavi{
|
||||
private <init>();
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.support.adas.connect.status" >
|
||||
</manifest>
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.zhidao.support.adas.high;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.zhidao.support.adas.high.common.ConnectStatusTask;
|
||||
import com.zhidao.support.adas.high.widget.ConnectStatusFloatWindow;
|
||||
|
||||
/**
|
||||
* @ProjectName: lib-adas-fpga
|
||||
* @Package: com.zhidao.lib.adas.high
|
||||
* @ClassName: AdasManager
|
||||
* @Description: java类作用描述
|
||||
* @Author: fenghl
|
||||
* @CreateDate: 2020/2/7 13:13
|
||||
* @UpdateUser: 更新者:
|
||||
* @UpdateDate: 2020/2/7 13:13
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class AdasConnectStatusManager {
|
||||
private static volatile AdasConnectStatusManager ourInstance;
|
||||
|
||||
private ConnectStatusFloatWindow floatWindow;
|
||||
|
||||
public static AdasConnectStatusManager getInstance() {
|
||||
if (ourInstance == null) {
|
||||
synchronized (AdasConnectStatusManager.class) {
|
||||
if (ourInstance == null) {
|
||||
ourInstance = new AdasConnectStatusManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private AdasConnectStatusManager() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 展示连接历史
|
||||
*
|
||||
* @param activity
|
||||
*/
|
||||
public void showConnectStatusFloatWindow(Activity activity) {
|
||||
if (floatWindow == null) {
|
||||
floatWindow = new ConnectStatusFloatWindow(activity, ConnectStatusTask.getInstance().getList(), new ConnectStatusFloatWindow.OnConnectStatusFloatWindowListener() {
|
||||
@Override
|
||||
public void onClose() {
|
||||
closeConnectStatusFloatWindow();
|
||||
}
|
||||
});
|
||||
floatWindow.showFloatWindow();
|
||||
} else {
|
||||
closeConnectStatusFloatWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void closeConnectStatusFloatWindow() {
|
||||
floatWindow.hideFloatWindow();
|
||||
floatWindow = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import androidx.annotation.ColorRes;
|
||||
|
||||
public class IPCConnectState {
|
||||
public final String status;
|
||||
@ColorRes
|
||||
public final int color;
|
||||
|
||||
public IPCConnectState(String status, @ColorRes int color) {
|
||||
this.status = status;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,382 +0,0 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.IPCConnectState;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* 连接状态存储任务
|
||||
*/
|
||||
public class ConnectStatusTask {
|
||||
private static final String TAG = ConnectStatusTask.class.getSimpleName();
|
||||
public static final String ROOT_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "mogo" + File.separator + "adas" + File.separator;//程序外部存储跟目录
|
||||
private static final String LOG_FILE_NAME = "ipc_connect_status.log";//文件名称
|
||||
private volatile static ConnectStatusTask INSTANCE;
|
||||
private static final int MAX_LINES = 1000;//最大存储行数
|
||||
private static final int DEL_LINES = 500;//超过最大存储行数删除的行数
|
||||
private static final int EVERY_TIME_READ_LINES = 200;//每次读取最大行数
|
||||
private LinkedBlockingQueue<String> queue;
|
||||
private BufferedWriter buff = null;
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault());
|
||||
private File file;
|
||||
//是否写入本地
|
||||
private final AtomicBoolean isSave = new AtomicBoolean(false);
|
||||
private Future future;
|
||||
private final AtomicBoolean isInitRead = new AtomicBoolean(false);//是否已经读取过本地文件
|
||||
private final List<OnReadListener> onReadListeners = new ArrayList<>();
|
||||
private final List<IPCConnectState> listLog = new ArrayList<>();
|
||||
|
||||
private ConnectStatusTask() {
|
||||
queue = new LinkedBlockingQueue<>();
|
||||
init(false);
|
||||
ThreadPoolManager.getsInstance().submit(new ReadThread());
|
||||
}
|
||||
|
||||
public static ConnectStatusTask getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (ConnectStatusTask.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new ConnectStatusTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public List<IPCConnectState> getList() {
|
||||
return listLog;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
init(true);
|
||||
listLog.clear();
|
||||
if (onReadListeners.size() != 0) {
|
||||
for (int i = 0; i < onReadListeners.size(); i++) {
|
||||
onReadListeners.get(i).onRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setIsLogSwitch(boolean isLogSwitch) {
|
||||
this.isLogSwitch = isLogSwitch;
|
||||
}
|
||||
|
||||
public boolean isLogSwitch() {
|
||||
return isLogSwitch;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSdcardUse() {
|
||||
boolean bl = false;
|
||||
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
private void init(boolean isClear) {
|
||||
if (isSdcardUse()) {
|
||||
try {
|
||||
file = new File(ROOT_PATH + LOG_FILE_NAME);
|
||||
if (isClear && file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
if (!file.exists()) {
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
file.createNewFile();
|
||||
}
|
||||
FileWriter fw = new FileWriter(file, true);
|
||||
buff = new BufferedWriter(fw);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
start();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (future == null) {
|
||||
future = ThreadPoolManager.getsInstance().submit(new WriteThread());
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
queue.clear();
|
||||
if (future != null && !future.isCancelled()) {
|
||||
future.cancel(true);
|
||||
}
|
||||
future = null;
|
||||
closeBufferedWriter();
|
||||
}
|
||||
|
||||
private void closeBufferedWriter() {
|
||||
if (buff != null) {
|
||||
try {
|
||||
buff.flush();
|
||||
buff.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
buff = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void save(String status) {
|
||||
if (isLogSwitch) {
|
||||
String time = sdf.format(new Date(System.currentTimeMillis()));
|
||||
queue.add(time + "##" + status);
|
||||
}
|
||||
}
|
||||
|
||||
private int getStatusColor(String connectStatus) {
|
||||
if (connectStatus.contains("已连接")) {
|
||||
return R.color.connect_status_connected;
|
||||
} else if (connectStatus.contains("连接中") || connectStatus.contains("重连中")) {
|
||||
return R.color.connect_status_connecting;
|
||||
} else if (connectStatus.contains("正在搜索IP")) {
|
||||
return R.color.connect_status_search_address;
|
||||
} else if (connectStatus.contains("地址不可用或不合法")) {
|
||||
return R.color.connect_status_disconnecting;
|
||||
} else {
|
||||
return R.color.connect_status_disconnected;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private synchronized void addList(String status) {
|
||||
listLog.add(0, onParse(status));
|
||||
if (onReadListeners.size() != 0) {
|
||||
for (OnReadListener listener : onReadListeners) {
|
||||
listener.onRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IPCConnectState onParse(String status) {
|
||||
status = status.replace("##", "\n");
|
||||
return new IPCConnectState(status, getStatusColor(status));
|
||||
}
|
||||
|
||||
//写入
|
||||
public class WriteThread implements Runnable {
|
||||
int lineNum = -1;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// L.i(TAG, "是否是主线程=" + Utils.isMainThread());
|
||||
if (lineNum == -1) {
|
||||
lineNum = lineNumber();
|
||||
}
|
||||
CupidLogUtils.i(TAG, "初始化获得的行数=" + lineNum);
|
||||
synchronized (this) {
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
String data = queue.take();
|
||||
data = data == null ? "主动断开连接" : data;
|
||||
// addList(data, true);
|
||||
// L.i(TAG, "写入Log---" + data);
|
||||
if (buff != null && !TextUtils.isEmpty(data)) {
|
||||
buff.write(data);
|
||||
buff.newLine();
|
||||
buff.flush();
|
||||
lineNum++;
|
||||
if (lineNum == MAX_LINES + 1 + DEL_LINES) {
|
||||
List<String> delLines = readAndRemoveFirstLines();
|
||||
for (String str : delLines) {
|
||||
CupidLogUtils.i(TAG, "被删除的数据=" + str);
|
||||
}
|
||||
lineNum = lineNum - DEL_LINES;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<String> readAndRemoveFirstLines() {
|
||||
List<String> strList = new ArrayList<>();
|
||||
RandomAccessFile raf = null;
|
||||
try {
|
||||
raf = new RandomAccessFile(file, "rw");
|
||||
//Initial write position
|
||||
long writePosition = raf.getFilePointer();
|
||||
for (int i = 0; i < DEL_LINES; i++) {
|
||||
String line = raf.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
strList.add(new String(line.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
|
||||
}
|
||||
// Shift the next lines upwards.
|
||||
long readPosition = raf.getFilePointer();
|
||||
|
||||
byte[] buff = new byte[1024];
|
||||
int n;
|
||||
while (-1 != (n = raf.read(buff))) {
|
||||
raf.seek(writePosition);
|
||||
raf.write(buff, 0, n);
|
||||
readPosition += n;
|
||||
writePosition += n;
|
||||
raf.seek(readPosition);
|
||||
}
|
||||
raf.setLength(writePosition);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (raf != null) {
|
||||
raf.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return strList;
|
||||
}
|
||||
|
||||
|
||||
//获取文件总行数
|
||||
private int lineNumber() {
|
||||
int lineNumber = 0;
|
||||
if (file != null)
|
||||
try {
|
||||
LineNumberReader lineNumberReader = new LineNumberReader(new FileReader(file));
|
||||
lineNumberReader.skip(Long.MAX_VALUE);
|
||||
//注意加1,实际上是读取换行符,所以需要+1
|
||||
lineNumber = lineNumberReader.getLineNumber() + 1;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
|
||||
//读取日志
|
||||
public void registerReadListener(OnReadListener onReadListener) {
|
||||
if (onReadListener != null) {
|
||||
if (!onReadListeners.contains(onReadListener)) {
|
||||
onReadListeners.add(onReadListener);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void unRegisterReadListener(OnReadListener onReadListener) {
|
||||
if (onReadListener != null)
|
||||
onReadListeners.remove(onReadListener);
|
||||
}
|
||||
|
||||
|
||||
public interface OnReadListener {
|
||||
void onRefresh();
|
||||
}
|
||||
|
||||
//读取
|
||||
public class ReadThread implements Runnable {
|
||||
RandomAccessFile rf = null;
|
||||
long len;
|
||||
long start;
|
||||
long nextend;
|
||||
long readLine = 0;
|
||||
boolean isRead = true;
|
||||
int lineNum = -1;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// L.i(TAG, "是否是主线程=" + Utils.isMainThread());
|
||||
if (lineNum == -1) {
|
||||
lineNum = lineNumber();
|
||||
}
|
||||
synchronized (this) {
|
||||
try {
|
||||
if (rf == null && file != null) {
|
||||
rf = new RandomAccessFile(file, "r");
|
||||
len = rf.length();
|
||||
start = rf.getFilePointer();
|
||||
nextend = start + len - 1;
|
||||
rf.seek(nextend);
|
||||
}
|
||||
// L.i(TAG, "len=" + len);
|
||||
// L.i(TAG, "start=" + start);
|
||||
// L.i(TAG, "nextend=" + nextend);
|
||||
String line;
|
||||
int c = -1;
|
||||
while (isRead && nextend > start) {
|
||||
c = rf.read();
|
||||
if (c == '\n' || c == '\r') {
|
||||
line = rf.readLine();
|
||||
if (!TextUtils.isEmpty(line)) {
|
||||
String log = new String(line.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
listLog.add(onParse(log));
|
||||
}
|
||||
nextend--;
|
||||
readLine++;
|
||||
}
|
||||
nextend--;
|
||||
rf.seek(nextend);
|
||||
if (nextend == 0) {// 当文件指针退至文件开始处,输出第一行
|
||||
String log = new String(rf.readLine().getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
listLog.add(onParse(log));
|
||||
readLine++;
|
||||
}
|
||||
if (readLine == EVERY_TIME_READ_LINES + 1) {
|
||||
isRead = false;
|
||||
}
|
||||
// L.i(TAG, "readLine=" + readLine);
|
||||
}
|
||||
Collections.reverse(listLog);
|
||||
if (onReadListeners.size() != 0) {
|
||||
for (int i = 0; i < onReadListeners.size(); i++) {
|
||||
onReadListeners.get(i).onRefresh();
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (rf != null)
|
||||
rf.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
isInitRead.set(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.zhidao.support.adas.high.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.support.adas.high.R;
|
||||
import com.zhidao.support.adas.high.bean.IPCConnectState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* 连接状态
|
||||
*/
|
||||
public class ConnectStatusAdapter extends RecyclerView.Adapter<ConnectStatusAdapter.InfoViewHolder> {
|
||||
private static final String POS = "%03d. ";
|
||||
private List<IPCConnectState> mDatas;
|
||||
private Context mContext;
|
||||
|
||||
public void setData(List<IPCConnectState> mDatas) {
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
public void refreshView() {
|
||||
// notifyItemChanged(mDatas.size()-1,0);
|
||||
notifyItemRangeChanged(0, getItemCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public InfoViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
||||
mContext = viewGroup.getContext();
|
||||
View remoteView = LayoutInflater.from(mContext).inflate(R.layout.item_status, viewGroup, false);
|
||||
return new InfoViewHolder(remoteView);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull InfoViewHolder viewHolder, int position) {
|
||||
if (mDatas != null) {
|
||||
IPCConnectState data = mDatas.get(position);
|
||||
viewHolder.id.setText(String.format(Locale.getDefault(), POS, getItemCount() - position));
|
||||
viewHolder.editText.setText(data.status);
|
||||
viewHolder.editText.setTextColor(mContext.getResources().getColor(data.color));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDatas == null ? 0 : mDatas.size();
|
||||
}
|
||||
|
||||
|
||||
class InfoViewHolder extends RecyclerView.ViewHolder {
|
||||
EditText editText;
|
||||
TextView id;
|
||||
|
||||
public InfoViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
editText = itemView.findViewById(R.id.log);
|
||||
id = itemView.findViewById(R.id.id);
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
package com.zhidao.support.adas.high.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.support.adas.high.R;
|
||||
import com.zhidao.support.adas.high.bean.IPCConnectState;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xuxinchao
|
||||
* @description
|
||||
* @since: 2022/4/20
|
||||
*/
|
||||
public class ConnectStatusFloatWindow implements View.OnTouchListener {
|
||||
|
||||
|
||||
private final Activity mContext;
|
||||
private WindowManager.LayoutParams mWindowParams;
|
||||
private WindowManager mWindowManager;
|
||||
|
||||
private View mFloatLayout;
|
||||
private ImageView btn_drag;
|
||||
private float mInViewX;
|
||||
private float mInViewY;
|
||||
private float mDownInScreenX;
|
||||
private float mDownInScreenY;
|
||||
private float mInScreenX;
|
||||
private float mInScreenY;
|
||||
private RecyclerView rv_status;
|
||||
private ConnectStatusAdapter adapter;
|
||||
private List<IPCConnectState> list;
|
||||
private OnConnectStatusFloatWindowListener listener;
|
||||
|
||||
public interface OnConnectStatusFloatWindowListener {
|
||||
void onClose();
|
||||
}
|
||||
|
||||
public ConnectStatusFloatWindow(Activity context, List<IPCConnectState> list, OnConnectStatusFloatWindowListener listener) {
|
||||
this.mContext = context;
|
||||
this.list = list;
|
||||
this.listener = listener;
|
||||
initFloatWindow();
|
||||
}
|
||||
|
||||
public void refreshView() {
|
||||
if (adapter != null) {
|
||||
adapter.refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
private void initRV() {
|
||||
//创建默认的线性LayoutManager 横向的GridLayoutManager
|
||||
MyLinearLayoutManager linearLayoutManager = new MyLinearLayoutManager(mContext);
|
||||
// linearLayoutManager.setStackFromEnd(true);//列表再底部开始展示,反转后由上面开始展示
|
||||
// linearLayoutManager.setReverseLayout(true);//列表翻转
|
||||
rv_status.setLayoutManager(linearLayoutManager);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
rv_status.setHasFixedSize(false);
|
||||
rv_status.setNestedScrollingEnabled(false);
|
||||
adapter = new ConnectStatusAdapter();
|
||||
adapter.setHasStableIds(true);
|
||||
rv_status.setAdapter(adapter);
|
||||
adapter.setData(list);
|
||||
}
|
||||
|
||||
private void initFloatWindow() {
|
||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
if (inflater == null)
|
||||
return;
|
||||
mFloatLayout = inflater.inflate(R.layout.layout_float, null);
|
||||
rv_status = mFloatLayout.findViewById(R.id.rv_status);
|
||||
View btn_close = mFloatLayout.findViewById(R.id.btn_close);
|
||||
View btn_help = mFloatLayout.findViewById(R.id.btn_help);
|
||||
View btn_save = mFloatLayout.findViewById(R.id.btn_save);
|
||||
btn_drag = mFloatLayout.findViewById(R.id.btn_drag);
|
||||
btn_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null)
|
||||
listener.onClose();
|
||||
}
|
||||
});
|
||||
btn_help.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(v.getContext(), "功能提示\n1.将数连接状态写入本地;\n2.清空列表以及保存到本地的数据;\n3.拖拽;\n4.帮助;\n5.关闭此窗口;", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
btn_save.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
mFloatLayout.setOnTouchListener(this);
|
||||
initRV();
|
||||
mWindowParams = new WindowManager.LayoutParams();
|
||||
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
if (Build.VERSION.SDK_INT >= 26) {//8.0新特性
|
||||
mWindowParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
mWindowParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
}
|
||||
|
||||
mWindowManager = mContext.getWindowManager();
|
||||
|
||||
mWindowParams.format = PixelFormat.RGBA_8888;
|
||||
mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
mWindowParams.gravity = Gravity.START | Gravity.TOP;
|
||||
mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
mWindowParams.alpha = 0.82F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
return floatLayoutTouch(motionEvent);
|
||||
}
|
||||
|
||||
private boolean floatLayoutTouch(MotionEvent motionEvent) {
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
// 获取相对View的坐标,即以此View左上角为原点
|
||||
mInViewX = motionEvent.getX();
|
||||
mInViewY = motionEvent.getY();
|
||||
// 获取相对屏幕的坐标,即以屏幕左上角为原点
|
||||
mDownInScreenX = motionEvent.getRawX();
|
||||
mDownInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
|
||||
mInScreenX = motionEvent.getRawX();
|
||||
mInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
|
||||
btn_drag.setSelected(true);
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// 更新浮动窗口位置参数
|
||||
mInScreenX = motionEvent.getRawX();
|
||||
mInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
|
||||
mWindowParams.x = (int) (mInScreenX - mInViewX);
|
||||
mWindowParams.y = (int) (mInScreenY - mInViewY);
|
||||
// 手指移动的时候更新小悬浮窗的位置
|
||||
mWindowManager.updateViewLayout(mFloatLayout, mWindowParams);
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
btn_drag.setSelected(false);
|
||||
// 如果手指离开屏幕时,xDownInScreen和xInScreen相等,且yDownInScreen和yInScreen相等,则视为触发了单击事件。
|
||||
if (mDownInScreenX == mInScreenX && mDownInScreenY == mInScreenY) {
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void showFloatWindow() {
|
||||
if (mFloatLayout.getParent() == null) {
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
// 默认固定位置,靠屏幕右边缘的中间
|
||||
mWindowManager.getDefaultDisplay().getMetrics(metrics);
|
||||
mWindowParams.x = metrics.widthPixels;
|
||||
mWindowParams.y = metrics.heightPixels;
|
||||
mWindowManager.addView(mFloatLayout, mWindowParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void hideFloatWindow() {
|
||||
if (mFloatLayout.getParent() != null)
|
||||
mWindowManager.removeView(mFloatLayout);
|
||||
}
|
||||
|
||||
public void setFloatLayoutAlpha(boolean alpha) {
|
||||
if (alpha)
|
||||
mFloatLayout.setAlpha((float) 0.5);
|
||||
else
|
||||
mFloatLayout.setAlpha(1);
|
||||
}
|
||||
|
||||
private int sbar = -1;
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.zhidao.support.adas.high.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class MyLinearLayoutManager extends LinearLayoutManager {
|
||||
public MyLinearLayoutManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MyLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
public MyLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPredictiveItemAnimations() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
//override this method and implement code as below
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#3B4577"
|
||||
android:pathData="M148.86,185.78c-25.64,0 -46.44,-21.63 -46.44,-48.28s20.8,-48.28 46.44,-48.28h316.74V48.28C465.6,21.63 486.4,0 512.04,0c25.73,0 46.44,21.63 46.44,48.28v40.94h316.65c25.73,0 46.44,21.63 46.44,48.28s-20.71,48.28 -46.44,48.28H148.86zM754.79,927.44l67.8,-573.76H201.38L269.18,927.44h485.6zM875.16,257.11c13.28,0 25.92,5.99 34.74,16.32 8.92,10.33 13,24.14 11.33,37.85L841.91,981.61c-2.79,24.23 -22.57,42.39 -46.07,42.39H228.13c-23.5,0 -43.28,-18.16 -46.07,-42.39L102.73,311.29c-1.58,-13.71 2.51,-27.52 11.42,-37.85 8.73,-10.33 21.37,-16.32 34.74,-16.32h726.27z" />
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#99CCCC"
|
||||
android:pathData="M148.86,185.78c-25.64,0 -46.44,-21.63 -46.44,-48.28s20.8,-48.28 46.44,-48.28h316.74V48.28C465.6,21.63 486.4,0 512.04,0c25.73,0 46.44,21.63 46.44,48.28v40.94h316.65c25.73,0 46.44,21.63 46.44,48.28s-20.71,48.28 -46.44,48.28H148.86zM754.79,927.44l67.8,-573.76H201.38L269.18,927.44h485.6zM875.16,257.11c13.28,0 25.92,5.99 34.74,16.32 8.92,10.33 13,24.14 11.33,37.85L841.91,981.61c-2.79,24.23 -22.57,42.39 -46.07,42.39H228.13c-23.5,0 -43.28,-18.16 -46.07,-42.39L102.73,311.29c-1.58,-13.71 2.51,-27.52 11.42,-37.85 8.73,-10.33 21.37,-16.32 34.74,-16.32h726.27z" />
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M584.41,512l362.04,362.04c20,20 20,52.42 0,72.41 -19.99,19.99 -52.41,19.99 -72.4,0L512,584.41l-362.04,362.04c-20,19.99 -52.42,19.99 -72.41,0 -19.99,-19.99 -19.99,-52.41 0,-72.41L439.59,512l-362.04,-362.04c-19.99,-20 -19.99,-52.42 0,-72.41 19.99,-19.99 52.41,-19.99 72.41,0L512,439.59l362.04,-362.04c20,-19.99 52.42,-19.99 72.41,0 19.99,19.99 19.99,52.41 0,72.41L584.41,512z"
|
||||
android:fillColor="#3B4577"/>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M584.41,512l362.04,362.04c20,20 20,52.42 0,72.41 -19.99,19.99 -52.41,19.99 -72.4,0L512,584.41l-362.04,362.04c-20,19.99 -52.42,19.99 -72.41,0 -19.99,-19.99 -19.99,-52.41 0,-72.41L439.59,512l-362.04,-362.04c-19.99,-20 -19.99,-52.42 0,-72.41 19.99,-19.99 52.41,-19.99 72.41,0L512,439.59l362.04,-362.04c20,-19.99 52.42,-19.99 72.41,0 19.99,19.99 19.99,52.41 0,72.41L584.41,512z"
|
||||
android:fillColor="#99CCCC"/>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M1020.93,527.02a39.41,39.41 0,0 0,3.06 -15.05c0,-5.25 -1.1,-10.34 -3.06,-15.12a38.45,38.45 0,0 0,-8.46 -12.62l-162.54,-162.55c-15.28,-15.28 -40.04,-15.28 -55.41,0 -15.28,15.36 -15.28,40.13 0,55.41l95.69,95.69h-339.03V133.67l95.69,95.69a39.04,39.04 0,0 0,27.67 11.44c10.03,0 20.06,-3.84 27.74,-11.44 15.28,-15.36 15.28,-40.12 0,-55.41L539.66,11.4c-1.8,-1.88 -4.08,-2.74 -6.19,-4.15 -2.11,-1.41 -3.99,-3.22 -6.43,-4.23a39.46,39.46 0,0 0,-30.17 0c-2.43,1.02 -4.23,2.82 -6.43,4.23 -2.04,1.41 -4.31,2.27 -6.2,4.15L321.71,173.95c-15.28,15.28 -15.28,40.05 0,55.41a39.21,39.21 0,0 0,55.41 0l95.69,-95.69V472.79H133.78l95.61,-95.69c15.36,-15.28 15.36,-40.05 0,-55.41 -15.28,-15.28 -40.05,-15.28 -55.41,0L11.53,484.23A37.27,37.27 0,0 0,3.05 496.85,38.37 38.37,0 0,0 0,511.98a37.99,37.99 0,0 0,3.06 15.05,37.59 37.59,0 0,0 8.46,12.7l162.46,162.47a39.03,39.03 0,0 0,27.74 11.44c10.04,0 20.06,-3.76 27.66,-11.44 15.36,-15.28 15.36,-40.12 0,-55.41L133.78,551.16h339.03v339.05l-95.69,-95.62a39.07,39.07 0,0 0,-55.41 0c-15.28,15.28 -15.28,40.05 0,55.41l162.46,162.47a39.44,39.44 0,0 0,12.85 8.46A37.89,37.89 0,0 0,511.99 1024c5.09,0 10.19,-1.02 14.89,-3.06a38.63,38.63 0,0 0,12.85 -8.46l162.54,-162.47c15.28,-15.36 15.28,-40.13 0,-55.41 -15.36,-15.36 -40.12,-15.36 -55.41,0l-95.69,95.62v-339.05h339.03l-95.69,95.62c-15.28,15.28 -15.28,40.12 0,55.41a39.03,39.03 0,0 0,27.74 11.44c10.04,0 20.06,-3.76 27.66,-11.44l162.54,-162.47a38.77,38.77 0,0 0,8.46 -12.7"
|
||||
android:fillColor="#3B4577"/>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M1020.93,527.02a39.41,39.41 0,0 0,3.06 -15.05c0,-5.25 -1.1,-10.34 -3.06,-15.12a38.45,38.45 0,0 0,-8.46 -12.62l-162.54,-162.55c-15.28,-15.28 -40.04,-15.28 -55.41,0 -15.28,15.36 -15.28,40.13 0,55.41l95.69,95.69h-339.03V133.67l95.69,95.69a39.04,39.04 0,0 0,27.67 11.44c10.03,0 20.06,-3.84 27.74,-11.44 15.28,-15.36 15.28,-40.12 0,-55.41L539.66,11.4c-1.8,-1.88 -4.08,-2.74 -6.19,-4.15 -2.11,-1.41 -3.99,-3.22 -6.43,-4.23a39.46,39.46 0,0 0,-30.17 0c-2.43,1.02 -4.23,2.82 -6.43,4.23 -2.04,1.41 -4.31,2.27 -6.2,4.15L321.71,173.95c-15.28,15.28 -15.28,40.05 0,55.41a39.21,39.21 0,0 0,55.41 0l95.69,-95.69V472.79H133.78l95.61,-95.69c15.36,-15.28 15.36,-40.05 0,-55.41 -15.28,-15.28 -40.05,-15.28 -55.41,0L11.53,484.23A37.27,37.27 0,0 0,3.05 496.85,38.37 38.37,0 0,0 0,511.98a37.99,37.99 0,0 0,3.06 15.05,37.59 37.59,0 0,0 8.46,12.7l162.46,162.47a39.03,39.03 0,0 0,27.74 11.44c10.04,0 20.06,-3.76 27.66,-11.44 15.36,-15.28 15.36,-40.12 0,-55.41L133.78,551.16h339.03v339.05l-95.69,-95.62a39.07,39.07 0,0 0,-55.41 0c-15.28,15.28 -15.28,40.05 0,55.41l162.46,162.47a39.44,39.44 0,0 0,12.85 8.46A37.89,37.89 0,0 0,511.99 1024c5.09,0 10.19,-1.02 14.89,-3.06a38.63,38.63 0,0 0,12.85 -8.46l162.54,-162.47c15.28,-15.36 15.28,-40.13 0,-55.41 -15.36,-15.36 -40.12,-15.36 -55.41,0l-95.69,95.62v-339.05h339.03l-95.69,95.62c-15.28,15.28 -15.28,40.12 0,55.41a39.03,39.03 0,0 0,27.74 11.44c10.04,0 20.06,-3.76 27.66,-11.44l162.54,-162.47a38.77,38.77 0,0 0,8.46 -12.7"
|
||||
android:fillColor="#99CCCC"/>
|
||||
</vector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M40.96,853.95a40.96,40.96 0,0 1,-40.96 -40.96V81.92a40.96,40.96 0,0 1,40.96 -40.96h942.08a40.96,40.96 0,0 1,40.96 40.96v731.07a40.96,40.96 0,0 1,-40.96 40.96h-308.18l-132.45,146.33c-16.3,18.01 -44.6,17.96 -60.83,-0.1l-131.43,-146.23H40.96zM81.92,122.88v649.15h286.48a40.96,40.96 0,0 1,30.46 13.58l113.29,126.03 114.17,-126.14a40.96,40.96 0,0 1,30.37 -13.47H942.08V122.88H81.92z"
|
||||
android:fillColor="#3B4577"/>
|
||||
<path
|
||||
android:pathData="M470.27,261.12a40.96,40.96 0,1 1,81.92 0v212.08a40.96,40.96 0,0 1,-81.92 0V261.12z"
|
||||
android:fillColor="#3B4577"/>
|
||||
<path
|
||||
android:pathData="M564.71,627.91c0,30.04 -24.47,54.47 -54.56,54.47 -30.18,0 -54.47,-24.43 -54.47,-54.47A54.37,54.37 0,0 1,510.15 573.44c30.09,0 54.56,24.34 54.56,54.47"
|
||||
android:fillColor="#3B4577"/>
|
||||
</vector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M40.96,853.95a40.96,40.96 0,0 1,-40.96 -40.96V81.92a40.96,40.96 0,0 1,40.96 -40.96h942.08a40.96,40.96 0,0 1,40.96 40.96v731.07a40.96,40.96 0,0 1,-40.96 40.96h-308.18l-132.45,146.33c-16.3,18.01 -44.6,17.96 -60.83,-0.1l-131.43,-146.23H40.96zM81.92,122.88v649.15h286.48a40.96,40.96 0,0 1,30.46 13.58l113.29,126.03 114.17,-126.14a40.96,40.96 0,0 1,30.37 -13.47H942.08V122.88H81.92z"
|
||||
android:fillColor="#99CCCC"/>
|
||||
<path
|
||||
android:pathData="M470.27,261.12a40.96,40.96 0,1 1,81.92 0v212.08a40.96,40.96 0,0 1,-81.92 0V261.12z"
|
||||
android:fillColor="#99CCCC"/>
|
||||
<path
|
||||
android:pathData="M564.71,627.91c0,30.04 -24.47,54.47 -54.56,54.47 -30.18,0 -54.47,-24.43 -54.47,-54.47A54.37,54.37 0,0 1,510.15 573.44c30.09,0 54.56,24.34 54.56,54.47"
|
||||
android:fillColor="#99CCCC"/>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M805,923.08a37.67,37.67 0,0 1,37.65 37.66,37.67 37.67,0 0,1 -37.65,37.66L58.14,998.4A37.67,37.67 0,0 1,20.48 960.74L20.48,213.88a37.67,37.67 0,0 1,37.66 -37.65,37.67 37.67,0 0,1 37.65,37.65v709.21h709.21zM246.41,772.46h671.56L917.97,100.92L246.42,100.92v671.55zM955.63,25.6A37.67,37.67 0,0 1,993.28 63.26v746.86a37.67,37.67 0,0 1,-37.66 37.65L208.76,847.77a37.67,37.67 0,0 1,-37.65 -37.65L171.11,63.26A37.67,37.67 0,0 1,208.76 25.6h746.86zM555.54,642.62l-125.39,-125.39a37.68,37.68 0,0 1,0 -53.25,37.68 37.68,0 0,1 53.24,0l61.15,61.08L544.54,272.23c0,-20.79 16.79,-37.65 37.65,-37.65a37.67,37.67 0,0 1,37.66 37.65v252.83l61.08,-61.08a37.68,37.68 0,0 1,53.24 0,37.68 37.68,0 0,1 0,53.25l-125.39,125.39a37.46,37.46 0,0 1,-26.59 11,37.5 37.5,0 0,1 -26.66,-10.99z"
|
||||
android:fillColor="#3B4577"/>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M805,923.08a37.67,37.67 0,0 1,37.65 37.66,37.67 37.67,0 0,1 -37.65,37.66L58.14,998.4A37.67,37.67 0,0 1,20.48 960.74L20.48,213.88a37.67,37.67 0,0 1,37.66 -37.65,37.67 37.67,0 0,1 37.65,37.65v709.21h709.21zM246.41,772.46h671.56L917.97,100.92L246.42,100.92v671.55zM955.63,25.6A37.67,37.67 0,0 1,993.28 63.26v746.86a37.67,37.67 0,0 1,-37.66 37.65L208.76,847.77a37.67,37.67 0,0 1,-37.65 -37.65L171.11,63.26A37.67,37.67 0,0 1,208.76 25.6h746.86zM555.54,642.62l-125.39,-125.39a37.68,37.68 0,0 1,0 -53.25,37.68 37.68,0 0,1 53.24,0l61.15,61.08L544.54,272.23c0,-20.79 16.79,-37.65 37.65,-37.65a37.67,37.67 0,0 1,37.66 37.65v252.83l61.08,-61.08a37.68,37.68 0,0 1,53.24 0,37.68 37.68,0 0,1 0,53.25l-125.39,125.39a37.46,37.46 0,0 1,-26.59 11,37.5 37.5,0 0,1 -26.66,-10.99z"
|
||||
android:fillColor="#99CCCC"/>
|
||||
</vector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_clear_true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/ic_clear_false" />
|
||||
</selector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_close_true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/ic_close_false" />
|
||||
</selector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_drag_true" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_drag_false" />
|
||||
</selector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_help_true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/ic_help_false" />
|
||||
</selector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_save_true" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/ic_save_false" />
|
||||
</selector>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--测试列表Item-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#999999"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/log"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:cursorVisible="false"
|
||||
android:focusable="false"
|
||||
android:textColor="#ff0000"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="320dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/selector_save" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_clear"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/selector_clear" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_drag"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/selector_drag" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_help"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/selector_help" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:src="@drawable/selector_close" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="2dp"
|
||||
android:background="@drawable/bg_float" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="connect_status_connected">#32CD32</color>
|
||||
<color name="connect_status_disconnected">#DC143C</color>
|
||||
<color name="connect_status_connecting">#FF00FF</color>
|
||||
<color name="connect_status_disconnecting">#DAA520</color>
|
||||
<color name="connect_status_search_address">#1E90FF</color>
|
||||
</resources>
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">adas-status</string>
|
||||
</resources>
|
||||
BIN
app_ipc_monitoring/other.zip
Normal file
BIN
app_ipc_monitoring/other.zip
Normal file
Binary file not shown.
@@ -2,9 +2,12 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.zhidao.adas.client">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.DEVICE_POWER"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
@@ -20,9 +23,7 @@
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
@@ -63,6 +64,12 @@
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".other.permission.PermissionLongBackgroundRunningDialog"
|
||||
android:theme="@style/PermissionLongBackgroundRunningDialogStyle" />
|
||||
<activity
|
||||
android:name=".other.router.RouterActivity"
|
||||
android:theme="@style/NoActionBar" />
|
||||
<!-- 开机启动 -->
|
||||
<receiver
|
||||
android:name="BootCompletedReceive"
|
||||
|
||||
@@ -4,10 +4,12 @@ import android.util.Pair;
|
||||
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BagManagerCmd;
|
||||
import com.zhidao.adas.client.bean.BaseInfo;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.ChassisStates;
|
||||
import com.zhidao.adas.client.bean.DataShow;
|
||||
import com.zhidao.adas.client.bean.ErrorData;
|
||||
import com.zhidao.adas.client.bean.FSMFunctionStates;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
@@ -100,27 +102,52 @@ public class DataDistribution {
|
||||
this.isCutDown = cutDown;
|
||||
}
|
||||
|
||||
private static final int LIST_SIZE = 50;//默认list最大数据量5个
|
||||
public final List<String> listTrajectory = new ArrayList<>();
|
||||
public final List<String> listTrackedObjects = new ArrayList<>();
|
||||
public final List<String> listGnssInfo = new ArrayList<>();
|
||||
public final List<String> listAutopilotState = new ArrayList<>();
|
||||
public final List<String> listMogoReportMessage = new ArrayList<>();
|
||||
public final List<String> listPerceptionTrafficLight = new ArrayList<>();
|
||||
public final List<String> listPredictionObstacleTrajectory = new ArrayList<>();
|
||||
public final List<String> listRecordPanel = new ArrayList<>();
|
||||
public final List<String> listGlobalPathResp = new ArrayList<>();
|
||||
public final List<String> listWarn = new ArrayList<>();
|
||||
public final List<String> listArrivalNotification = new ArrayList<>();
|
||||
public final List<String> listStatusInfo = new ArrayList<>();
|
||||
public final List<String> listRecordDataConfig = new ArrayList<>();
|
||||
public final List<String> listErrorData = new ArrayList<>();
|
||||
public final List<String> listOriginalPointCloud = new ArrayList<>();
|
||||
public final List<String> listPlanningObjects = new ArrayList<>();
|
||||
public final List<String> listPlanningDecisionState = new ArrayList<>();
|
||||
public final List<String> listChassisStates = new ArrayList<>();
|
||||
public final List<String> listFSMFunctionStates = new ArrayList<>();
|
||||
public final List<String> listRoboSweeperTaskIndex = new ArrayList<>();
|
||||
private static final int LIST_SIZE = 30;//默认list最大数据量
|
||||
public final List<DataShow> listTrajectory = new ArrayList<>();
|
||||
public final List<DataShow> listTrackedObjects = new ArrayList<>();
|
||||
public final List<DataShow> listGnssInfo = new ArrayList<>();
|
||||
public final List<DataShow> listVehicleState = new ArrayList<>();
|
||||
public final List<DataShow> listAutopilotState = new ArrayList<>();
|
||||
public final List<DataShow> listMogoReportMessage = new ArrayList<>();
|
||||
public final List<DataShow> listPerceptionTrafficLight = new ArrayList<>();
|
||||
public final List<DataShow> listPredictionObstacleTrajectory = new ArrayList<>();
|
||||
public final List<DataShow> listRecordPanel = new ArrayList<>();
|
||||
public final List<DataShow> listGlobalPathResp = new ArrayList<>();
|
||||
public final List<DataShow> listWarn = new ArrayList<>();
|
||||
public final List<DataShow> listArrivalNotification = new ArrayList<>();
|
||||
public final List<DataShow> listStatusInfo = new ArrayList<>();
|
||||
public final List<DataShow> listRecordDataConfig = new ArrayList<>();
|
||||
public final List<DataShow> listErrorData = new ArrayList<>();
|
||||
public final List<DataShow> listOriginalPointCloud = new ArrayList<>();
|
||||
public final List<DataShow> listPlanningObjects = new ArrayList<>();
|
||||
public final List<DataShow> listPlanningDecisionState = new ArrayList<>();
|
||||
public final List<DataShow> listChassisStates = new ArrayList<>();
|
||||
public final List<DataShow> listFSMFunctionStates = new ArrayList<>();
|
||||
public final List<DataShow> listRoboSweeperTaskIndex = new ArrayList<>();
|
||||
public final List<DataShow> listBagManagerCmd = new ArrayList<>();
|
||||
|
||||
private long listTrajectorySize = 0;
|
||||
private long listTrackedObjectsSize = 0;
|
||||
private long listGnssInfoSize = 0;
|
||||
private long listVehicleStateSize = 0;
|
||||
private long listAutopilotStateSize = 0;
|
||||
private long listMogoReportMessageSize = 0;
|
||||
private long listPerceptionTrafficLightSize = 0;
|
||||
private long listPredictionObstacleTrajectorySize = 0;
|
||||
private long listRecordPanelSize = 0;
|
||||
private long listGlobalPathRespSize = 0;
|
||||
private long listWarnSize = 0;
|
||||
private long listArrivalNotificationSize = 0;
|
||||
private long listStatusInfoSize = 0;
|
||||
private long listRecordDataConfigSize = 0;
|
||||
private long listErrorDataSize = 0;
|
||||
private long listOriginalPointCloudSize = 0;
|
||||
private long listPlanningObjectsSize = 0;
|
||||
private long listPlanningDecisionStateSize = 0;
|
||||
private long listChassisStatesSize = 0;
|
||||
private long listFSMFunctionStatesSize = 0;
|
||||
private long listRoboSweeperTaskIndexSize = 0;
|
||||
private long listBagManagerCmdSize = 0;
|
||||
|
||||
public String cutDown(String str) {
|
||||
if (isCutDown && str.length() > 650) {
|
||||
@@ -133,7 +160,7 @@ public class DataDistribution {
|
||||
String temp = data.toString();
|
||||
String str = cutDown(temp);
|
||||
if (data instanceof Trajectory) {
|
||||
listTrajectory.add(0, time + str);
|
||||
listTrajectory.add(0, new DataShow(listTrajectorySize++, time + str));
|
||||
if (listTrajectory.size() > LIST_SIZE) {
|
||||
listTrajectory.remove(listTrajectory.size() - 1);
|
||||
}
|
||||
@@ -141,7 +168,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof TrackedObjects) {
|
||||
listTrackedObjects.add(0, time + str);
|
||||
listTrackedObjects.add(0, new DataShow(listTrackedObjectsSize++, time + str));
|
||||
if (listTrackedObjects.size() > LIST_SIZE) {
|
||||
listTrackedObjects.remove(listTrackedObjects.size() - 1);
|
||||
}
|
||||
@@ -149,7 +176,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof OriginalPointCloudData) {
|
||||
listOriginalPointCloud.add(0, time + str);
|
||||
listOriginalPointCloud.add(0, new DataShow(listOriginalPointCloudSize++, time + str));
|
||||
if (listOriginalPointCloud.size() > LIST_SIZE) {
|
||||
listOriginalPointCloud.remove(listOriginalPointCloud.size() - 1);
|
||||
}
|
||||
@@ -157,7 +184,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof PlanningObjects) {
|
||||
listPlanningObjects.add(0, time + str);
|
||||
listPlanningObjects.add(0, new DataShow(listPlanningObjectsSize++, time + str));
|
||||
if (listPlanningObjects.size() > LIST_SIZE) {
|
||||
listPlanningObjects.remove(listPlanningObjects.size() - 1);
|
||||
}
|
||||
@@ -165,7 +192,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof PlanningDecisionState) {
|
||||
listPlanningDecisionState.add(0, time + str);
|
||||
listPlanningDecisionState.add(0, new DataShow(listPlanningDecisionStateSize++, time + str));
|
||||
if (listPlanningDecisionState.size() > LIST_SIZE) {
|
||||
listPlanningDecisionState.remove(listPlanningDecisionState.size() - 1);
|
||||
}
|
||||
@@ -173,15 +200,23 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof GnssInfo) {
|
||||
listGnssInfo.add(0, time + str);
|
||||
listGnssInfo.add(0, new DataShow(listGnssInfoSize++, time + str));
|
||||
if (listGnssInfo.size() > LIST_SIZE) {
|
||||
listGnssInfo.remove(listGnssInfo.size() - 1);
|
||||
}
|
||||
if (listener != null && Constants.TITLE.RECEIVE_GNSS_INFO.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof VehicleState) {
|
||||
listVehicleState.add(0, new DataShow(listVehicleStateSize++, time + str));
|
||||
if (listVehicleState.size() > LIST_SIZE) {
|
||||
listVehicleState.remove(listVehicleState.size() - 1);
|
||||
}
|
||||
if (listener != null && Constants.TITLE.RECEIVE_VEHICLE_STATE.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof ChassisStates) {
|
||||
listChassisStates.add(0, time + str);
|
||||
listChassisStates.add(0, new DataShow(listChassisStatesSize++, time + str));
|
||||
if (listChassisStates.size() > LIST_SIZE) {
|
||||
listChassisStates.remove(listChassisStates.size() - 1);
|
||||
}
|
||||
@@ -189,7 +224,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof AutopilotState) {
|
||||
listAutopilotState.add(0, time + str);
|
||||
listAutopilotState.add(0, new DataShow(listAutopilotStateSize++, time + str));
|
||||
if (listAutopilotState.size() > LIST_SIZE) {
|
||||
listAutopilotState.remove(listAutopilotState.size() - 1);
|
||||
}
|
||||
@@ -197,7 +232,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof MogoReportMessage) {
|
||||
listMogoReportMessage.add(0, time + str);
|
||||
listMogoReportMessage.add(0, new DataShow(listMogoReportMessageSize++, time + str));
|
||||
if (listMogoReportMessage.size() > LIST_SIZE) {
|
||||
listMogoReportMessage.remove(listMogoReportMessage.size() - 1);
|
||||
}
|
||||
@@ -205,7 +240,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof PerceptionTrafficLight) {
|
||||
listPerceptionTrafficLight.add(0, time + str);
|
||||
listPerceptionTrafficLight.add(0, new DataShow(listPerceptionTrafficLightSize++, time + str));
|
||||
if (listPerceptionTrafficLight.size() > LIST_SIZE) {
|
||||
listPerceptionTrafficLight.remove(listPerceptionTrafficLight.size() - 1);
|
||||
}
|
||||
@@ -213,7 +248,7 @@ public class DataDistribution {
|
||||
listener.second.onPerceptionTrafficLight((PerceptionTrafficLight) data);
|
||||
}
|
||||
} else if (data instanceof PredictionObstacleTrajectory) {
|
||||
listPredictionObstacleTrajectory.add(0, time + str);
|
||||
listPredictionObstacleTrajectory.add(0, new DataShow(listPredictionObstacleTrajectorySize++, time + str));
|
||||
if (listPredictionObstacleTrajectory.size() > LIST_SIZE) {
|
||||
listPredictionObstacleTrajectory.remove(listPredictionObstacleTrajectory.size() - 1);
|
||||
}
|
||||
@@ -227,15 +262,23 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof RecordPanel) {
|
||||
listRecordPanel.add(0, time + str);
|
||||
listRecordPanel.add(0, new DataShow(listRecordPanelSize++, time + str));
|
||||
if (listRecordPanel.size() > LIST_SIZE) {
|
||||
listRecordPanel.remove(listRecordPanel.size() - 1);
|
||||
}
|
||||
if (listener != null && Constants.TITLE.RECEIVE_RECORD_RESULT.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof BagManagerCmd) {
|
||||
listBagManagerCmd.add(0, new DataShow(listBagManagerCmdSize++, time + str));
|
||||
if (listBagManagerCmd.size() > LIST_SIZE) {
|
||||
listBagManagerCmd.remove(listBagManagerCmd.size() - 1);
|
||||
}
|
||||
if (listener != null && Constants.TITLE.RECEIVE_BAG_MANAGER_CMD.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof GlobalPathResp) {
|
||||
listGlobalPathResp.add(0, time + str);
|
||||
listGlobalPathResp.add(0, new DataShow(listGlobalPathRespSize++, time + str));
|
||||
if (listGlobalPathResp.size() > LIST_SIZE) {
|
||||
listGlobalPathResp.remove(listGlobalPathResp.size() - 1);
|
||||
}
|
||||
@@ -243,7 +286,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof Warn) {
|
||||
listWarn.add(0, time + str);
|
||||
listWarn.add(0, new DataShow(listWarnSize++, time + str));
|
||||
if (listWarn.size() > LIST_SIZE) {
|
||||
listWarn.remove(listWarn.size() - 1);
|
||||
}
|
||||
@@ -251,7 +294,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof ArrivalNotification) {
|
||||
listArrivalNotification.add(0, time + str);
|
||||
listArrivalNotification.add(0, new DataShow(listArrivalNotificationSize++, time + str));
|
||||
if (listArrivalNotification.size() > LIST_SIZE) {
|
||||
listArrivalNotification.remove(listArrivalNotification.size() - 1);
|
||||
}
|
||||
@@ -259,7 +302,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof StatusInfo) {
|
||||
listStatusInfo.add(0, time + str);
|
||||
listStatusInfo.add(0, new DataShow(listStatusInfoSize++, time + str));
|
||||
if (listStatusInfo.size() > LIST_SIZE) {
|
||||
listStatusInfo.remove(listStatusInfo.size() - 1);
|
||||
}
|
||||
@@ -267,7 +310,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof RecordDataConfig) {
|
||||
listRecordDataConfig.add(0, time + str);
|
||||
listRecordDataConfig.add(0, new DataShow(listRecordDataConfigSize++, time + str));
|
||||
if (listRecordDataConfig.size() > LIST_SIZE) {
|
||||
listRecordDataConfig.remove(listRecordDataConfig.size() - 1);
|
||||
}
|
||||
@@ -282,8 +325,16 @@ public class DataDistribution {
|
||||
if (listener != null && Constants.TITLE.RECEIVE_SWEEPER_TASK_INDEX_DATA.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof RoboSweeperTaskIndex) {
|
||||
listRoboSweeperTaskIndex.add(0, new DataShow(listRoboSweeperTaskIndexSize++, time + str));
|
||||
if (listRoboSweeperTaskIndex.size() > LIST_SIZE) {
|
||||
listRoboSweeperTaskIndex.remove(listRoboSweeperTaskIndex.size() - 1);
|
||||
}
|
||||
if (listener != null && Constants.TITLE.RECEIVE_SWEEPER_TASK_INDEX_DATA.equals(listener.first)) {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof FSMFunctionStates) {
|
||||
listFSMFunctionStates.add(0, time + str);
|
||||
listFSMFunctionStates.add(0, new DataShow(listFSMFunctionStatesSize++, time + str));
|
||||
if (listFSMFunctionStates.size() > LIST_SIZE) {
|
||||
listFSMFunctionStates.remove(listFSMFunctionStates.size() - 1);
|
||||
}
|
||||
@@ -291,7 +342,7 @@ public class DataDistribution {
|
||||
listener.second.onRefresh();
|
||||
}
|
||||
} else if (data instanceof ErrorData) {
|
||||
listErrorData.add(0, time + str);
|
||||
listErrorData.add(0, new DataShow(listErrorDataSize++, time + str));
|
||||
if (listErrorData.size() > 100) {
|
||||
listErrorData.remove(listErrorData.size() - 1);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,11 @@ import android.widget.TextView;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
import com.zhidao.adas.client.bean.DataShow;
|
||||
|
||||
|
||||
//log所用
|
||||
public class DataShowAdapter extends BaseAdapter<String, DataShowAdapter.ViewHolder> {
|
||||
public class DataShowAdapter extends BaseAdapter<DataShow, DataShowAdapter.ViewHolder> {
|
||||
|
||||
|
||||
public void refreshView() {
|
||||
@@ -28,9 +29,9 @@ public class DataShowAdapter extends BaseAdapter<String, DataShowAdapter.ViewHol
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, String data, int position) {
|
||||
viewHolder.id.setText((getItemCount() - position) + ". ");
|
||||
viewHolder.editText.setText(data);
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, DataShow data, int position) {
|
||||
viewHolder.id.setText(data.position + ". ");
|
||||
viewHolder.editText.setText(data.data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class BagManagerCmd extends BaseInfo {
|
||||
public final BagManagerOuterClass.BagManager bean;
|
||||
|
||||
public BagManagerCmd(MessagePad.Header header, BagManagerOuterClass.BagManager bean, SimpleDateFormat sdf) {
|
||||
super("接收", bean.getSerializedSize(), header, sdf);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
public class DataShow {
|
||||
public final long position;
|
||||
public final String data;
|
||||
|
||||
public DataShow(long position, String data) {
|
||||
this.position = position;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,10 @@ import java.util.List;
|
||||
import chassis.SpecialVehicleTaskCmdOuterClass;
|
||||
|
||||
public class SpecialVehicleBean {
|
||||
private interface TAG {
|
||||
public interface TAG {
|
||||
String FTQSC = "ftqsc";//福田清扫车
|
||||
String KWXB = "kwxb";//开沃小巴
|
||||
String JLM1 = "jlm1";//金旅M1
|
||||
}
|
||||
|
||||
public interface SEND_TYPE {
|
||||
@@ -30,7 +31,7 @@ public class SpecialVehicleBean {
|
||||
public final String name;
|
||||
public final String simpleName;//简单名字 两个字
|
||||
public final List<SpecialVehicleOption> options;
|
||||
private final String tag;//用于存储
|
||||
public final String tag;//用于存储
|
||||
public int sendType = SEND_TYPE.ONE;//发送类型
|
||||
private SpecialVehicleFloatWindowManager manager;
|
||||
|
||||
@@ -127,20 +128,79 @@ public class SpecialVehicleBean {
|
||||
int checkPos = options.get(index).checkPos;
|
||||
setFuTianCleanValue(builder, index, checkPos);
|
||||
}
|
||||
|
||||
SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd fuTianCleanCmd = builder.build();
|
||||
SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd.newBuilder()
|
||||
.setRoboSweeperFutianCleanCmd(fuTianCleanCmd).build();
|
||||
AdasManager.getInstance().sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd);
|
||||
str = TextFormat.printer().escapingNonAscii(false).printToString(fuTianTaskCmd).replaceAll("\n", "");
|
||||
str = TextFormat.printer().escapingNonAscii(false).shortDebugString(fuTianTaskCmd);
|
||||
} else if (TextUtils.equals(this.tag, TAG.KWXB)) { //开沃小巴
|
||||
SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd = SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd.newBuilder()
|
||||
.build();
|
||||
AdasManager.getInstance().sendRoboVanSkywellTaskCmd(vanSkywellTaskCmd);
|
||||
} else if (TextUtils.equals(this.tag, TAG.JLM1)) { //金旅M1
|
||||
SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder();
|
||||
if (index < 0) {
|
||||
for (index = 0; index < options.size(); index++) {
|
||||
SpecialVehicleOption option = options.get(index);
|
||||
if (option.moreCheckPos != -1) {
|
||||
option.checkPos = option.moreCheckPos;
|
||||
option.moreCheckPos = -1;
|
||||
}
|
||||
setJinlvM1Value(builder, index, option.checkPos);
|
||||
}
|
||||
} else {
|
||||
int checkPos = options.get(index).checkPos;
|
||||
setJinlvM1Value(builder, index, checkPos);
|
||||
}
|
||||
SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd = builder.build();
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd);
|
||||
str = TextFormat.printer().escapingNonAscii(false).shortDebugString(roboBusJinlvM1Cmd);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private void setJinlvM1Value(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.Builder builder, int index, int checkPos) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
builder.setAirConditionerCmd(checkPos);
|
||||
break;
|
||||
case 1:
|
||||
builder.setAirConditionerModeCmd(checkPos);
|
||||
break;
|
||||
case 2:
|
||||
builder.setAirConditionerWindSpeedCmd(checkPos);
|
||||
break;
|
||||
case 3:
|
||||
if (checkPos == 1) {
|
||||
checkPos = 16;
|
||||
} else if (checkPos == 2) {
|
||||
checkPos = 20;
|
||||
} else if (checkPos == 3) {
|
||||
checkPos = 26;
|
||||
}
|
||||
builder.setAirConditionerTemperatureCmd(checkPos);
|
||||
break;
|
||||
case 4:
|
||||
builder.setHeaderCmd(checkPos);
|
||||
break;
|
||||
case 5:
|
||||
builder.setHeaderWindSpeedCmd(checkPos);
|
||||
break;
|
||||
case 6:
|
||||
builder.setMainLamp1Cmd(checkPos);
|
||||
break;
|
||||
case 7:
|
||||
builder.setMainLamp2Cmd(checkPos);
|
||||
break;
|
||||
case 8:
|
||||
builder.setSmallLampCmd(checkPos);
|
||||
break;
|
||||
case 9:
|
||||
builder.setFrontDoorCmd(checkPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setFuTianCleanValue(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder, int index, int checkPos) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
@@ -222,8 +282,65 @@ public class SpecialVehicleBean {
|
||||
optionsF.add(new SpecialVehicleOption("扫盘加速", tag, value, 0));
|
||||
SpecialVehicleBean beanF = new SpecialVehicleBean("福田清扫车", "福清", TAG.FTQSC, optionsF);
|
||||
SpecialVehicleBean beanK = new SpecialVehicleBean("开沃小巴", "开巴", TAG.KWXB, null);
|
||||
List<SpecialVehicleOption> optionsM1 = new ArrayList<>();
|
||||
tag = 0;
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启空调";
|
||||
value[2] = "2-关闭空调";
|
||||
optionsM1.add(new SpecialVehicleOption("空调", tag++, value, 0));
|
||||
value = new String[4];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-自动模式";
|
||||
value[2] = "2-制冷模式";
|
||||
value[3] = "3-通风模式";
|
||||
optionsM1.add(new SpecialVehicleOption("空调模式", tag++, value, 0));
|
||||
value = new String[4];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-1档";
|
||||
value[2] = "2-2档";
|
||||
value[3] = "3-3档";
|
||||
optionsM1.add(new SpecialVehicleOption("空调档位", tag++, value, 0));
|
||||
value = new String[4];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "16-16度";
|
||||
value[2] = "20-20度";
|
||||
value[3] = "26-26度";
|
||||
optionsM1.add(new SpecialVehicleOption("空调温度", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启暖风";
|
||||
value[2] = "2-关闭暖风";
|
||||
optionsM1.add(new SpecialVehicleOption("暖风机", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-1档";
|
||||
value[2] = "2-2档";
|
||||
optionsM1.add(new SpecialVehicleOption("暖风机档位", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("顶灯1", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("顶灯2", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("氛围灯", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-打开";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("车门", tag++, value, 0));
|
||||
SpecialVehicleBean beanM1 = new SpecialVehicleBean("金旅M1", "M1", TAG.JLM1, optionsM1);
|
||||
list.add(beanF);
|
||||
list.add(beanK);
|
||||
list.add(beanM1);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.zhidao.adas.client.other.permission;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 长时间后台运行权限检查
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public class BackgrounderPermission {
|
||||
private static volatile BackgrounderPermission INSTANCE;
|
||||
private OnAdasPermissionListener listener;
|
||||
|
||||
private BackgrounderPermission() {
|
||||
}
|
||||
|
||||
public static BackgrounderPermission getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (BackgrounderPermission.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new BackgrounderPermission();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void setListener(OnAdasPermissionListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void showPermissionLongBackgroundRunningDialog(Context context) {
|
||||
Intent intent = new Intent(context, PermissionLongBackgroundRunningDialog.class);
|
||||
context.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
void onBackgrounderPermission(boolean isBackgrounderPermission) {
|
||||
if (listener != null) {
|
||||
listener.onBackgrounderPermission(isBackgrounderPermission);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前是否开启电池优化
|
||||
*
|
||||
* @param context 上下文
|
||||
* @return 否在设备的电源白名单上 true 表示未优化
|
||||
*/
|
||||
boolean isIgnoringBatteryOptimizations(Context context) {
|
||||
boolean isIgnoring = false;
|
||||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
if (powerManager != null) {
|
||||
isIgnoring = powerManager.isIgnoringBatteryOptimizations(context.getPackageName());
|
||||
}
|
||||
return isIgnoring;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请 关闭电池优化权限
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
|
||||
void requestIgnoreBatteryOptimizations(Activity context) {
|
||||
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivityForResult(intent, PermissionLongBackgroundRunningDialog.REQUEST_CODE_BATTERY_OPTIMIZATIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否忽略计费网络限制
|
||||
* 后台运行时网络限制
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
|
||||
private boolean isIgnoringMeteredNetworkRestrictions(Context context) {
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
// 检查设备是否在计费网络
|
||||
// if (connMgr.isActiveNetworkMetered()) {
|
||||
// Checks user’s Data Saver settings.
|
||||
switch (connMgr.getRestrictBackgroundStatus()) {
|
||||
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED:
|
||||
// 用户已为此应用启用流量节省程序。应用应努力限制前台流量消耗,并妥善处理后台流量消耗限制。
|
||||
Log.i("Permission", "用户已为此应用启用流量节省程序。应用应努力限制前台流量消耗,并妥善处理后台流量消耗限制。");
|
||||
return false;
|
||||
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED:
|
||||
// 用户已启用流量节省程序,但应用在白名单中。应用应努力限制前台和后台流量消耗。
|
||||
Log.i("Permission", "用户已启用流量节省程序,但应用在白名单中。应用应努力限制前台和后台流量消耗。");
|
||||
return false;
|
||||
case ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED:
|
||||
// 流量节省程序已停用。
|
||||
Log.i("Permission", "流量节省程序已停用。");
|
||||
return true;
|
||||
}
|
||||
// } else {
|
||||
// // 设备不在计费网络,为所欲为
|
||||
// Log.i("Permission","设备不在计费网络,为所欲为");
|
||||
// return true;
|
||||
// }
|
||||
Log.i("dddd", "其他");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 除非应用的核心功能受到不利影响,否则 Google Play 政策禁止应用请求直接豁免 Android 6.0+ 中的电源管理功能(低电耗模式和应用待机模式)
|
||||
*/
|
||||
private static void requestAddDataSaverWhite(Context context) {
|
||||
// ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
// if (connMgr != null && connMgr.getRestrictBackgroundStatus() == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED) {
|
||||
Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否允许长时间后台运行
|
||||
* 目前测试得出:电池优化会影响后台运行
|
||||
*
|
||||
* @param context 上下文
|
||||
* @return
|
||||
*/
|
||||
public boolean isPermissionLongBackgroundRunning(Context context) {
|
||||
// return isIgnoringBatteryOptimizations(context) && isIgnoringMeteredNetworkRestrictions(context);
|
||||
return isIgnoringBatteryOptimizations(context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.zhidao.adas.client.other.permission;
|
||||
|
||||
public interface OnAdasPermissionListener {
|
||||
/**
|
||||
* 是否允许后台运行
|
||||
* 目前只检查了是否关闭电池优化
|
||||
* @param isAllow 是否允许后台运行
|
||||
*/
|
||||
void onBackgrounderPermission(boolean isAllow);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.zhidao.adas.client.other.permission;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
|
||||
|
||||
/**
|
||||
* 数据用量及电池优化 权限申请
|
||||
* 高版本Android系统会针对熄屏、休眠或后台 对电池WiFi等进行优化,长时间网络可能会断开连接
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public class PermissionLongBackgroundRunningDialog extends AppCompatActivity {
|
||||
public static final int REQUEST_CODE_BATTERY_OPTIMIZATIONS = 0x01;
|
||||
private TextView hint_battery;
|
||||
private Button btn_close_battery_optimizations;
|
||||
private BackgrounderPermission listener;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_adas_permission_long_background_running);
|
||||
initView();
|
||||
setBatteryHint();
|
||||
// //设置弹出窗口与屏幕对齐
|
||||
// Window win = this.getWindow();
|
||||
// int density = (int) (getResources().getDisplayMetrics().density + 0.5f);
|
||||
////设置内边距,这里设置为10dp
|
||||
// win.getDecorView().setPadding(10 * density, 10 * density, 10 * density, 10 * density);
|
||||
// WindowManager.LayoutParams lp = win.getAttributes();
|
||||
////设置窗口宽度
|
||||
// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
////设置窗口高度
|
||||
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
////设置Dialog位置
|
||||
// lp.gravity = Gravity.TOP;
|
||||
// win.setAttributes(lp);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
hint_battery = findViewById(R.id.hint_battery);
|
||||
btn_close_battery_optimizations = findViewById(R.id.btn_close_battery_optimizations);
|
||||
btn_close_battery_optimizations.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
BackgrounderPermission.getInstance().requestIgnoreBatteryOptimizations(PermissionLongBackgroundRunningDialog.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private boolean setBatteryHint() {
|
||||
boolean isIgnoringBatteryOptimizations = BackgrounderPermission.getInstance().isIgnoringBatteryOptimizations(this);
|
||||
btn_close_battery_optimizations.setVisibility(isIgnoringBatteryOptimizations ? View.INVISIBLE : View.VISIBLE);
|
||||
String str = "电池优化:" + (isIgnoringBatteryOptimizations ? "<font color='green'>不优化</font>" : "<font color='red'>优化</font>");
|
||||
hint_battery.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
return isIgnoringBatteryOptimizations;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (requestCode == REQUEST_CODE_BATTERY_OPTIMIZATIONS) {
|
||||
BackgrounderPermission.getInstance().onBackgrounderPermission(setBatteryHint());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package com.zhidao.adas.client.other.router;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.JsResult;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class PlaceholderFragment extends Fragment {
|
||||
private static final String TAG = PlaceholderFragment.class.getSimpleName();
|
||||
private static final String ROUTER_URL = "router_url";
|
||||
private static final String ROUTER_COOKIE = "router_cookie";
|
||||
private String url;
|
||||
private ProgressBar progressBar;
|
||||
private WebView webView;
|
||||
private CookieManager cookieManager;
|
||||
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
public static PlaceholderFragment newInstance(String url) {
|
||||
PlaceholderFragment fragment = new PlaceholderFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(ROUTER_URL, url);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
url = getArguments().getString(ROUTER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_router, container, false);
|
||||
webView = view.findViewById(R.id.web_view);
|
||||
progressBar = view.findViewById(R.id.progressbar);//进度条
|
||||
if (getActivity() != null)
|
||||
sharedPreferences = getActivity().getSharedPreferences("adas_config", Context.MODE_PRIVATE);
|
||||
cookieManager = CookieManager.getInstance();
|
||||
cookieManager.setAcceptCookie(true);
|
||||
initWebView();
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onRefresh() {
|
||||
webView.reload();
|
||||
}
|
||||
|
||||
private void initWebView() {
|
||||
String cokkie = null;
|
||||
if (sharedPreferences != null)
|
||||
cokkie = sharedPreferences.getString(ROUTER_COOKIE, null);
|
||||
if (cokkie != null && cokkie.length() > 0 && cokkie.contains(url)) {
|
||||
int index = cokkie.indexOf("##");
|
||||
cookieManager.setCookie(this.url, cokkie.substring(index));
|
||||
}
|
||||
webView.loadUrl(url);//加载url
|
||||
webView.addJavascriptInterface(this, "android");//添加js监听 这样html就能调用客户端
|
||||
webView.setWebChromeClient(webChromeClient);
|
||||
webView.setWebViewClient(webViewClient);
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);//允许使用js
|
||||
|
||||
/**
|
||||
* LOAD_CACHE_ONLY: 不使用网络,只读取本地缓存数据
|
||||
* LOAD_DEFAULT: (默认)根据cache-control决定是否从网络上取数据。
|
||||
* LOAD_NO_CACHE: 不使用缓存,只从网络获取数据.
|
||||
* LOAD_CACHE_ELSE_NETWORK,只要本地有,无论是否过期,或者no-cache,都使用缓存中的数据。
|
||||
*/
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);//不使用缓存,只从网络获取数据.
|
||||
//支持屏幕缩放
|
||||
webSettings.setSupportZoom(true);
|
||||
webSettings.setBuiltInZoomControls(true);
|
||||
//不显示webview缩放按钮
|
||||
webSettings.setDisplayZoomControls(false);
|
||||
// webSettings.setUseWideViewPort(true);//自适应屏幕
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
webSettings.setAllowFileAccess(true);
|
||||
webSettings.setAppCacheEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setDatabaseEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
//WebViewClient主要帮助WebView处理各种通知、请求事件
|
||||
private final WebViewClient webViewClient = new WebViewClient() {
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {//页面加载完成
|
||||
progressBar.setVisibility(View.GONE);
|
||||
String oldCookie = cookieManager.getCookie(url);
|
||||
if (!TextUtils.isEmpty(oldCookie)) {
|
||||
String cokkie = null;
|
||||
if (sharedPreferences != null)
|
||||
cokkie = sharedPreferences.getString(ROUTER_COOKIE, null);
|
||||
if (!TextUtils.equals(cokkie, oldCookie)) {
|
||||
sharedPreferences.edit().putString(url + "##" + ROUTER_COOKIE, oldCookie).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {//页面开始加载
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
//返回true 拦截
|
||||
return super.shouldOverrideUrlLoading(view, url);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//WebChromeClient主要辅助WebView处理Javascript的对话框、网站图标、网站title、加载进度等
|
||||
private final WebChromeClient webChromeClient = new WebChromeClient() {
|
||||
//不支持js的alert弹窗,需要自己监听然后通过dialog弹窗
|
||||
@Override
|
||||
public boolean onJsAlert(WebView webView, String url, String message, JsResult result) {
|
||||
AlertDialog.Builder localBuilder = new AlertDialog.Builder(webView.getContext());
|
||||
localBuilder.setMessage(message).setPositiveButton("确定", null);
|
||||
localBuilder.setCancelable(false);
|
||||
localBuilder.create().show();
|
||||
|
||||
//注意:
|
||||
//必须要这一句代码:result.confirm()表示:
|
||||
//处理结果为确定状态同时唤醒WebCore线程
|
||||
//否则不能继续点击按钮
|
||||
result.confirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
//获取网页标题
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
super.onReceivedTitle(view, title);
|
||||
Log.i(TAG, "网页标题:" + title);
|
||||
}
|
||||
|
||||
//加载进度回调
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
progressBar.setProgress(newProgress);
|
||||
}
|
||||
};
|
||||
|
||||
public boolean onKeyDownChild(int keyCode) {
|
||||
Log.i(TAG, "是否有上一个页面:" + webView.canGoBack());
|
||||
if (webView.canGoBack() && keyCode == KeyEvent.KEYCODE_BACK) {//点击返回按钮的时候判断有没有上一页
|
||||
webView.goBack(); // goBack()表示返回webView的上一页面
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
//释放资源
|
||||
webView.destroy();
|
||||
webView = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.zhidao.adas.client.other.router;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.zhidao.adas.client.R;
|
||||
|
||||
|
||||
public class RouterActivity extends AppCompatActivity {
|
||||
private static final String[] TAB_TITLES = new String[]{"Bus", "Taxi"};
|
||||
private boolean isBus;
|
||||
private int currentPosition = 0;//默认选中bus
|
||||
|
||||
public static void newInstance(Context context, boolean isBus) {
|
||||
Intent intent = new Intent(context, RouterActivity.class);
|
||||
intent.putExtra("is_bus", isBus);
|
||||
context.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_router);
|
||||
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, TAB_TITLES);
|
||||
ViewPager2 viewPager = findViewById(R.id.view_pager);
|
||||
|
||||
viewPager.setAdapter(sectionsPagerAdapter);
|
||||
TabLayout tabs = findViewById(R.id.tabs);
|
||||
viewPager.setOffscreenPageLimit(1);
|
||||
TabLayoutMediator mediator = new TabLayoutMediator(tabs, viewPager, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||
@Override
|
||||
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||
tab.setText(TAB_TITLES[position]);
|
||||
}
|
||||
});
|
||||
mediator.attach();
|
||||
viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
currentPosition = position;
|
||||
Log.i("dddd", "当前 Pos=" + currentPosition);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!isClose(KeyEvent.KEYCODE_BACK))
|
||||
finish();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PlaceholderFragment fragment = (PlaceholderFragment) getViewPagerFragment(currentPosition);
|
||||
if (fragment != null) {
|
||||
fragment.onRefresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
isBus = intent.getBooleanExtra("is_bus", true);
|
||||
}
|
||||
currentPosition = isBus ? 0 : 1;
|
||||
viewPager.setCurrentItem(currentPosition, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param position fragment 的位置
|
||||
* @return
|
||||
*/
|
||||
private Fragment getViewPagerFragment(int position) {
|
||||
return getSupportFragmentManager().findFragmentByTag("f" + position);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return isClose(keyCode) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private boolean isClose(int keyCode) {
|
||||
PlaceholderFragment fragment = (PlaceholderFragment) getViewPagerFragment(currentPosition);
|
||||
if (fragment != null) {
|
||||
return fragment.onKeyDownChild(keyCode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.zhidao.adas.client.other.router;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class SectionsPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
private final String[] TAB_TITLES;
|
||||
public final Map<String, PlaceholderFragment> fragments = new HashMap<>();
|
||||
private final FragmentActivity fragmentActivity;
|
||||
|
||||
public SectionsPagerAdapter(@NonNull FragmentActivity fragmentActivity, String[] TAB_TITLES) {
|
||||
super(fragmentActivity);
|
||||
this.fragmentActivity = fragmentActivity;
|
||||
this.TAB_TITLES = TAB_TITLES;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
String url = "192.168.1.1";
|
||||
if ("Bus".equals(TAB_TITLES[position])) {
|
||||
url = "192.168.8.1";
|
||||
}
|
||||
return PlaceholderFragment.newInstance(url);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return TAB_TITLES.length;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.AutopilotConfigAdapter;
|
||||
import com.zhidao.adas.client.base.BaseActivity;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
import com.zhidao.adas.client.bean.DataShow;
|
||||
import com.zhidao.adas.client.bean.UpdateDataEvent;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.common.ThreadPoolManager;
|
||||
@@ -263,9 +264,9 @@ public class AutopilotConfigActivity extends BaseActivity {
|
||||
private OnAdasClientListener listener = new OnAdasClientListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
List<String> listGnssInfo = DataDistribution.getInstance().listGnssInfo;
|
||||
List<DataShow> listGnssInfo = DataDistribution.getInstance().listGnssInfo;
|
||||
if (!listGnssInfo.isEmpty()) {
|
||||
String info = listGnssInfo.get(listGnssInfo.size() - 1);
|
||||
String info = listGnssInfo.get(listGnssInfo.size() - 1).data;
|
||||
lon = Double.parseDouble(info.split("longitude: ")[1].split("\n")[0]);
|
||||
lat = Double.parseDouble(info.split("latitude: ")[1].split("\n")[0]);
|
||||
getHandler().sendEmptyMessage(WHAT_UPDATE_SHOW);
|
||||
|
||||
@@ -138,6 +138,8 @@ public class InfoFragment extends BaseFragment {
|
||||
adapter.setData(DataDistribution.getInstance().listGlobalPathResp);
|
||||
} else if (Constants.TITLE.RECEIVE_RECORD_RESULT.equals(title)) {
|
||||
adapter.setData(DataDistribution.getInstance().listRecordPanel);
|
||||
} else if (Constants.TITLE.RECEIVE_BAG_MANAGER_CMD.equals(title)) {
|
||||
adapter.setData(DataDistribution.getInstance().listBagManagerCmd);
|
||||
} else if (Constants.TITLE.RECEIVE_REPORT_MESSAGE.equals(title)) {
|
||||
adapter.setData(DataDistribution.getInstance().listMogoReportMessage);
|
||||
} else if (Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT.equals(title)) {
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseFragment;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BagManagerCmd;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.ChassisStates;
|
||||
@@ -81,6 +82,9 @@ import com.zhidao.adas.client.bean.Trajectory;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.log.ConnectStatusSave;
|
||||
import com.zhidao.adas.client.log.LogSave;
|
||||
import com.zhidao.adas.client.other.permission.BackgrounderPermission;
|
||||
import com.zhidao.adas.client.other.permission.OnAdasPermissionListener;
|
||||
import com.zhidao.adas.client.other.router.RouterActivity;
|
||||
import com.zhidao.adas.client.ui.special.SpecialVehicleDialog;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.adas.client.utils.PreferencesUtils;
|
||||
@@ -97,9 +101,6 @@ import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
|
||||
import com.zhidao.support.adas.high.other.permission.BackgrounderPermission;
|
||||
import com.zhidao.support.adas.high.other.permission.OnAdasPermissionListener;
|
||||
import com.zhidao.support.adas.high.other.router.RouterActivity;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
@@ -114,6 +115,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import chassis.Chassis;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import function_state_management.FunctionStates;
|
||||
@@ -644,6 +646,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_CAR_CONFIG_RESP);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_RECORD_DATA_CONFIG_RESP);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_RECORD_RESULT);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_BAG_MANAGER_CMD);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION);
|
||||
titleFragmentData.add(Constants.TITLE.RECEIVE_STATUS_QUERY_RESP);
|
||||
@@ -673,6 +676,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_SPEED);
|
||||
titleBtnData.add(Constants.TITLE.SEND_TRIP_INFO);
|
||||
titleBtnData.add(Constants.TITLE.SEND_PLANNING_CMD);
|
||||
|
||||
}
|
||||
|
||||
@@ -874,7 +878,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatistics(AutopilotStatistics statistics) {
|
||||
Log.i(TAG, "启动自动驾驶状态=" + statistics.status + " 用时=" + statistics.usedTime + " SetAutopilotModeReq=" + TextFormat.printer().escapingNonAscii(false).printToString(statistics.req) + " failedMessage=" + (statistics.failedMessage == null ? null : TextFormat.printer().escapingNonAscii(false).printToString(statistics.failedMessage)));
|
||||
Log.i(TAG, "启动自动驾驶状态=" + statistics.status + " 用时=" + statistics.usedTime + " SetAutopilotModeReq=" + (statistics.req == null ? null : TextFormat.printer().escapingNonAscii(false).printToString(statistics.req)) + " failedMessage=" + (statistics.failedMessage == null ? null : TextFormat.printer().escapingNonAscii(false).printToString(statistics.failedMessage)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -896,6 +900,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates chassisStates) {
|
||||
ChassisStates base = new ChassisStates(header, chassisStates, sdf);
|
||||
@@ -1035,6 +1040,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
DataDistribution.getInstance().addData(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBagManagerCmd(MessagePad.Header header, BagManagerOuterClass.BagManager bagManager) {
|
||||
BagManagerCmd base = new BagManagerCmd(header, bagManager, sdf);
|
||||
DataDistribution.getInstance().addData(base);
|
||||
}
|
||||
|
||||
private void initAdas() {
|
||||
CupidLogUtils.e(TAG, "--->初始化");
|
||||
@@ -1274,6 +1284,13 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
break;
|
||||
case Constants.TITLE.SEND_SPECIAL_VEHICLE_TASK_CMD:
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(1,2,3,4);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(5,6);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1MainLampCmd(7,8);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(9);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(10);
|
||||
|
||||
|
||||
if (specialVehicleBeanList == null) {
|
||||
specialVehicleBeanList = SpecialVehicleBean.init();
|
||||
}
|
||||
@@ -1442,6 +1459,10 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
AdasManager.getInstance().sendTripInfoReq(4, "x19", "x20", "x21", true);
|
||||
AdasManager.getInstance().sendTripInfoReq(5, "x22", "x23", "x24", false);
|
||||
break;
|
||||
case Constants.TITLE.SEND_PLANNING_CMD:
|
||||
AdasManager.getInstance().sendPlanningCmd(1);
|
||||
AdasManager.getInstance().sendPlanningCmd(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ public class SpecialVehicleDialog extends Dialog {
|
||||
private void initView() {
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
findViewById(R.id.settings).setVisibility(View.GONE);
|
||||
findViewById(R.id.cancel).setVisibility(View.GONE);
|
||||
TextView textView = findViewById(R.id.title);
|
||||
textView.setText("特种车辆");
|
||||
}
|
||||
|
||||
@@ -330,9 +330,11 @@ public class SpecialVehicleFloatWindow extends LinearLayout {
|
||||
.findViewById(R.id.r_btn);
|
||||
button.setText(value[j]);
|
||||
button.setId(j);
|
||||
if (i == 1 || i == 2 || i == 3 || i == 4) {
|
||||
ViewGroup.LayoutParams layoutParams = button.getLayoutParams();
|
||||
layoutParams.width = 202;
|
||||
if (specialVehicleBean.tag.equals(SpecialVehicleBean.TAG.FTQSC)) {
|
||||
if (i == 1 || i == 2 || i == 3 || i == 4) {
|
||||
ViewGroup.LayoutParams layoutParams = button.getLayoutParams();
|
||||
layoutParams.width = 202;
|
||||
}
|
||||
}
|
||||
radioGroup.addView(button);
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ public class Constants {
|
||||
String TITLE_CAR_CONFIG_RESP = "工控机版本\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t配置";
|
||||
String RECEIVE_CAR_CONFIG_RESP = "信息与配置";
|
||||
String RECEIVE_RECORD_RESULT = MessageType.TYPE_RECEIVE_RECORD_RESULT.desc;
|
||||
String RECEIVE_BAG_MANAGER_CMD = MessageType.TYPE_RECEIVE_BAG_MANAGER_CMD.desc;
|
||||
String RECEIVE_RECORD_DATA_CONFIG_RESP = MessageType.TYPE_RECEIVE_RECORD_DATA_CONFIG_RESP.desc;
|
||||
String RECEIVE_GLOBAL_PATH_RESP = MessageType.TYPE_RECEIVE_GLOBAL_PATH_RESP.desc;
|
||||
String RECEIVE_WARN = MessageType.TYPE_RECEIVE_WARN.desc;
|
||||
@@ -194,6 +195,7 @@ public class Constants {
|
||||
String SEND_DETOURING_CLOSE = "绕障类功能关";
|
||||
String SEND_DETOURING_SPEED = "绕障速度阈值";
|
||||
String SEND_TRIP_INFO = "行程信息";
|
||||
String SEND_PLANNING_CMD = "给Planning指令";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FA3B4577" />
|
||||
<solid android:color="#FAFFFFFF" />
|
||||
<stroke
|
||||
android:width="0.2dp"
|
||||
android:color="#AF3B4577" />
|
||||
android:width="0.8dp"
|
||||
android:color="#81666666" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
65
app_ipc_monitoring/src/main/res/layout/activity_router.xml
Normal file
65
app_ipc_monitoring/src/main/res/layout/activity_router.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".router.RouterActivity">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="刷新" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="输入路由器用户名/密码->点击“登录”->点击“连接用户”查看当前列表中是否存在IP是“192.168.X.102”的设备"
|
||||
android:textColor="#000000"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tabs" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_adas_dialog"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="电池优化:优化"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_close_battery_optimizations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="关闭" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="开启池优化功能,会影响熄屏或休眠后网络连接"
|
||||
android:textColor="#696969" />
|
||||
</LinearLayout>
|
||||
31
app_ipc_monitoring/src/main/res/layout/fragment_router.xml
Normal file
31
app_ipc_monitoring/src/main/res/layout/fragment_router.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".router.PlaceholderFragment">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/web_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintTop_creator="1" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintTop_creator="1" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -42,4 +42,27 @@
|
||||
<item name="android:layout_height">35dp</item>
|
||||
<item name="android:background">@drawable/radio_btn_bg</item>
|
||||
</style>
|
||||
|
||||
<style name="PermissionLongBackgroundRunningDialogStyle" parent="Theme.AppCompat.Dialog">
|
||||
<!--设置dialog的背景-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--设置Dialog的windowFrame框为无-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--设置无标题-->
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--是否半透明-->
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<!--设置窗口内容不覆盖-->
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<!--背景是否模糊显示-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
|
||||
<style name="NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user