Merge branch 'qa_merge_shunyi_vr_map' into dev_1.1.9

This commit is contained in:
wangcongtao
2020-12-28 10:58:38 +08:00
58 changed files with 753 additions and 269 deletions

2
.idea/gradle.xml generated
View File

@@ -16,6 +16,7 @@
<option value="$PROJECT_DIR$/app2" />
<option value="$PROJECT_DIR$/foudations" />
<option value="$PROJECT_DIR$/foudations/httpdns-base" />
<option value="$PROJECT_DIR$/foudations/httpdns-mogo" />
<option value="$PROJECT_DIR$/foudations/httpdns-noop" />
<option value="$PROJECT_DIR$/foudations/httpdns-tencent" />
<option value="$PROJECT_DIR$/foudations/mogo-base-services-apk" />
@@ -84,7 +85,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -203,7 +203,7 @@ android {
// 分享时是否隐藏 adas
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
// 是否需要实时上报坐标
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
}
// 同上
em4 {

View File

@@ -8,7 +8,7 @@ project.dependencies {
d8xxImplementation rootProject.ext.dependencies.httpdnsnoop
d80xImplementation rootProject.ext.dependencies.httpdnsnoop
em4Implementation rootProject.ext.dependencies.httpdnsnoop
e8xxImplementation rootProject.ext.dependencies.httpdnsnoop
e8xxImplementation rootProject.ext.dependencies.httpdnstencent
f8xxImplementation rootProject.ext.dependencies.httpdnstencent
f80xImplementation rootProject.ext.dependencies.httpdnstencent
f8AmapImplementation rootProject.ext.dependencies.httpdnstencent
@@ -20,7 +20,7 @@ project.dependencies {
d8xxImplementation project(':foudations:httpdns-noop')
d80xImplementation project(':foudations:httpdns-noop')
em4Implementation project(':foudations:httpdns-noop')
e8xxImplementation project(':foudations:httpdns-noop')
e8xxImplementation project(':foudations:httpdns-tencent')
f8xxImplementation project(':foudations:httpdns-tencent')
f80xImplementation project(':foudations:httpdns-tencent')
f8AmapImplementation project(':foudations:httpdns-tencent')

View File

@@ -75,7 +75,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS ) );
if ( DebugConfig.isMapBased() ) {
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
// MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
}
MogoModulePaths.addBaseModule( new MogoModule( ShareConstants.TAG, ShareConstants.MODEL_NAME ) );

View File

@@ -10,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.httpdns.HttpDnsConst;
import com.mogo.httpdns.IHttpDnsCallback;
import com.mogo.httpdns.IMogoHttpDns;
import com.mogo.httpdns.MogoHttpDnsHandler;
@@ -76,7 +77,7 @@ public class MainActivity extends AppCompatActivity {
WorkThreadHandler.getInstance().post( new Runnable() {
@Override
public void run() {
httpDns.getHttpDnsIp( "dnstest.zhidaozhixing.com", false, new IHttpDnsCallback() {
httpDns.getHttpDnsIp( "dnstest.zhidaozhixing.com", HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP, false, new IHttpDnsCallback() {
@Override
public void onParsed( @Nullable String ip ) {
StringBuilder sb = new StringBuilder( "httpDns ip:\n" );
@@ -100,7 +101,7 @@ public class MainActivity extends AppCompatActivity {
WorkThreadHandler.getInstance().post( new Runnable() {
@Override
public void run() {
httpDns.getHttpDnsIp( "dzt-city.zhidaozhixing.com", false, new IHttpDnsCallback() {
httpDns.getHttpDnsIp( "dzt-city.zhidaozhixing.com", HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP, false, new IHttpDnsCallback() {
@Override
public void onParsed( @Nullable String ip ) {
StringBuilder sb = new StringBuilder( "httpDns ip:\n" );
@@ -121,7 +122,7 @@ public class MainActivity extends AppCompatActivity {
private void renderResponse( ResponseBody body ) {
StringBuilder sb = new StringBuilder( "httpDns ip:\n" );
String ip = httpDns.getCachedHttpDnsIps( "dnstest.zhidaozhixing.com" );
String ip = httpDns.getCachedHttpDnsIps( "dnstest.zhidaozhixing.com", HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP );
sb.append( ip ).append( "\n" );
sb.append( "\nserverIp: \n" ).append( body.result.serverIp ).append( "\n" );
content.setText( sb.toString() );

View File

@@ -223,6 +223,7 @@ ext {
httpdnsbase : "com.mogo.httpdns:httpdns-base:${HTTPDNS_BASE_VERSION}",
httpdnsnoop : "com.mogo.httpdns:httpdns-noop:${HTTPDNS_NOOP_VERSION}",
httpdnstencent : "com.mogo.httpdns:httpdns-tencent:${HTTPDNS_TENCENT_VERSION}",
httpdnsmogo : "com.mogo.httpdns:httpdns-mogo:${HTTPDNS_MOGO_VERSION}",
]
}

View File

@@ -14,4 +14,8 @@ class HttpDnsConst {
@Keep
public static final String PATH = "/httpdns/api";
public static final int HTTP_DNS_ADDRESS_TYPE_HTTP = 0;
public static final int HTTP_DNS_ADDRESS_TYPE_WS = 1;
public static final int HTTP_DNS_ADDRESS_TYPE_IM = 2;
}

View File

@@ -27,36 +27,72 @@ interface IMogoHttpDns extends IProvider {
@Nullable
HttpDns dns();
// /**
// * 获取缓存中的 dns ip地址
// *
// * @param host
// * @return
// */
// @Nullable
// String getCachedHttpDnsIps( String host );
/**
* 获取缓存中的 dns ip地址
*
* @param host
* 获取缓存中的dns ip地址
* @param host domain
* @param type 类型
* @return
*/
@Nullable
String getCachedHttpDnsIps( String host );
@Keep
String getCachedHttpDnsIps(String host, int type);
//
// /**
// * dns 解析
// *
// * @param host 域名
// * @param useCache 是否使用缓存,是 - 如果没有缓存,则解析新地址、否 - 解析新地址,并将新地址缓存
// * @param callback
// */
// void getHttpDnsIp( String host, boolean useCache, IHttpDnsCallback callback );
/**
* dns 解析
*
* @param host 域名
* @param useCache 是否使用缓存,是 - 如果没有缓存,则解析新地址、否 - 解析新地址,并将新地址缓存
* dns解析
* @param host
* @param type
* @param useCache
* @param callback
*/
void getHttpDnsIp( String host, boolean useCache, IHttpDnsCallback callback );
@Keep
void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback);
// /**
// * 监听 ttl 回调
// *
// * @param host 域名
// * @param callback
// */
// void addHttpDnsTtlCallback( String host, IHttpDnsTtlCallback callback );
/**
* 监听 ttl 回调
*
* @param host 域名
* 监听ttl回调
* @param host
* @param type
* @param callback
*/
void addHttpDnsTtlCallback( String host, IHttpDnsTtlCallback callback );
@Keep
void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback);
// /**
// * 注销 ttl 回调
// *
// * @param host 域名
// */
// void removeHttpDnsTtlCallback( String host );
/**
* 注销 ttl 回调
*
* @param host 域名
* 注销ttl回调
* @param host
* @param type
*/
void removeHttpDnsTtlCallback( String host );
@Keep
void removeHttpDnsTtlCallback(String host,int type);
}

View File

@@ -14,6 +14,10 @@ public
@Keep
class MogoHttpDnsHandler {
private MogoHttpDnsHandler(){
}
private static IMogoHttpDns sHttpDns;
public static IMogoHttpDns getHttpDnsApi() {

1
foudations/httpdns-mogo/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,48 @@
apply plugin: 'com.android.library'
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")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation 'com.mogo.httpdns:httpdns-helper:1.0.6'
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.httpdnsbase
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.modulecommon
} else {
implementation project(':foudations:httpdns-base')
implementation project(':foudations:mogo-commons')
implementation project(':modules:mogo-module-common')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.httpdns
POM_ARTIFACT_ID=httpdns-mogo
VERSION_CODE=1

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.httpdns.mogo">
</manifest>

View File

@@ -0,0 +1,118 @@
package com.mogo.httpdns.mogo;
import android.content.Context;
import android.text.TextUtils;
import android.util.ArrayMap;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.network.Utils;
import com.mogo.httpdns.HttpDnsConst;
import com.mogo.httpdns.IHttpDnsCallback;
import com.mogo.httpdns.IHttpDnsTtlCallback;
import com.mogo.httpdns.IMogoHttpDns;
import com.mogo.httpdnshelper.sdk.HttpDnsHelper;
import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation;
import com.mogo.httpdnshelper.sdk.listener.IHttpDnsCurrentLocation;
import com.mogo.httpdnshelper.sdk.listener.OnAddressChangedListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.HttpDns;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static com.mogo.httpdns.HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP;
@Route(path = HttpDnsConst.PATH)
public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListener {
private HttpDnsHelper httpDnsHelper;
@Nullable
@Override
public HttpDns dns() {
return this;
}
@Override
public String getCachedHttpDnsIps(String host, int type) {
return httpDnsHelper.getHttpDnsCachedAddress(type, host);
}
@Override
public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) {
if (useCache) {
String address = httpDnsHelper.getHttpDnsCachedAddress(type, host);
if (address != null) {
callback.onParsed(address);
} else {
callback.onParsed(httpDnsHelper.getHttpDnsAddress(type, host));
}
} else {
callback.onParsed(httpDnsHelper.getHttpDnsAddress(type, host));
}
}
private final Map<String, IHttpDnsTtlCallback> ttlCallbackMap = new ArrayMap<>();
@Override
public void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback) {
ttlCallbackMap.put(type + "-" + host, callback);
}
@Override
public void removeHttpDnsTtlCallback(String host, int type) {
ttlCallbackMap.remove(type + "-" + host);
}
@Override
public void init(final Context context) {
httpDnsHelper = new HttpDnsHelper.Builder().setContext(context).setSn(Utils.getSn()).setShowDebugLog(true).setLoopCheckDelay(15 * 60 * 1000).setCurrentLocation(new IHttpDnsCurrentLocation() {
@org.jetbrains.annotations.Nullable
@Override
public HttpDnsSimpleLocation getCurrentLocation() {
MogoLocation last = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
if (last != null) {
return new HttpDnsSimpleLocation(last.getCityCode(), last.getLatitude(), last.getLongitude());
}
return null;
}
}).build();
httpDnsHelper.setAddressChangedListener(this);
}
@Override
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
String cacheIp = httpDnsHelper.getHttpDnsCachedAddress(HTTP_DNS_ADDRESS_TYPE_HTTP, hostname);
if (cacheIp == null || TextUtils.isEmpty(cacheIp)) {
return Collections.emptyList();
}
String[] info = cacheIp.split(":");
if (info.length > 1) {
return Arrays.asList(InetAddress.getAllByName(info[0]));
} else {
return Arrays.asList(InetAddress.getAllByName(cacheIp));
}
}
@Override
public void onAddressChanged(@org.jetbrains.annotations.Nullable Map<String, String> map) {
if (map != null) {
for (String key : map.keySet()) {
IHttpDnsTtlCallback callback = ttlCallbackMap.get(key);
if (callback != null) {
callback.onTtl();
}else{
Logger.d("MogoHttpDns", "callback is null: " + key);
}
}
}
}
}

View File

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

View File

@@ -25,24 +25,24 @@ class HttpDnsNoop implements IMogoHttpDns {
}
@Override
public String getCachedHttpDnsIps( String host ) {
public String getCachedHttpDnsIps( String host,int type ) {
return null;
}
@Override
public void getHttpDnsIp( String host, boolean useCache, IHttpDnsCallback callback ) {
public void getHttpDnsIp( String host,int type, boolean useCache, IHttpDnsCallback callback ) {
if ( callback != null ) {
callback.onParsed( null );
}
}
@Override
public void addHttpDnsTtlCallback( String host, IHttpDnsTtlCallback callback ) {
public void addHttpDnsTtlCallback( String host,int type, IHttpDnsTtlCallback callback ) {
}
@Override
public void removeHttpDnsTtlCallback( String host ) {
public void removeHttpDnsTtlCallback( String host,int type ) {
}

View File

@@ -3,6 +3,8 @@ package com.mogo.httpdns.tencent;
import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.Keep;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.httpdns.HttpDnsConst;
@@ -19,8 +21,11 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.mogo.httpdns.HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_IM;
import static com.mogo.httpdns.HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS;
public
/**
/*
* @author congtaowang
* @since 2020/11/18
*
@@ -50,8 +55,13 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
}
@Override
public String getCachedHttpDnsIps( String host ) {
return HttpDnsIpsCache.getHttpDnsIps( host );
public String getCachedHttpDnsIps( String host,int type ) {
String ip = HttpDnsIpsCache.getHttpDnsIps(host);
if (ip == null) {
return null;
} else {
return tailPort(ip, type);
}
}
private String getCacheOrParseIpIfNecessary( String host ) {
@@ -66,7 +76,7 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
}
@Override
public void getHttpDnsIp( String host, boolean useCache, IHttpDnsCallback callback ) {
public void getHttpDnsIp( String host,int type, boolean useCache, IHttpDnsCallback callback ) {
String cacheIp = null;
if ( useCache ) {
cacheIp = getCacheOrParseIpIfNecessary( host );
@@ -78,7 +88,7 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
}
if ( !TextUtils.isEmpty( cacheIp ) ) {
if ( callback != null ) {
callback.onParsed( cacheIp );
callback.onParsed( tailPort(cacheIp,type) );
return;
}
}
@@ -88,15 +98,16 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
}
@Override
public void addHttpDnsTtlCallback( String host, IHttpDnsTtlCallback callback ) {
public void addHttpDnsTtlCallback( String host,int type, IHttpDnsTtlCallback callback ) {
HttpDnsIpsCache.addHttpDnsTtlCallback( host, callback );
}
@Override
public void removeHttpDnsTtlCallback( String host ) {
public void removeHttpDnsTtlCallback( String host,int type ) {
HttpDnsIpsCache.removeHttpDnsTtlCallback( host );
}
@Keep
@Override
public void init( Context context ) {
if ( sInited ) {
@@ -113,4 +124,15 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
HttpDnsIpsCache.loopDnsParse();
sInited = true;
}
private String tailPort(String ip, int type) {
switch (type) {
case HTTP_DNS_ADDRESS_TYPE_WS:
return ip + ":4004";
case HTTP_DNS_ADDRESS_TYPE_IM:
return ip + ":4002";
default:
return ip;
}
}
}

View File

@@ -1,16 +1,19 @@
package com.mogo.base.services;
public
/**
import androidx.annotation.Keep;
public abstract
/*
* @author congtaowang
* @since 2020/7/23
*
* 描述
*/
interface BaseServicesConstants {
class BaseServicesConstants {
/**
* 建立长链的通道ID
*/
String SOCKET_CHANNEL_ID = "dataCrawler";
@Keep
public static final String SOCKET_CHANNEL_ID = "dataCrawler";
}

View File

@@ -16,7 +16,7 @@ import com.zhidao.tcloginsdk.model.TokenData;
import com.zhidao.tcloginsdk.network.LoginCallback;
public
/**
/*
* @author congtaowang
* @since 2020/7/16
*

View File

@@ -174,7 +174,7 @@ class SocketManager implements IMogoSocketManager, Callback {
Logger.w( TAG, "msgType %d is exist.", msgType );
}
if ( !mListeners.containsKey( msgType ) ) {
mListeners.put( msgType, new ArrayList< IMogoOnMessageListener >() );
mListeners.put( msgType, new ArrayList<>() );
}
mListeners.get( msgType ).add( listener );
}

View File

@@ -0,0 +1,2 @@
-keep class com.mogo.base.websocket.WebSocketData{*;}
-keep class com.mogo.base.websocket.WebSocketShakeHandsData{*;}

View File

@@ -1,21 +1,30 @@
package com.mogo.base.websocket;
import androidx.annotation.Keep;
import com.mogo.commons.debug.DebugConfig;
@Keep
public class WebSocketConstant {
private static final String HOST_DEV = "ws://62.234.196.121";
private static final String HOST_QA = "ws://62.234.196.121";
private static final String HOST_DEMO = "ws://62.234.196.121";
@Keep
private static final String HOST_RELEASE = "ws://62.234.196.121";
// private static final String PORT = ":14001/ws";
public static final String PORT = ":4004/ws";
// private static final String PORT = ":14001/ws";
@Keep
public static final String PATH = "/ws";
@Keep
public static final String PORT = ":4004"+PATH;
@Keep
public static final String PROTOCOL = "ws://";
private static final String DOMAIN_DEV = "dzt-city.zhidaozhixing.com";
private static final String DOMAIN_QA = "dzt-city.zhidaozhixing.com";
private static final String DOMAIN_DEMO = "dzt-city.zhidaozhixing.com";
@Keep
private static final String DOMAIN_RELEASE = "dzt-city.zhidaozhixing.com";
public static String getSocketServer() {

View File

@@ -1,6 +1,7 @@
package com.mogo.base.websocket;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.httpdns.HttpDnsConst;
import com.mogo.httpdns.IMogoHttpDns;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.logger.Logger;
@@ -27,22 +28,22 @@ public class WebSocketDnsManager {
public void getHttpDnsIp(WebSocketDns webSocketDns) {
this.webSocketDns = webSocketDns;
IMogoHttpDns mogoHttpDns = ARouter.getInstance().navigation(IMogoHttpDns.class);
ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(WebSocketConstant.getDomain(), false, ip -> {
ThreadPoolService.execute(() -> mogoHttpDns.getHttpDnsIp(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS,false, ip -> {
Logger.d(TAG, "getHttpDnsIp ip : " + ip + " , 得到Dns IP,准备回调 初始化webSocket");
this.cacheIp = ip;
this.webSocketDns.getDnsIp((cacheIp != null ?
WebSocketConstant.PROTOCOL + ip + WebSocketConstant.PORT :
WebSocketConstant.PROTOCOL + ip + WebSocketConstant.PATH :
WebSocketConstant.getSocketServer() + WebSocketConstant.PORT));
}));
mogoHttpDns.addHttpDnsTtlCallback(WebSocketConstant.getDomain(), () -> {
mogoHttpDns.addHttpDnsTtlCallback(WebSocketConstant.getDomain(), HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS, () -> {
Logger.d(TAG, "ttl callBack ,ready to getCache Dns IP");
String dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(WebSocketConstant.getDomain());
String dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(WebSocketConstant.getDomain(),HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS);
if (dnsCacheIp == null) {
return;
}
Logger.d(TAG, "获取缓存Dns IP : " + dnsCacheIp + " , 原缓存 IP " + cacheIp);
if (cacheIp != null && !cacheIp.equals(dnsCacheIp)) {
this.webSocketDns.ttlIp(dnsCacheIp + WebSocketConstant.PORT);
this.webSocketDns.ttlIp(dnsCacheIp + WebSocketConstant.PATH);
}
});
}

View File

@@ -27,7 +27,7 @@ public class WebSocketHandlerThread extends HandlerThread {
super.handleMessage(msg);
if (msg.what == MSG_SEND) {
Logger.d(tag, "WebSocketHandlerThread handleMessage = " + msg.obj.toString());
SocketClient.getInstance().getClientProxy().sendMessage(msg.obj.toString());
WebSocketInstanceHolder.getClientProxy().sendMessage(msg.obj.toString());
}
}
};

View File

@@ -0,0 +1,26 @@
package com.mogo.base.websocket;
import com.mogo.websocket.SocketClient;
public
/**
* @author congtaowang
* @since 2020/12/24
*
* 描述
*/
class WebSocketInstanceHolder {
private volatile static SocketClient sClient;
public static SocketClient getClientProxy() {
if ( sClient == null ) {
synchronized ( WebSocketInstanceHolder.class ) {
if ( sClient == null ) {
sClient = new SocketClient();
}
}
}
return sClient;
}
}

View File

@@ -5,8 +5,6 @@ import android.os.SystemClock;
import androidx.annotation.Keep;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mogo.commons.network.Utils;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
@@ -17,7 +15,6 @@ import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.websocket.ISocketMsgCallBack;
import com.mogo.websocket.ISocketMsgSetting;
import com.mogo.websocket.SocketClient;
import java.util.ArrayList;
import java.util.Iterator;
@@ -28,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap;
import static com.mogo.service.connection.WebSocketMsgType.MSG_TYPE_ACK;
import static com.mogo.service.connection.WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
@Keep
public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSetting,
ISocketMsgCallBack {
@@ -82,8 +78,8 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
@Override
public void ttlIp(String url) {
Logger.d(TAG,"ttlIp url : " + url);
SocketClient.getInstance().getClientProxy().stop();
SocketClient.getInstance().getClientProxy().disConnect();
WebSocketInstanceHolder.getClientProxy().stop();
WebSocketInstanceHolder.getClientProxy().disConnect();
Logger.d(TAG,"ready to re initWebSocket : " + url);
initWebSocket(url);
}
@@ -91,10 +87,10 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
}
private void initWebSocket(String ip){
SocketClient.getInstance().getClientProxy().initSocketServer(ip);
SocketClient.getInstance().getClientProxy().getMessageSettings(this);
SocketClient.getInstance().getClientProxy().addISocketMsgCallBack(this);
SocketClient.getInstance().getClientProxy().startConnect();
WebSocketInstanceHolder.getClientProxy().initSocketServer(ip);
WebSocketInstanceHolder.getClientProxy().getMessageSettings(this);
WebSocketInstanceHolder.getClientProxy().addISocketMsgCallBack(this);
WebSocketInstanceHolder.getClientProxy().startConnect();
}
@Override
@@ -224,8 +220,8 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
@Override
public void onConnectClose() {
Logger.d(TAG, "websocket ready to reconnect");
SocketClient.getInstance().getClientProxy().stop();
SocketClient.getInstance().getClientProxy().reConnect();
WebSocketInstanceHolder.getClientProxy().stop();
WebSocketInstanceHolder.getClientProxy().reConnect();
}
@Override

View File

@@ -1,5 +1,5 @@
#-----Foundation-Commons-----
-keep class com.mogo.commons.data.BaseData.*{*;}
-keep class com.mogo.commons.data.BaseData{*;}
-keep class com.mogo.commons.voice.VoiceIntentTrack
-keep class com.mogo.commons.voice.VoiceTrack
-keep class com.mogo.commons.voice.VoicePreemptType

View File

@@ -2,6 +2,8 @@ package com.mogo.commons.analytics;
import android.content.Context;
import androidx.annotation.Keep;
import com.elegant.analytics.Analytics;
import com.elegant.analytics.AnalyticsConfig;
import com.elegant.analytics.IAnalyticsParamsProvider;
@@ -20,6 +22,7 @@ import java.util.Map;
*/
public class AnalyticsUtils {
@Keep
public static void init( Context context ) {
// 1 - debug 近实时上报积累一条埋点上报或者积累3秒上报一次。
// 2 - 本地缓存聚合上报积累30条埋点上报或者积累60秒上报一次。

View File

@@ -0,0 +1,32 @@
package com.mogo.commons.layoutinflater;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
public
/**
* @author congtaowang
* @since 2020/12/23
*
* 系统实现的布局加载
*/
class OriginalLayoutInflater {
private static LayoutInflater sLayoutInflater;
public static void init( Context context ) {
sLayoutInflater = LayoutInflater.from( context ).cloneInContext( context );
}
public static View inflate( @LayoutRes int layoutId, ViewGroup container, boolean attachToRoot ) {
return sLayoutInflater.inflate( layoutId, container, attachToRoot );
}
public static View inflate( @LayoutRes int layoutId, ViewGroup container ) {
return sLayoutInflater.inflate( layoutId, container, container != null );
}
}

View File

@@ -133,16 +133,17 @@ MOGO_MODULES_MVISION_VERSION=2.0.12
MOGO_MODULES_SMALL_MAP=1.0.0
# httpdns
HTTPDNS_TENCENT_VERSION = 2.0.12
HTTPDNS_MOGO_VERSION=2.0.12
HTTPDNS_BASE_VERSION = 2.0.12
HTTPDNS_NOOP_VERSION = 2.0.12
######## 外部依赖引用
# 车聊聊
CARCHATTING_VERSION=2.2.35
CARCHATTING_VERSION=2.2.41
# 车聊聊接口
CARCHATTINGPROVIDER_VERSION=1.1.8
# websocket
WEBSOCKET_VERSION=1.1.2
WEBSOCKET_VERSION=1.1.7
# loglib
LOGLIB_VERSION = 1.0.4

View File

@@ -67,7 +67,8 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.4'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.1'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -62,7 +62,8 @@ public class AMapViewWrapper implements IMogoMapView,
OnMapClickListener,
OnMapTouchListener,
OnMarkClickListener,
OnMapStyleListener {
OnMapStyleListener,
MapStyleController.IMapStyleAutoChangedListener {
private static final String TAG = "AMapViewWrapper";
private final MapAutoView mMapView;
@@ -92,10 +93,15 @@ public class AMapViewWrapper implements IMogoMapView,
if ( DebugConfig.isDebug() ) {
GpsTester.getInstance().init( mMapView );
}
initViews();
initListeners();
this.mIMap = new AMapWrapper( this.mMapView.getMapAutoViewHelper(), this.mMapView, this );
}
private void initViews() {
}
private void initMapView() {
if ( mMapView == null ) {
return;
@@ -684,6 +690,7 @@ public class AMapViewWrapper implements IMogoMapView,
}
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
MapStyleController.getInstance().onLocationChanged( location, this );
}
@Override
@@ -797,4 +804,21 @@ public class AMapViewWrapper implements IMogoMapView,
public void testGpsData() {
GpsTester.getInstance().testGpsData();
}
@Override
public void onStyleAutoChanged( boolean isVrMode ) {
if ( isVrMode ) {
if ( mCurrentUI != EnumMapUI.Type_VR ) {
changeZoom( 20 );
changeMapMode( EnumMapUI.Type_VR );
Logger.d( TAG, "自动切换为vr模式" );
}
} else {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
changeZoom( 16 );
changeMapMode( EnumMapUI.Type_Night );
Logger.d( TAG, "自动切换为2D模式" );
}
}
}
}

View File

@@ -0,0 +1,108 @@
package com.mogo.map.impl.custom;
import com.zhidaoauto.map.sdk.open.location.MogoLocation;
import java.util.ArrayList;
import java.util.List;
public
/**
* @author congtaowang
* @since 2020/12/25
*
* 地图样式控制
*/
class MapStyleController {
private static volatile MapStyleController sInstance;
private boolean mIsInVrMode = false;
private List< VrAreaFilter > mVrAreaFilters = new ArrayList<>();
private MapStyleController() {
mVrAreaFilters.add( new ShunYiArea() );
}
public static MapStyleController getInstance() {
if ( sInstance == null ) {
synchronized ( MapStyleController.class ) {
if ( sInstance == null ) {
sInstance = new MapStyleController();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public void onLocationChanged( MogoLocation location, IMapStyleAutoChangedListener listener ) {
if ( location == null ) {
return;
}
boolean isInVrMode = false;
for ( VrAreaFilter vrAreaFilter : mVrAreaFilters ) {
if ( vrAreaFilter == null ) {
continue;
}
isInVrMode |= vrAreaFilter.isVrArea( location );
if ( isInVrMode ) {
break;
}
}
if ( isInVrMode ) {
if ( !mIsInVrMode ) {
// 第一次进入 vr 区域,自动变为 vr 模式
mIsInVrMode = true;
if ( listener != null ) {
listener.onStyleAutoChanged( true );
}
}
} else {
if ( mIsInVrMode ) {
// 驶出 vr 区域,自动变为 2d 模式
mIsInVrMode = false;
if ( listener != null ) {
listener.onStyleAutoChanged( false );
}
}
}
}
public interface IMapStyleAutoChangedListener {
void onStyleAutoChanged( boolean isVrMode );
}
public interface VrAreaFilter {
boolean isVrArea( MogoLocation location );
}
public static class ShunYiArea implements VrAreaFilter {
// 顺义一期高精地图范围(目前圈定了一个矩形区域,认为都是高精地图区域)
private final double leftBottomLat = 40.18728;
private final double leftBottomLon = 116.71194;
private final double rightTopLat = 40.20671;
private final double rightTopLon = 116.74804;
@Override
public boolean isVrArea( MogoLocation location ) {
if ( location == null ) {
return false;
}
return location.getLat() > leftBottomLat && location.getLon() > leftBottomLon
&& location.getLat() < rightTopLat && location.getLon() < rightTopLon;
}
}
}

View File

@@ -74,8 +74,8 @@ class GpsTester {
break;
case 2:
try {
readOneLineGpsDataAndSet2Map();
sendEmptyMessageDelayed( 2, 0 );
long time = readOneLineGpsDataAndSet2Map();
sendEmptyMessageDelayed( 2, time );
} catch ( Exception e ) {
e.printStackTrace();
}
@@ -112,7 +112,6 @@ class GpsTester {
if ( TextUtils.isEmpty( line ) ) {
return 0;
}
int count = 0;
long duration = 3;
@@ -154,7 +153,6 @@ class GpsTester {
step++;
if ( step >= 50 ) {
step = 0;
count++;
long realDuration = mogoLocation.getDuration() + 75;
realDuration = realDuration / 4;

View File

@@ -72,8 +72,8 @@ public class ObjectUtils {
MarkerOptions markerOptions = new MarkerOptions()
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
.anchor(opt.getU(), opt.getV())
// .icons( descriptors )
// .period( opt.getPeriod() )
.icons( descriptors )
.period( opt.getPeriod() )
.rotateAngle(opt.getRotate())
.setFlat(opt.isFlat())
.visible(opt.isVisible())

View File

@@ -1,2 +1,2 @@
#-----AuthorizeModule-----
-keep class com.mogo.module.authorize.module.bean.**{*;}
-keep class com.mogo.module.authorize.module.bean.*{*;}

View File

@@ -34,7 +34,6 @@ dependencies {
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.callchatprovider
implementation "com.mogo.httpdns:httpdns-helper:1.0.1"
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi

View File

@@ -92,6 +92,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
return;
}
filterData( data.getAllList() );
List< CloudRoadData > allDatumsList = new ArrayList<>();
allDatumsList.addAll( data.getAllList() );
// allDatumsList.addAll( data.getNearList() );
@@ -158,7 +159,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
points.add( new MogoLatLng( target.lat, target.lon ) );
marker.startSmoothInMs( points, 500L );
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
}
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
@@ -170,6 +171,29 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
}
/**
* vr 模式下显示合并数据,否则只显示上报位置的车辆
*
* @param dataList
*/
private void filterData( List< CloudRoadData > dataList ) {
if ( dataList == null || dataList.isEmpty() ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return;
}
List< CloudRoadData > newList = new ArrayList<>();
for ( CloudRoadData cloudRoadData : dataList ) {
if ( cloudRoadData.getFromType() != CloudRoadData.FROM_MY_LOCATION ) {
continue;
}
newList.add( cloudRoadData );
}
dataList.clear();
dataList.addAll( newList );
}
private void bindClickListener( IMogoMarker marker ) {
if ( marker == null || marker.isDestroyed() ) {
return;

View File

@@ -24,7 +24,8 @@ import com.mogo.utils.logger.Logger;
* desc : 地图Marker图标
* version: 1.0
*/
public class MapMarkerView extends MapMarkerBaseView {
public class
MapMarkerView extends MapMarkerBaseView {
private String TAG = "MapMarkerView";
private FrameLayout clMarkerTopView;

View File

@@ -1,64 +0,0 @@
package com.mogo.module.common.utils;
import android.content.Context;
import com.mogo.commons.network.Utils;
import com.mogo.httpdnshelper.sdk.HttpDnsHelper;
import com.mogo.httpdnshelper.sdk.IHttpDnsConfig;
import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import org.jetbrains.annotations.NotNull;
/**
* MogoHttpDnsHelper包装类
*
* @author tongchenfei
*/
public class MogoHttpDnsUtil {
private MogoHttpDnsUtil(){
}
private final static MogoHttpDnsUtil INSTANCE = new MogoHttpDnsUtil();
public static MogoHttpDnsUtil getInstance(){
return INSTANCE;
}
public void init(Context context){
HttpDnsHelper.INSTANCE.init(context, new IHttpDnsConfig() {
@NotNull
@Override
public HttpDnsSimpleLocation getCurrentLocation() {
MogoLocation last = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
if(last!=null){
return new HttpDnsSimpleLocation(last.getCityCode(), last.getLatitude(), last.getLongitude());
}
return null;
}
@Override
public boolean showDebugLog() {
return true;
}
@NotNull
@Override
public String getSn() {
return Utils.getSn();
}
});
}
public String getHttpAddress(){
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP);
}
public String getWsAddress(){
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_WS);
}
public void release(){
HttpDnsHelper.INSTANCE.release();
}
}

View File

@@ -1265,7 +1265,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
} else if (v.getId() == R.id.debugPanel) {
// 简易调试面板
if (SystemClock.elapsedRealtime() - lastDebugPanelClickTime > 1000) {
long diff = SystemClock.elapsedRealtime() - lastDebugPanelClickTime;
Logger.d("DebugPanel", "diff: " + diff);
if (diff > 3000) {
debugPanelClickCount = 1;
} else {
debugPanelClickCount++;

View File

@@ -12,7 +12,6 @@ import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.MogoHttpDnsUtil;
import com.mogo.module.main.EventDispatchCenter;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.module.main.delaycheck.DelayCheckUtil;
@@ -53,8 +52,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
// 开启延时检测
DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this);
delayCheckUtil.waitingForCheck();
MogoHttpDnsUtil.getInstance().init(this);
}
@Nullable
@@ -111,6 +108,5 @@ class MogoMainService extends Service implements IMogoLocationListener {
mLocationClient = null;
}
mServiceApis = null;
MogoHttpDnsUtil.getInstance().release();
}
}

View File

@@ -3,10 +3,13 @@ package com.mogo.module.media.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.SweepGradient;
import android.util.AttributeSet;
import android.view.View;
@@ -78,7 +81,7 @@ public class CircleNumberProgress extends View {
//中间圆的背景颜色 默认为浅紫色
paintUndoneColor = typedArray.getColor(R.styleable.PercentageRing_circleBackground, 0xffafb4db);
//外圆环的颜色 默认为深紫色
paintDoneColor = typedArray.getColor(R.styleable.PercentageRing_ringColor, 0xff6950a1);
// paintDoneColor = typedArray.getColor(R.styleable.PercentageRing_ringColor, Color.parseColor("#e6fffff"));
// 构造器中初始化数据
initData();
@@ -100,17 +103,20 @@ public class CircleNumberProgress extends View {
paintUndone.setStyle(Paint.Style.STROKE);
// 已经完成进度条的画笔的属性
paintDone.setColor(paintDoneColor);
// paintDone.setColor(paintDoneColor);
paintDone.setStrokeWidth(paintProgressWidthPx);
paintDone.setAntiAlias(true);
paintDone.setStyle(Paint.Style.STROKE);
// 文字的画笔的属性
// paintText.setColor(paintTextColor);
// paintText.setTextSize(paintTextSizePx);
// paintText.setAntiAlias(true);
// paintText.setStyle(Paint.Style.STROKE);
// paintText.setTypeface(Typeface.DEFAULT_BOLD);
float[] pos = {0f, 0.5f, 1.0f};
SweepGradient linearGradient = new SweepGradient((getMeasuredWidth() - 40)/2,(getMeasuredHeight() - 40)/2,
new int[]{Color.parseColor("#ffffff"), Color.parseColor("#B3ffffff"), Color.parseColor("#ffffff")}, pos);
// SweepGradient linearGradient = new SweepGradient((getMeasuredWidth() -40)/2,(getMeasuredHeight() - 40)/2,new int[]{Color.GREEN, Color.RED, Color.YELLOW, Color.WHITE, Color.BLUE}, pos);
Matrix matrix = new Matrix();
matrix.setRotate(180, getMeasuredWidth()/2, getMeasuredHeight()/2);
linearGradient.setLocalMatrix(matrix);
paintDone.setShader(linearGradient);
}
@@ -147,7 +153,6 @@ public class CircleNumberProgress extends View {
// 比较文字高度和圆环宽度,如果文字高度较大,那么文字将突破圆环,否则,圆环会把文字包裹在内部
Rect rect = new Rect();
// paintText.getTextBounds("100%", 0, "100%".length(), rect);
int textHeight = rect.height();
// 得到圆环的中间半径(外径和内径平均值)
@@ -156,14 +161,6 @@ public class CircleNumberProgress extends View {
rectF.top = viewCenterY - radiusArc;
rectF.right = viewCenterX + radiusArc;
rectF.bottom = viewCenterY + radiusArc;
// 文字所依赖路径圆弧的半径
radiusText = radiusArc - textHeight / 2;
rectF2.left = viewCenterX - radiusText;
rectF2.top = viewCenterY - radiusText;
rectF2.right = viewCenterX + radiusText;
rectF2.bottom = viewCenterY + radiusText;
}
@Override
@@ -176,37 +173,6 @@ public class CircleNumberProgress extends View {
// 画已经完成进度的圆弧 从-90度开始即从圆环顶部开始
canvas.drawArc(rectF, -90, progress / 100.0f * 360, false, paintDone);
// 为文字所在路径添加一段圆弧轨迹进度为0%-9%时应该最短进度为10%-99%时应该边长进度为100%时应该最长
// 这样才能保证文字和圆弧的进度一致,不会出现超前或者滞后的情况
// 要画的文字
String text = progress + "%";
// 存储字符所有字符所占宽度的数组
float[] widths = new float[text.length()];
// 得到所有字符所占的宽度
// paintText.getTextWidths(text, 0, text.length(), widths);
// 所有字符所占宽度之和
float textWidth = 0;
for (float f : widths) {
textWidth += f;
}
// 根据长度得到路径对应的扫过的角度
// width = sweepAngle * 2 * π * R / 360 ; sweepAngle = width * 360 / 2 /
// π / R
float sweepAngle = (float) (textWidth * 360 / 2 / Math.PI / radiusText);
// 添加路径
path.addArc(rectF2, progress * 3.6f - 90.0f - sweepAngle / 2.0f, sweepAngle);
// 绘制进度的文字
// canvas.drawTextOnPath(text, path, 0, 0, paintText);
// 重置路径
path.reset();
}
/**

View File

@@ -12,9 +12,9 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:circleBackground="@color/modules_media_music_bg_color"
app:ringColor="@color/modules_media_music_circle_color"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- app:ringColor="@color/modules_media_music_circle_color"-->
<!-- <com.mogo.module.media.widget.PercentageRingView-->
<!-- android:id="@+id/window_circle_bg"-->

View File

@@ -555,6 +555,8 @@ public class MogoServices implements IMogoMapListener,
MapMarkerManager.getInstance().syncLocation( latLng.lon, latLng.lat );
Logger.d( TAG, "zoom = %s", zoom );
if ( mIsCameraInited ) {
mLastZoomLevel = zoom;
mLastCustomRefreshCenterLocation = latLng;

View File

@@ -46,6 +46,7 @@ import java.util.List;
public class MockIntentHandler implements IntentHandler {
private static final String TAG = "MockIntentHandler";
private IMogoMarker centerMarker;
@Override
public void handle( Context context, Intent intent ) {
@@ -364,6 +365,24 @@ public class MockIntentHandler implements IntentHandler {
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
}
break;
case 35:
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().testGpsData();
break;
case 36:
MogoLatLng center = MogoApisHandler.getInstance().getApis()
.getMapServiceApi().getMapUIController()
.getWindowCenterLocation();
centerMarker = MogoApisHandler.getInstance().getApis()
.getMapServiceApi().getMarkerManager( context )
.addMarker( TAG, new MogoMarkerOptions()
.position( center )
.icon( BitmapFactory.decodeResource( context.getResources(), R.drawable.bg_map_marker_red ) ) );
break;
case 37:
if ( centerMarker != null ) {
centerMarker.destroy();
}
break;
}
}

View File

@@ -12,6 +12,7 @@ import com.mogo.module.service.websocket.OnePerSecondSendContent;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
import com.mogo.service.connection.WebSocketMsgType;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
@@ -104,6 +105,7 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
if ( content.self == null &&
( content.adas == null || content.adas.isEmpty() ) ) {
Logger.d( TAG, "no information 2 sent" );
return;
}

View File

@@ -2,9 +2,12 @@ package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -13,6 +16,7 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.animation.BezierAnimationView;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.common.entity.V2XEventShowEntity;
@@ -76,6 +80,8 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private ImageView ivEventReportErr;
private HeartLikeView ivEventZan;
private ViewGroup mViewGroup;
// 上传事件的用户信息
private MarkerUserInfo mUserInfo;
@@ -148,6 +154,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false)
, v2XWindow);
mContext = viewGroup.getContext();
mViewGroup = viewGroup;
init(itemView);
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@@ -305,7 +312,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
e.printStackTrace();
}
}
/*
* 展示事件的图片/视频资源
* */

View File

@@ -111,19 +111,19 @@ public class V2XAlarmServer {
}
// 进行提醒
if (!isAlreadyAlert) {
Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
"\n事件详情ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
"\n事件详情" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) +
"\n距离" + v2XRoadEventEntity.getDistance() + "" +
"\n是否已经提醒" + isAlreadyAlert +
"\n当前车辆-经度:" + currentLocation.getLongitude() +
"\n当前车辆-经度:" + currentLocation.getLatitude() +
"\n当前车辆-角度:" + currentLocation.getBearing() +
"\n道路事件-经度:" + eventLocation.getLon() +
"\n道路事件-经度:" + eventLocation.getLat() +
"\n道路事件-角度:" + eventLocation.getAngle() +
"\n夹角角度" + eventAngle + ""
);
// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
// "\n事件详情ID" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n事件详情" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) +
// "\n距离" + v2XRoadEventEntity.getDistance() + "米" +
// "\n是否已经提醒" + isAlreadyAlert +
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
// "\n当前车辆-角度:" + currentLocation.getBearing() +
// "\n道路事件-经度:" + eventLocation.getLon() +
// "\n道路事件-经度:" + eventLocation.getLat() +
// "\n道路事件-角度:" + eventLocation.getAngle() +
// "\n夹角角度" + eventAngle + " 度"
// );
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
return v2XRoadEventEntity;
}
@@ -141,13 +141,13 @@ public class V2XAlarmServer {
// );
}
} else {
Logger.w(MODULE_NAME,
"V2X预警--车头方向与事件方向角度不一致:" +
"\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
"\n车头方向 " + carBearing +
"\n事件方向" + eventBearing +
"\n角度差值" + diffAngle
);
// Logger.w(MODULE_NAME,
// "V2X预警--车头方向与事件方向角度不一致:" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
// "\n车头方向 " + carBearing +
// "\n事件方向" + eventBearing +
// "\n角度差值" + diffAngle
// );
}
} else {
// Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了" +
@@ -156,10 +156,10 @@ public class V2XAlarmServer {
// );
}
} else {
Logger.e(MODULE_NAME,
"V2X预警--道路事件没有角度信息" +
"\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
);
// Logger.e(MODULE_NAME,
// "V2X预警--道路事件没有角度信息" +
// "\n事件详情" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
// );
}
}
}

View File

@@ -60,6 +60,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
private static CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
// 上次的道路事件的预警Marker
private static IMogoMarker mAlarmInfoMarker;
@Override
public void drawableLastAllPOI() {
//Logger.w(MODULE_NAME, "V2X---绘制上一次的POI回调给Launcher底层逻辑让其进行绘制");
@@ -257,19 +258,20 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
.longitude(roadEventEntity.getLocation().getLon());
optionsRipple.anchor(0.5f, 0.5f);
// 由于性能问题D车机不使用事件扩散动画
//由于性能问题D车机不使用事件扩散动画
//showInfoWindow只支持添加单个marker,不支持帧动画
if (!CarSeries.isF8xxSeries()) {
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions()));
mAlarmInfoMarker.showInfoWindow();
} else {
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
}
} else {
optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity));
optionsRipple.period(1);
}
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
mAlarmInfoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl(markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions()));
mAlarmInfoMarker.showInfoWindow();
} else{
// optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
optionsRipple.period(100);
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
}
// 当前Marker设置为最上面

View File

@@ -187,7 +187,7 @@
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
app:layout_constraintStart_toEndOf="@id/ivEventEventNav"
app:layout_goneMarginLeft="@dimen/dp_10"
tools:visibility="visible" />
tools:visibility="visible"/>
</LinearLayout>
@@ -198,8 +198,8 @@
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="4dp"
android:maxLines="2"
android:textColor="@color/v2x_FFF_333"
android:maxLines="1"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_40"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -59,7 +59,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_15"
android:textColor="@color/v2x_FFF_333"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_40"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/ivFaultHelpHead"
@@ -73,7 +73,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.59"
android:textColor="@color/v2x_FFF_999"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_24"
app:layout_constraintStart_toStartOf="@id/tvFaultHelpName"
app:layout_constraintTop_toBottomOf="@id/tvFaultHelpName"
@@ -87,7 +87,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_42"
android:gravity="center_vertical"
android:textColor="@color/v2x_FFF_333"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_70"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/ivFaultHelpEventCall"

View File

@@ -55,7 +55,7 @@ class AdasObjectUtils {
recognizedResults.add( result );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
return recognizedResults;
@@ -65,8 +65,13 @@ class AdasObjectUtils {
if ( rectBean == null ) {
return null;
}
if( rectBean.getLat() < 1){
return null;
}
ADASRecognizedResult result = new ADASRecognizedResult();
result.uuid = rectBean.getUuid();
double amapCoord[] = CoordinateUtils.transformFromWGSToGCJ( rectBean.getLat(), rectBean.getLon() );
if ( amapCoord != null ) {
result.lat = amapCoord[0];

View File

@@ -57,6 +57,7 @@ import java.util.List;
import java.util.Map;
import io.reactivex.schedulers.Schedulers;
import java.util.concurrent.CopyOnWriteArrayList;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
@@ -85,7 +86,7 @@ public class MogoADASController implements IMogoADASController {
private IMogoStatusManager mStatusManager = SingletonsHolder.get( IMogoStatusManager.class );
private boolean mIsReleased = true;
private List<IMogoAdasDataCallback> adasDataCallbackList = new ArrayList<>();
private List< IMogoAdasDataCallback > adasDataCallbackList = new ArrayList<>();
private IAutopolitDataCallBack mAutopolitDataCallBack;
@@ -113,6 +114,10 @@ public class MogoADASController implements IMogoADASController {
// 物体识别返回
// Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
mLastFrameData = rectInfo;
// 仅在 vr 模式下显示 adas 识别车辆
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return;
}
handleAdasRecognizedData( rectInfo );
}
@@ -210,7 +215,7 @@ public class MogoADASController implements IMogoADASController {
@Override
public void showADAS() {
if( DebugConfig.isNeedLoadGuideModule() ){
if ( DebugConfig.isNeedLoadGuideModule() ) {
if ( !SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getBoolean( getSpGuide(), false ) ) {
return;
}
@@ -272,13 +277,13 @@ public class MogoADASController implements IMogoADASController {
@Override
public void requestGetCarModelListInfo() {
if (DebugConfig.isMapBased()) {
Logger.d(TAG, "requestGetCarModelListInfo");
if ( DebugConfig.isMapBased() ) {
Logger.d( TAG, "requestGetCarModelListInfo" );
// 向adas发送车模list
String carModelList = SharedPrefsMgr.getInstance(context).getString(
"CAR_MODEL_LIST", "");
if (carModelList != null && !carModelList.isEmpty()) {
AutopilotServiceManage.getInstance().settingCarModelListInfo(carModelList);
String carModelList = SharedPrefsMgr.getInstance( context ).getString(
"CAR_MODEL_LIST", "" );
if ( carModelList != null && !carModelList.isEmpty() ) {
AutopilotServiceManage.getInstance().settingCarModelListInfo( carModelList );
}
// 此处进行网络请求请求成功后再通知一次adas
requestCarModelList();
@@ -368,6 +373,7 @@ public class MogoADASController implements IMogoADASController {
}
private Context context;
@Override
public void init( Context context ) {
AutopilotServiceManage.getInstance().init( context );
@@ -464,40 +470,40 @@ public class MogoADASController implements IMogoADASController {
private String currentSn = TEST_SN;
private void requestCarModelList() {
Map<String, String> params = new HashMap<>(8);
params.put("sn", Utils.getSn());
Map< String, String > params = new HashMap<>( 8 );
params.put( "sn", Utils.getSn() );
// currentSn = useTestSn ? TEST_SN : Utils.getSn();
// params.put("sn", currentSn);
MogoApisHandler.getInstance().getApis().getNetworkApi().create(CarModelInfoNetApiServices.class, CarModelInfoNetApiServices.getBaseUrl()).
requestCarModelList(params).
subscribeOn(Schedulers.io()).
observeOn(Schedulers.io()).
subscribe(new SubscribeImpl<CarModelListResponse>(RequestOptions.create(context)) {
MogoApisHandler.getInstance().getApis().getNetworkApi().create( CarModelInfoNetApiServices.class, CarModelInfoNetApiServices.getBaseUrl() ).
requestCarModelList( params ).
subscribeOn( Schedulers.io() ).
observeOn( Schedulers.io() ).
subscribe( new SubscribeImpl< CarModelListResponse >( RequestOptions.create( context ) ) {
@Override
public void onSuccess(CarModelListResponse o) {
super.onSuccess(o);
Logger.d(TAG, "请求车模列表成功: " + o);
public void onSuccess( CarModelListResponse o ) {
super.onSuccess( o );
Logger.d( TAG, "请求车模列表成功: " + o );
// 保存到sp中
String value = GsonUtil.jsonFromObject(o.getResult());
SharedPrefsMgr.getInstance(context).putString("CAR_MODEL_LIST",
value);
if(value != null && !value.isEmpty()){
AutopilotServiceManage.getInstance().settingCarModelListInfo(value);
String value = GsonUtil.jsonFromObject( o.getResult() );
SharedPrefsMgr.getInstance( context ).putString( "CAR_MODEL_LIST",
value );
if ( value != null && !value.isEmpty() ) {
AutopilotServiceManage.getInstance().settingCarModelListInfo( value );
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
Logger.e(TAG, e, "请求自车模型失败");
public void onError( Throwable e ) {
super.onError( e );
Logger.e( TAG, e, "请求自车模型失败" );
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
Logger.e(TAG, "请求自车模型失败: " + message);
public void onError( String message, int code ) {
super.onError( message, code );
Logger.e( TAG, "请求自车模型失败: " + message );
}
});
} );
}
@@ -547,8 +553,13 @@ public class MogoADASController implements IMogoADASController {
@Override
public List< ADASRecognizedResult > getLastADASRecognizedResult() {
RectInfo rectInfo = mLastFrameData;
List< ADASRecognizedResult > recognizedResultList = AdasObjectUtils.fromAdasObject( rectInfo );
return recognizedResultList;
List< ADASRecognizedResult > recognizedResultList = null;
try {
recognizedResultList = AdasObjectUtils.fromAdasObject( rectInfo );
return recognizedResultList;
} catch ( Exception e ) {
return null;
}
}
@Override

View File

@@ -1,3 +1,4 @@
include ':foudations:httpdns-mogo'
include ':modules:mogo-module-smp'
include ':app2'
include ':foudations:httpdns-base'