This commit is contained in:
unknown
2021-01-05 10:11:49 +08:00
73 changed files with 1185 additions and 342 deletions

6
.idea/misc.xml generated
View File

@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMIdeaPluginConfiguration">
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ASMPluginConfiguration">
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -486,6 +486,7 @@ dependencies {
implementation rootProject.ext.dependencies.moduleextensions
implementation rootProject.ext.dependencies.modulemap
implementation rootProject.ext.dependencies.moduleSmallMap
implementation rootProject.ext.dependencies.httpdnsnoop
} else {
implementation project(':foudations:mogo-commons')
implementation project(':foudations:mogo-base-websocket-sdk')
@@ -503,6 +504,7 @@ dependencies {
implementation project(':modules:mogo-module-extensions')
implementation project(':modules:mogo-module-map')
implementation project(':modules:mogo-module-smp')
implementation project(':foudations:httpdns-noop')
}
apply from: "./functions/basedmap.gradle"
@@ -515,7 +517,7 @@ dependencies {
apply from: "./functions/crashreport.gradle"
apply from: "./functions/widgets.gradle"
apply from: "./functions/tts.gradle"
apply from: "./functions/httpdns.gradle"
// apply from: "./functions/httpdns.gradle"
apply from: "./functions/backwidget.gradle"
apply from: "./functions/mediaui.gradle"
apply from: "./functions/bizguide.gradle"

View File

@@ -8,10 +8,10 @@ project.dependencies {
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
e8xxImplementation rootProject.ext.dependencies.httpdnsnoop
f8xxImplementation rootProject.ext.dependencies.httpdnsnoop
f80xImplementation rootProject.ext.dependencies.httpdnsnoop
f8AmapImplementation rootProject.ext.dependencies.httpdnsnoop
em3Implementation rootProject.ext.dependencies.httpdnsnoop
} else {
bydautoImplementation project(':foudations:httpdns-noop')
@@ -20,10 +20,10 @@ project.dependencies {
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')
e8xxImplementation project(':foudations:httpdns-noop')
f8xxImplementation project(':foudations:httpdns-noop')
f80xImplementation project(':foudations:httpdns-noop')
f8AmapImplementation project(':foudations:httpdns-noop')
em3Implementation project(':foudations:httpdns-noop')
}
}

View File

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

View File

@@ -8,11 +8,11 @@ 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";
private static final String HOST_DEV = "ws://119.45.249.167";
private static final String HOST_QA = "ws://119.45.249.167";
private static final String HOST_DEMO = "ws://119.45.249.167";
@Keep
private static final String HOST_RELEASE = "ws://62.234.196.121";
private static final String HOST_RELEASE = "ws://119.45.249.167";
// private static final String PORT = ":14001/ws";
@Keep
public static final String PATH = "/ws";

View File

@@ -20,11 +20,12 @@ public class ViewUtils {
view.destroyDrawingCache();
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas( bitmap );
view.draw( canvas );
return bitmap;
// return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas( bitmap );
// view.draw( canvas );
// return bitmap;
Bitmap bitmap = null;
return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
}
public static void processChildView(View view) {

View File

@@ -139,7 +139,7 @@ HTTPDNS_NOOP_VERSION = 2.0.12
######## 外部依赖引用
# 车聊聊
CARCHATTING_VERSION=2.2.42
CARCHATTING_VERSION=2.2.50
# 车聊聊接口
CARCHATTINGPROVIDER_VERSION=1.1.8
# websocket

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.3'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.7'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
}

View File

@@ -85,6 +85,8 @@ public class AMapViewWrapper implements IMogoMapView,
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentUI;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
public AMapViewWrapper( MapAutoView mMapView ) {
startTime = System.currentTimeMillis();
@@ -327,10 +329,12 @@ public class AMapViewWrapper implements IMogoMapView,
case Type_Light:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_DAY );
mIsLightStyle = true;
break;
case Type_Night:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_NIGHT );
mIsLightStyle = false;
break;
case Type_AUTO_LIGHT_Night:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true );
@@ -342,7 +346,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng ) {
moveToCenter( latLng, true );
}
private void setUIMode( EnumMapUI ui ) {
@@ -573,6 +577,10 @@ public class AMapViewWrapper implements IMogoMapView,
if ( !checkAMapView() ) {
return;
}
if ( mCurrentUI == EnumMapUI.Type_VR ) {
Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Logger.i( TAG, "showBounds:%s -%s-%s- %b ", tag, carPosition.toString(), bound.toShortString(), lockCarPosition );
try {
if ( DebugConfig.isDebug() ) {
@@ -691,7 +699,12 @@ public class AMapViewWrapper implements IMogoMapView,
}
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
MapStyleController.getInstance().onLocationChanged( location, this );
if ( checkAMapView() && mMapLoaded ) {
// 避免设置之后被其他初始化给重置为其他模式
UiThreadHandler.postDelayed( () -> {
MapStyleController.getInstance().onLocationChanged( location, this );
}, 5_000L );
}
}
@Override
@@ -706,6 +719,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onMapLoaded() {
Logger.i( TAG, "autoop--onMapLoaded: " );
MogoMapListenerHandler.getInstance().onMapLoaded();
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
if ( cameraPosition != null ) {
Trace.beginSection( "timer.onCameraChangeFinish" );
@@ -715,9 +729,6 @@ public class AMapViewWrapper implements IMogoMapView,
cameraPosition.getBearing() );
Trace.endSection();
}
getMap().getUIController().setAnchorRate( 0.01f );
getMap().getUIController().setAnchorScale( 1.2f, 2.7f );
}
@Override
@@ -776,6 +787,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onChangeMapStyle( int i ) {
EnumMapUI last = mCurrentUI;
if ( i == MapAutoApi.MAP_STYLE_DAY
|| i == MapAutoApi.MAP_STYLE_DAY_NAV ) {
mCurrentUI = EnumMapUI.Type_Light;
@@ -789,6 +803,14 @@ public class AMapViewWrapper implements IMogoMapView,
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
mCurrentUI = EnumMapUI.CarUp_3D;
}
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
if ( last == EnumMapUI.Type_VR && mCurrentUI != last ) {
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
return;
}
}
if ( mCurrentUI != null ) {
UiThreadHandler.post( () -> {
try {
@@ -817,7 +839,11 @@ public class AMapViewWrapper implements IMogoMapView,
} else {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
changeZoom( 16 );
changeMapMode( EnumMapUI.Type_Night );
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
} else {
changeMapMode( EnumMapUI.Type_Night );
}
Logger.d( TAG, "自动切换为2D模式" );
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.map.IMogoMapApiBuilder;
import com.mogo.map.IMogoMapView;
@@ -92,14 +93,20 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public IMogoMapView getMapView( Context context ) {
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( true )
.setDebugMode( DebugConfig.isDebug() )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 16 )
.setPointToCenter( 0.734375f, 0.5f )
.setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() );
MapAutoView mapAutoView = new MapAutoView( context );
IMogoMapView mapView = new AMapViewWrapper( mapAutoView );
MapAutoView mapAutoView = new MapAutoView(context);
Logger.w(TAG, "mapAutoView==" + mapAutoView);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
return mapView;
}

View File

@@ -7,7 +7,7 @@ class HttpConstants {
companion object {
const val DEV_BASE_URL_OWNER = "http://dzt-test.zhidaozhixing.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaozhixing.com/"
const val SHOW_BASE_URL_OWNER = "http://dzt-show.zhidaozhixing.com/"
fun getBaseUrl(): String {

View File

@@ -131,7 +131,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
mLeftShadowFrame.setVisibility(View.GONE);
mApps.setVisibility(View.GONE);
}else{
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_out_vr_mode );
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_id_entrance_fragment_container_marginLeft );
mLeftShadowFrame.setVisibility(View.VISIBLE);
mApps.setVisibility(View.VISIBLE);
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >444px</dimen>
</resources>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >444px</dimen>
</resources>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
</resources>

View File

@@ -12,7 +12,6 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
@@ -34,6 +33,7 @@ dependencies {
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.callchatprovider
api "com.mogo.libs:hook:1.0"
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi

View File

@@ -73,11 +73,27 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL
runnable.run();
}
public void bezierAnimationStart(){
runnable = new Runnable() {
@Override
public void run() {
try {
Log.d("点赞--", "");
bezierAnimation(resource);
handler.postDelayed(this, 500);
} catch (Exception e) {
e.printStackTrace();
}
}
};
runnable.run();
}
private void bezierAnimation(int resource) {
final ImageView imageView = new ImageView(context);
imageView.setBackgroundResource(animation_drawable[resource]);
RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(ALIGN_BOTTOM);
// params.addRule(ALIGN_BOTTOM);
params.addRule(CENTER_HORIZONTAL);
imageView.setLayoutParams(params);
addView(imageView);

View File

@@ -50,10 +50,10 @@ public class MapMarkerAdapter {
* @return MarkerView
*/
public static IMarkerView getMarkerInfoWindowView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
if ( markerShowEntity.isChecked() ) {
return new MapMarkerInfoView( context, markerShowEntity, options );
} else {
return new MapMarkerView( context, markerShowEntity, options );
}
// if ( markerShowEntity.isChecked() ) {
// return new MapMarkerInfoView( context, markerShowEntity, options );
// } else {
// }
return new MapMarkerView( context, markerShowEntity, options );
}
}

View File

@@ -52,7 +52,11 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
public MapMarkerInfoView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
super( context );
mOptions = options;
updateView( markerShowEntity );
try {
updateView( markerShowEntity );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
@@ -60,7 +64,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout_info, this );
ivUserHead = findViewById( R.id.ivUserHead );
// ivIcon = findViewById( R.id.ivIcon );
ivIcon = findViewById(R.id.ivIcon);
ivIcon = findViewById( R.id.ivIcon );
clMarkerContent = findViewById( R.id.clMarkerContent );
ivReverseTriangle = findViewById( R.id.ivReverseTriangle );
ivCar = findViewById( R.id.ivCar );
@@ -69,84 +73,80 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
try {
Object bindObj = markerShowEntity.getBindObj();
Object bindObj = markerShowEntity.getBindObj();
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr );
} else {
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
}
clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info );
ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow );
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_CARS_CHATTING:
case ModuleNames.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility( View.VISIBLE );
ivIcon.setVisibility( View.INVISIBLE );
loadImageWithMarker( markerShowEntity );
ivCar.setImageResource( R.drawable.icon_map_marker_car_gray );
//ivCar.setRotation(new Random().nextInt(360));
ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() );
break;
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
if (poiWrapper != null) {
// 加载图片
loadPoiTypeIcon(poiWrapper.getIconInfoUrl(),poiWrapper.getIconInfoRes());
}else{
Logger.e(TAG, "未能根据poiType获取对应poi信息无法渲染info marker====" + poiType);
}
}
break;
case ModuleNames.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerShareMusic ) {
// 2 为书籍听书3 为新闻,1 为qq音乐,int
switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) {
case 1:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
case 2:
ivIcon.setImageResource( R.drawable.icon_map_marker_book );
break;
case 3:
ivIcon.setImageResource( R.drawable.icon_map_marker_news );
break;
default:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
}
}
break;
default:
break;
}
if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) {
String content;
if ( markerShowEntity.getTextContent().length() > 8 ) {
content = markerShowEntity.getTextContent().substring( 0, 7 ) + "...";
} else {
content = markerShowEntity.getTextContent();
}
tvMarkerContent.setText( content );
}
} catch ( Exception e ) {
e.printStackTrace();
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr );
} else {
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
}
clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info );
ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow );
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_CARS_CHATTING:
case ModuleNames.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility( View.VISIBLE );
ivIcon.setVisibility( View.INVISIBLE );
loadImageWithMarker( markerShowEntity );
ivCar.setImageResource( R.drawable.icon_map_marker_car_gray );
//ivCar.setRotation(new Random().nextInt(360));
ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() );
break;
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染info marker====" + poiType );
}
}
break;
case ModuleNames.CARD_TYPE_SHARE_MUSIC:
ivUserHead.setVisibility( View.INVISIBLE );
ivIcon.setVisibility( View.VISIBLE );
if ( bindObj instanceof MarkerShareMusic ) {
// 2 为书籍听书3 为新闻,1 为qq音乐,int
switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) {
case 1:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
case 2:
ivIcon.setImageResource( R.drawable.icon_map_marker_book );
break;
case 3:
ivIcon.setImageResource( R.drawable.icon_map_marker_news );
break;
default:
ivIcon.setImageResource( R.drawable.icon_map_marker_misic );
break;
}
}
break;
default:
break;
}
if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) {
String content;
if ( markerShowEntity.getTextContent().length() > 8 ) {
content = markerShowEntity.getTextContent().substring( 0, 7 ) + "...";
} else {
content = markerShowEntity.getTextContent();
}
tvMarkerContent.setText( content );
}
}
}

