smooth move (using test data)
This commit is contained in:
@@ -228,10 +228,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private RefreshCallback mCustomRefreshCallback = new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
public void onSuccess(Object o) {
|
||||
mLoopRequest = false;
|
||||
// 用户手动操作地图刷新成功后,设置状态为 true,引发延时策略
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -245,7 +246,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private RefreshCallback mAutoRefreshCallback = new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
public void onSuccess(Object o) {
|
||||
mLoopRequest = false;
|
||||
Logger.d( TAG, "request Success." );
|
||||
invokeAutoRefreshStrategy();
|
||||
@@ -342,6 +343,8 @@ 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);
|
||||
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
}
|
||||
}
|
||||
@@ -643,7 +646,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
} else {
|
||||
// 搜索后,打开打点策略
|
||||
if ( mAutoRefreshCallback != null ) {
|
||||
mAutoRefreshCallback.onSuccess();
|
||||
mAutoRefreshCallback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -697,7 +700,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
refreshStrategy();
|
||||
// ADAS关闭后,打开打点策略
|
||||
if ( mAutoRefreshCallback != null ) {
|
||||
mAutoRefreshCallback.onSuccess();
|
||||
mAutoRefreshCallback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -23,4 +24,9 @@ public interface RefreshApiService {
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
|
||||
Observable<MarkerResponse> queryOnLineCarWithRoute(@FieldMap Map< String, Object > parameters );
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public class RefreshBody {
|
||||
public int radius = 2_000; // 地理围栏半径(米)
|
||||
public LatLon location; // 坐标
|
||||
|
||||
public String sn;
|
||||
public boolean onlyFocus; // 是否仅查询已关注的好友
|
||||
public boolean onlySameCity; // 是否仅查询注册城市相同的同城用户
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ package com.mogo.module.service.network;
|
||||
* <p>
|
||||
* 刷新回调
|
||||
*/
|
||||
public interface RefreshCallback {
|
||||
public interface RefreshCallback <T> {
|
||||
|
||||
void onSuccess();
|
||||
void onSuccess(T o);
|
||||
|
||||
void onFail();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
@@ -73,7 +75,7 @@ public class RefreshModel {
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess();
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +131,7 @@ public class RefreshModel {
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess();
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,4 +145,52 @@ public class RefreshModel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆 及路线
|
||||
*
|
||||
* @param latLng 经纬度
|
||||
* @param onlyFocus 是否仅查询已关注的好友
|
||||
* @param onlySameCity 是否仅查询注册城市相同的同城用户
|
||||
* @param callback
|
||||
*/
|
||||
public void queryOnLineCarWithRoute(MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
final RefreshCallback callback){
|
||||
if (mRefreshApiService != null) {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.sn = Utils.getSn();
|
||||
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lng);
|
||||
refreshBody.onlyFocus = onlyFocus;
|
||||
refreshBody.onlySameCity = onlySameCity;
|
||||
|
||||
query.put("data", GsonUtil.jsonFromObject(refreshBody));
|
||||
mRefreshApiService.queryOnLineCarWithRoute(query)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)){
|
||||
@Override
|
||||
public void onSuccess(MarkerResponse o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
callback.onFail();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user