Merge remote-tracking branch 'origin/dev_1.1.9' into dev_1.1.9
3
.idea/gradle.xml
generated
@@ -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" />
|
||||
@@ -58,7 +59,6 @@
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-splash-noop" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-v2x" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-widgets" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-modules-mvision" />
|
||||
<option value="$PROJECT_DIR$/services" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service-api" />
|
||||
@@ -84,7 +84,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -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 {
|
||||
@@ -229,7 +229,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'
|
||||
}
|
||||
// e系列-2+32,对标D系列2+32,采用独立app的形式
|
||||
em3 {
|
||||
@@ -255,7 +255,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'
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em1 {
|
||||
@@ -333,7 +333,7 @@ android {
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'true'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
}
|
||||
// d系列 2 + 32
|
||||
d80x {
|
||||
@@ -359,7 +359,7 @@ android {
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'true'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
}
|
||||
// d系列 1+16 版本
|
||||
d82x {
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -217,12 +217,13 @@ ext {
|
||||
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
|
||||
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
|
||||
|
||||
mogomodulemachinevision : "com.mogo.module:module-machine-vision:${MOGO_MODULES_MVISION_VERSION}",
|
||||
// mogomodulemachinevision : "com.mogo.module:module-machine-vision:${MOGO_MODULES_MVISION_VERSION}",
|
||||
|
||||
|
||||
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}",
|
||||
]
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
@@ -0,0 +1 @@
|
||||
/build
|
||||
48
foudations/httpdns-mogo/build.gradle
Normal 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()
|
||||
0
foudations/httpdns-mogo/consumer-rules.pro
Normal file
3
foudations/httpdns-mogo/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.httpdns
|
||||
POM_ARTIFACT_ID=httpdns-mogo
|
||||
VERSION_CODE=1
|
||||
21
foudations/httpdns-mogo/proguard-rules.pro
vendored
Normal 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
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
5
foudations/httpdns-mogo/src/main/AndroidManifest.xml
Normal 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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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 ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.zhidao.tcloginsdk.model.TokenData;
|
||||
import com.zhidao.tcloginsdk.network.LoginCallback;
|
||||
|
||||
public
|
||||
/**
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-keep class com.mogo.base.websocket.WebSocketData{*;}
|
||||
-keep class com.mogo.base.websocket.WebSocketShakeHandsData{*;}
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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秒上报一次。
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
@@ -129,20 +129,21 @@ TTS_ZHI_VERSION=2.0.12
|
||||
TTS_NOOP_VERSION=2.0.12
|
||||
# 自研地图
|
||||
MAP_CUSTOM_VERSION=2.0.12
|
||||
MOGO_MODULES_MVISION_VERSION=2.0.12
|
||||
#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.42
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.1.8
|
||||
# websocket
|
||||
WEBSOCKET_VERSION=1.1.2
|
||||
WEBSOCKET_VERSION=1.1.7
|
||||
# loglib
|
||||
LOGLIB_VERSION = 1.0.4
|
||||
|
||||
|
||||
@@ -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.3'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -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;
|
||||
@@ -307,6 +313,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if ( ui == null ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "ui = %s", ui );
|
||||
if ( checkAMapView() ) {
|
||||
switch ( ui ) {
|
||||
case CarUp_2D:
|
||||
@@ -684,6 +691,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
|
||||
MapStyleController.getInstance().onLocationChanged( location, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -797,4 +805,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模式" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,6 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
.setDebugMode( true )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setStyleDir( "sdcard/shmdata_asset/mogo_style" )
|
||||
.setCachePath( "sdcard/tiles" )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.734375f, 0.5f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -42,10 +42,8 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.modulemain
|
||||
api rootProject.ext.dependencies.moduleapps
|
||||
} else {
|
||||
api project(":modules:mogo-module-main")
|
||||
api project(':modules:mogo-module-apps')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.res.srcDirs = ['src/main/res', 'src/main/res-voice-icon']
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -44,6 +44,7 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
private RecyclerView mNavigatorAppsList;
|
||||
private AppIndicatorAdapter mAppIndicatorAdapter;
|
||||
|
||||
private ImageView mAIAssistBkg;
|
||||
private ImageView mAIAssist;
|
||||
private View mAIAssistContainer;
|
||||
private AnimWrapper mAnim;
|
||||
@@ -71,13 +72,14 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
mNavigatorAppsList.setAdapter( mAppIndicatorAdapter );
|
||||
|
||||
mAIAssistContainer = findViewById( R.id.module_apps_id_ai_assist_container );
|
||||
mAIAssistBkg = findViewById( R.id.module_apps_id_ai_assist_bkg );
|
||||
mAIAssist = findViewById( R.id.module_apps_id_ai_assist );
|
||||
|
||||
mAnim = new AnimWrapper( mAIAssist );
|
||||
mAnim = new AnimWrapper( mAIAssist, mAIAssistBkg );
|
||||
boolean naviStatus = AppServiceHandler.getApis().getMapServiceApi().getNavi( getContext() ).isNaviing();
|
||||
// if ( naviStatus ) {
|
||||
// setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Navigation );
|
||||
// }
|
||||
if ( naviStatus ) {
|
||||
setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Navigation );
|
||||
}
|
||||
|
||||
mAIAssist.setOnClickListener( new OnAiAssistClickListener() );
|
||||
mAIAssistContainer.setOnClickListener( view -> {
|
||||
@@ -109,12 +111,12 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
|
||||
@Override
|
||||
public void setCurrentXiaoZhiEmoji( AnimRes.EmojiType type ) {
|
||||
// boolean started = mAnim.isStarted();
|
||||
// mAnim.stop();
|
||||
// mAnim.setCurrentAnim( type );
|
||||
// if ( started ) {
|
||||
// mAnim.start();
|
||||
// }
|
||||
boolean started = mAnim.isStarted();
|
||||
mAnim.stop();
|
||||
mAnim.setCurrentAnim( type );
|
||||
if ( started ) {
|
||||
mAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,83 +18,502 @@ public class AnimRes {
|
||||
}
|
||||
|
||||
public static final int sNavigation[] = {
|
||||
|
||||
R.drawable.ic_navi_00000,
|
||||
R.drawable.ic_navi_00001,
|
||||
R.drawable.ic_navi_00002,
|
||||
R.drawable.ic_navi_00003,
|
||||
R.drawable.ic_navi_00004,
|
||||
R.drawable.ic_navi_00005,
|
||||
R.drawable.ic_navi_00006,
|
||||
R.drawable.ic_navi_00007,
|
||||
R.drawable.ic_navi_00008,
|
||||
R.drawable.ic_navi_00009,
|
||||
R.drawable.ic_navi_00010,
|
||||
R.drawable.ic_navi_00011,
|
||||
R.drawable.ic_navi_00012,
|
||||
R.drawable.ic_navi_00013,
|
||||
R.drawable.ic_navi_00014,
|
||||
R.drawable.ic_navi_00015,
|
||||
R.drawable.ic_navi_00016,
|
||||
R.drawable.ic_navi_00017,
|
||||
R.drawable.ic_navi_00018,
|
||||
R.drawable.ic_navi_00019,
|
||||
R.drawable.ic_navi_00020,
|
||||
R.drawable.ic_navi_00021,
|
||||
R.drawable.ic_navi_00022,
|
||||
R.drawable.ic_navi_00023,
|
||||
R.drawable.ic_navi_00024,
|
||||
R.drawable.ic_navi_00025,
|
||||
R.drawable.ic_navi_00026,
|
||||
R.drawable.ic_navi_00027,
|
||||
R.drawable.ic_navi_00028,
|
||||
R.drawable.ic_navi_00029,
|
||||
R.drawable.ic_navi_00030,
|
||||
R.drawable.ic_navi_00031,
|
||||
R.drawable.ic_navi_00032,
|
||||
R.drawable.ic_navi_00033,
|
||||
R.drawable.ic_navi_00034,
|
||||
R.drawable.ic_navi_00035
|
||||
};
|
||||
|
||||
public static final int sMusic[] = {
|
||||
|
||||
R.drawable.ic_music_00000,
|
||||
R.drawable.ic_music_00001,
|
||||
R.drawable.ic_music_00002,
|
||||
R.drawable.ic_music_00003,
|
||||
R.drawable.ic_music_00004,
|
||||
R.drawable.ic_music_00005,
|
||||
R.drawable.ic_music_00006,
|
||||
R.drawable.ic_music_00007,
|
||||
R.drawable.ic_music_00008,
|
||||
R.drawable.ic_music_00009,
|
||||
R.drawable.ic_music_00010,
|
||||
R.drawable.ic_music_00011,
|
||||
R.drawable.ic_music_00012,
|
||||
R.drawable.ic_music_00013,
|
||||
R.drawable.ic_music_00014,
|
||||
R.drawable.ic_music_00015,
|
||||
R.drawable.ic_music_00016,
|
||||
R.drawable.ic_music_00017,
|
||||
R.drawable.ic_music_00018,
|
||||
R.drawable.ic_music_00019,
|
||||
R.drawable.ic_music_00020,
|
||||
R.drawable.ic_music_00021,
|
||||
R.drawable.ic_music_00022,
|
||||
R.drawable.ic_music_00023,
|
||||
R.drawable.ic_music_00024,
|
||||
R.drawable.ic_music_00025
|
||||
};
|
||||
|
||||
public static final int sAll[][] = new int[][]{{
|
||||
R.drawable.mogo_tts_icon_00000,
|
||||
R.drawable.mogo_tts_icon_00001,
|
||||
R.drawable.mogo_tts_icon_00002,
|
||||
R.drawable.mogo_tts_icon_00003,
|
||||
R.drawable.mogo_tts_icon_00004,
|
||||
R.drawable.mogo_tts_icon_00005,
|
||||
R.drawable.mogo_tts_icon_00006,
|
||||
R.drawable.mogo_tts_icon_00007,
|
||||
R.drawable.mogo_tts_icon_00008,
|
||||
R.drawable.mogo_tts_icon_00009,
|
||||
R.drawable.mogo_tts_icon_00010,
|
||||
R.drawable.mogo_tts_icon_00011,
|
||||
R.drawable.mogo_tts_icon_00012,
|
||||
R.drawable.mogo_tts_icon_00013,
|
||||
R.drawable.mogo_tts_icon_00014,
|
||||
R.drawable.mogo_tts_icon_00015,
|
||||
R.drawable.mogo_tts_icon_00016,
|
||||
R.drawable.mogo_tts_icon_00017,
|
||||
R.drawable.mogo_tts_icon_00018,
|
||||
R.drawable.mogo_tts_icon_00019,
|
||||
R.drawable.mogo_tts_icon_00020,
|
||||
R.drawable.mogo_tts_icon_00021,
|
||||
R.drawable.mogo_tts_icon_00022,
|
||||
R.drawable.mogo_tts_icon_00023,
|
||||
R.drawable.mogo_tts_icon_00024,
|
||||
R.drawable.mogo_tts_icon_00025,
|
||||
R.drawable.mogo_tts_icon_00026,
|
||||
R.drawable.mogo_tts_icon_00027,
|
||||
R.drawable.mogo_tts_icon_00028,
|
||||
R.drawable.mogo_tts_icon_00029,
|
||||
R.drawable.mogo_tts_icon_00030,
|
||||
R.drawable.mogo_tts_icon_00031,
|
||||
R.drawable.mogo_tts_icon_00032,
|
||||
R.drawable.mogo_tts_icon_00033,
|
||||
R.drawable.mogo_tts_icon_00034,
|
||||
R.drawable.mogo_tts_icon_00035,
|
||||
R.drawable.mogo_tts_icon_00036,
|
||||
R.drawable.mogo_tts_icon_00037,
|
||||
R.drawable.mogo_tts_icon_00038,
|
||||
R.drawable.mogo_tts_icon_00039,
|
||||
R.drawable.mogo_tts_icon_00040,
|
||||
R.drawable.mogo_tts_icon_00041,
|
||||
R.drawable.mogo_tts_icon_00042,
|
||||
R.drawable.mogo_tts_icon_00043,
|
||||
R.drawable.mogo_tts_icon_00044,
|
||||
R.drawable.mogo_tts_icon_00045,
|
||||
R.drawable.mogo_tts_icon_00046,
|
||||
R.drawable.mogo_tts_icon_00047,
|
||||
R.drawable.mogo_tts_icon_00048,
|
||||
R.drawable.mogo_tts_icon_00049,
|
||||
R.drawable.mogo_tts_icon_00050,
|
||||
R.drawable.mogo_tts_icon_00051,
|
||||
R.drawable.mogo_tts_icon_00052,
|
||||
R.drawable.mogo_tts_icon_00053,
|
||||
R.drawable.mogo_tts_icon_00054,
|
||||
R.drawable.mogo_tts_icon_00055,
|
||||
R.drawable.mogo_tts_icon_00056,
|
||||
R.drawable.mogo_tts_icon_00057,
|
||||
R.drawable.mogo_tts_icon_00058,
|
||||
R.drawable.mogo_tts_icon_00059,
|
||||
R.drawable.mogo_tts_icon_00060,
|
||||
R.drawable.mogo_tts_icon_00061,
|
||||
R.drawable.mogo_tts_icon_00062,
|
||||
R.drawable.mogo_tts_icon_00063,
|
||||
R.drawable.mogo_tts_icon_00064,
|
||||
R.drawable.mogo_tts_icon_00065,
|
||||
R.drawable.mogo_tts_icon_00066,
|
||||
R.drawable.mogo_tts_icon_00067
|
||||
}};
|
||||
public static final int sBlink[] = {
|
||||
R.drawable.ic_blink_00000,
|
||||
R.drawable.ic_blink_00001,
|
||||
R.drawable.ic_blink_00002,
|
||||
R.drawable.ic_blink_00003,
|
||||
R.drawable.ic_blink_00004,
|
||||
R.drawable.ic_blink_00005,
|
||||
R.drawable.ic_blink_00006,
|
||||
R.drawable.ic_blink_00007,
|
||||
R.drawable.ic_blink_00008,
|
||||
R.drawable.ic_blink_00009,
|
||||
R.drawable.ic_blink_00010,
|
||||
R.drawable.ic_blink_00011,
|
||||
R.drawable.ic_blink_00012,
|
||||
R.drawable.ic_blink_00013,
|
||||
R.drawable.ic_blink_00014,
|
||||
R.drawable.ic_blink_00015,
|
||||
R.drawable.ic_blink_00016,
|
||||
R.drawable.ic_blink_00017,
|
||||
R.drawable.ic_blink_00018,
|
||||
R.drawable.ic_blink_00019,
|
||||
R.drawable.ic_blink_00020,
|
||||
R.drawable.ic_blink_00021,
|
||||
R.drawable.ic_blink_00022,
|
||||
R.drawable.ic_blink_00023,
|
||||
R.drawable.ic_blink_00024,
|
||||
R.drawable.ic_blink_00025,
|
||||
R.drawable.ic_blink_00026,
|
||||
R.drawable.ic_blink_00027,
|
||||
R.drawable.ic_blink_00028,
|
||||
R.drawable.ic_blink_00029,
|
||||
R.drawable.ic_blink_00030,
|
||||
R.drawable.ic_blink_00031,
|
||||
R.drawable.ic_blink_00032,
|
||||
R.drawable.ic_blink_00033,
|
||||
R.drawable.ic_blink_00034,
|
||||
R.drawable.ic_blink_00035
|
||||
};
|
||||
|
||||
public static final int sDaily[] = {
|
||||
R.drawable.ic_daily_00000,
|
||||
R.drawable.ic_daily_00001,
|
||||
R.drawable.ic_daily_00002,
|
||||
R.drawable.ic_daily_00003,
|
||||
R.drawable.ic_daily_00004,
|
||||
R.drawable.ic_daily_00005,
|
||||
R.drawable.ic_daily_00006,
|
||||
R.drawable.ic_daily_00007,
|
||||
R.drawable.ic_daily_00008,
|
||||
R.drawable.ic_daily_00009,
|
||||
R.drawable.ic_daily_00010,
|
||||
R.drawable.ic_daily_00011,
|
||||
R.drawable.ic_daily_00012,
|
||||
R.drawable.ic_daily_00013,
|
||||
R.drawable.ic_daily_00014,
|
||||
R.drawable.ic_daily_00015,
|
||||
R.drawable.ic_daily_00016,
|
||||
R.drawable.ic_daily_00017,
|
||||
R.drawable.ic_daily_00018,
|
||||
R.drawable.ic_daily_00019,
|
||||
R.drawable.ic_daily_00020,
|
||||
R.drawable.ic_daily_00021,
|
||||
R.drawable.ic_daily_00022,
|
||||
R.drawable.ic_daily_00023,
|
||||
R.drawable.ic_daily_00024,
|
||||
R.drawable.ic_daily_00025,
|
||||
R.drawable.ic_daily_00026,
|
||||
R.drawable.ic_daily_00027,
|
||||
R.drawable.ic_daily_00028,
|
||||
R.drawable.ic_daily_00029,
|
||||
R.drawable.ic_daily_00030,
|
||||
R.drawable.ic_daily_00031,
|
||||
R.drawable.ic_daily_00032,
|
||||
R.drawable.ic_daily_00033,
|
||||
R.drawable.ic_daily_00034,
|
||||
R.drawable.ic_daily_00035,
|
||||
R.drawable.ic_daily_00036,
|
||||
R.drawable.ic_daily_00037,
|
||||
R.drawable.ic_daily_00038,
|
||||
R.drawable.ic_daily_00039,
|
||||
R.drawable.ic_daily_00040,
|
||||
R.drawable.ic_daily_00041,
|
||||
R.drawable.ic_daily_00042
|
||||
};
|
||||
|
||||
public static final int sHappy1[] = {
|
||||
R.drawable.ic_happy1_00000,
|
||||
R.drawable.ic_happy1_00001,
|
||||
R.drawable.ic_happy1_00002,
|
||||
R.drawable.ic_happy1_00003,
|
||||
R.drawable.ic_happy1_00004,
|
||||
R.drawable.ic_happy1_00005,
|
||||
R.drawable.ic_happy1_00006,
|
||||
R.drawable.ic_happy1_00007,
|
||||
R.drawable.ic_happy1_00008,
|
||||
R.drawable.ic_happy1_00009,
|
||||
R.drawable.ic_happy1_00010,
|
||||
R.drawable.ic_happy1_00011,
|
||||
R.drawable.ic_happy1_00012,
|
||||
R.drawable.ic_happy1_00013,
|
||||
R.drawable.ic_happy1_00014,
|
||||
R.drawable.ic_happy1_00015,
|
||||
R.drawable.ic_happy1_00016,
|
||||
R.drawable.ic_happy1_00017,
|
||||
R.drawable.ic_happy1_00018,
|
||||
R.drawable.ic_happy1_00019,
|
||||
R.drawable.ic_happy1_00020,
|
||||
R.drawable.ic_happy1_00021,
|
||||
R.drawable.ic_happy1_00022,
|
||||
R.drawable.ic_happy1_00023,
|
||||
R.drawable.ic_happy1_00024,
|
||||
R.drawable.ic_happy1_00025,
|
||||
R.drawable.ic_happy1_00026,
|
||||
R.drawable.ic_happy1_00027,
|
||||
R.drawable.ic_happy1_00028
|
||||
};
|
||||
|
||||
public static final int sHappy2[] = {
|
||||
R.drawable.ic_happy2_00000,
|
||||
R.drawable.ic_happy2_00001,
|
||||
R.drawable.ic_happy2_00002,
|
||||
R.drawable.ic_happy2_00003,
|
||||
R.drawable.ic_happy2_00004,
|
||||
R.drawable.ic_happy2_00005,
|
||||
R.drawable.ic_happy2_00006,
|
||||
R.drawable.ic_happy2_00007,
|
||||
R.drawable.ic_happy2_00008,
|
||||
R.drawable.ic_happy2_00009,
|
||||
R.drawable.ic_happy2_00010,
|
||||
R.drawable.ic_happy2_00011,
|
||||
R.drawable.ic_happy2_00012,
|
||||
R.drawable.ic_happy2_00013,
|
||||
R.drawable.ic_happy2_00014,
|
||||
R.drawable.ic_happy2_00015,
|
||||
R.drawable.ic_happy2_00016,
|
||||
R.drawable.ic_happy2_00017,
|
||||
R.drawable.ic_happy2_00018,
|
||||
R.drawable.ic_happy2_00019,
|
||||
R.drawable.ic_happy2_00020,
|
||||
R.drawable.ic_happy2_00021
|
||||
};
|
||||
|
||||
public static final int sOverlook[] = {
|
||||
R.drawable.ic_overlooking_00000,
|
||||
R.drawable.ic_overlooking_00001,
|
||||
R.drawable.ic_overlooking_00002,
|
||||
R.drawable.ic_overlooking_00003,
|
||||
R.drawable.ic_overlooking_00004,
|
||||
R.drawable.ic_overlooking_00005,
|
||||
R.drawable.ic_overlooking_00006,
|
||||
R.drawable.ic_overlooking_00007,
|
||||
R.drawable.ic_overlooking_00008,
|
||||
R.drawable.ic_overlooking_00009,
|
||||
R.drawable.ic_overlooking_00010,
|
||||
R.drawable.ic_overlooking_00011,
|
||||
R.drawable.ic_overlooking_00012,
|
||||
R.drawable.ic_overlooking_00013,
|
||||
R.drawable.ic_overlooking_00014,
|
||||
R.drawable.ic_overlooking_00015,
|
||||
R.drawable.ic_overlooking_00016,
|
||||
R.drawable.ic_overlooking_00017,
|
||||
R.drawable.ic_overlooking_00018,
|
||||
R.drawable.ic_overlooking_00019,
|
||||
R.drawable.ic_overlooking_00020,
|
||||
R.drawable.ic_overlooking_00021,
|
||||
R.drawable.ic_overlooking_00022,
|
||||
R.drawable.ic_overlooking_00023,
|
||||
R.drawable.ic_overlooking_00024,
|
||||
R.drawable.ic_overlooking_00025,
|
||||
R.drawable.ic_overlooking_00026,
|
||||
R.drawable.ic_overlooking_00027,
|
||||
R.drawable.ic_overlooking_00028,
|
||||
R.drawable.ic_overlooking_00029,
|
||||
R.drawable.ic_overlooking_00030,
|
||||
R.drawable.ic_overlooking_00031,
|
||||
R.drawable.ic_overlooking_00032,
|
||||
R.drawable.ic_overlooking_00033,
|
||||
R.drawable.ic_overlooking_00034,
|
||||
R.drawable.ic_overlooking_00035,
|
||||
R.drawable.ic_overlooking_00036,
|
||||
R.drawable.ic_overlooking_00037,
|
||||
R.drawable.ic_overlooking_00038,
|
||||
R.drawable.ic_overlooking_00039,
|
||||
R.drawable.ic_overlooking_00040,
|
||||
R.drawable.ic_overlooking_00041,
|
||||
R.drawable.ic_overlooking_00042,
|
||||
R.drawable.ic_overlooking_00043,
|
||||
R.drawable.ic_overlooking_00044,
|
||||
R.drawable.ic_overlooking_00045,
|
||||
R.drawable.ic_overlooking_00046,
|
||||
R.drawable.ic_overlooking_00047,
|
||||
R.drawable.ic_overlooking_00048,
|
||||
R.drawable.ic_overlooking_00049,
|
||||
R.drawable.ic_overlooking_00050,
|
||||
R.drawable.ic_overlooking_00051,
|
||||
R.drawable.ic_overlooking_00052,
|
||||
R.drawable.ic_overlooking_00053,
|
||||
R.drawable.ic_overlooking_00054,
|
||||
R.drawable.ic_overlooking_00055,
|
||||
R.drawable.ic_overlooking_00056,
|
||||
R.drawable.ic_overlooking_00057,
|
||||
R.drawable.ic_overlooking_00058,
|
||||
R.drawable.ic_overlooking_00059,
|
||||
R.drawable.ic_overlooking_00060,
|
||||
R.drawable.ic_overlooking_00061,
|
||||
R.drawable.ic_overlooking_00062,
|
||||
R.drawable.ic_overlooking_00063,
|
||||
R.drawable.ic_overlooking_00064,
|
||||
R.drawable.ic_overlooking_00065,
|
||||
R.drawable.ic_overlooking_00066,
|
||||
R.drawable.ic_overlooking_00067,
|
||||
R.drawable.ic_overlooking_00068,
|
||||
R.drawable.ic_overlooking_00069,
|
||||
R.drawable.ic_overlooking_00070,
|
||||
R.drawable.ic_overlooking_00071,
|
||||
R.drawable.ic_overlooking_00072,
|
||||
R.drawable.ic_overlooking_00073,
|
||||
R.drawable.ic_overlooking_00074,
|
||||
R.drawable.ic_overlooking_00075,
|
||||
R.drawable.ic_overlooking_00076,
|
||||
R.drawable.ic_overlooking_00077,
|
||||
R.drawable.ic_overlooking_00078,
|
||||
R.drawable.ic_overlooking_00079
|
||||
};
|
||||
|
||||
public static final int sReading[] = {
|
||||
R.drawable.ic_reading_00000,
|
||||
R.drawable.ic_reading_00001,
|
||||
R.drawable.ic_reading_00002,
|
||||
R.drawable.ic_reading_00003,
|
||||
R.drawable.ic_reading_00004,
|
||||
R.drawable.ic_reading_00005,
|
||||
R.drawable.ic_reading_00006,
|
||||
R.drawable.ic_reading_00007,
|
||||
R.drawable.ic_reading_00008,
|
||||
R.drawable.ic_reading_00009,
|
||||
R.drawable.ic_reading_00010,
|
||||
R.drawable.ic_reading_00011,
|
||||
R.drawable.ic_reading_00012,
|
||||
R.drawable.ic_reading_00013,
|
||||
R.drawable.ic_reading_00014,
|
||||
R.drawable.ic_reading_00015,
|
||||
R.drawable.ic_reading_00016,
|
||||
R.drawable.ic_reading_00017,
|
||||
R.drawable.ic_reading_00018,
|
||||
R.drawable.ic_reading_00019,
|
||||
R.drawable.ic_reading_00020,
|
||||
R.drawable.ic_reading_00021,
|
||||
R.drawable.ic_reading_00022,
|
||||
R.drawable.ic_reading_00023,
|
||||
R.drawable.ic_reading_00024,
|
||||
R.drawable.ic_reading_00025,
|
||||
R.drawable.ic_reading_00026,
|
||||
R.drawable.ic_reading_00027,
|
||||
R.drawable.ic_reading_00028,
|
||||
R.drawable.ic_reading_00029,
|
||||
R.drawable.ic_reading_00030,
|
||||
R.drawable.ic_reading_00031,
|
||||
R.drawable.ic_reading_00032,
|
||||
R.drawable.ic_reading_00033,
|
||||
R.drawable.ic_reading_00034,
|
||||
R.drawable.ic_reading_00035,
|
||||
R.drawable.ic_reading_00036,
|
||||
R.drawable.ic_reading_00037,
|
||||
R.drawable.ic_reading_00038,
|
||||
R.drawable.ic_reading_00039,
|
||||
R.drawable.ic_reading_00040,
|
||||
R.drawable.ic_reading_00041,
|
||||
R.drawable.ic_reading_00042,
|
||||
R.drawable.ic_reading_00043,
|
||||
R.drawable.ic_reading_00044,
|
||||
R.drawable.ic_reading_00045,
|
||||
R.drawable.ic_reading_00046,
|
||||
R.drawable.ic_reading_00047,
|
||||
R.drawable.ic_reading_00048,
|
||||
R.drawable.ic_reading_00049,
|
||||
R.drawable.ic_reading_00050,
|
||||
R.drawable.ic_reading_00051,
|
||||
R.drawable.ic_reading_00052,
|
||||
R.drawable.ic_reading_00053,
|
||||
R.drawable.ic_reading_00054,
|
||||
R.drawable.ic_reading_00055,
|
||||
R.drawable.ic_reading_00056,
|
||||
R.drawable.ic_reading_00057,
|
||||
R.drawable.ic_reading_00058,
|
||||
R.drawable.ic_reading_00059,
|
||||
R.drawable.ic_reading_00060,
|
||||
R.drawable.ic_reading_00061,
|
||||
R.drawable.ic_reading_00062,
|
||||
R.drawable.ic_reading_00063,
|
||||
R.drawable.ic_reading_00064,
|
||||
R.drawable.ic_reading_00065,
|
||||
R.drawable.ic_reading_00066,
|
||||
R.drawable.ic_reading_00067,
|
||||
R.drawable.ic_reading_00068,
|
||||
R.drawable.ic_reading_00069,
|
||||
R.drawable.ic_reading_00070,
|
||||
R.drawable.ic_reading_00071,
|
||||
R.drawable.ic_reading_00072,
|
||||
R.drawable.ic_reading_00073,
|
||||
R.drawable.ic_reading_00074,
|
||||
R.drawable.ic_reading_00075,
|
||||
R.drawable.ic_reading_00076,
|
||||
R.drawable.ic_reading_00077,
|
||||
R.drawable.ic_reading_00078,
|
||||
R.drawable.ic_reading_00079,
|
||||
R.drawable.ic_reading_00080,
|
||||
R.drawable.ic_reading_00081,
|
||||
R.drawable.ic_reading_00082,
|
||||
R.drawable.ic_reading_00083,
|
||||
R.drawable.ic_reading_00084,
|
||||
R.drawable.ic_reading_00085,
|
||||
R.drawable.ic_reading_00086,
|
||||
R.drawable.ic_reading_00087,
|
||||
R.drawable.ic_reading_00088,
|
||||
R.drawable.ic_reading_00089,
|
||||
R.drawable.ic_reading_00090,
|
||||
R.drawable.ic_reading_00091
|
||||
};
|
||||
|
||||
public static final int[] sRunning = {
|
||||
R.drawable.ic_running_00000,
|
||||
R.drawable.ic_running_00001,
|
||||
R.drawable.ic_running_00002,
|
||||
R.drawable.ic_running_00003,
|
||||
R.drawable.ic_running_00004,
|
||||
R.drawable.ic_running_00005,
|
||||
R.drawable.ic_running_00006,
|
||||
R.drawable.ic_running_00007,
|
||||
R.drawable.ic_running_00008,
|
||||
R.drawable.ic_running_00009,
|
||||
R.drawable.ic_running_00010,
|
||||
R.drawable.ic_running_00011,
|
||||
R.drawable.ic_running_00012,
|
||||
R.drawable.ic_running_00013,
|
||||
R.drawable.ic_running_00014,
|
||||
R.drawable.ic_running_00015,
|
||||
R.drawable.ic_running_00016,
|
||||
R.drawable.ic_running_00017,
|
||||
R.drawable.ic_running_00018,
|
||||
R.drawable.ic_running_00019,
|
||||
R.drawable.ic_running_00020,
|
||||
R.drawable.ic_running_00021,
|
||||
R.drawable.ic_running_00022,
|
||||
R.drawable.ic_running_00023,
|
||||
R.drawable.ic_running_00024,
|
||||
R.drawable.ic_running_00025,
|
||||
R.drawable.ic_running_00026,
|
||||
R.drawable.ic_running_00027,
|
||||
R.drawable.ic_running_00028,
|
||||
R.drawable.ic_running_00029,
|
||||
R.drawable.ic_running_00030,
|
||||
R.drawable.ic_running_00031,
|
||||
R.drawable.ic_running_00032,
|
||||
R.drawable.ic_running_00033,
|
||||
R.drawable.ic_running_00034,
|
||||
R.drawable.ic_running_00035,
|
||||
R.drawable.ic_running_00036
|
||||
};
|
||||
|
||||
public static final int sSleep[] = {
|
||||
R.drawable.ic_sleep_00000,
|
||||
R.drawable.ic_sleep_00001,
|
||||
R.drawable.ic_sleep_00002,
|
||||
R.drawable.ic_sleep_00003,
|
||||
R.drawable.ic_sleep_00004,
|
||||
R.drawable.ic_sleep_00005,
|
||||
R.drawable.ic_sleep_00006,
|
||||
R.drawable.ic_sleep_00007,
|
||||
R.drawable.ic_sleep_00008,
|
||||
R.drawable.ic_sleep_00009,
|
||||
R.drawable.ic_sleep_00010,
|
||||
R.drawable.ic_sleep_00011,
|
||||
R.drawable.ic_sleep_00012,
|
||||
R.drawable.ic_sleep_00013,
|
||||
R.drawable.ic_sleep_00014,
|
||||
R.drawable.ic_sleep_00015,
|
||||
R.drawable.ic_sleep_00016,
|
||||
R.drawable.ic_sleep_00017,
|
||||
R.drawable.ic_sleep_00018,
|
||||
R.drawable.ic_sleep_00019,
|
||||
R.drawable.ic_sleep_00020,
|
||||
R.drawable.ic_sleep_00021,
|
||||
R.drawable.ic_sleep_00022,
|
||||
R.drawable.ic_sleep_00023,
|
||||
R.drawable.ic_sleep_00024,
|
||||
R.drawable.ic_sleep_00025,
|
||||
R.drawable.ic_sleep_00026,
|
||||
R.drawable.ic_sleep_00027,
|
||||
R.drawable.ic_sleep_00028,
|
||||
R.drawable.ic_sleep_00029,
|
||||
R.drawable.ic_sleep_00030,
|
||||
R.drawable.ic_sleep_00031,
|
||||
R.drawable.ic_sleep_00032,
|
||||
R.drawable.ic_sleep_00033,
|
||||
R.drawable.ic_sleep_00034,
|
||||
R.drawable.ic_sleep_00035,
|
||||
R.drawable.ic_sleep_00036,
|
||||
R.drawable.ic_sleep_00037,
|
||||
R.drawable.ic_sleep_00038,
|
||||
R.drawable.ic_sleep_00039,
|
||||
R.drawable.ic_sleep_00040,
|
||||
R.drawable.ic_sleep_00041
|
||||
};
|
||||
|
||||
public static final int sAll[][] = new int[][]{
|
||||
sOverlook,
|
||||
sBlink,
|
||||
sDaily,
|
||||
sHappy1,
|
||||
sReading,
|
||||
sRunning,
|
||||
sHappy2,
|
||||
sSleep
|
||||
};
|
||||
|
||||
// 需要循环的点
|
||||
public static final int sKeyPoint[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
47,
|
||||
26,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
public static final int sKeyPointOfNavigation = 16;
|
||||
|
||||
public static int sRes[] = sAll[0];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
@@ -17,8 +18,9 @@ public class AnimWrapper implements Anim {
|
||||
private Anim mDelegate;
|
||||
private boolean mIsStarted = false;
|
||||
|
||||
public AnimWrapper( ImageView target ) {
|
||||
public AnimWrapper( ImageView target, ImageView bkg ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
bkg.setVisibility( View.VISIBLE );
|
||||
mDelegate = new OthersAnim( target );
|
||||
} else {
|
||||
mDelegate = new KitkatAnim( target );
|
||||
|
||||
@@ -17,12 +17,13 @@ public class OthersAnim implements Anim {
|
||||
|
||||
private final static int MSG_LOOP = 3003;
|
||||
public static final int MSG_CHANGE = 3004;
|
||||
public static final long INTERVAL = 100L;
|
||||
public static final long INTERVAL = 50L;
|
||||
private boolean mStarted = false;
|
||||
|
||||
private ImageView mImageView;
|
||||
|
||||
private int mEmojiIndex = 0;
|
||||
private int mKeyPoint = 0;
|
||||
|
||||
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
@@ -34,6 +35,9 @@ public class OthersAnim implements Anim {
|
||||
if ( AnimRes.sRes.length == 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( mStartIndex >= AnimRes.sRes.length - 1 ) {
|
||||
mStartIndex = mKeyPoint;
|
||||
}
|
||||
mImageView.setImageResource( AnimRes.sRes[mStartIndex++ % AnimRes.sRes.length] );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOOP, INTERVAL );
|
||||
}
|
||||
@@ -44,6 +48,7 @@ public class OthersAnim implements Anim {
|
||||
stop();
|
||||
mEmojiIndex++;
|
||||
AnimRes.sRes = AnimRes.sAll[mEmojiIndex % AnimRes.sAll.length];
|
||||
mKeyPoint = AnimRes.sKeyPoint[mEmojiIndex % AnimRes.sKeyPoint.length];
|
||||
mStartIndex = 0;
|
||||
if ( start ) {
|
||||
start();
|
||||
@@ -70,7 +75,7 @@ public class OthersAnim implements Anim {
|
||||
}
|
||||
mStarted = true;
|
||||
mHandler.sendEmptyMessage( MSG_LOOP );
|
||||
// mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 60 * 1_000L );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 30 * 1_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,10 +94,12 @@ public class OthersAnim implements Anim {
|
||||
switch ( type ) {
|
||||
case Navigation:
|
||||
mStartIndex = 0;
|
||||
mKeyPoint = AnimRes.sKeyPointOfNavigation;
|
||||
AnimRes.sRes = AnimRes.sNavigation;
|
||||
break;
|
||||
case Music:
|
||||
mStartIndex = 0;
|
||||
mKeyPoint = 0;
|
||||
AnimRes.sRes = AnimRes.sMusic;
|
||||
break;
|
||||
case Others:
|
||||
|
||||
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |