目的地车友白天模式及其他

This commit is contained in:
wangcongtao
2020-09-24 15:10:41 +08:00
parent 5cb983ce8e
commit b993d77be1
35 changed files with 249 additions and 26 deletions

View File

@@ -201,7 +201,7 @@ public class MogoServices implements IMogoMapListener,
}
break;
case ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH:
handleCalculationNotHomeCompanyDistanceForPush();
handleCalculationNotHomeCompanyDistanceForPush( msg.arg1 );
break;
}
}
@@ -944,8 +944,12 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onStartNavi() {
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush" );
scheduleCalculationNotHomeCompanyDistanceForPush();
if ( DebugConfig.isIsScheduleCalculateNotHomeCompanyDistanceForPush() ) {
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush" );
scheduleCalculationNotHomeCompanyDistanceForPush( 1, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
} else {
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush un support" );
}
}
@Override
@@ -957,14 +961,22 @@ public class MogoServices implements IMogoMapListener,
/**
* 延时一分钟发起计算导航目的地推送策略
*/
private void scheduleCalculationNotHomeCompanyDistanceForPush() {
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH, ServiceConst.INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
private void scheduleCalculationNotHomeCompanyDistanceForPush( int time, long delay ) {
Message msg = Message.obtain();
msg.what = ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH;
msg.arg1 = time;
mHandler.sendMessageDelayed( msg, delay );
}
/**
* 发起计算导航目的地推送策略
*
* @param time 第x次重试
*/
private void handleCalculationNotHomeCompanyDistanceForPush() {
private void handleCalculationNotHomeCompanyDistanceForPush( final int time ) {
if ( time > 3 ) {
return;
}
String json = SpStorage.getNavigationTarget();
if ( !TextUtils.isEmpty( json ) ) {
try {
@@ -993,6 +1005,9 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onError( Throwable e ) {
super.onError( e );
Logger.d( TAG, "re scheduleCalculationNotHomeCompanyDistanceForPush after 30s" );
// 延时30s重试
scheduleCalculationNotHomeCompanyDistanceForPush( time + 1, 30_000L );
}
@Override

View File

@@ -3,7 +3,10 @@ package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.mogo.commons.storage.SpStorage;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.service.MarkerServiceHandler;
public
@@ -17,6 +20,12 @@ class OnlineCarPanelIntentHandler implements IntentHandler {
@Override
public void handle( Context context, Intent intent ) {
String json = SpStorage.getNavigationTarget();
if ( TextUtils.isEmpty( json ) ) {
AIAssist.getInstance( context ).speakTTSVoice( "没有导航目的地" );
return;
}
AIAssist.getInstance( context ).speakTTSVoice( "正在查询" );
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
MarkerServiceHandler.getApis().getOnlineCarPanelApi().showPanel();
} else {

View File

@@ -76,6 +76,11 @@ class LauncherCardRefresher {
*/
private int mDefaultConfigCounter = 0;
/**
* 事件/车友播报次数
*/
private int mMsgExplorerWayOrOnlineCarDataCounter = 0;
/**
* 因为缓存ticket失效导致失败的情况需要重新请求ticket然后再次获取数据这里重试3次
*/
@@ -151,18 +156,18 @@ class LauncherCardRefresher {
private ZhidaoRefreshModel mZhidaoRefreshModel;
private LauncherCardRefreshStrategy mExplorerWayOrOnlineCarDataStrategy = new LauncherCardRefreshStrategy(
40 * ONE_MINUTE,null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA
40 * ONE_MINUTE, null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA
);
private LauncherCardRefreshStrategy mInduceStrategy = new LauncherCardRefreshStrategy(
3 * ONE_MINUTE,mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE
3 * ONE_MINUTE, mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE
);
private LauncherCardRefreshStrategy mLauncherCardConfigStrategy = new LauncherCardRefreshStrategy(
2 * ONE_MINUTE,mInduceStrategy, MSG_REFRESH_DEFAULT_CARD
2 * ONE_MINUTE, mInduceStrategy, MSG_REFRESH_DEFAULT_CARD
);
private LauncherCardRefreshStrategy mRefreshStrategy = mLauncherCardConfigStrategy;
public void start() {
if ( DebugConfig.isLauncher() || DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ) {
if ( !DebugConfig.isIsSupportLauncherCardRefreshStrategy() ) {
return;
}
if ( mStart ) {
@@ -172,6 +177,7 @@ class LauncherCardRefresher {
mLaunchTTSText = mContext.getString( R.string.module_service_open_app_tip );
mDefaultConfigCounter = 0;
mRefreshTicketCounter = 0;
mMsgExplorerWayOrOnlineCarDataCounter = 0;
mRefreshStrategy = mLauncherCardConfigStrategy;
// 延时加载数据已保证accOn之后网络恢复正常
long delay = ONE_MINUTE;
@@ -238,6 +244,10 @@ class LauncherCardRefresher {
restart();
return;
}
mMsgExplorerWayOrOnlineCarDataCounter++;
if ( mMsgExplorerWayOrOnlineCarDataCounter > 2 ) {
return;
}
MogoLatLng latLng = new MogoLatLng( location.getLatitude(), location.getLongitude() );
handleRefreshExplorerWayOrOnlineCarData( latLng, mRefreshStrategy.getType() );
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.service.marker;
import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
import android.util.Log;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.LinearInterpolator;
@@ -16,6 +17,7 @@ import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.entity.MarkerCarPois;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
@@ -187,9 +189,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
// 在线车辆点击使用infoWindow
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
if ( !mogoMarker.isDestroyed() ) {
mogoMarker.setInfoWindowAdapter( UserDataMarkerInfoWindowAdapter.getInstance( mContext ) );
mogoMarker.showInfoWindow();
Logger.d( TAG, "打开info window" );
try {
MarkerOnlineCar onlineCar = ( MarkerOnlineCar ) ( ( MarkerShowEntity ) mogoMarker.getObject() ).getBindObj();
CallChatApi.getInstance().showUserWindow( mContext, onlineCar );
} catch ( Exception e ) {
Logger.e( TAG, e, "openMarker" );
}
}
} else {
Object object = mogoMarker.getObject();
@@ -220,7 +225,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
// 在线车辆点击使用infoWindow
if ( TextUtils.equals( mogoMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
mogoMarker.hideInfoWindow();
// mogoMarker.hideInfoWindow();
Logger.d( TAG, "关闭info window" );
} else {
Object object = mogoMarker.getObject();
@@ -792,7 +797,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
Logger.d( TAG, "内部 - 请求开始" );
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit,false, new RefreshCallback() {
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
@Override
public void onSuccess( Object o ) {
MarkerResponse data = ( MarkerResponse ) o;
@@ -977,7 +982,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
return;
}
if ( mLastDataResult != null ) {
runOnTargetThread( ()->{
runOnTargetThread( () -> {
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
drawMarkerByCurrentType( mLastDataResult );
mLastCheckMarker = null;

View File

@@ -198,6 +198,14 @@ public class RefreshModel {
}
}
@Override
public void onError( Throwable e ) {
super.onError( e );
if ( callback != null ) {
callback.onFail();
}
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );

View File

@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.request.RequestOptions;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
@@ -21,6 +22,7 @@ import com.mogo.module.service.Utils;
import com.mogo.utils.ResourcesHelper;
import com.mogo.utils.WindowUtils;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -32,6 +34,8 @@ import java.util.List;
*/
class OnlineCarPanelAdapter extends RecyclerView.Adapter< OnlineCarPanelAdapter.VH > {
private static final String TAG = "OnlineCarPanelAdapter";
private List< MarkerOnlineCar > mDatums;
private double mToLon;
private double mToLat;
@@ -89,6 +93,11 @@ class OnlineCarPanelAdapter extends RecyclerView.Adapter< OnlineCarPanelAdapter.
distance.setText( content );
detail.setOnClickListener( view -> {
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "Mogoer_List_click", null );
try {
CallChatApi.getInstance().showUserWindow( itemView.getContext(), car );
} catch ( Exception e ) {
Logger.e( TAG, e, "detail.OnClick" );
}
} );
}

View File

@@ -113,6 +113,7 @@ public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, On
mRefreshPanel.setVisibility( View.VISIBLE );
mLoading.setVisibility( View.GONE );
AIAssist.getInstance( getContext() ).speakTTSVoice( "未找到车友" );
if ( strategy == null ) {
m20KMStrategy.setVisibility( View.GONE );
m40KMStrategy.setVisibility( View.GONE );