View File

@@ -24,11 +24,11 @@ import com.mogo.utils.logger.Logger;
* desc : 地图Marker图标
* version: 1.0
*/
public class
MapMarkerView extends MapMarkerBaseView {
public class MapMarkerView extends MapMarkerBaseView {
private String TAG = "MapMarkerView";
private FrameLayout clMarkerTopView;
private MarkerShowEntity mMarkerShowEntity;
public MapMarkerView( Context context ) {
super( context );
@@ -45,7 +45,12 @@ MapMarkerView extends MapMarkerBaseView {
public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
super( context );
mOptions = options;
updateView( markerShowEntity );
mMarkerShowEntity = markerShowEntity;
try {
updateView( markerShowEntity );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
@@ -55,37 +60,35 @@ MapMarkerView extends MapMarkerBaseView {
} else {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
}
ivIcon = findViewById( R.id.ivIcon );
clMarkerTopView = findViewById( R.id.clMarkerTopView );
ivIcon = findViewById( R.id.ivIcon );
ivCar = findViewById( R.id.ivCar );
}
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
try {
Object bindObj = markerShowEntity.getBindObj();
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType );
}
Object bindObj = markerShowEntity.getBindObj();
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
case ModuleNames.CARD_TYPE_NOVELTY:
if ( mMarkerShowEntity != null && mMarkerShowEntity.isChecked() ) {
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg_checked );
}
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType );
}
break;
default:
break;
}
} catch ( Exception e ) {
e.printStackTrace();
}
break;
default:
break;
}
}

View File

