merge branch

This commit is contained in:
tongchenfei
2021-01-07 19:33:30 +08:00
77 changed files with 1349 additions and 495 deletions

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

@@ -13,10 +13,8 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.service.adas.entity.ADASRecognizedListResult;
import com.mogo.utils.ViewUtils;
import java.util.ArrayList;
import java.util.HashMap;
@@ -68,8 +66,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// adas marker 缓存
private Map< String, IMogoMarker > mAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
private boolean mIsVrMode = false;
public void renderAdasRecognizedResult( List< ADASRecognizedListResult > resultList, boolean machineVision, double curSpeed ) {
if ( resultList == null || resultList.isEmpty() ) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).removeMarkers( DataTypes.TYPE_MARKER_ADAS );
@@ -100,15 +96,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
continue;
}
mAdasRecognizedMarkersCaches.put( uniqueKey, marker );
} else {
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
if ( mIsVrMode ) {
marker.use3DResource( getVrModel() );
} else {
marker.setIcon( ViewUtils.fromView( inflateView( recognizedListResult, machineVision, 0 ) ) );
}
}
}
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
@@ -122,8 +109,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if ( latLon == null ) {
continue;
}
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
}
@@ -135,8 +120,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
continue;
}
points.add( lastPosition );
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
}
mLastPositions.put( uniqueKey, endLatLon );
@@ -191,25 +174,18 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
return null;
}
// double targetPos[] = transformGcj02ToFitMap( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon );
MogoMarkerOptions options = new MogoMarkerOptions()
.owner( DataTypes.TYPE_MARKER_ADAS )
.anchor( 0.5f, 0.5f )
.set3DMode( true )
.icon3DRes( getVrModel() )
.rotate( ( float ) recognizedListResult.heading )
// .position( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
options.icon3DRes( getVrModel() );
} else {
options.icon( inflateView( recognizedListResult, machineVision, curSpeed ) );
}
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
}
private int getVrModel() {
return R.raw.taxi;
return R.raw.carred;
}
private View inflateView( ADASRecognizedListResult data, boolean machineVision, double curSpeed ) {
@@ -225,7 +201,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// safeType
// ) );
iv.setImageResource( R.drawable.icon_map_marker_car_type_taxi );
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
return rootView;
}

View File

