opt
This commit is contained in:
@@ -112,6 +112,6 @@ ext {
|
||||
jetbrainsannotationsjava5: "org.jetbrains:annotations-java5:15.0",
|
||||
|
||||
// 统一登录
|
||||
accountsdk : "com.zhidao.accountservice:account-sdk:1.0.4",
|
||||
accountsdk : "com.zhidao.accountservice:account-sdk:1.0.5",
|
||||
]
|
||||
}
|
||||
@@ -146,6 +146,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
private RefreshCallback mCustomRefreshCallback = new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
mRefreshRemainingTimeStatus = false;
|
||||
// 用户手动操作地图刷新成功后,设置状态为 true,引发延时策略
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true );
|
||||
}
|
||||
@@ -389,6 +390,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
|
||||
|
||||
if ( mIsCameraInited ) {
|
||||
mLastZoomLevel = zoom;
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mIsCameraInited = false;
|
||||
return;
|
||||
@@ -398,6 +400,12 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
refreshCameraPosition();
|
||||
}
|
||||
|
||||
// 部分非用户操作导致地图视图变化:绘线、圈点等不触发用户刷新
|
||||
// 消费状态
|
||||
if ( mStatusManager.isUserInteracted() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动刷新触发
|
||||
if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) {
|
||||
// 缩放级别缩小
|
||||
@@ -406,7 +414,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mLastZoomLevel = zoom;
|
||||
} else if ( mLastZoomLevel - zoom < 0 ) {
|
||||
mLastZoomLevel = zoom;
|
||||
|
||||
} else if ( mLastZoomLevel == zoom ) {
|
||||
// 手动平移
|
||||
if ( invokeRefreshWhenTranslationByUser( latLng ) ) {
|
||||
@@ -453,16 +460,18 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
return;
|
||||
}
|
||||
// 自动刷新触发
|
||||
final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
if ( mLastAutoRefreshLocation == null ) {
|
||||
mLastAutoRefreshLocation = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
mLastAutoRefreshLocation = point;
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
return;
|
||||
}
|
||||
mLastAutoRefreshLocation = point;
|
||||
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
if ( distance > mAutoRefreshStrategy.getDistance() ) {
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true );
|
||||
mUiController.moveToCenter( mLastAutoRefreshLocation );
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
} else {
|
||||
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
if ( distance > mAutoRefreshStrategy.getDistance() ) {
|
||||
// 触发自动刷新之前,将未消费的用户状态清除
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, false, false );
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,9 +482,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isUserInteracted() ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, mAutoRefreshCallback == callback ? "触发自动刷新" : "触发手动刷新" );
|
||||
int amount = mLastZoomLevel >= 10 ? 5 : 10;
|
||||
mRefreshModel.refreshData( latLng, radius, mLastZoomLevel >= 10 ? 5 : 10, callback );
|
||||
@@ -508,7 +514,8 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
switch ( descriptor ) {
|
||||
case USER_INTERACTED:
|
||||
if ( isTrue ) {
|
||||
if ( isTrue && !mRefreshRemainingTimeStatus ) {
|
||||
mRefreshRemainingTimeStatus = true;
|
||||
mRefreshRemainingTime += mAutoRefreshStrategy.getInterruptInterval();
|
||||
Logger.i( TAG, "用户状态改变,自动刷新时间延时,%s ms后自动刷新", mRefreshRemainingTime );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user