@@ -35,6 +35,9 @@ public class V2XEventShowEntity implements Serializable {
// 违章停车
private MarkerExploreWay v2XIllegalPark;
// 基于目的地道路推荐详情
private V2XRecommendRouteEntity v2XRecommendRouteEntity;
public int getViewType() {
return viewType;
}
@@ -83,6 +86,14 @@ public class V2XEventShowEntity implements Serializable {
this.v2XIllegalPark = v2XIllegalPark;
}
public V2XRecommendRouteEntity getV2XRecommendRouteEntity() {
return v2XRecommendRouteEntity;
}
public void setV2XRecommendRouteEntity(V2XRecommendRouteEntity v2XRecommendRouteEntity) {
this.v2XRecommendRouteEntity = v2XRecommendRouteEntity;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -97,14 +108,15 @@ public class V2XEventShowEntity implements Serializable {
Objects.equals(v2XLiveCarInfoRes, that.v2XLiveCarInfoRes) &&
Objects.equals(v2XLiveCarList, that.v2XLiveCarList) &&
Objects.equals(v2XPushMessageEntity, that.v2XPushMessageEntity) &&
Objects.equals(v2XIllegalPark, that.v2XIllegalPark);
Objects.equals(v2XIllegalPark, that.v2XIllegalPark) &&
Objects.equals(v2XRecommendRouteEntity, that.v2XRecommendRouteEntity);
}
@Override
public int hashCode() {
return Objects.hash(viewType, v2XRoadEventEntity,
v2XLiveCarInfoRes, v2XLiveCarList,
v2XPushMessageEntity, v2XIllegalPark);
v2XPushMessageEntity, v2XIllegalPark, v2XRecommendRouteEntity);
}
@@ -119,6 +131,7 @@ public class V2XEventShowEntity implements Serializable {
V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP,
V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE,
})
@Target({
ElementType.PARAMETER,

View File

@@ -141,8 +141,10 @@ public class V2XMessageEntity<T> implements Serializable {
int ALERT_EVENT_UGC_WARNING = 1_009;
// 呼叫、请求直播事件
int ALERT_VOICE_CALL_FOR_LIVECAR_SHOW = 1_010;
// 基于目的地预判的道路事件
int ALERT_PREJECTED_ROAD_WARNING = 1_011;
// 基于预判目的地道路事件的路线推荐
int ALERT_RECOMMEND_ROUTE = 1_011;
// 基于预判目的地违章高发停车场推荐
int ALERT_RECOMMEND_PARKING = 1_012;
// 推送VR消息展示
int ALERT_PUSH_VR_SHOW = 2_000;
// 自车求助
@@ -164,7 +166,8 @@ public class V2XMessageEntity<T> implements Serializable {
V2XTypeEnum.ALERT_EVENT_UGC_WARNING,
V2XTypeEnum.ALERT_CAR_FOR_HELP,
V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW,
V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING,
V2XTypeEnum.ALERT_RECOMMEND_ROUTE,
V2XTypeEnum.ALERT_RECOMMEND_PARKING,
V2XTypeEnum.ALERT_PUSH_VR_SHOW,
V2XTypeEnum.ALERT_OBU_EVENT,
})

View File

@@ -1,9 +0,0 @@
package com.mogo.module.common.entity;
/**
* created by wujifei on 2020/12/24 15:33
* describe:基于目的地预判的道路事件
*/
public class V2XPrejectedRoadEventEntity {
}

View File

@@ -0,0 +1,39 @@
package com.mogo.module.common.entity;
import java.util.List;
/**
* created by wujifei on 2020/12/31 18:45
* describe:基于目的地预判的道路事件
*/
public class V2XRecommendRouteEntity {
private List<Double> toPoint; //目的地坐标
private String formatAddress; //目的地地址
private String tts; //播报内容
public V2XRecommendRouteEntity(List<Double> toPoint, String formatAddress) {
this.toPoint = toPoint;
this.formatAddress = formatAddress;
}
public List<Double> getToPoint() {
return toPoint;
}
public void setToPoint(List<Double> toPoint) {
this.toPoint = toPoint;
}
public String getFormatAddress() {
return formatAddress;
}
public void setFormatAddress(String formatAddress) {
this.formatAddress = formatAddress;
}
public String getTts() {
tts = "主人,我发现前往" + formatAddress + "沿途有拥堵,推荐你导航最优路线,现在开启导航吗?";
return tts;
}
}

View File

@@ -270,6 +270,10 @@ public class MapCenterPointStrategy {
if ( controller == null ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Logger.e( TAG, "scene"+scene );
Map< Integer, Map< String, MapCenterPoint > > strategies = sCommonStrategies;
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#890">
<com.mogo.module.common.animation.BezierAnimationView
android:id="@+id/bezier_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#7810" />
</RelativeLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="#000000" />
<size
android:width="@dimen/module_media_pop_window_anim_img_size_new"
android:height="@dimen/module_media_pop_window_anim_img_size_new" />
</shape>

View File

@@ -7,45 +7,59 @@
<com.mogo.module.media.widget.CircleNumberProgress
android:id="@+id/window_circle_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:circleBackground="@color/modules_media_music_bg_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:circleBackground="@color/modules_media_music_bg_color"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- app:ringColor="@color/modules_media_music_circle_color"-->
app:layout_constraintTop_toTopOf="parent" />
<!-- app:ringColor="@color/modules_media_music_circle_color"-->
<!-- <com.mogo.module.media.widget.PercentageRingView-->
<!-- android:id="@+id/window_circle_bg"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent" />-->
<!-- <com.mogo.module.media.widget.PercentageRingView-->
<!-- android:id="@+id/window_circle_bg"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent" />-->
<com.mogo.module.media.widget.AnimCircleImageView
android:id="@+id/window_circle_img_new"
android:layout_width="@dimen/module_media_pop_window_anim_img_size_new"
android:layout_height="@dimen/module_media_pop_window_anim_img_size_new"
android:src="@drawable/module_media_default_music_img_new"
android:scaleType="fitCenter"
android:src="@drawable/module_media_default_music_img_new"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/window_play_pause_new"
android:layout_width="@dimen/module_media_pop_window_pause"
android:layout_height="@dimen/module_media_pop_window_pause"
android:background="@drawable/module_media_play_bg_selector"
android:src="@drawable/module_media_window_pop_play_new"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/window_obscuration"
android:layout_width="@dimen/module_media_pop_window_anim_img_size_new"
android:layout_height="@dimen/module_media_pop_window_anim_img_size_new"
android:layout_gravity="center_vertical|center_horizontal"
android:alpha="0.5"
android:background="@drawable/module_media_circle_bg" />
<ImageView
android:id="@+id/window_play_pause_new"
android:layout_width="@dimen/module_media_pop_window_pause"
android:layout_height="@dimen/module_media_pop_window_pause"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/module_media_play_bg_selector"
android:src="@drawable/module_media_window_pop_play_new" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -927,16 +927,26 @@ public class MogoServices implements IMogoMapListener,
return mLastCarLocation;
}
private boolean mLastStatusIsVr = false;
@Override
public void onMapModeChanged( EnumMapUI ui ) {
if ( ui == EnumMapUI.Type_VR ) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
if ( !mLastStatusIsVr ) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
AIAssist.getInstance( mContext ).speakTTSVoice( "你已进入鹰眼模式" );
mLastStatusIsVr = true;
}
} else {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
if ( mLastStatusIsVr ) {
mLastStatusIsVr = false;
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
MapCenterPointStrategy.resetByChangeMode();
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
AIAssist.getInstance( mContext ).speakTTSVoice( "你已离开鹰眼模式" );
}
}
}
}

View File

@@ -2,10 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.small.map">
<application>
<!--<application>
<service
android:name=".SmallMapService"
android:exported="false"
android:process=":smallMap"/>
</application>
/>
</application>-->
</manifest>

View File

