完成基础的角度修改
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.mogo.launcher;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Process;
|
||||
@@ -22,7 +21,7 @@ import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.push.base.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.share.constant.ShareConstants;
|
||||
import com.mogo.module.small.map.IMogoSmallMapProvider;
|
||||
import com.mogo.service.map.IMogoSmallMapProvider;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -96,7 +95,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
// MogoModulePaths.addModule( new MogoModule( IMogoMachineVisionProvider.path, "IMogoMachineVisionProvider" ) );
|
||||
|
||||
// 小地图模块
|
||||
MogoModulePaths.addModule( new MogoModule( IMogoSmallMapProvider.path, "IMogoSmallMapProvider" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SMALL_MAP, "IMogoSmallMapProvider" ) );
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake" ) );
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.module.small.map;
|
||||
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/10/20 1:36 PM
|
||||
*/
|
||||
public interface IMogoSmallMapProvider extends IMogoModuleProvider {
|
||||
String path = "/small_map/api";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.module.small.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.view.RoundLayout;
|
||||
|
||||
/**
|
||||
* 小地图的方向View
|
||||
*
|
||||
* @author donghongyu
|
||||
* @date 12/14/20 4:40 PM
|
||||
*/
|
||||
public class SmallMapDirectionView extends RoundLayout {
|
||||
|
||||
private ImageView mIvMapBorder;
|
||||
|
||||
public SmallMapDirectionView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
mIvMapBorder = findViewById(R.id.ivMapBorder);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改角度
|
||||
*
|
||||
* @param angle 角度 0 - 359度旋转,相对于自身中心位置
|
||||
*/
|
||||
public void changeAngle(int angle) {
|
||||
Animation mRotateAnimation = new RotateAnimation(
|
||||
0, angle,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f);
|
||||
//设置线性插值,可以解决旋转一圈后卡顿问题
|
||||
mRotateAnimation.setInterpolator(new DecelerateInterpolator());
|
||||
//设置旋转一圈时间
|
||||
mRotateAnimation.setDuration(1000);
|
||||
//控件动画结束时是否保持动画最后的状态
|
||||
mRotateAnimation.setFillAfter(true);
|
||||
|
||||
mIvMapBorder.startAnimation(mRotateAnimation);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class SmallMapService extends Service {
|
||||
private IBinder mBinder;
|
||||
|
||||
private WindowManagerView mWindowManagerView;
|
||||
private SmallMapView mMapView;
|
||||
private SmallMapDirectionView mSmallMapDirectionView;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -69,20 +69,30 @@ public class SmallMapService extends Service {
|
||||
|
||||
private void addMachineVisionMapView() {
|
||||
Logger.d(TAG, "addMachineVisionMapView");
|
||||
|
||||
mWindowManagerView = new WindowManagerView.Builder(getApplicationContext())
|
||||
.contentView(R.layout.module_small_map_view)
|
||||
.contentView(R.layout.module_small_map_direction_view)
|
||||
.size(
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
.position(
|
||||
getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_x ),
|
||||
getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_y )
|
||||
getResources().getDimensionPixelOffset(R.dimen.module_mvision_view_x),
|
||||
getResources().getDimensionPixelOffset(R.dimen.module_mvision_view_y)
|
||||
)
|
||||
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||
.showInWindowManager();
|
||||
mWindowManagerView.show();
|
||||
|
||||
mSmallMapDirectionView = mWindowManagerView.findViewById(R.id.smallMapDirectionView);
|
||||
|
||||
|
||||
mSmallMapDirectionView.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.changeAngle(-60);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,17 +11,23 @@ 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.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;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/10/20 1:34 PM
|
||||
*/
|
||||
@Route(path = IMogoSmallMapProvider.path)
|
||||
public class SmallVisionProvider implements IMogoSmallMapProvider {
|
||||
@Route(path = MogoServicePaths.PATH_SMALL_MAP)
|
||||
public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusChangedListener {
|
||||
private final String TAG = "SmallVisionProvider";
|
||||
|
||||
private Intent mSmallMapServiceIntent;
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public Fragment createFragment(Context context, Bundle data) {
|
||||
@@ -47,15 +53,55 @@ public class SmallVisionProvider implements IMogoSmallMapProvider {
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Log.d(TAG, "小地图模块初始化……");
|
||||
mSmallMapServiceIntent = new Intent(context, SmallMapService.class);
|
||||
context.startService(mSmallMapServiceIntent);
|
||||
mContext = context;
|
||||
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener(
|
||||
MogoServicePaths.PATH_SMALL_MAP,
|
||||
StatusDescriptor.VR_MODE,
|
||||
this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
Log.d(TAG, "小地图模块销毁……");
|
||||
hidePanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
Log.d(TAG, "小地图模块触发展示……");
|
||||
|
||||
mSmallMapServiceIntent = new Intent(mContext, SmallMapService.class);
|
||||
mContext.startService(mSmallMapServiceIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePanel() {
|
||||
Log.d(TAG, "小地图模块触发隐藏……");
|
||||
|
||||
if (mSmallMapServiceIntent != null) {
|
||||
AbsMogoApplication.getApp().stopService(mSmallMapServiceIntent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeAngle(double angle) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
Log.d(TAG, "onStatusChanged……descriptor=" + descriptor + ",isTrue=" + isTrue);
|
||||
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
if (isTrue) {
|
||||
showPanel();
|
||||
} else {
|
||||
hidePanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.module.small.map.SmallMapDirectionView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/smallMapDirectionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
@@ -1,17 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.module.common.view.RoundLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_small_map_view_border"
|
||||
android:gravity="center"
|
||||
android:id="@+id/rlSmallMapBorder"
|
||||
android:layout_width="@dimen/module_mvision_view_width"
|
||||
android:layout_height="@dimen/module_mvision_view_height"
|
||||
app:roundLayoutRadius="360dp">
|
||||
|
||||
<com.mogo.module.small.map.SmallMapView
|
||||
android:id="@+id/tv"
|
||||
<ImageView
|
||||
android:id="@+id/ivMapBorder"
|
||||
android:layout_width="@dimen/module_mvision_view_width"
|
||||
android:layout_height="@dimen/module_mvision_view_height"
|
||||
android:gravity="center"/>
|
||||
android:src="@drawable/module_small_map_view_border" />
|
||||
|
||||
|
||||
</com.mogo.module.common.view.RoundLayout>
|
||||
@@ -19,6 +19,7 @@ import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.map.IMogoSmallMapProvider;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoMarkerService;
|
||||
@@ -306,4 +307,11 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoMapFrameController getMapFrameControllerApi();
|
||||
|
||||
/**
|
||||
* 地图图层控制接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoSmallMapProvider getSmallMapProviderApi();
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public class MogoServicePaths {
|
||||
* 授权服务
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_AGREEMENT = "/agreement/showFragment";
|
||||
public static final String PATH_AGREEMENT = "/agreement/showFragment";
|
||||
|
||||
/**
|
||||
* 日志上传
|
||||
@@ -299,4 +299,9 @@ public class MogoServicePaths {
|
||||
* 自研地图和高德地图切换
|
||||
*/
|
||||
public static final String PATH_MAP_FRAME_CONTROLLER = "/mapframe/controller";
|
||||
|
||||
/**
|
||||
* 小地图控件
|
||||
*/
|
||||
public static final String PATH_SMALL_MAP = "/small_map/api";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.service.map;
|
||||
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/10/20 1:36 PM
|
||||
*/
|
||||
public interface IMogoSmallMapProvider extends IMogoModuleProvider {
|
||||
|
||||
|
||||
/**
|
||||
* 显示面板
|
||||
*/
|
||||
void showPanel();
|
||||
|
||||
/**
|
||||
* 隐藏面板
|
||||
*/
|
||||
void hidePanel();
|
||||
|
||||
/**
|
||||
* 修改轮盘角度
|
||||
* @param angle 角度值 0-359
|
||||
*/
|
||||
void changeAngle(double angle);
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.map.IMogoSmallMapProvider;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoMarkerService;
|
||||
@@ -251,6 +252,11 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance( IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoSmallMapProvider getSmallMapProviderApi() {
|
||||
return getApiInstance( IMogoSmallMapProvider.class, MogoServicePaths.PATH_SMALL_MAP );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficUploadProvider getTrafficUploadApi() {
|
||||
return getApiInstance(IMogoTrafficUploadProvider.class, MogoServicePaths.PATH_TRAFFIC_UPLOAD);
|
||||
|
||||
Reference in New Issue
Block a user