This commit is contained in:
lixiaopeng
2020-11-02 20:36:15 +08:00
parent c84fc33bf0
commit 56ce2a946e
14 changed files with 47 additions and 94 deletions

View File

@@ -1,25 +0,0 @@
package com.mogo.module.share;
import android.content.Context;
import androidx.annotation.Keep;
/**
* @author lixiaopeng
* @description
* @since 2020-01-10
*/
@Keep
public interface IShareControl {
/**
* 显示对话框
*/
@Keep
void showDialog(/*Context context*/);
/**
* 对话框消失
*/
@Keep
void dismissDialog();
}

View File

@@ -47,6 +47,7 @@ import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.TipDrawable;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -155,41 +156,11 @@ public class TanluManager implements IMogoMarkerClickListener,
});
}
public void shareSuccess(String poiType, MogoLatLng location) {
MarkerInfo markerInfo = new MarkerInfo(poiType, "", location.lon, location.lat, true, "1");
EventBus.getDefault().post(markerInfo);
}
/**
* 构造经纬度列表
*
* @param markerExploreWay
* @return
*/
private List<MogoLatLng> getList(MarkerExploreWay markerExploreWay) {
List<MogoLatLng> list = new ArrayList<>();
if (markerExploreWay != null) {
MarkerLocation location = markerExploreWay.getLocation();
if (location != null) {
Logger.d(TAG, "getList location.getLon() =" + location.getLon() + " >>>location.getLat()=" + location.getLat());
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
//经度
Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
//维度
Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
list.add(mogoLatLng);
} else {
Logger.e(TAG, "getList() location == null");
}
} else {
Logger.e(TAG, "getList() markerExploreWay == null");
}
return list;
}
private void initInterface() {
//地图marker地图操作
mMarkerManager = TanluServiceManager.getMapService().getMarkerManager(mContext);
@@ -364,6 +335,7 @@ public class TanluManager implements IMogoMarkerClickListener,
Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg);
// speakFailVoice(searchfaileVoiceStrings[1]);
speakFailVoice("未发现" + mKeywords + "附近的特殊路况");
moveToMarcker(currentLat, currentLon);
}
@Override
@@ -460,24 +432,6 @@ public class TanluManager implements IMogoMarkerClickListener,
}, delay);
}
/**
* 发送广播
*/
private void sendShareReceiver(String type) {
if (!type.equals("0") && mMogoStatusManager != null) {
mMogoStatusManager.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true);
}
Logger.d(TAG, "TanluListWindow sendShareReceiver type = " + type);
Intent intent = new Intent();
intent.setAction("com.zhidao.share.roadcondition.action"); //com.zhidao.roadcondition.share
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
intent.putExtra("type", type);
mContext.sendBroadcast(intent);
}
private void moveToMarcker(double lat, double lon) {
Logger.d(TAG, "moveToMarcker lat = " + lat + " >>>>lon = " + lon);
MogoLatLng latLng = new MogoLatLng(lat, lon);
@@ -485,6 +439,10 @@ public class TanluManager implements IMogoMarkerClickListener,
mMApUIController.moveToCenter(latLng);
}
private void moveNotFresh() {
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
}
/**
* marker点击事件
*
@@ -620,15 +578,17 @@ public class TanluManager implements IMogoMarkerClickListener,
.owner(ShareConstants.MODEL_NAME)
.longitude(lon);
final IMogoMarker mogoAnimationMarker = mMarkerManager.addMarker(ShareConstants.MODEL_NAME, options);
mogoAnimationMarker.startScaleAnimation(0, 4f, 0, 4f, 500, new LinearInterpolator(), new OnMarkerAnimationListener() {
IMogoMarker mogoAnimationMarker = mMarkerManager.addMarker(ShareConstants.MODEL_NAME, options);
mogoAnimationMarker.startScaleAnimation(0, 1f, 0, 1f, 500, new LinearInterpolator(), new OnMarkerAnimationListener() {
@Override
public void onAnimStart() {
}
@Override
public void onAnimEnd() {
mogoAnimationMarker.destroy();
UiThreadHandler.postDelayed( () -> {
mogoAnimationMarker.destroy();
}, 1_200L );
}
});
}
@@ -665,10 +625,6 @@ public class TanluManager implements IMogoMarkerClickListener,
});
}
private void moveNotFresh() {
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
}
private void showBonndsRoadtion() {
Logger.e(TAG, "showBonndsRoadtion markerExploreWayList.size() = " + markerExploreWayList.size());
Logger.d(TAG, "showBonndsRoadtion getMogoList().size() = " + getMogoList().size());

View File

@@ -13,7 +13,6 @@ object ServiceApisManager {
lateinit var serviceApis: IMogoServiceApis
fun init(context: Context) {
Log.d("liyz", "ServiceApisManager --- init ")
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
}
}

View File

@@ -47,13 +47,12 @@ object UploadHelper {
// 有网就正常上报
ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
// 上报即成功
Log.d("liyz", "upload --- init------2---- ")
TanluManager.getInstance(context).shareSuccess(type.eventType, type.location)
val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation
val latLon = MogoLatLng(location.latitude, location.longitude)
type.location = latLon
Logger.d("UploadHelper", "upload ----> $type")
TanluManager.getInstance(context).uploadRoadCondition(type)
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
//语音播报
showVoiceTip(context, type.eventType)

View File

@@ -42,6 +42,6 @@ interface ShareApiService {
*/
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
fun queryRoadInfos(@FieldMap params: Map<String?, Any?>?): Observable<BaseDataCompat<RoadInfos?>?>?
fun queryRoadInfos(@FieldMap params: Map<String, Object>): Observable<BaseDataCompat<RoadInfos>>
}

View File

@@ -0,0 +1,31 @@
package com.mogo.module.share.net;
import com.mogo.module.share.bean.BaseDataCompat;
import com.mogo.module.share.bean.RoadInfos;
import java.util.Map;
import io.reactivex.Observable;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
/**
* @author lixiaopeng
* @description 探路相关接口定义
* @since 2020-01-07
*/
public interface TanluApiService {
/**
* 查询(搜索)道路事件信息
* 接口文档http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842
* 文档中有些参数暂时没有用到包括radius,limit
* @return
*/
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
Observable<BaseDataCompat<RoadInfos>> queryRoadInfos(@FieldMap Map<String, Object> params);
}

View File

@@ -48,13 +48,13 @@ import static com.mogo.module.share.constant.ShareConstants.TYPE_NAME_BLOCK;
public class TanluModelData {
private final Context mContext;
private ShareApiService mShareApiService;
private TanluApiService mShareApiService;
private static final String TAG = "TanluModelData";
public TanluModelData(Context context) {
this.mContext = context;
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
mShareApiService = network.create(ShareApiService.class, getBaseUrl());
mShareApiService = network.create(TanluApiService.class, getBaseUrl());
}
private String getBaseUrl() {