@@ -0,0 +1,186 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.amap.api.col.n3;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.LayoutInflater.Factory;
import android.view.View;
import android.view.ViewStub;
import com.android.internal.policy.MyPhoneLayoutInflater;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.HashSet;
public final class le2 extends ContextThemeWrapper {
private Resources a = lg.a();
private Theme b;
private LayoutInflater c;
private ClassLoader d;
private int e;
private static final String[] f = new String[]{"android.widget", "android.webkit", "android.app"};
private le2.a g = new le2.a();
private Factory h = new Factory() {
public final View onCreateView(String var1, Context var2, AttributeSet var3) {
return le2.this.a(var1, var2, var3);
}
};
public le2(Context var1, int var2, ClassLoader var3) {
super(var1, var2);
this.d = var3;
this.b = lg.b();
this.e = var2;
super.onApplyThemeResource(this.b, this.e, true);
(new StringBuilder("classloader:")).append(this.d);
}
public final Resources getResources() {
return this.a != null ? this.a : super.getResources();
}
public final void a(int var1) {
if (var1 != this.e) {
this.e = var1;
super.onApplyThemeResource(this.b, this.e, true);
}
}
public final Theme getTheme() {
return this.b != null ? this.b : super.getTheme();
}
public final Object getSystemService(String var1) {
if ("layout_inflater".equals(var1)) {
if (this.c == null) {
// 这里构建一个自己对的布局填充器
// 与已经被修改的context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)
// 隔离从而保证高德地图SDK能正常初始化
LayoutInflater var2 = new MyPhoneLayoutInflater(getBaseContext());
this.c = var2.cloneInContext(this);
this.c.setFactory(this.h);
this.c = this.c.cloneInContext(this);
}
return this.c;
} else {
return super.getSystemService(var1);
}
}
private final View a(String var1, Context var2, AttributeSet var3) {
if (this.g.a.contains(var1)) {
return null;
} else {
Constructor var4;
if ((var4 = (Constructor) this.g.b.get(var1)) == null) {
Class var5 = null;
boolean var6 = false;
String var7 = "api.navi";
label71:
{
label70:
{
Throwable var10000;
label79:
{
boolean var10001;
try {
if (var1.contains(var7)) {
var5 = this.d.loadClass(var1);
} else {
String[] var17;
int var8 = (var17 = f).length;
int var9 = 0;
while (var9 < var8) {
String var10 = var17[var9];
try {
var5 = this.d.loadClass(var10 + "." + var1);
break;
} catch (Throwable var13) {
++var9;
}
}
}
if (var5 == null) {
break label71;
}
} catch (Throwable var15) {
var10000 = var15;
var10001 = false;
break label79;
}
if (var5 == ViewStub.class) {
break label71;
}
try {
if (var5.getClassLoader() != this.d) {
break label71;
}
break label70;
} catch (Throwable var14) {
var10000 = var14;
var10001 = false;
}
}
Throwable var18 = var10000;
(new StringBuilder("load view err:")).append(Log.getStackTraceString(var18));
break label71;
}
var6 = true;
}
if (!var6) {
this.g.a.add(var1);
return null;
}
try {
var4 = var5.getConstructor(Context.class, AttributeSet.class);
this.g.b.put(var1, var4);
} catch (Throwable var12) {
(new StringBuilder("create view err:")).append(Log.getStackTraceString(var12));
}
}
try {
View var16 = null;
if (var4 != null) {
var16 = (View) var4.newInstance(var2, var3);
}
return var16;
} catch (Throwable var11) {
(new StringBuilder("create view err:")).append(Log.getStackTraceString(var11));
return null;
}
}
}
public static class a {
public HashSet<String> a = new HashSet();
public HashMap<String, Constructor<?>> b = new HashMap();
public a() {
}
}
}

View File

@@ -0,0 +1,40 @@
package com.amap.api.col.n3;
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* 这里是为了解决 使用换肤框架后,高德地图初始化有问题加入的
* 问题原因是:
* skin 框架会替换 LayoutInflater 中的 setFactory2 从而导致高德 le 中的 setFactory 失效。
* 解决方案为:
* 直接通过内存地址替换整个 ArtMethod来将需要修改的高德SDK中的方法指向我们修改过后的方法。
*/
public class lg2 extends lg {
static le2 b;
public static View a(Context var0, int var1, ViewGroup var2) {
XmlResourceParser var9 = a().getXml(var1);
if (!a) {
return LayoutInflater.from(var0).inflate(var9, var2);
} else {
try {
if (b == null) {
b = new le2(var0, c == -1 ? 0 : c, lg.class.getClassLoader());
}
b.a(c == -1 ? 0 : c);
View var3 = LayoutInflater.from(b).inflate(var9, var2);
return var3;
} catch (Throwable var7) {
var7.printStackTrace();
np.c(var7, "ResourcesUtil", "selfInflate(Activity activity, int resource, ViewGroup root)");
} finally {
var9.close();
}
return null;
}
}
}

View File

@@ -0,0 +1,60 @@
package com.android.internal.policy;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
/**
* @author donghongyu
* @date 12/25/20 5:12 PM
*/
public class MyPhoneLayoutInflater extends LayoutInflater {
private static final String[] sClassPrefixList = {
"android.widget.",
"android.webkit.",
"android.app."
};
/**
* Instead of instantiating directly, you should retrieve an instance
* through {@link Context#getSystemService}
*
* @param context The Context in which in which to find resources and other
* application-specific things.
* @see Context#getSystemService
*/
public MyPhoneLayoutInflater(Context context) {
super(context);
}
protected MyPhoneLayoutInflater(LayoutInflater original, Context newContext) {
super(original, newContext);
}
/**
* Override onCreateView to instantiate names that correspond to the
* widgets known to the Widget factory. If we don't find a match,
* call through to our super class.
*/
@Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
for (String prefix : sClassPrefixList) {
try {
View view = createView(name, prefix, attrs);
if (view != null) {
return view;
}
} catch (ClassNotFoundException e) {
// In this case we want to let the base class take a crack
// at it.
}
}
return super.onCreateView(name, attrs);
}
public LayoutInflater cloneInContext(Context newContext) {
return new MyPhoneLayoutInflater(this, newContext);
}
}

View File

