From f05cb42fe5f6ede536d1b895fb0a44e150fde5a4 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Fri, 25 Dec 2020 16:38:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?online=E6=B8=A0=E9=81=93=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=88=90mogoHttpDns=EF=BC=8C=E5=85=B6=E4=BB=96=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E4=BD=BF=E7=94=A8httpDnsNoop=EF=BC=8C=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E7=94=A8tencentHttpDns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + app/functions/httpdns.gradle | 28 +++--------- config.gradle | 1 + foudations/httpdns-mogo/build.gradle | 2 +- .../com/mogo/httpdns/mogo/MogoHttpDns.java | 43 +++++++------------ gradle.properties | 1 + 6 files changed, 26 insertions(+), 50 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 426ff6b360..8efbfa420e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -85,6 +85,7 @@ diff --git a/app/functions/httpdns.gradle b/app/functions/httpdns.gradle index 176938bc92..9edbf9b3f7 100644 --- a/app/functions/httpdns.gradle +++ b/app/functions/httpdns.gradle @@ -2,28 +2,12 @@ project.dependencies { if (Boolean.valueOf(RELEASE)) { - bydautoImplementation rootProject.ext.dependencies.httpdnsnoop - d82xImplementation rootProject.ext.dependencies.httpdnsnoop - em1Implementation rootProject.ext.dependencies.httpdnsnoop - d8xxImplementation rootProject.ext.dependencies.httpdnsnoop - d80xImplementation rootProject.ext.dependencies.httpdnsnoop - em4Implementation rootProject.ext.dependencies.httpdnsnoop - e8xxImplementation rootProject.ext.dependencies.httpdnstencent - f8xxImplementation rootProject.ext.dependencies.httpdnstencent - f80xImplementation rootProject.ext.dependencies.httpdnstencent - f8AmapImplementation rootProject.ext.dependencies.httpdnstencent - em3Implementation rootProject.ext.dependencies.httpdnsnoop + qaImplementation rootProject.ext.dependencies.httpdnsnoop + demoImplementation rootProject.ext.dependencies.httpdnsnoop + onlineImplementation rootProject.ext.dependencies.httpdnsmogo } else { - bydautoImplementation project(':foudations:httpdns-noop') - d82xImplementation project(':foudations:httpdns-noop') - em1Implementation project(':foudations:httpdns-noop') - d8xxImplementation project(':foudations:httpdns-noop') - d80xImplementation project(':foudations:httpdns-noop') - em4Implementation project(':foudations:httpdns-noop') - e8xxImplementation project(':foudations:httpdns-tencent') - f8xxImplementation project(':foudations:httpdns-tencent') - f80xImplementation project(':foudations:httpdns-tencent') - f8AmapImplementation project(':foudations:httpdns-tencent') - em3Implementation project(':foudations:httpdns-noop') + qaImplementation project(':foudations:httpdns-noop') + demoImplementation project(':foudations:httpdns-noop') + onlineImplementation project(':foudations:httpdns-mogo') } } \ No newline at end of file diff --git a/config.gradle b/config.gradle index 3e22b033e4..c15cb61257 100644 --- a/config.gradle +++ b/config.gradle @@ -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}", ] } \ No newline at end of file diff --git a/foudations/httpdns-mogo/build.gradle b/foudations/httpdns-mogo/build.gradle index 27ff9d4d42..af8c7c97be 100644 --- a/foudations/httpdns-mogo/build.gradle +++ b/foudations/httpdns-mogo/build.gradle @@ -32,7 +32,7 @@ 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.3' + implementation 'com.mogo.httpdns:httpdns-helper:1.0.6' if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.httpdnsbase diff --git a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java index 28f1fca9a0..e30d073420 100644 --- a/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java +++ b/foudations/httpdns-mogo/src/main/java/com/mogo/httpdns/mogo/MogoHttpDns.java @@ -14,14 +14,12 @@ 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.IHttpDnsConfig; +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.network.HttpDns; -import org.jetbrains.annotations.NotNull; - import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Arrays; @@ -31,9 +29,10 @@ 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 final HttpDnsHelper httpDnsHelper = new HttpDnsHelper(); +@Route(path = HttpDnsConst.PATH) +public class MogoHttpDns implements IMogoHttpDns, HttpDns, OnAddressChangedListener { + private HttpDnsHelper httpDnsHelper; + @Nullable @Override public HttpDns dns() { @@ -47,19 +46,20 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns,OnAddressChangedListen @Override public void getHttpDnsIp(String host, int type, boolean useCache, IHttpDnsCallback callback) { - if(useCache) { + if (useCache) { String address = httpDnsHelper.getHttpDnsCachedAddress(type, host); if (address != null) { callback.onParsed(address); - }else{ + } else { callback.onParsed(httpDnsHelper.getHttpDnsAddress(type, host)); } - }else { + } else { callback.onParsed(httpDnsHelper.getHttpDnsAddress(type, host)); } } private final Map ttlCallbackMap = new ArrayMap<>(); + @Override public void addHttpDnsTtlCallback(String host, int type, IHttpDnsTtlCallback callback) { ttlCallbackMap.put(type + "-" + host, callback); @@ -73,41 +73,30 @@ public class MogoHttpDns implements IMogoHttpDns, HttpDns,OnAddressChangedListen @Override public void init(final Context context) { - httpDnsHelper.init(context, new IHttpDnsConfig() { - @NotNull + 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){ + 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(); - } - }); + }).build(); httpDnsHelper.setAddressChangedListener(this); } @Override public List lookup(String hostname) throws UnknownHostException { String cacheIp = httpDnsHelper.getHttpDnsCachedAddress(HTTP_DNS_ADDRESS_TYPE_HTTP, hostname); - if ( cacheIp == null || TextUtils.isEmpty( cacheIp ) ) { + 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(info[0])); + } else { return Arrays.asList(InetAddress.getAllByName(cacheIp)); } } diff --git a/gradle.properties b/gradle.properties index 72a14f2bd8..47537e0156 100644 --- a/gradle.properties +++ b/gradle.properties @@ -133,6 +133,7 @@ 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 From a2c7380ea955aa8874061dd4d8f7a27fd0c9a671 Mon Sep 17 00:00:00 2001 From: liujing Date: Fri, 25 Dec 2020 16:40:49 +0800 Subject: [PATCH 2/3] no message --- .../v2x/adapter/holder/V2XRoadEventVH.java | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java index f4f30a5f05..f269856f7b 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java @@ -268,8 +268,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { .registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP, v2XVoiceOpenLiveListener); ivEventLive.setOnClickListener(v -> { - getCoordinateForFather(ivEventLive); -// showLiveCar(v2XEventShowEntity); + showLiveCar(v2XEventShowEntity); }); } else { ivEventLive.setVisibility(GONE); @@ -313,31 +312,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { e.printStackTrace(); } } - - private void getCoordinateForFather(View view) { - try { - float f_top = view.getTop();//view自身的顶边到其父布局顶边的距离 - float f_left = view.getY();//view自身的左边到其父布局左边的距离 - float f_right = view.getRight();//view自身的右边到其父布局左边的距离 - float f_bottom = view.getBottom();//view自身的底边到其父布局顶边的距离 - float x_left = view.getX();//点击事件距离控件左边的距离 - float y_top = view.getTop();//点击事件距离控件顶边的距离 - - Log.d("getCoordinateForFather", "f_top:" + f_top + "f_left:" + f_left + "f_right:" - + f_right + "f_bottom:" + f_bottom + "x_left:" + x_left + "y_top:" + y_top); - - //动态添加贝塞尔动画view - BezierAnimationView bezierAnimationView = new BezierAnimationView(mContext); - Drawable drawable = mContext.getResources().getDrawable(R.drawable.bg_v2x_event_type_orange_vr); - bezierAnimationView.setBackground(drawable); - mViewGroup.addView(bezierAnimationView, 20, 20); - bezierAnimationView.setGravity(Gravity.CENTER); - - } catch (Exception e) { - - } - } - + /* * 展示事件的图片/视频资源 * */ From f593995b9f2a01685b4d4b19eca7ef2b27677a7a Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Fri, 25 Dec 2020 17:56:21 +0800 Subject: [PATCH 3/3] opt --- .../src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java | 8 ++++---- .../mogo/module/extensions/entrance/EntranceFragment.java | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java b/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java index 9aed264e16..fdf50007aa 100644 --- a/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java +++ b/foudations/httpdns-noop/src/main/java/com/mogo/httpdns/noop/HttpDnsNoop.java @@ -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 ) { } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 47db3a0b5a..850cef0236 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -1265,7 +1265,9 @@ public class EntranceFragment extends MvpFragment 1000) { + long diff = SystemClock.elapsedRealtime() - lastDebugPanelClickTime; + Logger.d("DebugPanel", "diff: " + diff); + if (diff > 3000) { debugPanelClickCount = 1; } else { debugPanelClickCount++;