[2.13.0][fix]全览地图开启、结束V2X事件定时轮询
This commit is contained in:
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||
public class OverviewMapFragment extends BaseFragment
|
||||
implements IMogoSmallMapProvider {
|
||||
private final String TAG = "SmallMapFragment";
|
||||
private final String TAG = "OverviewMapFragment";
|
||||
protected AMapCustomView mAMapCustomView;
|
||||
private OverViewModel mViewModel;
|
||||
|
||||
@@ -80,22 +80,24 @@ public class OverviewMapFragment extends BaseFragment
|
||||
|
||||
@Override
|
||||
public void startQueryV2XEvents() {
|
||||
long lineId = getLineId();
|
||||
if (lineId > 0) {
|
||||
mViewModel.getAllV2XEventsByLineId("" + lineId, MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
if (isAdded()) {
|
||||
long lineId = getLineId();
|
||||
if (lineId > 0 && mViewModel != null) {
|
||||
mViewModel.getAllV2XEventsByLineId("" + lineId, MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearV2XMarkers() {
|
||||
if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
|
||||
UiThreadHandler.post(() -> {
|
||||
if (isAdded()) {
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.clearV2XMarkers();
|
||||
});
|
||||
} else {
|
||||
mAMapCustomView.clearV2XMarkers();
|
||||
}
|
||||
if (mViewModel != null) {
|
||||
mViewModel.stopQueryV2XEvents();
|
||||
}
|
||||
}
|
||||
mViewModel.stopQueryV2XEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,7 +138,6 @@ public class OverviewMapFragment extends BaseFragment
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Taxi的下发的轨迹id
|
||||
*/
|
||||
private long getLineId() {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
import android.os.Looper
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -16,6 +18,10 @@ object CallerSmpManager : CallerBase() {
|
||||
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP)
|
||||
.navigation() as IMogoSmallMapProvider
|
||||
|
||||
private val mogoOverViewMapProvider: IMogoSmallMapProvider
|
||||
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_OVERVIEW)
|
||||
.navigation() as IMogoSmallMapProvider
|
||||
|
||||
/**
|
||||
* 绘制路径线
|
||||
*/
|
||||
@@ -50,11 +56,23 @@ object CallerSmpManager : CallerBase() {
|
||||
|
||||
@JvmStatic
|
||||
fun startQueryV2XEvents() {
|
||||
mogoSmallMapProvider.startQueryV2XEvents()
|
||||
if (Thread.currentThread() !== Looper.getMainLooper().thread) {
|
||||
UiThreadHandler.post {
|
||||
mogoOverViewMapProvider.startQueryV2XEvents()
|
||||
}
|
||||
} else {
|
||||
mogoOverViewMapProvider.startQueryV2XEvents()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun clearV2XMarkers() {
|
||||
mogoSmallMapProvider.clearV2XMarkers()
|
||||
if (Thread.currentThread() !== Looper.getMainLooper().thread) {
|
||||
UiThreadHandler.post {
|
||||
mogoOverViewMapProvider.clearV2XMarkers()
|
||||
}
|
||||
} else {
|
||||
mogoOverViewMapProvider.clearV2XMarkers()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user