@@ -37,6 +37,7 @@ public class SmallMapDirectionView extends RelativeLayout {
private AMapNaviView mAMapNaviView;
private DirectionRotateAnimation mRotateAnimation;
private int lastAngle = 0;
private int zoomLevel = 17;
public SmallMapDirectionView(Context context) {
this(context, null);
@@ -133,19 +134,19 @@ public class SmallMapDirectionView extends RelativeLayout {
options.setNaviArrowVisible(false);
// 通过路线是否自动置灰,仅支持驾车导航
options.setAfterRouteAutoGray(false);
options.setZoom(((int) 9));
//options.setZoom(((int) 9));
//options.setPointToCenter(0.7D, 0.5D);
// 2D模式
options.setTilt(0);
// 黑夜模式
// options.setNaviNight(true);
//options.setNaviNight(true);
// 自定义地图样式
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
aMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() {
@@ -175,7 +176,7 @@ public class SmallMapDirectionView extends RelativeLayout {
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
});
@@ -218,7 +219,7 @@ public class SmallMapDirectionView extends RelativeLayout {
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
}

View File

@@ -1,22 +1,30 @@
package com.mogo.module.small.map;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.amap.api.col.n3.lg;
import com.amap.api.col.n3.lg2;
import com.mogo.hook.HookManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.map.IMogoSmallMapProvider;
import com.mogo.service.module.ModuleType;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
import java.lang.reflect.Method;
/**
* @author donghongyu
@@ -26,9 +34,11 @@ import com.mogo.service.statusmanager.StatusDescriptor;
public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusChangedListener {
private final String TAG = "SmallVisionProvider";
private Intent mSmallMapServiceIntent;
private Context mContext;
private WindowManagerView mWindowManagerView;
private SmallMapDirectionView mSmallMapDirectionView;
@Override
public Fragment createFragment(Context context, Bundle data) {
return null;
@@ -55,6 +65,15 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
Log.d(TAG, "小地图模块初始化……");
mContext = context;
try {
// 替换高德地图的方法,解决因为加入换肤框架导致地图初始化失败
Method srcMethod = lg.class.getDeclaredMethod("a", Context.class, int.class, ViewGroup.class);
Method destMethod = lg2.class.getDeclaredMethod("a", Context.class, int.class, ViewGroup.class);
HookManager.get().hookMethod(srcMethod, destMethod);
} catch (Exception e) {
e.printStackTrace();
}
MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
@@ -76,22 +95,22 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
public void onDestroy() {
Log.d(TAG, "小地图模块销毁……");
hidePanel();
// 释放组件内存
mSmallMapDirectionView = null;
mWindowManagerView = null;
}
@Override
public void showPanel() {
Log.d(TAG, "小地图模块触发展示……");
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
mSmallMapServiceIntent = new Intent(mContext, SmallMapService.class);
mContext.startService(mSmallMapServiceIntent);
}
addSmallMapView();
}
@Override
public void hidePanel() {
Log.d(TAG, "小地图模块触发隐藏……");
if (mSmallMapServiceIntent != null) {
AbsMogoApplication.getApp().stopService(mSmallMapServiceIntent);
if (mWindowManagerView != null && mWindowManagerView.isShowing()) {
mWindowManagerView.dismiss();
}
}
@@ -122,4 +141,33 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
}
}
}
/**
* 添加小地图View
*/
private void addSmallMapView() {
Logger.d(TAG, "addSmallMapView");
// 初始化小地图控件
if (mSmallMapDirectionView == null) {
mSmallMapDirectionView = new SmallMapDirectionView(mContext);
}
if (mWindowManagerView == null) {
mWindowManagerView = new WindowManagerView.Builder(mContext)
.contentView(mSmallMapDirectionView)
.size(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT
)
.position(
mContext.getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_x),
mContext.getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_y)
)
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();
}
mWindowManagerView.show();
}
}

View File