@@ -1,7 +1,6 @@
package com.mogo.module.common.drawer;
import android.content.Context;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -9,15 +8,20 @@ import android.widget.ImageView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
@@ -36,16 +40,19 @@ public
*
* 云端数据绘制
*/
class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListener {
class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListener, IMogoStatusChangedListener {
private static final String TAG = "SnapshotSetDataDrawer";
private static volatile SnapshotSetDataDrawer sInstance;
private Context mContext;
private boolean mChangeCarModeStatus;
private SnapshotSetDataDrawer() {
mContext = AbsMogoApplication.getApp();
MogoApisHandler.getInstance().getApis()
.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
}
public static SnapshotSetDataDrawer getInstance() {
@@ -71,13 +78,38 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
// 云端 marker 缓存
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
private int mPurseCounter = 0;
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
private Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
private boolean mIsVrMode = false;
private long mLastReceiveTime = 0L;
// private long mLastReceiveTime = 0L;
// private long mAnimationDuration = 500L;
@Override
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
Logger.d( TAG, "%s - %s", descriptor, isTrue );
mChangeCarModeStatus = true;
ThreadPoolService.execute( () -> {
clearOldStyleMarkers();
} );
}
private void clearOldStyleMarkers() {
try {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi().getMarkerManager( mContext )
.removeMarkers( DataTypes.TYPE_MARKER_CLOUD_DATA );
mLastPositions.clear();
mCloudSnapshotMarkersCaches.clear();
} catch ( Exception e ) {
}
try {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi().getMarkerManager( mContext )
.removeMarkers( DataTypes.TYPE_MARKER_ADAS );
} catch ( Exception e ) {
}
}
/**
* 其他车辆、rsu 车辆数据
@@ -86,6 +118,10 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
*/
public void renderSnapshotData( MogoSnapshotSetData data,
boolean machineVision ) {
recordTimeFlag();
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
return;
}
if ( data == null || (
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
@@ -93,19 +129,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
return;
}
List< CloudRoadData > allDatumsList = new ArrayList<>();
allDatumsList.addAll( data.getAllList() );
// allDatumsList.addAll( data.getNearList() );
// if ( machineVision ) {
// allDatumsList.addAll( data.getAllList() );
// allDatumsList.addAll( data.getNearList() );
// } else {
// allDatumsList.addAll( data.getAllList() );
// }
mPurseCounter++;
if ( mPurseCounter >= 100 ) {
mPurseCounter = 0;
}
purgeCloudSnapshotData( allDatumsList );
prepareData( data.getAllList(), allDatumsList );
for ( CloudRoadData cloudRoadData : allDatumsList ) {
if ( cloudRoadData == null ) {
continue;
@@ -118,7 +142,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
}
IMogoMarker marker = null;
String uniqueKey = cloudRoadData.getUniqueKey();
if ( TextUtils.isEmpty( uniqueKey ) ) {
@@ -127,7 +150,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
if ( mCloudSnapshotMarkersCaches.containsKey( uniqueKey ) ) {
marker = mCloudSnapshotMarkersCaches.get( uniqueKey );
}
MogoLatLng target = new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() );
if ( marker == null || marker.isDestroyed() ) {
marker = drawSnapshotDataMarker( cloudRoadData, machineVision, data.curSpeed );
if ( marker == null ) {
@@ -138,38 +160,104 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
} else {
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
if ( mChangeCarModeStatus ) {
mChangeCarModeStatus = false;
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
if ( mIsVrMode ) {
Logger.d( TAG, "3D模型-%s", uniqueKey );
marker.getMogoMarkerOptions().set3DMode( true );
marker.use3DResource( getVrModel( cloudRoadData ) );
} else {
Logger.d( TAG, "2D贴图-%s", uniqueKey );
marker.getMogoMarkerOptions().set3DMode( false );
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
}
}
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
// double targetPos[] = transformGcj02ToFitMap( target.lat, target.lon );
// double lastPos[] = transformGcj02ToFitMap( lastPosition.lat, lastPosition.lon );
CloudRoadData lastPosition = mLastPositions.get( uniqueKey );
if ( lastPosition != null ) {
if ( lastPosition.equals( target ) ) {
marker.setPosition( lastPosition.lat, lastPosition.lon );
if ( lastPosition.equals( cloudRoadData ) ) {
if ( ( ( int ) cloudRoadData.getSpeed() ) == 0 ) {
MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
if ( position != null ) {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() - position.getBearing() );
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
}
}
Logger.d( TAG, "保持位置 - %s", uniqueKey );
marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
} else {
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
points.add( new MogoLatLng( target.lat, target.lon ) );
marker.startSmoothInMs( points, 500L );
points.add( new MogoLatLng( lastPosition.getLat(), lastPosition.getLon() ) );
points.add( new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() ) );
marker.startSmoothInMs( points, cloudRoadData.getSystemTime() - lastPosition.getSystemTime() );
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, cloudRoadData.getSystemTime() - lastPosition.getSystemTime() );
}
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
marker.setPosition( target.lat, target.lon );
MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
if ( position != null ) {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() - position.getBearing() );
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
}
marker.setPosition( cloudRoadData.getLat(), cloudRoadData.getLon() );
}
}
mLastPositions.put( uniqueKey, target );
mLastReceiveTime = SystemClock.elapsedRealtime();
mLastPositions.put( uniqueKey, cloudRoadData );
}
}
/**
* 过滤数据
*
* @param in 输入集合
* @param out 输出集合
*/
private void prepareData( List< CloudRoadData > in, List< CloudRoadData > out ) {
filterData( in );
out.addAll( in );
purgeCloudSnapshotData( out );
}
/**
* 记录时间
*/
private void recordTimeFlag() {
// if ( mLastReceiveTime != 0 ) {
// mAnimationDuration = System.currentTimeMillis() - mLastReceiveTime;
// if ( mAnimationDuration > 1000L ) {
// mAnimationDuration = 500L;
// }
// } else {
// mAnimationDuration = 500L;
// }
// mLastReceiveTime = System.currentTimeMillis();
}
/**
* vr 模式下显示合并数据,否则只显示上报位置的车辆
*
* @param dataList
*/
private void filterData( List< CloudRoadData > dataList ) {
if ( dataList == null || dataList.isEmpty() ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return;
}
List< CloudRoadData > newList = new ArrayList<>();
for ( CloudRoadData cloudRoadData : dataList ) {
if ( cloudRoadData.getFromType() != CloudRoadData.FROM_MY_LOCATION ) {
continue;
}
newList.add( cloudRoadData );
}
dataList.clear();
dataList.addAll( newList );
}
private void bindClickListener( IMogoMarker marker ) {
if ( marker == null || marker.isDestroyed() ) {
return;
@@ -224,17 +312,20 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
Logger.d( TAG, "draw marker uniqueKey = %s", data.getUniqueKey() );
// double coor[] = transformGcj02ToFitMap( data.getLat(), data.getLon() );
MogoMarkerOptions options = new MogoMarkerOptions()
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
.anchor( 0.5f, 0.5f )
.rotate( ( float ) data.getHeading() )
.object( data )
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
options.set3DMode( true );
options.anchorColor( "#00FF00" );
Logger.d( TAG, "3D模型 - %s", data.getUniqueKey() );
options.icon3DRes( getVrModel( data ) );
} else {
options.set3DMode( false );
Logger.d( TAG, "2D贴图 - %s", data.getUniqueKey() );
options.icon( inflateView( data, machineVision, curSpeed ) );
}
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
@@ -243,9 +334,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
private int getVrModel( CloudRoadData data ) {
switch ( data.getFromType() ) {
case CloudRoadData.FROM_ADAS:
return R.raw.taxi;
// return R.raw.taxi;
case CloudRoadData.FROM_ROAD_UNIT:
return R.raw.bus;
// return R.raw.bus;
case CloudRoadData.FROM_MY_LOCATION:
default:
return R.raw.carred;
@@ -272,9 +363,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
private int get2DModel( CloudRoadData data ) {
switch ( data.getFromType() ) {
case CloudRoadData.FROM_ADAS:
return R.drawable.icon_map_marker_car_type_taxi;
// return R.drawable.icon_map_marker_car_type_taxi;
case CloudRoadData.FROM_ROAD_UNIT:
return R.drawable.icon_map_marker_car_type_bus;
// return R.drawable.icon_map_marker_car_type_bus;
case CloudRoadData.FROM_MY_LOCATION:
default:
return R.drawable.icon_map_marker_car_gray;

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

@@ -90,7 +90,9 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
}
private void loadPoiTypeIconInUiThread(String url,int res) {
if (mMarker != null) {
mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this));
}
if (!url.isEmpty()) {
ivIcon.setPlaceHolder(res);
ivIcon.setFailureHolder(res);

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

@@ -7,6 +7,7 @@ import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.utils.logger.Logger;
public
/**
@@ -17,6 +18,8 @@ public
*/
class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter {
private static final String TAG = "RoadConditionInfoWindow3DAdapter";
private MarkerShowEntity mEntity;
private Context mContext;
private MogoMarkerOptions mOptions;
@@ -31,6 +34,7 @@ class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter {
@Override
public View getInfoWindow( IMogoMarker marker ) {
Logger.d( TAG, "创建marker的infowindow" );
IMarkerView creator = MapMarkerAdapter.getMarkerInfoWindowView( mContext, mEntity, mOptions );
return creator.getView();
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.map.MogoLatLng;
import com.mogo.utils.CoordinateUtils;
import java.util.Objects;

View File

@@ -133,7 +133,7 @@ public class CloudRoadData implements Parcelable {
this.coordinates = coordinates;
}
public void setUuid(String uuid) {
public void setUuid( String uuid ) {
this.uuid = uuid;
}
@@ -222,4 +222,19 @@ public class CloudRoadData implements Parcelable {
return new CloudRoadData[size];
}
};
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
CloudRoadData that = ( CloudRoadData ) o;
return Double.compare( that.lat, lat ) == 0 &&
Double.compare( that.lon, lon ) == 0;
}
}

View File

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

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>

Binary file not shown.

View File

@@ -839,11 +839,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
handler.post(() -> seekHelpGroup.setVisibility(View.GONE));
}
} else if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue) {
enterVrMode();
} else {
exitVrMode();
try {
if (isTrue) {
enterVrMode();
} else {
exitVrMode();
}
} catch( Exception e ){
e.printStackTrace();
}
}
}

View File

@@ -16,6 +16,8 @@ import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.view.VerticalTrafficLightView;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GRAY;
/**
* vr模式下导航信息封装
*
@@ -28,14 +30,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
private final VerticalTrafficLightView turnAroundLight, turnLeftLight, straightLight, turnRightLight;
private final ImageView ivTurnIcon;
private final TextView tvDistance,tvDistanceUnit, tvNextRoad;
private final TextView tvDistance, tvDistanceUnit, tvNextRoad;
private final TextView tvCurrentSpeed;
private final Handler handler = new Handler(this);
public VrModeNavInfoView(Context context) {
this(context,null);
this(context, null);
}
public VrModeNavInfoView(Context context, AttributeSet attrs) {
@@ -72,7 +74,7 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
}
public void refreshLimitSpeed(int limitSpeed) {
if(getVisibility() != View.VISIBLE){
if (getVisibility() != View.VISIBLE) {
return;
}
handler.removeMessages(MSG_HIDE_LIMIT_SPEED);
@@ -91,6 +93,14 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
private int[] lightArray = new int[4];
private String[] surplusTimeArray = new String[4];
/**
* 将红绿灯状态全部置灰,相当于隐藏红绿灯状态
*/
public void hideTrafficLightStatus() {
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
refreshTrafficLightStatus(new int[]{TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GRAY}, new String[]{"", "", "", ""});
}
/**
* 刷新红绿灯显示状态
*
@@ -107,12 +117,15 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
turnRightLight.setTrafficLightStatus(laneLight[3], surplusTime[3]);
// todo 再根据当前所在车道,置灰不需关注的灯
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT);
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT, HIDE_TRAFFIC_LIGHT_DELAY);
}
/**
* 根据所在车道,控制红绿灯展示
*/
public void refreshLaneStatus(){
public void refreshLaneStatus() {
}
@@ -136,16 +149,24 @@ public class VrModeNavInfoView extends BaseNaviInfoView implements Handler.Callb
public boolean isVisible() {
return navGroup.getVisibility() == View.VISIBLE;
}
private static final int MSG_HIDE_LIMIT_SPEED = 1001;
private static final long HIDE_LIMIT_SPEED_DELAY = 5000;
private static final int MSG_HIDE_TRAFFIC_LIGHT = 1002;
private static final long HIDE_TRAFFIC_LIGHT_DELAY = 1000;
@Override
public boolean handleMessage(Message msg) {
if (!isAttachedToWindow()||getVisibility() != View.VISIBLE) {
if (!isAttachedToWindow() || getVisibility() != View.VISIBLE) {
return false;
}
if (msg.what == MSG_HIDE_LIMIT_SPEED) {
tvLimitSpeed.setVisibility(View.GONE);
return true;
} else if (msg.what == MSG_HIDE_TRAFFIC_LIGHT) {
hideTrafficLightStatus();
return true;
}
return false;
}

View File

@@ -158,8 +158,9 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
String obuLightAction = intent.getStringExtra("action");
if ("1".equals(obuLightAction)) {
// 隐藏红绿灯
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
vrModeNavInfoView.hideTrafficLightStatus();
// handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
// handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
} else {
// 红绿灯处理
String data = intent.getStringExtra("data");

View File

@@ -100,7 +100,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
* @param roadData
*/
private void addVrCameraMarker(CloudRoadData roadData) {
Log.d(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
removeCameraMarker();
MogoMarkerOptions options = new MogoMarkerOptions()
@@ -127,7 +127,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
* @param roadData
*/
private void addNormalCameraMarker(CloudRoadData roadData) {
Log.d(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
removeCameraMarker();
if (mMogoMarker != null) {
@@ -178,7 +178,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
if (TextUtils.equals(mCurrentUuid, mCloudRoadData.getUuid())) {
if (isVrMode == isVrModeMarker) {
// do nothing.
Log.e(TAG, "-------------1------------");
Log.d(TAG, "-------------1------------");
} else {
if (isVrMode) {
Log.d(TAG, "-------------2------------");

View File

@@ -199,6 +199,16 @@ public class TopViewAnimHelper {
if (params == null) {
throw new IllegalArgumentException("method addTopView params LayoutParams is null");
}
if (isOuting) {
if (motionViewCache != null) {
motionViewCache.statusListener.beforeViewRemoveAnim(motionViewCache.view);
motionViewCache.statusListener.onViewRemoved(motionViewCache.view);
}
motionViewCache = new MotionViewCache(view, params, statusListener);
// return;
}
if (!viewCaches.contains(view)) {
// 判断此view是否已经增加到了顶部view如果增加过就不增加了
currentAnimatingView = view;
@@ -278,6 +288,9 @@ public class TopViewAnimHelper {
// 顶部view还没有内容需要整体下移
viewCaches.add(view);
topContainer.addView(view, params);
LayoutParams p = topContainer.getLayoutParams();
p.height = params.height;
topContainer.setLayoutParams(p);
Logger.d(TAG, "整体进入==== view.visibility: " + view.getVisibility() + " view" +
".position: (" + view.getX() + ", " + view.getY() + ") params.width: " + params.width + " params.height: " + params.height);
if (statusListenerMap.get(view) != null) {
@@ -333,6 +346,7 @@ public class TopViewAnimHelper {
}
Logger.d("TopViewAnimHelper", "startTopOutAnim=====");
if (!isTopViewOut && viewCaches.contains(view)) {
isOuting = true;
// 顶部view仅剩一个view需要整体上移
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
@@ -341,7 +355,7 @@ public class TopViewAnimHelper {
NoMapTopViewShaderHelper.getInstance().hideShader();
topContainer.animate().translationY(-topContainer.getTranslationY()).setListener(mainAnimListener).start();
topContainer.animate().translationY(0).setListener(mainAnimListener).start();
checkCameraModePosition(false);
@@ -389,6 +403,7 @@ public class TopViewAnimHelper {
}
Logger.d("TopViewAnimHelper", "hideNaviView=====");
animNavInfoView.setTranslationY(0);
animNavInfoView.setVisibility(View.GONE);
vrModeNavInfoView.stopNav();
int scene = 0;
@@ -441,6 +456,7 @@ public class TopViewAnimHelper {
listener.onViewRemoved(child);
}
}
topContainer.setTranslationY(0);
topContainer.removeAllViews();
hideNaviView();
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
@@ -496,6 +512,11 @@ public class TopViewAnimHelper {
}
topContainer.removeAllViews();
currentAnimatingView = null;
isOuting = false;
// if (motionViewCache != null) {
// startTopInAnim(motionViewCache.view, motionViewCache.params, motionViewCache.statusListener);
// motionViewCache = null;
// }
} else {
listener = statusListenerMap.get(currentAnimatingView);
if (listener != null) {
@@ -516,4 +537,21 @@ public class TopViewAnimHelper {
}
};
private MotionViewCache motionViewCache = null;
private boolean isOuting = false;
private static class MotionViewCache {
private final View view;
private final LayoutParams params;
private final IMogoTopViewStatusListener statusListener;
public MotionViewCache(View view, LayoutParams params, IMogoTopViewStatusListener statusListener) {
this.view = view;
this.params = params;
this.statusListener = statusListener;
}
}
}

View File

@@ -29,6 +29,7 @@
android:id="@+id/module_ext_id_tv_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_nav_common_margin_top"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_speed_margin_start"
android:text="--"
android:textColor="#fff"
@@ -53,6 +54,8 @@
android:id="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
android:layout_width="@dimen/module_ext_navi_in_vr_navi_icon_size"
android:layout_height="@dimen/module_ext_navi_in_vr_navi_icon_size"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_nav_common_margin_top"
android:layout_marginStart="@dimen/module_ext_navi_in_vr_limit_speed_margin_start"
android:src="@drawable/tc_11"
app:layout_constraintBottom_toTopOf="@id/module_ext_id_navi_in_vr_traffic_bg"
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_navi_in_vr_traffic_bg"
@@ -65,6 +68,7 @@
android:text="200"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_txt_size"
app:layout_constraintBottom_toTopOf="@id/module_map_id_navi_next_info_road_in_vr_mode"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
app:layout_constraintTop_toTopOf="@id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode" />
@@ -85,6 +89,7 @@
android:text="北三环东路辅路"
android:textColor="#f1f1f1"
android:textSize="@dimen/module_ext_navi_in_vr_next_info_road_txt_size"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_next_info_road_turn_icon_in_vr_mode"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_navi_next_info_distance_in_vr_mode"
app:layout_constraintTop_toBottomOf="@id/module_map_id_navi_next_info_distance_in_vr_mode" />
@@ -94,6 +99,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/module_ext_navi_in_vr_limit_speed_margin_end"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_limit_speed_margin_top"
android:background="@drawable/module_ext_vr_mode_limit_speed_bg"
android:gravity="center"
android:text="80"
@@ -148,14 +154,14 @@
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_ext_id_tv_speed,module_ext_id_tv_speed_unit"
android:visibility="gone"
tools:visibility="gone" />
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/module_ext_id_group_navi_in_vr_nav_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
tools:visibility="gone"
app:constraint_referenced_ids="module_map_id_navi_next_info_road_turn_icon_in_vr_mode,module_map_id_navi_next_info_distance_in_vr_mode,module_map_id_navi_next_info_distance_unit_in_vr_mode,module_map_id_navi_next_info_road_in_vr_mode" />
<!-- 除了上面两个group以外的其他view的group方便整体控制显示隐藏不包含limitSpeed需要单独控制它的显示隐藏 -->

View File

@@ -23,12 +23,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12"
android:layout_marginTop="@dimen/module_ext_navi_in_vr_traffic_light_left_time_margin_top"
android:textColor="#fff"
app:layout_constraintHorizontal_chainStyle="packed"
android:textSize="@dimen/module_ext_navi_in_vr_traffic_light_left_time_txt_size"
app:layout_constraintLeft_toLeftOf="@id/module_ext_id_traffic_light_icon"
app:layout_constraintRight_toLeftOf="@id/module_ext_id_traffic_light_left_time_unit"
app:layout_constraintTop_toBottomOf="@id/module_ext_id_traffic_light_icon" />
app:layout_constraintTop_toTopOf="@id/module_ext_id_traffic_light_icon" />
<TextView
android:id="@+id/module_ext_id_traffic_light_left_time_unit"

View File

@@ -226,18 +226,21 @@
<dimen name="module_ext_navi_in_vr_traffic_bg_margin_bottom">60px</dimen>
<dimen name="module_ext_navi_in_vr_speed_text_size">100px</dimen>
<dimen name="module_ext_navi_in_vr_speed_unit_size">30px</dimen>
<dimen name="module_ext_navi_in_vr_speed_unit_margin_start">30px</dimen>
<dimen name="module_ext_navi_in_vr_speed_unit_margin_start">15px</dimen>
<dimen name="module_ext_navi_in_vr_speed_margin_start">70px</dimen>
<dimen name="module_ext_navi_in_vr_speed_margin_top">22px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_size">78px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_end">66px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_top">43px</dimen>
<dimen name="module_ext_navi_in_vr_nav_common_margin_top">23px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_top">30px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_margin_start">20px</dimen>
<dimen name="module_ext_navi_in_vr_limit_speed_text_size">40px</dimen>
<dimen name="module_ext_navi_in_vr_bg_corner">20px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_margin_top">17px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_txt_size">36px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_margin_top">60px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_left_time_unit_size">21px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">21px</dimen>
<dimen name="module_ext_navi_in_vr_traffic_light_no_time_margin_top">11px</dimen>
<dimen name="module_video_window_width_content">400px</dimen>
<dimen name="module_video_window_height_content">300px</dimen>

View File

@@ -159,14 +159,14 @@ public class EventDispatchCenter implements
this.mMapLoadedCallback = callback;
}
private boolean mIsMapLoaded = false;
// private boolean mIsMapLoaded = false;
@Override
public void onMapLoaded() {
if ( mIsMapLoaded ) {
return;
}
mIsMapLoaded = true;
// if ( mIsMapLoaded ) {
// return;
// }
// mIsMapLoaded = true;
if ( mMapLoadedCallback != null ) {
mMapLoadedCallback.run();
mMapLoadedCallback = null;

View File

@@ -182,6 +182,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
resetMapCenterPoint();
resetMapUiStyle();
loadOthersModules();
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
} );
@@ -203,6 +204,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
}
private void resetMapUiStyle(){
final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode();
mServiceApis.getMapServiceApi().getMapUIController().changeMapMode( mapUI );
}
private void resetMapCenterPoint() {
// 右移地图中心点
MapCenterPointStrategy.init();
@@ -374,6 +380,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoFragmentManager.unregisterMainFragmentStackTransactionListener();
mMogoFragmentManager = null;
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().destroy();
mServiceApis.getMapServiceApi().getMapUIController().destroy();
AdasConfigApiController.getInstance().release();
mServiceApis.getAdasControllerApi().release();
Logger.d( TAG, "destroy." );

View File

@@ -154,10 +154,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
if ( mMogoMap.getUIController() != null ) {
mMogoMap.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
}
final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode();
getUIController().changeMapMode( mapUI );
}
}

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

@@ -45,7 +45,7 @@ class MockUtil:Handler.Callback {
if (msg.what == 1001) {
Logger.d(TAG,"准备添加调试view")
val api = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
api.windowManagerApi.addView(view, 500, 300, false)
api.windowManagerApi.addView(view, 800, 300, false)
}
return false
}

View File

@@ -103,8 +103,8 @@ public class MogoServiceProvider implements IMogoModuleProvider {
MogoRTKLocation.getInstance().init();
}
MogoServices.getInstance().preInit( context );
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
UiThreadHandler.postDelayed( () -> {
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
}, 5_000L );
}

View File

@@ -326,6 +326,7 @@ public class MogoServices implements IMogoMapListener,
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.TOP_VIEW, statusChangedListener );
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListener );
mStatusManager.setAIAssistReady( TAG, AIAssist.getInstance( mContext ).hasFlush() );
}
public void init( Context context ) {
@@ -337,9 +338,9 @@ public class MogoServices implements IMogoMapListener,
registerInternalUnWakeupWords();
mRegisterCenter = MarkerServiceHandler.getRegisterCenter();
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoLocationListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoNaviListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoMapListener( ServiceConst.TYPE, this );
mRegisterCenter.registerMogoAimlessModeListener( ServiceConst.TYPE, this );
mRegisterCenter.registerCarLocationChangedListener( ServiceConst.TYPE, this );
@@ -555,6 +556,8 @@ public class MogoServices implements IMogoMapListener,
MapMarkerManager.getInstance().syncLocation( latLng.lon, latLng.lat );
Logger.d( TAG, "zoom = %s", zoom );
if ( mIsCameraInited ) {
mLastZoomLevel = zoom;
mLastCustomRefreshCenterLocation = latLng;
@@ -925,16 +928,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

@@ -383,6 +383,10 @@ public class MockIntentHandler implements IntentHandler {
centerMarker.destroy();
}
break;
case 38:
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.rtkEnable( false );
break;
}
}

View File

@@ -158,16 +158,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
@Override
public void onMsgReceived( MogoSnapshotSetData data ) {
if ( data == null ) {
return;
}
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
// return;
}
if ( MogoServices.getInstance().getLastCarLocation() != null ) {
data.curSpeed = MogoServices.getInstance().getLastCarLocation().getSpeed();
}
// if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
//// return;
// }
//
// if ( MogoServices.getInstance().getLastCarLocation() != null ) {
// data.curSpeed = MogoServices.getInstance().getLastCarLocation().getSpeed();
// }
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, false );
// VrModeController.getInstance().renderMogoSnapshotSetData( data );
}

View File

@@ -90,13 +90,13 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
locationResult.lastCoordinate = lastInfo;
locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
}
locationResult.coordinates = new ArrayList<>();
// locationResult.coordinates = new ArrayList<>();
locationResult.sn = com.mogo.commons.network.Utils.getSn();
if ( cloudLocationInfo == null ) {
locationResult.coordinates.addAll( new ArrayList<>() );
} else {
locationResult.coordinates.addAll( cloudLocationInfo );
}
// if ( cloudLocationInfo == null ) {
// locationResult.coordinates.addAll( new ArrayList<>() );
// } else {
// locationResult.coordinates.addAll( cloudLocationInfo );
// }
}
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
OnePerSecondSendContent content = new OnePerSecondSendContent();

View File

@@ -17,6 +17,7 @@ import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant;
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener;
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
import com.mogo.module.common.constants.HostConst;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.BaseFloatDialog;
import com.mogo.module.common.utils.CloudPoiManager;
import com.mogo.module.share.bean.FixableButton;
@@ -193,13 +194,13 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
// if (!DebugConfig.isLauncher()) {
ServiceApisManager.serviceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() {
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (!isTrue) {
dismissShareDialog();
}
}
});
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (!isTrue) {
dismissShareDialog();
}
}
});
// }
// if (!DebugConfig.isLauncher()) {
@@ -300,6 +301,9 @@ public class ShareControl implements IMogoShareManager, Handler.Callback {
}
break;
case VOICE_CMD_PUB_TROUBLE_HELP:
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
return;
}
if (needAuth()) {
goAuth(STEP_AFTER_AUTH_TYPE_SEEK_HELP, TYPE_DENSE_FOG, false);
} else {

View File

@@ -7,6 +7,7 @@ import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.navi.IMogoAimless;
import com.mogo.map.search.poisearch.IMogoPoiSearch;
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
@@ -35,7 +36,7 @@ public class TanluServiceManager {
private static IMogoAimless mIMogoAimless;
public static void init(Context context) {
mServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mServiceApis = MogoApisHandler.getInstance().getApis();
mMapService = mServiceApis.getMapServiceApi();
mIMogoStatusManager = mServiceApis.getStatusManagerApi();
mAnalytics = mServiceApis.getAnalyticsApi();

View File

@@ -23,7 +23,7 @@ public class ShareConstants {
// 此处只记录了事故、实时路况、道路积水、道路结冰、浓雾,至于拥堵、交通检查和封路是在extention模块里面管理
public static final String VOICE_CMD_PUB_TROUBLE_HELP = "com.zhidao.auxiliaryDriving" +
".pubTroubleHelp";
".pubTroubleHelp";/*唤醒词 发起故障求助*/
public static final String VOICE_CMD_GO_TO_SHARE = "com.zhidao.share";
public static final String TAG = "/tanlu/ui";

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 = 15;
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,55 +176,53 @@ public class SmallMapDirectionView extends RelativeLayout {
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
});
try {
// 判断是否有样式文件存在
File styleExit = new File(styleFilePath);
if (!styleExit.exists()) {
FileUtils.copy(
context.getAssets().open("small_map_style.data"),
styleFilePath,
new FileUtils.FileCopyListener() {
//File styleExit = new File(styleFilePath);
FileUtils.copy(
context.getAssets().open("small_map_style.data"),
styleFilePath,
new FileUtils.FileCopyListener() {
@Override
public void onStart() {
Log.w("FileCopyListener", "onStart=");
@Override
public void onStart() {
Log.w("FileCopyListener", "onStart=");
}
@Override
public void onFail(Exception e) {
Log.w("FileCopyListener", "onFail=");
e.printStackTrace();
}
@Override
public void onProcess(int process) {
Log.w("FileCopyListener", "onProcess=" + process);
}
@Override
public void onFinish(String toPath) {
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
// 高德地图有bug所以需要多次调用设置皮肤才能成功
if (options != null) {
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(12);
aMap.moveCamera(cameraUpdate);
}
}
);
}
@Override
public void onFail(Exception e) {
Log.w("FileCopyListener", "onFail=");
e.printStackTrace();
}
@Override
public void onProcess(int process) {
Log.w("FileCopyListener", "onProcess=" + process);
}
@Override
public void onFinish(String toPath) {
Log.w("FileCopyListener", "onFinish toPath=" + toPath);
// 高德地图有bug所以需要多次调用设置皮肤才能成功
if (options != null) {
options.setCustomMapStylePath(styleFilePath);
mAMapNaviView.setViewOptions(options);
}
//设置希望展示的地图缩放级别
CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
aMap.moveCamera(cameraUpdate);
}
}
);
} catch (IOException e) {
e.printStackTrace();
}

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;
@@ -76,22 +86,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 +132,44 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
}
}
}
/**
* 添加小地图View
*/
private void addSmallMapView() {
Logger.d(TAG, "addSmallMapView");
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);
Logger.d(TAG, "hook 高德地图成功");
} catch (Exception e) {
e.printStackTrace();
}
// 初始化小地图控件
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

@@ -13,6 +13,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XObuEventEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
@@ -178,6 +179,10 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
@Override
public void onEventInfoCallback(MogoObuEventInfo info) {
Logger.d("V2X_OBU_EVENT", "carEventInfo==" + info);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
Logger.d("V2X_OBU_EVENT","vr模式下不展示obu事件");
return;
}
Long last = intervalMap.get(info.getTypeCode());
if (last == null) {
last = 0L;

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

@@ -1,6 +1,7 @@
package com.mogo.module.v2x.scenario.impl;
import android.content.Intent;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -91,7 +92,7 @@ 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();

View File

@@ -59,7 +59,7 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity>
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources()
.getDimension(R.dimen.v2x_video_window_height));
.getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode()? R.dimen.dp_394:R.dimen.v2x_video_window_height));
V2XServiceManager
.getMogoTopViewManager()
.addViewNoLinkage(getV2XWindow().getView(), layoutParams, this);

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

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

@@ -140,20 +140,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#2651A6"
android:padding="@dimen/dp_10"
android:text="折行显示文案测试数据"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerParkEvent"
android:layout_width="wrap_content"

View File

@@ -120,5 +120,4 @@
<dimen name="v2x_driving_heigt">46px</dimen>
<dimen name="v2x_recommond_route_size">26px</dimen>
</resources>