Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
This commit is contained in:
@@ -58,8 +58,8 @@ import java.util.List;
|
||||
* 数据刷新策略
|
||||
* <p>
|
||||
* 1. 位置移动触发刷新
|
||||
* 2. 用户手势交互导致地图视图移动跨过当前视图
|
||||
* 3. 用户手势缩小比例尺级别达2级
|
||||
* 2. 用户手势交互导致地图视图移动跨过当前视图,延时 1 分钟,不累加
|
||||
* 3. 用户手势缩小比例尺级别达2级,延时 1 分钟,不累加
|
||||
* 4. 用户交互语音导致地图视图移动,缩放,不触发刷新
|
||||
*/
|
||||
@Route( path = ServiceConst.PATH_REFRESH_STRATEGY )
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -180,6 +181,9 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
}
|
||||
};
|
||||
|
||||
// 延时状态
|
||||
private boolean mRefreshRemainingTimeStatus = false;
|
||||
|
||||
@Override
|
||||
public final Fragment createFragment( Context context, Bundle data ) {
|
||||
return null;
|
||||
@@ -386,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;
|
||||
@@ -395,6 +400,12 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
refreshCameraPosition();
|
||||
}
|
||||
|
||||
// 部分非用户操作导致地图视图变化:绘线、圈点等不触发用户刷新
|
||||
// 消费状态
|
||||
if ( mStatusManager.isUserInteracted() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 手动刷新触发
|
||||
if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) {
|
||||
// 缩放级别缩小
|
||||
@@ -403,7 +414,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mLastZoomLevel = zoom;
|
||||
} else if ( mLastZoomLevel - zoom < 0 ) {
|
||||
mLastZoomLevel = zoom;
|
||||
|
||||
} else if ( mLastZoomLevel == zoom ) {
|
||||
// 手动平移
|
||||
if ( invokeRefreshWhenTranslationByUser( latLng ) ) {
|
||||
@@ -450,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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,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 );
|
||||
@@ -505,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 );
|
||||
}
|
||||
|
||||
@@ -463,7 +463,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
public void onCmdSelected(String cmd) {
|
||||
Logger.d(TAG, "免唤醒 onCmdSelected mogoVoiceListener cmd =" + cmd);
|
||||
if (cmd.equals(TanluConstants.PLAY_VIDEO)) { //播放路况 --ok
|
||||
//TODO
|
||||
FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime);
|
||||
}
|
||||
}
|
||||
@@ -709,17 +708,11 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
refreshVideoData(markerExploreWay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
mRootLayout.setVisibility(View.GONE);
|
||||
mEmptyTv.setText(Html.fromHtml(getContext().getString(R.string.main_empty_content)));
|
||||
}
|
||||
|
||||
//TODO liyz
|
||||
getRoadLineData();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -868,17 +861,21 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
|
||||
/**
|
||||
* push 类型,1为导航数据,2为通勤族 TODO
|
||||
* push 类型,1为导航数据,2为通勤族
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onPushInfo(final PushTypeInfo event) {
|
||||
Logger.d(TAG, " onPushInfo event.type =" + event.type);
|
||||
if (event.type.equals("1")) {
|
||||
getNaviRoadLineInfo();
|
||||
} else if (event.type.equals("2")) {
|
||||
getRoadLineData();
|
||||
if (event != null && TextUtils.isEmpty(event.type)) {
|
||||
Logger.d(TAG, " onPushInfo event.type =" + event.type);
|
||||
if (event.type.equals("1")) {
|
||||
getNaviRoadLineInfo();
|
||||
} else if (event.type.equals("2")) {
|
||||
getRoadLineData();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "event == null ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -913,16 +910,17 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
//绘制线路线
|
||||
if (o != null && o.getPointList() != null && o.getPointList().size() > 0) {
|
||||
drawMapLine(o.getPointList());
|
||||
if (o != null && o.getResult() != null && o.getResult().getPointList() != null
|
||||
&& o.getResult().getPointList().size() > 0) {
|
||||
drawMapLine(o.getResult().getPointList());
|
||||
} else {
|
||||
Logger.e(TAG, "getRoadLineData onSuccess o.getPointList() == null");
|
||||
Log.e(TAG, "getRoadLineData onSuccess o.getPointList() == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
Logger.d(TAG, "getRoadLineData onFail message =" + message + ">>>code =" + code);
|
||||
Log.e(TAG, "getRoadLineData onFail message =" + message + ">>>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -935,16 +933,17 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
//绘制线路线
|
||||
if (o != null && o.getPointList() != null && o.getPointList().size() > 0) {
|
||||
drawMapLine(o.getPointList());
|
||||
if (o != null && o.getResult() != null && o.getResult().getPointList() != null
|
||||
&& o.getResult().getPointList().size() > 0) {
|
||||
drawMapLine(o.getResult().getPointList());
|
||||
} else {
|
||||
Logger.e(TAG, "getNaviRoadLineInfo onSuccess o.getPointList() == null");
|
||||
Log.e(TAG, "getNaviRoadLineInfo onSuccess o.getPointList() == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onFail message =" + message + ">>>code =" + code);
|
||||
Log.e(TAG, "getNaviRoadLineInfo onFail message =" + message + ">>>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -953,8 +952,11 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
* 绘制线路
|
||||
*/
|
||||
private void drawMapLine(List<Center> pointList) {
|
||||
//避免人为操作,刷新
|
||||
mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
|
||||
|
||||
int intervalNum = Utils.getIntervalValue(pointList.size());
|
||||
Logger.d(TAG, "drawMapLine intervalNum = $intervalNum -- pointList.size = ${pointList.size}");
|
||||
Logger.d(TAG, "drawMapLine intervalNum = " + intervalNum + ">>> pointList.size =" + pointList.size());
|
||||
int listSize = pointList.size();
|
||||
passedByPoints = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -9,22 +9,35 @@ import java.util.List;
|
||||
* @since 2020-01-08
|
||||
*/
|
||||
public class PathLineResult extends BaseData {
|
||||
private List<Information> informations;
|
||||
private List<Center> pointList;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
private PathResult result;
|
||||
|
||||
public PathResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
public void setResult(PathResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public List<Center> getPointList() {
|
||||
return pointList;
|
||||
}
|
||||
public static class PathResult {
|
||||
private List<Information> informations;
|
||||
private List<Center> pointList;
|
||||
|
||||
public void setPointList(List<Center> pointList) {
|
||||
this.pointList = pointList;
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
|
||||
public List<Center> getPointList() {
|
||||
return pointList;
|
||||
}
|
||||
|
||||
public void setPointList(List<Center> pointList) {
|
||||
this.pointList = pointList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ public class TanluModelData {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "getRoadLineData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
@@ -165,6 +166,7 @@ public class TanluModelData {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.tanlu.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import com.mogo.module.tanlu.model.event.PushTypeInfo
|
||||
import com.mogo.module.tanlu.model.event.VoiceRoadInfo
|
||||
@@ -14,9 +15,9 @@ import org.greenrobot.eventbus.EventBus
|
||||
class PushReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action == "com.zhidao.roadcondition.split"){
|
||||
var type = intent.getStringExtra("type")
|
||||
Log.d("PushReceiver", "type = $type")
|
||||
EventBus.getDefault().post(PushTypeInfo(type))
|
||||
var uri = Uri.parse(intent.getStringExtra("uri"))
|
||||
Log.d("PushReceiver", "uri = $uri")
|
||||
EventBus.getDefault().post(PushTypeInfo(uri.getQueryParameter("type")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user