Merge branch 'dev_merge_shunyi_vr_map' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into dev_merge_shunyi_vr_map

This commit is contained in:
unknown
2020-12-25 17:57:52 +08:00
14 changed files with 185 additions and 134 deletions

1
.idea/gradle.xml generated
View File

@@ -85,6 +85,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -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')
}
}

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

@@ -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

View File

@@ -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<String, IHttpDnsTtlCallback> 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<InetAddress> 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));
}
}

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

@@ -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

View File

@@ -67,8 +67,8 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.7'
// 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

@@ -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

@@ -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

@@ -268,8 +268,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
.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<V2XEventShowEntity> {
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) {
}
}
/*
* 展示事件的图片/视频资源
* */