Merge branch 'dev_merge_shunyi_vr_map' into dev_1.1.9

This commit is contained in:
董宏宇
2020-12-23 14:35:24 +08:00
9 changed files with 70 additions and 173 deletions

View File

@@ -10,10 +10,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.elegant.analytics.Analytics;
import com.elegant.analytics.AnalyticsConfig;
import com.elegant.analytics.IAnalyticsParamsProvider;
import com.elegant.analytics.UploadMode;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.device.Devices;
@@ -28,10 +24,8 @@ import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.TipDrawable;
import com.mogo.utils.TipToast;
import com.mogo.utils.network.NetConfig;
import com.mogo.utils.storage.SharedPrefsMgr;
import java.security.SecureRandom;
import java.util.Map;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
@@ -48,6 +42,13 @@ public abstract class AbsMogoApplication extends Application {
private static final String TAG = "AbsMogoApplication";
// 没有换肤功能的LayoutInflater
private static LayoutInflater mLayoutInflaterNoSkin;
public static LayoutInflater getLayoutInflaterNoSkin() {
return mLayoutInflaterNoSkin;
}
private static Application sApp;
public static Application getApp() {
@@ -57,6 +58,8 @@ public abstract class AbsMogoApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// 在设置皮肤布局填充器之前进行克隆一个出来
mLayoutInflaterNoSkin = LayoutInflater.from(this).cloneInContext(this);
sApp = this;
initARouter();
if ( shouldInit() ) {

View File

@@ -83,7 +83,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
protected void beforeSetContentView( Bundle savedInstanceState ) {
init();
installSkinManager( savedInstanceState );
//installSkinManager( savedInstanceState );
}
/**

View File

@@ -1,11 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.small.map">
<application>
<service
android:name=".SmallMapService"
android:exported="false"
android:process=":smallMap"/>
</application>
</manifest>

View File

@@ -4,9 +4,9 @@ import android.content.Context;
import android.graphics.BitmapFactory;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.Nullable;
@@ -17,7 +17,7 @@ import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.navi.AMapNaviView;
import com.amap.api.navi.AMapNaviViewOptions;
import com.mogo.module.common.view.RoundLayout;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.small.map.animation.DirectionRotateAnimation;
import com.mogo.utils.FileUtils;
@@ -30,11 +30,11 @@ import java.io.IOException;
* @author donghongyu
* @date 12/14/20 4:40 PM
*/
public class SmallMapDirectionView extends RoundLayout {
public class SmallMapDirectionView extends RelativeLayout {
private String styleFilePath = "/mnt/sdcard/amap/small_map_style.data";
private ImageView mIvMapBorder;
private AMapNaviView mAMapNaviView;
private DirectionRotateAnimation mRotateAnimation;
private int lastAngle = 0;
@@ -48,15 +48,17 @@ public class SmallMapDirectionView extends RoundLayout {
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
try {
initView(context);
} catch (Exception e) {
e.printStackTrace();
}
}
private void initView(Context context) {
String styleFilePath = "/mnt/sdcard/amap/small_map_style.data";
mRotateAnimation = new DirectionRotateAnimation(context, null);
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
AbsMogoApplication.getLayoutInflaterNoSkin().inflate(R.layout.module_small_map_view, this);
mIvMapBorder = findViewById(R.id.ivMapBorder);
mAMapNaviView = findViewById(R.id.aMapNaviView);
mAMapNaviView.onCreate(null);

View File

@@ -1,131 +0,0 @@
package com.mogo.module.small.map;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.view.Gravity;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.module.common.machinevision.IMachineVisionInterface;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.utils.logger.Logger;
/**
* @author donghongyu
* @date 12/10/20 1:35 PM
*/
public class SmallMapService extends Service {
private static final String TAG = "MachineVisionMapService";
private IBinder mBinder;
private WindowManagerView mWindowManagerView;
private SmallMapDirectionView mSmallMapDirectionView;
@Override
public void onCreate() {
super.onCreate();
Logger.d(TAG, "onCreate");
addSmallMapView();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
Logger.d(TAG, "onBind");
mBinder = new SmallMapServiceBinder();
return mBinder;
}
@Override
public void onRebind(Intent intent) {
super.onRebind(intent);
addSmallMapView();
Logger.d(TAG, "onRebind");
}
@Override
public boolean onUnbind(Intent intent) {
Logger.d(TAG, "onUnbind");
if (mWindowManagerView != null && mWindowManagerView.isShowing()) {
mWindowManagerView.dismiss();
}
mWindowManagerView = null;
return true;
}
@Override
public void onDestroy() {
super.onDestroy();
Logger.d(TAG, "onDestroy");
if (mWindowManagerView != null) {
mWindowManagerView.dismiss();
}
}
/**
* 添加小地图View
*/
private void addSmallMapView() {
Logger.d(TAG, "addSmallMapView");
mWindowManagerView = new WindowManagerView.Builder(getApplicationContext())
.contentView(R.layout.module_small_map_direction_view)
.size(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT
)
.position(
getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_x),
getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_y)
)
.gravity(Gravity.TOP | Gravity.LEFT)
.showInWindowManager();
mWindowManagerView.show();
mSmallMapDirectionView = mWindowManagerView.findViewById(R.id.smallMapDirectionView);
}
/**
* 小地图与大地图之间进程通讯
*/
public class SmallMapServiceBinder extends IMachineVisionInterface.Stub {
@Override
public void linkToDeath(@NonNull DeathRecipient recipient, int flags) {
super.linkToDeath(recipient, flags);
Logger.d(TAG, "linkToDeath");
}
@Override
public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) {
Logger.d(TAG, "unlinkToDeath");
return super.unlinkToDeath(recipient, flags);
}
@Override
public void postData(MogoSnapshotSetData data) throws RemoteException {
Logger.d(TAG, "postData");
}
@Override
public void hideViewIfExist() throws RemoteException {
Logger.d(TAG, "hideViewIfExist");
}
@Override
public void showViewIfExist() throws RemoteException {
Logger.d(TAG, "showViewIfExist");
}
}
}

View File

@@ -1,8 +0,0 @@
package com.mogo.module.small.map;
/**
* @author donghongyu
* @date 12/10/20 1:35 PM
*/
public class SmallMapViewHandler {
}

View File

@@ -1,22 +1,24 @@
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.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.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;
/**
* @author donghongyu
@@ -26,9 +28,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 +80,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();
}
}
@@ -119,4 +123,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

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge 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:layout_width="@dimen/module_small_map_border_view_width"
android:layout_height="@dimen/module_small_map_border_view_width"
tools:parentTag="RelativeLayout"
app:roundLayoutRadius="360dp">
@@ -33,4 +35,4 @@
android:layout_centerInParent="true"
android:src="@drawable/module_small_map_view_border" />
</RelativeLayout>
</merge>

View File

@@ -2,7 +2,6 @@ package com.mogo.module.v2x.alarm;
import android.text.TextUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
@@ -253,6 +252,10 @@ public class V2XAlarmServer {
//Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
String keyword = "停车场";
boolean isHighWay = false;
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null ||
regeocodeResult.getRegeocodeAddress().getFormatAddress() == null) {
return;
}
// 如果当前位置是高速则推荐服务区
if (regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("高速")) {
keyword = "停车场|服务区";