@@ -60,6 +60,9 @@ dependencies {
implementation rootProject.ext.dependencies.androidxviewpager2
implementation rootProject.ext.dependencies.localbroadcastmanager
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.videoarmv7
implementation rootProject.ext.dependencies.videoarm64
implementation rootProject.ext.dependencies.videojava

View File

@@ -133,4 +133,5 @@ public class V2XConst {
* 绿波车速marker
*/
public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER";
}

View File

@@ -13,6 +13,7 @@ import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
import com.mogo.module.v2x.adapter.holder.V2XOtherSeekHelpVH;
import com.mogo.module.v2x.adapter.holder.V2XPushEventVH;
import com.mogo.module.v2x.adapter.holder.V2XRecommendRouteVH;
import com.mogo.module.v2x.adapter.holder.V2XRoadEventVH;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
@@ -70,6 +71,10 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
holder = new V2XEventUgcVH(parent, mV2XWindow);
break;
//线路推荐
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
holder = new V2XRecommendRouteVH(parent, mV2XWindow);
break;
}
return holder;
}
@@ -97,6 +102,9 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
if (holder instanceof V2XOtherSeekHelpVH) {
((V2XOtherSeekHelpVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XRecommendRouteVH) {
((V2XRecommendRouteVH) holder).initView(itemList.get(position));
}
}
@Override

View File

@@ -0,0 +1,92 @@
package com.mogo.module.v2x.adapter.holder
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import com.mogo.commons.voice.AIAssist
import com.mogo.commons.voice.VoicePreemptType
import com.mogo.module.common.entity.MarkerExploreWay
import com.mogo.module.common.entity.MarkerLocation
import com.mogo.module.common.entity.V2XEventShowEntity
import com.mogo.module.v2x.R
import com.mogo.module.v2x.scenario.view.IV2XWindow
import com.mogo.module.v2x.utils.V2XUtils
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
import com.mogo.module.v2x.voice.V2XVoiceConstants
import com.mogo.module.v2x.voice.V2XVoiceManager.registerUnWakeVoice
import com.mogo.module.v2x.voice.V2XVoiceManager.unRegisterUnWakeVoice
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/**
* created by wujifei on 2020/12/31 16:10
* describe:
*/
class V2XRecommendRouteVH(viewGroup: ViewGroup, v2XWindow: IV2XWindow<*>) : V2XBaseViewHolder<V2XEventShowEntity>(
LayoutInflater.from(viewGroup.context).inflate(R.layout.item_v2x_recommend_route, viewGroup, false), v2XWindow), V2XVoiceCallbackListener {
private var mTvAddress: TextView? = null
private var mIvToNav: ImageView? = null
private var mIvClose: ImageView? = null
private var mNoveltyInfo: MarkerExploreWay? = null
private val mainScope = MainScope()
init {
mTvAddress = itemView.findViewById<TextView>(R.id.tvAddress)
mIvToNav = itemView.findViewById<ImageView>(R.id.ivToNav)
mIvClose = itemView.findViewById<ImageView>(R.id.ivClose)
mIvToNav?.setOnClickListener { triggerStartNavi(mNoveltyInfo) }
mIvClose?.setOnClickListener { delayedCloseWindow() }
itemView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
override fun onViewAttachedToWindow(view: View) {
registerUnwakeNavi()
mainScope.launch {
delay(1000 * 20)
delayedCloseWindow()
}
}
override fun onViewDetachedFromWindow(view: View) {
unRegisterUnwakeNavi()
AIAssist.getInstance(V2XUtils.getApp()).breakOffSpeak()
mainScope.cancel()
}
})
}
override fun initView(viewData: V2XEventShowEntity?) {
viewData?.let {
val markerLocation = MarkerLocation()
markerLocation.lon = it.getV2XRecommendRouteEntity().toPoint.get(0)
markerLocation.lat = it.getV2XRecommendRouteEntity().toPoint.get(1)
mNoveltyInfo = MarkerExploreWay()
mNoveltyInfo?.setLocation(markerLocation)
mTvAddress!!.text = "前往 ${it.getV2XRecommendRouteEntity().formatAddress}"
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(it.getV2XRecommendRouteEntity().tts, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null)
}
}
override fun onCallback(command: String?, intent: Intent?) {
when (command) {
V2XVoiceConstants.V2X_CONFIRM_ACTION -> triggerStartNavi(mNoveltyInfo)
V2XVoiceConstants.V2X_CANCLE_ACTION -> delayedCloseWindow()
}
}
private fun registerUnwakeNavi() {
registerUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION, this)
registerUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION, this)
}
private fun unRegisterUnwakeNavi() {
unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CONFIRM_ACTION)
unRegisterUnWakeVoice(V2XVoiceConstants.V2X_CANCLE_ACTION)
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.v2x.adapter.holder;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
@@ -10,11 +11,13 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.animation.BezierAnimationView;
import com.mogo.module.common.entity.MarkerExploreWay;
@@ -23,6 +26,7 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
@@ -81,7 +85,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
private HeartLikeView ivEventZan;
private ViewGroup mViewGroup;
private WindowManagerView mWindowManagerView;
// 上传事件的用户信息
private MarkerUserInfo mUserInfo;
@@ -312,7 +316,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
e.printStackTrace();
}
}
/*
* 展示事件的图片/视频资源
* */
@@ -364,6 +368,53 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
}
private void bezierAnimation(int[] loc) {
if (mWindowManagerView == null) {
Log.d(TAG, "bezierAnimation:null");
mWindowManagerView = new WindowManagerView.Builder(mContext.getApplicationContext())
.contentView(R.layout.module_common_bezier_layout)
.size(WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT)
.position(loc[0], loc[1])
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();
}
try {
if (mWindowManagerView.isShowing()) {
return;
}
mWindowManagerView.show();
} catch (Exception e) {
e.printStackTrace();
}
BezierAnimationView bezierAnimationView = mWindowManagerView.findViewById(R.id.bezier_view);
bezierAnimationView.bezierAnimationStart();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// mWindowManagerView.dismiss();
}
}, 2000);
}
public int[] getLocation(View v) {
int[] loc = new int[4];
int[] location = new int[2];
v.getLocationOnScreen(location);
loc[0] = location[0];
loc[1] = location[1];
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
v.measure(w, h);
loc[2] = v.getMeasuredWidth();
loc[3] = v.getMeasuredHeight();
//base = computeWH();
return loc;
}
/**
* 为了给车聊聊更多的信息需要重新查询一次
*

View File

@@ -249,7 +249,7 @@ public class V2XAlarmServer {
LocationUtils.geoCodeSearch(location, new IMogoGeoSearchListener() {
@Override
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
//Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
String keyword = "停车场";
boolean isHighWay = false;
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null ||

View File

@@ -30,20 +30,18 @@ public class V2XRoadDataRes extends BaseData {
}
public static class ResultDTO {
private String formatAddress;
private List<Double> fromPoint;
private List<Double> topPoint;
private List<PoiDataDTO> poiData;
private List<IllegalParkingDataDTO> illegalParkingData;
@Override
public String toString() {
return "ResultDTO{" +
"fromPoint=" + fromPoint +
", topPoint=" + topPoint +
", poiData=" + poiData +
", illegalParkingData=" + illegalParkingData +
'}';
public String getFormatAddress() {
return formatAddress;
}
public void setFormatAddress(String formatAddress) {
this.formatAddress = formatAddress;
}
public List<Double> getFromPoint() {

View File

@@ -12,17 +12,21 @@ import com.mogo.commons.data.BaseData;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeResult;
import com.mogo.map.search.geo.MogoRegeocodeResult;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPrejectedRoadEventEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRecommendRouteEntity;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.network.RefreshBody;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes;
import com.mogo.module.v2x.entity.net.V2XLiveCarBroadcastReq;
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
@@ -32,7 +36,7 @@ import com.mogo.module.v2x.entity.net.V2XRoadDataRes;
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.network.IMogoNetwork;
@@ -42,14 +46,13 @@ import com.mogo.utils.network.utils.GsonUtil;
import java.util.Map;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
/**
@@ -684,32 +687,85 @@ public class V2XRefreshModel {
@Override
public void onNext(V2XRoadDataRes v2XRoadDataRes) {
super.onNext(v2XRoadDataRes);
Logger.d("queryRoadData:onSuccess", v2XRoadDataRes.toString());
if (v2XRoadDataRes == null || v2XRoadDataRes.getResult() == null) {
if (v2XRoadDataRes == null
|| v2XRoadDataRes.getResult() == null
|| v2XRoadDataRes.getResult().getTopPoint() == null
|| v2XRoadDataRes.getResult().getTopPoint().isEmpty()) {
return;
}
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
V2XPrejectedRoadEventEntity v2XPrejectedRoadEventEntity = new V2XPrejectedRoadEventEntity();
V2XMessageEntity<V2XPrejectedRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2XPrejectedRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
MogoLocation mogoLocation = new MogoLocation();
mogoLocation.setLongitude(v2XRoadDataRes.getResult().getTopPoint().get(0));
mogoLocation.setLatitude(v2XRoadDataRes.getResult().getTopPoint().get(1));
LocationUtils.geoCodeSearch(mogoLocation, new IMogoGeoSearchListener() {
@Override
public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null) {
return;
}
try {
String province = regeocodeResult.getRegeocodeAddress().getProvince();
String city = regeocodeResult.getRegeocodeAddress().getCity();
v2XRoadDataRes.getResult().setFormatAddress(regeocodeResult.getRegeocodeAddress().getFormatAddress().replaceAll(province, "").replaceAll(city, ""));
sendBroadcast(v2XRoadDataRes);
} catch (Exception e) {
e.printStackTrace();
}
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
Logger.d("queryRoadData:onError", e.toString());
}
});
}
});
}
}
private void sendBroadcast(V2XRoadDataRes v2XRoadDataRes) {
boolean isSendRecommendRoute = false;
if (v2XRoadDataRes.getResult().getPoiData() != null && v2XRoadDataRes.getResult().getPoiData().size() > 0) {
for (V2XRoadDataRes.ResultDTO.PoiDataDTO poiDataDTO : v2XRoadDataRes.getResult().getPoiData()) {
if (!V2XPoiTypeEnum.FOURS_LIVING.equals(poiDataDTO.getPoiType())) {
isSendRecommendRoute = true;
break;
}
}
}
if (isSendRecommendRoute) {
V2XMessageEntity<V2XRecommendRouteEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE);
// 设置数据
v2xMessageEntity.setContent(new V2XRecommendRouteEntity(v2XRoadDataRes.getResult().getTopPoint(), v2XRoadDataRes.getResult().getFormatAddress()));
// 控制展示状态
v2xMessageEntity.setShowState(true);
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
}
if (!isSendRecommendRoute && v2XRoadDataRes.getResult().getIllegalParkingData() != null && v2XRoadDataRes.getResult().getIllegalParkingData().size() > 0) {
try {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = new V2XMessageEntity<>();
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING);
// 设置数据
V2XRoadDataRes.ResultDTO.IllegalParkingDataDTO parkingDataDTO = v2XRoadDataRes.getResult().getIllegalParkingData().get(0);
V2XPushMessageEntity pushMessageEntity = new V2XPushMessageEntity();
pushMessageEntity.setAddress(parkingDataDTO.getAddr());
pushMessageEntity.setAlarmContent("停车场推荐");
pushMessageEntity.setLat(parkingDataDTO.getLat());
pushMessageEntity.setLon(parkingDataDTO.getLon());
String tts = "主人,我发现" + v2XRoadDataRes.getResult().getFormatAddress() + "停车容易违章,推荐你导航到附近停车场,开始导航吗?";
AIAssist.getInstance(getContext()).speakTTSVoice(tts);
pushMessageEntity.setExpireTime(20000);
// 控制展示状态
v2XMessageEntity.setContent(pushMessageEntity);
v2XMessageEntity.setShowState(true);
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.v2x.scenario.impl;
import android.content.Intent;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -9,7 +10,7 @@ import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.IV2XScenarioManager;
import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationScenario;
import com.mogo.module.v2x.scenario.scene.destination.V2XPrejectedRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.destination.V2XRecommendRouteScenario;
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
import com.mogo.module.v2x.scenario.scene.help.V2XCarForHelpScenario;
import com.mogo.module.v2x.scenario.scene.livecar.V2XPushLiveCarScenario;
@@ -24,6 +25,7 @@ import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_PARKING;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
@@ -73,7 +75,8 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = new V2XSeekHelpScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING :
case ALERT_RECOMMEND_PARKING :
mV2XScenario = new V2XFatigueDrivingScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
@@ -92,13 +95,13 @@ public class V2XScenarioManager implements IV2XScenarioManager {
mV2XScenario = new V2XIllegalParkScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING:
mV2XScenario = new V2XEventUgcScenario();
mV2XScenario = V2XServiceManager.getMoGoStatusManager().isVrMode() ? null : new V2XEventUgcScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
mV2XScenario = new V2XVoiceCallLiveScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PREJECTED_ROAD_WARNING:
mV2XScenario = new V2XPrejectedRoadEventScenario();
case V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE:
mV2XScenario = new V2XRecommendRouteScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = new V2XPushVREventScenario();

View File

@@ -1,64 +0,0 @@
package com.mogo.module.v2x.scenario.scene.destination
import com.mogo.module.common.entity.V2XMessageEntity
import com.mogo.module.common.entity.V2XPrejectedRoadEventEntity
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario
/**
* created by wujifei on 2020/12/25 14:15
* describe:基于目的地预判的道路事件场景
*/
class V2XPrejectedRoadEventScenario : AbsV2XScenario<V2XPrejectedRoadEventEntity>() {
init {
v2XWindow = V2XPrejectedRoadEventWindow()
}
override fun init(v2XMessageEntity: V2XMessageEntity<V2XPrejectedRoadEventEntity>?) {
v2XMessageEntity?.content.let {
if (v2XMessageEntity!!.isShowState) {
if (!isSameScenario(v2XMessageEntity)) {
// 更新要提醒的数据
setV2XMessageEntity(v2XMessageEntity)
show()
} else {
// 更新要提醒的数据
setV2XMessageEntity(v2XMessageEntity)
}
} else {
close()
}
}
}
override fun show() {
TODO("Not yet implemented")
}
override fun showWindow() {
TODO("Not yet implemented")
}
override fun closeWindow() {
TODO("Not yet implemented")
}
override fun showButton() {
TODO("Not yet implemented")
}
override fun closeButton() {
TODO("Not yet implemented")
}
override fun drawPOI() {
TODO("Not yet implemented")
}
override fun clearPOI() {
TODO("Not yet implemented")
}
}

