导航按钮

This commit is contained in:
wangcongtao
2020-09-23 14:05:13 +08:00
parent eb511fa3c1
commit a5b450f765
23 changed files with 101 additions and 39 deletions

View File

@@ -200,6 +200,9 @@ public class MogoServices implements IMogoMapListener,
invokeAutoRefresh();
}
break;
case ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH:
handleCalculationNotHomeCompanyDistanceForPush();
break;
}
}
@@ -855,7 +858,6 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onIntentReceived( String command, Intent intent ) {
if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
onActionDone( MogoAction.Next );
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
@@ -942,6 +944,27 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onStartNavi() {
Logger.d( TAG, "onStartNavi: scheduleCalculationNotHomeCompanyDistanceForPush" );
scheduleCalculationNotHomeCompanyDistanceForPush();
}
@Override
public void onStopNavi() {
Logger.d( TAG, "onStopNavi: remove MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH msg" );
mHandler.removeMessages( ServiceConst.MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
}
/**
* 延时一分钟发起计算导航目的地推送策略
*/
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 handleCalculationNotHomeCompanyDistanceForPush() {
String json = SpStorage.getNavigationTarget();
if ( !TextUtils.isEmpty( json ) ) {
try {
@@ -978,7 +1001,7 @@ public class MogoServices implements IMogoMapListener,
}
} );
} catch ( Exception e ) {
Logger.e( TAG, e, "onStartNavi" );
Logger.e( TAG, e, "handleCalculationNotHomeCompanyDistanceForPush" );
}
}

View File

@@ -208,4 +208,14 @@ public class ServiceConst {
*/
public static final String COMMAND_ONLINE_CAR_PANEL = "com.zhidao.search.riders";
/**
* 导航开始后延时1分钟开启推送策略
*/
public static final int MSG_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH = 0x301;
/**
* 延时1分钟开启推送策略
*/
public static final long INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH = 60 * 1_000L;
}

View File

@@ -151,7 +151,7 @@ class LauncherCardRefresher {
private ZhidaoRefreshModel mZhidaoRefreshModel;
private LauncherCardRefreshStrategy mExplorerWayOrOnlineCarDataStrategy = new LauncherCardRefreshStrategy(
20 * 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

View File

@@ -792,7 +792,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
Logger.d( TAG, "内部 - 请求开始" );
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, new RefreshCallback() {
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit,false, new RefreshCallback() {
@Override
public void onSuccess( Object o ) {
MarkerResponse data = ( MarkerResponse ) o;

View File

@@ -20,6 +20,7 @@ public class RefreshBody {
public boolean onlyFocus; // 是否仅查询已关注的好友
public boolean onlySameCity; // 是否仅查询注册城市相同的同城用户
public boolean viewPush; // 是否走V2X通道 true-401011false -401001
public boolean onlyRealUser;
public static class LatLon {

View File

@@ -124,7 +124,6 @@ public class RefreshModel {
query.put( "data", data );
Logger.d( TAG, data );
mRefreshApiService.refreshDataSync( query )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
@@ -163,12 +162,14 @@ public class RefreshModel {
* @param onlyFocus 是否仅查询已关注的好友
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param callback
* @param onlyRealUser 是否只查询真实用户
*/
public void queryOnLineCarWithRoute( MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
int radius,
int limit,
boolean onlyRealUser,
final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
@@ -181,6 +182,7 @@ public class RefreshModel {
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;
refreshBody.onlyRealUser = onlyRealUser;
refreshBody.dataType.add( ServiceConst.CARD_TYPE_USER_DATA );
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );

View File

@@ -56,6 +56,7 @@ class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implement
false,
mStrategy.getRadius(),
LIMIT,
true,
this
);
} catch ( Exception e ) {