Merge branch 'dev' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev
# Conflicts: # modules/mogo-module-media/src/main/java/com/mogo/module/media/MediaWindow2.java
This commit is contained in:
@@ -82,7 +82,7 @@ android {
|
||||
// launcher app
|
||||
launcher{
|
||||
dimension "basic"
|
||||
applicationId rootProject.ext.android.zhidadoApplicationId
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
// 是否启动位置服务
|
||||
buildConfigField 'boolean', 'LAUNCH_LOCATION_SERVICE', 'true'
|
||||
// 是否使用自定义导航
|
||||
|
||||
@@ -69,7 +69,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
super.init();
|
||||
IMogoSocketManager mMogoSocketManager = ARouter.getInstance().navigation( IMogoSocketManager.class );
|
||||
if ( mMogoSocketManager != null ) {
|
||||
mMogoSocketManager.init(getApplicationContext(), BuildConfig.APPLICATION_ID);
|
||||
mMogoSocketManager.init(getApplicationContext(), "com.mogo.launcher");
|
||||
} else {
|
||||
Logger.e( TAG, "init socket server error." );
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.elegant.analytics.Analytics;
|
||||
import com.elegant.analytics.AnalyticsConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.device.Devices;
|
||||
import com.mogo.commons.network.AllAllowedHostnameVerifier;
|
||||
import com.mogo.commons.network.Constants;
|
||||
import com.mogo.commons.network.ParamsUtil;
|
||||
@@ -106,6 +107,8 @@ public class AbsMogoApplication extends Application {
|
||||
// 2 - 本地缓存,聚合上报,积累30条埋点上报,或者积累60秒上报一次。
|
||||
AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 2 : 2 );
|
||||
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
|
||||
|
||||
Devices.checkBindState();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class Devices {
|
||||
|
||||
public static final Uri CONTENT_URI_BIND = Uri.parse( "content://com.zhidao.guide.lock.product.bindstatus/status" );
|
||||
|
||||
private static boolean sIsBind = false;
|
||||
|
||||
/**
|
||||
* 检测车机激活状态
|
||||
*
|
||||
@@ -33,11 +35,15 @@ class Devices {
|
||||
return false;
|
||||
}
|
||||
int status = cursor.getInt( cursor.getColumnIndex( "lock_status" ) );
|
||||
return ( status == 1 );
|
||||
return sIsBind = ( status == 1 );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isBind() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.media.utils;
|
||||
package com.mogo.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -70,7 +70,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
|
||||
# 在线车辆F
|
||||
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
|
||||
# v2x
|
||||
MOGO_MODULE_V2X_VERSION=1.0.24
|
||||
MOGO_MODULE_V2X_VERSION=1.0.32
|
||||
# 媒体卡片
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.11
|
||||
# 推送
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.device.Devices;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.apps.adapter.AppIndicatorAdapter;
|
||||
@@ -17,6 +18,7 @@ import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
import com.mogo.module.apps.applaunch.BaseAppLauncher;
|
||||
import com.mogo.module.apps.applaunch.InternalFunctionLauncher;
|
||||
import com.mogo.module.apps.model.NavigatorApps;
|
||||
import com.mogo.module.apps.view.OnAiAssistClickListener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -63,10 +65,7 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
mAIAssistContainer = findViewById( R.id.module_apps_id_ai_assist_container );
|
||||
mAIAssist = findViewById( R.id.module_apps_id_ai_assist );
|
||||
mAnim.initAnim( mAIAssist );
|
||||
mAIAssist.setOnClickListener( view -> {
|
||||
AIAssist.startAssistant( getContext() );
|
||||
trackNavigatorClickEvent( 5 );
|
||||
} );
|
||||
mAIAssist.setOnClickListener( new OnAiAssistClickListener() );
|
||||
mAIAssistContainer.setOnClickListener( view -> {
|
||||
mAIAssist.performClick();
|
||||
} );
|
||||
|
||||
@@ -5,18 +5,14 @@ import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
@@ -10,11 +10,9 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.content.Context;
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.mogo.module.apps.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class LaunchUtils {
|
||||
|
||||
/**
|
||||
* 通过包名启动app
|
||||
*
|
||||
* @param context
|
||||
* @param pkg 包名
|
||||
*/
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception {
|
||||
Intent intent = getLaunchIntentForPackage( context, pkg );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage( Context context, String pkg ) {
|
||||
return context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.module.apps.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.device.Devices;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/9
|
||||
*
|
||||
* 如果已经激活设备,则按照正常流程打开语音,否则需要连续点击5下才能打开
|
||||
*/
|
||||
class OnAiAssistClickListener implements View.OnClickListener {
|
||||
|
||||
public static final int TOTAL_CLICK_AMOUNT = 5;
|
||||
public static final int INTERVAL = 2_000 / TOTAL_CLICK_AMOUNT;
|
||||
|
||||
private int mClickCounter = 0;
|
||||
private long mLastClickTime = 0L;
|
||||
|
||||
private boolean mDebugModeOpen = false;
|
||||
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
if ( Devices.isBind() ) {
|
||||
AIAssist.startAssistant( v.getContext() );
|
||||
trackNavigatorClickEvent( 5 );
|
||||
} else {
|
||||
if ( mDebugModeOpen ) {
|
||||
AIAssist.startAssistant( v.getContext(), 2 );
|
||||
trackNavigatorClickEvent( 5 );
|
||||
return;
|
||||
}
|
||||
if ( mClickCounter == 0 ) {
|
||||
mLastClickTime = System.currentTimeMillis();
|
||||
mClickCounter++;
|
||||
} else {
|
||||
if ( mClickCounter == TOTAL_CLICK_AMOUNT && !mDebugModeOpen ) {
|
||||
AIAssist.startAssistant( v.getContext(), 2 );
|
||||
TipToast.shortTip( "开启语音调试" );
|
||||
mClickCounter = 0;
|
||||
mLastClickTime = 0L;
|
||||
mDebugModeOpen = true;
|
||||
} else if ( System.currentTimeMillis() - mLastClickTime > INTERVAL ) {
|
||||
mClickCounter = 0;
|
||||
TipToast.shortTip( "请在2秒内打开调试模式" );
|
||||
} else {
|
||||
mClickCounter++;
|
||||
}
|
||||
mLastClickTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void trackNavigatorClickEvent( int type ) {
|
||||
final Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "type", type );
|
||||
AppServiceHandler.getMogoAnalytics().track( "Launcher_APP_Icon", properties );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import androidx.annotation.Nullable;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.utils.LaunchUtils;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class LaunchUtils {
|
||||
|
||||
/**
|
||||
* 通过包名启动app
|
||||
*
|
||||
* @param context
|
||||
* @param pkg 包名
|
||||
*/
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception {
|
||||
Intent intent = getLaunchIntentForPackage( context, pkg );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage( Context context, String pkg ) {
|
||||
return context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,12 @@ import com.mogo.module.media.constants.MusicConstant;
|
||||
import com.mogo.module.media.listener.NoDoubleClickListener;
|
||||
import com.mogo.module.media.model.MediaInfoData;
|
||||
import com.mogo.module.media.presenter.WeCarFlowPresenter;
|
||||
import com.mogo.module.media.utils.LaunchUtils;
|
||||
import com.mogo.module.media.utils.Utils;
|
||||
import com.mogo.module.media.view.IMusicView;
|
||||
import com.mogo.module.media.widget.AnimCircleImageView;
|
||||
import com.mogo.module.media.widget.NoScrollSeekBar;
|
||||
import com.mogo.module.media.widget.ScrollingTextView;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.FlowPlayControl;
|
||||
|
||||
@@ -5,14 +5,12 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -29,13 +27,11 @@ import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
@@ -59,10 +55,8 @@ import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -363,7 +357,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( msg.obj instanceof RefreshObject ) {
|
||||
RefreshObject ro = ( ( RefreshObject ) msg.obj );
|
||||
mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
|
||||
MapMarkerManager.getInstance().getOnlineCarData( ro.mLonLat );
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
|
||||
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
}
|
||||
@@ -724,6 +718,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
delay = mRefreshRemainingTime;
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay );
|
||||
MapMarkerManager.getInstance().stopAutoRefresh();
|
||||
Logger.i( TAG, "下次刷新时间:%ss后", mRefreshRemainingTime );
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,8 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
|
||||
isSameCity = true;
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE:
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE:
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( target );
|
||||
MapMarkerManager.getInstance().getOnlineCarData(
|
||||
Logger.d( TAG, "搜索附近的好友/在线车辆" );
|
||||
doDataRequest(
|
||||
target,
|
||||
isFocus,
|
||||
isSameCity,
|
||||
@@ -111,9 +110,7 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
|
||||
}
|
||||
|
||||
if ( TextUtils.equals( "附近", keyword ) ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( target );
|
||||
MapMarkerManager.getInstance().getOnlineCarData(
|
||||
doDataRequest(
|
||||
target,
|
||||
false,
|
||||
false,
|
||||
@@ -130,9 +127,7 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
|
||||
Logger.e( TAG, "geo 检索位置错误" );
|
||||
return;
|
||||
}
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( geocodeResult.getAddresses().get( 0 ).getLatlng() );
|
||||
MapMarkerManager.getInstance().getOnlineCarData(
|
||||
doDataRequest(
|
||||
target,
|
||||
false,
|
||||
false,
|
||||
@@ -164,4 +159,20 @@ class OnlineCarSearchIntentHandler implements IntentHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doDataRequest( MogoLatLng target,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 30_000 );
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( target );
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByVoiceControl(
|
||||
target,
|
||||
onlyFocus,
|
||||
onlySameCity,
|
||||
limit,
|
||||
radius );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
|
||||
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.IMogoMarkerManager;
|
||||
@@ -16,12 +17,12 @@ import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShareMusic;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
@@ -29,6 +30,7 @@ import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.utils.ViewUtils;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -67,6 +69,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// 平滑移动事件间隔(单位:秒)
|
||||
private static final int SMOOTH_DURATION = 15;
|
||||
|
||||
private Rect mMarkerDisplayBounds;
|
||||
|
||||
private MapMarkerManager() {
|
||||
}
|
||||
|
||||
@@ -272,16 +276,26 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*
|
||||
* @param onlineCarList
|
||||
*/
|
||||
private void drawOnlineCarMarkers( List< MarkerOnlineCar > onlineCarList, int maxAmount ) {
|
||||
private void drawOnlineCarMarkers( List< MarkerOnlineCar > onlineCarList,
|
||||
int maxAmount,
|
||||
boolean clearOld,
|
||||
boolean showBounds,
|
||||
Rect bound,
|
||||
MogoLatLng centerPoint ) {
|
||||
// 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗
|
||||
if ( onlineCarList == null || onlineCarList.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( clearOld ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
}
|
||||
|
||||
int size = getAppropriateSize( maxAmount, onlineCarList );
|
||||
|
||||
Map< String, IMogoMarker > existCarMap = purgeMarkerData( onlineCarList, ModuleNames.CARD_TYPE_USER_DATA );
|
||||
|
||||
List< MogoLatLng > carPoints = new ArrayList<>();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerOnlineCar markerOnlineCar = onlineCarList.get( i );
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
@@ -295,6 +309,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
markerShowEntity.setIconUrl( markerOnlineCar.getUserInfo().getUserHead() );
|
||||
}
|
||||
|
||||
if ( i <= 5 ) {
|
||||
carPoints.add( new MogoLatLng( markerLocation.getLat(), markerLocation.getLon() ) );
|
||||
}
|
||||
|
||||
String sn = getCarSnFromEntity( markerOnlineCar );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
@@ -302,6 +320,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
startSmooth( mogoMarker, markerOnlineCar, markerLocation );
|
||||
}
|
||||
|
||||
if ( showBounds && bound != null ) {
|
||||
// 将前6个点显示在固定范围内
|
||||
MarkerServiceHandler.getMapUIController().showBounds( TAG, centerPoint, carPoints, bound, false );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,34 +685,58 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
mCarLatLng = new MogoLatLng( lat, lon );
|
||||
}
|
||||
|
||||
public void getOnlineCarData( MogoLatLng latlng ) {
|
||||
getOnlineCarData( latlng, false, false, 50, 2_000 );
|
||||
}
|
||||
|
||||
public void getOnlineCarData( MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
public void getOnlineCarDataByAutoRefreshStrategy( MogoLatLng latlng ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
|
||||
getOnlineCarList( latLng, onlyFocus, onlySameCity, limit, radius );
|
||||
getOnlineCarDataImpl( latlng, false, false, 50, 2_000, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param latLng
|
||||
* @param onlyFocus
|
||||
* @param onlySameCity
|
||||
* @param limit
|
||||
* @param radius
|
||||
*/
|
||||
public void getOnlineCarDataByVoiceControl( MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
|
||||
getOnlineCarDataImpl( latLng, onlyFocus, onlySameCity, limit, radius, true );
|
||||
}
|
||||
|
||||
private Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getOnlineCarList( mCarLatLng, false, false, 2_000, 50 );
|
||||
getOnlineCarDataImpl( mCarLatLng, false, false, 50, 2_000, false );
|
||||
UiThreadHandler.postDelayed( this, SMOOTH_DURATION * 1000 );
|
||||
}
|
||||
};
|
||||
|
||||
private void getOnlineCarList(
|
||||
public void stopAutoRefresh(){
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索在线车辆
|
||||
*
|
||||
* @param latLng 搜索中心点
|
||||
* @param onlyFocus 是否关注
|
||||
* @param onlySameCity 是否是相同城市
|
||||
* @param limit 条数限制
|
||||
* @param radius 搜索半径
|
||||
* @param fitBounds 是否显示在可视范围内
|
||||
*/
|
||||
private void getOnlineCarDataImpl(
|
||||
MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
int radius,
|
||||
boolean fitBounds ) {
|
||||
|
||||
if ( latLng == null ) {
|
||||
return;
|
||||
@@ -716,8 +763,17 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
int size = onlineCarList == null ? 0 : onlineCarList.size();
|
||||
trackData( size );
|
||||
|
||||
if ( mMarkerDisplayBounds == null ) {
|
||||
mMarkerDisplayBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_leftMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_topMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_rightMargin ),
|
||||
ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_service_marker_bounds_bottomMargin )
|
||||
);
|
||||
}
|
||||
|
||||
runOnTargetThread( () -> {
|
||||
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE );
|
||||
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@@ -7,4 +7,10 @@
|
||||
<dimen name="module_service_marker_bubble_icon_width">50px</dimen>
|
||||
<dimen name="module_service_marker_bubble_icon_height">50px</dimen>
|
||||
<dimen name="module_service_marker_bubble_icon_marginTop">24px</dimen>
|
||||
|
||||
<!-- 导航查看全程显示范围-->
|
||||
<dimen name="module_service_marker_bounds_leftMargin">1000px</dimen>
|
||||
<dimen name="module_service_marker_bounds_topMargin">390px</dimen>
|
||||
<dimen name="module_service_marker_bounds_bottomMargin">200px</dimen>
|
||||
<dimen name="module_service_marker_bounds_rightMargin">200px</dimen>
|
||||
</resources>
|
||||
@@ -7,4 +7,9 @@
|
||||
<dimen name="module_service_marker_bubble_icon_width">27px</dimen>
|
||||
<dimen name="module_service_marker_bubble_icon_height">27px</dimen>
|
||||
<dimen name="module_service_marker_bubble_icon_marginTop">14px</dimen>
|
||||
|
||||
<dimen name="module_service_marker_bounds_leftMargin">550px</dimen>
|
||||
<dimen name="module_service_marker_bounds_topMargin">208px</dimen>
|
||||
<dimen name="module_service_marker_bounds_bottomMargin">100px</dimen>
|
||||
<dimen name="module_service_marker_bounds_rightMargin">100px</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user