View File

@@ -0,0 +1,8 @@
package com.mogo.module.v2x.scenario.scene.destination;
/**
* 基于目的地违章高发情况的停车推荐
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48958095
*/
public class V2XRecommendParkingLotScenario {
}

View File

@@ -0,0 +1,76 @@
package com.mogo.module.v2x.scenario.scene.destination
import android.view.ViewGroup
import com.mogo.module.common.entity.V2XMessageEntity
import com.mogo.module.common.entity.V2XRecommendRouteEntity
import com.mogo.module.v2x.R
import com.mogo.module.v2x.V2XServiceManager
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario
import com.mogo.module.v2x.utils.V2XUtils
/**
* created by wujifei on 2020/12/29 17:57
* describe:基于目的地预判的道路事件提醒、路线推荐
*/
class V2XRecommendRouteScenario : AbsV2XScenario<V2XRecommendRouteEntity>() {
init {
v2XWindow = V2XRecommendRouteWindow()
}
override fun init(v2XMessageEntity: V2XMessageEntity<V2XRecommendRouteEntity>?) {
v2XMessageEntity?.content?.let {
if (v2XMessageEntity!!.isShowState) {
if (!isSameScenario(v2XMessageEntity)) {
setV2XMessageEntity(v2XMessageEntity)
show()
} else {
setV2XMessageEntity(v2XMessageEntity)
}
} else {
close()
}
}
}
override fun show() {
if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume) {
showWindow()
}
}
override fun showWindow() {
v2XWindow?.let {
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
V2XUtils.getApp().resources.getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground).toInt())
V2XServiceManager.getMogoTopViewManager().addView(it.view, layoutParams)
it.show(v2XMessageEntity.content)
}
}
override fun closeWindow() {
v2XWindow?.let {
it.close()
}
}
override fun showButton() {
TODO("Not yet implemented")
}
override fun closeButton() {
TODO("Not yet implemented")
}
override fun drawPOI() {
TODO("Not yet implemented")
}
override fun clearPOI() {
TODO("Not yet implemented")
}
}

View File

@@ -4,34 +4,33 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView
import com.mogo.module.common.entity.V2XEventShowEntity
import com.mogo.module.common.entity.V2XRoadEventEntity
import com.mogo.module.common.entity.V2XMessageEntity
import com.mogo.module.common.entity.V2XRecommendRouteEntity
import com.mogo.module.v2x.R
import com.mogo.module.v2x.V2XServiceManager
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter
import com.mogo.module.v2x.listener.V2XWindowStatusListener
import com.mogo.module.v2x.scenario.scene.V2XBasWindow
import com.mogo.module.v2x.scenario.view.IV2XWindow
import java.util.*
/**
* created by wujifei on 2020/12/25 11:45
* describe:基于目的地预判的道路事件场景弹窗
*/
class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
class V2XRecommendRouteWindow @JvmOverloads constructor(
context: Context = V2XServiceManager.getContext(),
attrs: AttributeSet? = null,
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRoadEventEntity?> {
private var rvPrejectedRoadEventList: RecyclerView? = null
private var btnCloseWindow: ImageView? = null
defStyleAttr: Int = 0) : V2XBasWindow(context, attrs, defStyleAttr), IV2XWindow<V2XRecommendRouteEntity?> {
private var rvRoadEventList: RecyclerView? = null
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
// 列表展示
private val mItemList: List<V2XEventShowEntity> = ArrayList()
private var mV2XRoadEventAdapter: V2XRoadEventAdapter? = null
private val mItemList = mutableListOf<V2XEventShowEntity>()
init {
initView(context)
@@ -39,17 +38,15 @@ class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
private fun initView(context: Context) {
// 填充布局
LayoutInflater.from(context).inflate(R.layout.window_prejected_road_event_detail, this)
rvPrejectedRoadEventList = findViewById<View>(R.id.rvPrejectedRoadEventList) as RecyclerView
btnCloseWindow = findViewById<View>(R.id.btnCloseWindow) as ImageView
btnCloseWindow!!.setOnClickListener { close() }
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this)
rvRoadEventList = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = V2XRoadEventAdapter(mItemList, this)
rvPrejectedRoadEventList!!.adapter = mV2XRoadEventAdapter
rvRoadEventList?.setAdapter(mV2XRoadEventAdapter)
// 设置切换样式
PagerSnapHelper().attachToRecyclerView(rvPrejectedRoadEventList)
PagerSnapHelper().attachToRecyclerView(rvRoadEventList)
// 配置列表朝向
val layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
rvPrejectedRoadEventList!!.layoutManager = layoutManager
rvRoadEventList?.setLayoutManager(layoutManager)
}
@@ -62,10 +59,20 @@ class V2XPrejectedRoadEventWindow @JvmOverloads constructor(
return this
}
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {}
override fun setWindowStatusListener(listener: V2XWindowStatusListener) {
}
override fun show(entity: V2XRoadEventEntity?) {
TODO("Not yet implemented")
override fun show(entity: V2XRecommendRouteEntity?) {
entity.let {
// 清空数据
mItemList.clear()
val v2XEventShowEntity = V2XEventShowEntity()
v2XEventShowEntity.v2XRecommendRouteEntity = entity
v2XEventShowEntity.viewType = V2XMessageEntity.V2XTypeEnum.ALERT_RECOMMEND_ROUTE
mItemList.add(v2XEventShowEntity)
// 刷新列表
mV2XRoadEventAdapter?.notifyDataSetChanged()
}
}
}

View File

@@ -25,7 +25,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/5/15 5:37 PM
* desc : 疲劳驾驶场景
* desc : 疲劳驾驶/目的地停车场推荐场景
* 目的地停车场他推荐:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48958095
* version: 1.0
*/
public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEntity> implements IMogoTopViewStatusListener {

View File

@@ -57,7 +57,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerCallUserInfo;
private Button mBtnTriggerEventUgc;
private Button mBtnTriggerTrafficSearch;
private Button mBtnTriggerPrejectedRoadEvent;
private Button mBtnTriggerRecommendRouteEvent;
private Button nBtnTriggerVR;
private Button btnTriggerRearVIPCarTip,
@@ -118,7 +118,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
mBtnTriggerPrejectedRoadEvent = findViewById(R.id.btnTriggerPrejectedRoadEvent);
mBtnTriggerRecommendRouteEvent = findViewById(R.id.btnTriggerRecommendRouteEvent);
nBtnTriggerVR = findViewById(R.id.btnTriggerVR);
switch (showType) {
@@ -279,8 +279,8 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerTrafficSearch.setOnClickListener(v -> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
mBtnTriggerPrejectedRoadEvent.setOnClickListener(view -> {
V2XServiceManager.getV2XRefreshModel().queryRoadData("XTCAA83540301871");
mBtnTriggerRecommendRouteEvent.setOnClickListener(view -> {
V2XServiceManager.getV2XRefreshModel().queryRoadData("ZD802C1938L10797");
});
/*

View File

@@ -283,6 +283,13 @@ public class V2XVoiceConstants {
public static final String COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP";
public static final String[] COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP_WORDS = {"没注意", "没看到", "没有施工","无施工", "很正常", "取消", "关闭"};
//免唤醒词
public static final String V2X_CONFIRM_ACTION = "V2X_CONFIRM_ACTION";
public static final String[] UNWAKE_NAVI_CONFIRM = {"开始导航", "开启导航", "好的", "开始", "导航", "确定", "确认", ""};
public static final String V2X_CANCLE_ACTION = "V2X_CANCLE_ACTION";
public static final String[] UNWAKE_NAVI_CANCLE = {"取消", "关闭", "不要", "不导航"};
static {
// 免唤醒 默认
@@ -321,6 +328,9 @@ public class V2XVoiceConstants {
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_YES_UN_WAKEUP_WORDS);
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_FEEDBACK_SHI_GONG_NO_UN_WAKEUP_WORDS);
sVoiceCmds.put(V2X_CONFIRM_ACTION, UNWAKE_NAVI_CONFIRM);
sVoiceCmds.put(V2X_CANCLE_ACTION, UNWAKE_NAVI_CANCLE);
//2020-6-24 顺义演示需求添加,现合并至launcher 更新时间2020-08-25
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP, COMMAND_ZHIDAO_V2X_CALL_FRONT_CAR_DEMO_UN_WAKEUP_WORDS);

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/v2x_to_nav_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/v2x_to_nav_nomal" android:state_pressed="false" />
<item android:drawable="@drawable/v2x_to_nav_nomal" />
</selector>

View File

@@ -36,7 +36,7 @@
<TextView
android:id="@+id/tvEventTypeTitle"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_40"
android:layout_height="@dimen/dp_35"
android:layout_marginStart="@dimen/dp_31"
android:layout_marginBottom="@dimen/dp_42"
android:background="@drawable/bg_v2x_event_type_red_vr"

View File

@@ -30,7 +30,7 @@
android:layout_marginTop="@dimen/dp_20"
android:background="@drawable/bg_fatigue_driving"
android:gravity="center"
android:text="@string/recommended_route"
android:text="@string/recommended_Parking"
android:textColor="@color/v2x_item_white"
android:textSize="@dimen/v2x_recommond_route_size"
app:layout_constraintBottom_toTopOf="@+id/tvAddress"

View File

@@ -37,7 +37,7 @@
<TextView
android:id="@+id/tvImgTextContent"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_40"
android:layout_height="@dimen/dp_35"
android:layout_marginTop="15dp"
android:background="@drawable/bg_v2x_event_type_orange_vr"
android:gravity="center"

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rlContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/v2x_alert_window_bg"
app:roundLayoutRadius="@dimen/dp_40"
tools:layout_height="wrap_content">
<ImageView
android:id="@+id/ivIconP"
android:layout_width="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:layout_height="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:src="@drawable/v2x_icon_route"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tagEventType"
android:layout_width="@dimen/v2x_driving_width"
android:layout_height="@dimen/v2x_driving_heigt"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_56"
android:background="@drawable/bg_fatigue_driving"
android:gravity="center"
android:text="@string/recommended_route"
android:textColor="@color/v2x_item_white"
android:textSize="@dimen/v2x_recommond_route_size"
app:layout_constraintBottom_toTopOf="@+id/tvAddress"
app:layout_constraintStart_toEndOf="@+id/ivIconP"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvAddress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_56"
android:textColor="@color/v2x_FFF_333"
android:textSize="@dimen/module_v2x_event_parking_text_size"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivToNav"
app:layout_constraintStart_toStartOf="@+id/tagEventType"
app:layout_constraintTop_toBottomOf="@+id/tagEventType"
tools:text="前往 xxx" />
<ImageView
android:id="@+id/ivToNav"
android:layout_width="@dimen/module_v2x_event_button_size"
android:layout_height="@dimen/module_v2x_event_button_size"
android:layout_marginEnd="@dimen/dp_40"
android:src="@drawable/v2x_to_nav"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ivClose"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivClose"
android:layout_width="@dimen/module_v2x_event_button_size"
android:layout_height="@dimen/module_v2x_event_button_size"
android:layout_marginEnd="@dimen/dp_62"
android:src="@drawable/v2x_selector_icon_report_err"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -211,14 +211,14 @@
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerPrejectedRoadEvent"
android:id="@+id/btnTriggerRecommendRouteEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#3100E2"
android:padding="@dimen/dp_10"
android:text="触发基于目的地预测的道路事件"
android:text="触发基于目的地预测的线路推荐"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -120,5 +120,8 @@
<dimen name="v2x_driving_heigt">46px</dimen>
<dimen name="v2x_recommond_route_size">26px</dimen>
<!--适配贝塞尔曲线-->
<dimen name="v2x_bezier_x">1281px</dimen>
</resources>

View File

@@ -13,7 +13,8 @@
<string name="v2x_voice_see_front_car_live_error">诶呀呀,没有查到前方车辆直播视屏,过一会再试试吧</string>
<string name="v2x_voice_see_crossroad_live">已为您打开路口直播实况</string>
<string name="v2x_voice_see_crossroad_live_error">诶呀呀,周围没有可用路口实况直播</string>
<string name="recommended_route">停车场推荐</string>
<string name="recommended_Parking">停车场推荐</string>
<string name="recommended_route">线路推荐</string>
<string name="v2x_recommond_route_size">26px</string>
</resources>

View File

@@ -323,6 +323,10 @@ public class MogoADASController implements IMogoADASController {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return;
}
try {
AutopilotServiceManage.getInstance().showAdas();
} catch ( Exception e ) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB