opt
This commit is contained in:
@@ -1,27 +1,18 @@
|
||||
package com.mogo.module.share
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.module.share.adas.AdasFrontCarDistanceY
|
||||
import com.mogo.module.share.bean.event.MarkerInfo
|
||||
import com.mogo.module.share.constant.ACCIDENT_STRATEGY_SHARE_PUSH_TYPE
|
||||
import com.mogo.module.share.constant.S_TAG
|
||||
import com.mogo.module.share.strategyreceiver.AccidentStrategyReceiver
|
||||
import com.mogo.module.share.strategyreceiver.BlockStrategy
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.share.IMogoTanluUiProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.SingleEmitter
|
||||
import io.reactivex.SingleOnSubscribe
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.json.JSONObject
|
||||
|
||||
/**
|
||||
@@ -30,14 +21,13 @@ import org.json.JSONObject
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_STRATEGY_SHARE)
|
||||
class StrategyShareProvider : IMogoTanluUiProvider {
|
||||
class StrategyShareProvider : IProvider {
|
||||
private lateinit var blockStrategy: BlockStrategy
|
||||
private lateinit var mContext: Context;
|
||||
|
||||
override fun init(context: Context) {
|
||||
TanluServiceManager.init(context)
|
||||
TanluManager.getInstance(context).init()
|
||||
mContext = context
|
||||
|
||||
Logger.d(S_TAG, "策略上报Provider初始化====")
|
||||
val apis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
|
||||
blockStrategy = BlockStrategy(context, apis)
|
||||
@@ -71,25 +61,4 @@ class StrategyShareProvider : IMogoTanluUiProvider {
|
||||
}
|
||||
|
||||
|
||||
override fun searchRoadCondition(intentStr: String, data: String, city: String, keywords: String) {
|
||||
val disposable = Single.create(SingleOnSubscribe { emitter: SingleEmitter<Intent?> ->
|
||||
Logger.d(S_TAG, "searchRoadCondition---> intentStr: " + intentStr + " data: " + data + " " +
|
||||
"city: " + city + " keywords: " + keywords)
|
||||
val intent = Intent(intentStr)
|
||||
intent.putExtra("data", data)
|
||||
intent.putExtra("city", city)
|
||||
intent.putExtra("keywords", keywords)
|
||||
Thread.sleep(3000)
|
||||
emitter.onSuccess(intent)
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe { intent: Intent? ->
|
||||
Logger.d(S_TAG, "searchRoadCondition---go real share")
|
||||
TanluManager.getInstance(mContext).realShare(intentStr, intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun shareSuccess(poiType: String?, location: MogoLatLng) {
|
||||
val markerInfo = MarkerInfo(poiType, "", location.lon, location.lat, true, "1")
|
||||
EventBus.getDefault().post(markerInfo)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,6 +61,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.module.share.constant.ShareConstants.SPECIFIEDROAD_SEARCH;
|
||||
import static com.mogo.module.share.constant.ShareConstants.TXZ_SPECIFIEDROAD_SEARCH;
|
||||
import static com.mogo.module.share.constant.ShareConstants.TYPE_NAME_BLOCK;
|
||||
@@ -132,6 +138,30 @@ public class TanluManager implements IMogoMarkerClickListener,
|
||||
initListener();
|
||||
}
|
||||
|
||||
|
||||
public void searchRoadCondition(String intentStr, String data, String city, String keywords) {
|
||||
Disposable disposable = Single.create((SingleOnSubscribe<Intent>) emitter -> {
|
||||
Logger.d(TAG, "searchRoadCondition---> intentStr: " + intentStr + " data: " + data + " " +
|
||||
"city: " + city + " keywords: " + keywords);
|
||||
Intent intent = new Intent(intentStr);
|
||||
intent.putExtra("data", data);
|
||||
intent.putExtra("city", city);
|
||||
intent.putExtra("keywords", keywords);
|
||||
Thread.sleep(3000);
|
||||
emitter.onSuccess(intent);
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(intent -> {
|
||||
Logger.d(TAG, "searchRoadCondition---go real share");
|
||||
realShare(intentStr, intent);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void shareSuccess(String poiType, MogoLatLng location) {
|
||||
MarkerInfo markerInfo = new MarkerInfo(poiType, "", location.lon, location.lat, true, "1");
|
||||
EventBus.getDefault().post(markerInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构造经纬度列表
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.share.manager
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
@@ -12,6 +13,7 @@ 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
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum
|
||||
import com.mogo.module.share.R
|
||||
import com.mogo.module.share.TanluManager
|
||||
import com.mogo.module.share.constant.ShareConstants.*
|
||||
import com.mogo.service.share.TanluUploadParams
|
||||
import com.mogo.utils.NetworkUtils
|
||||
@@ -46,12 +47,13 @@ object UploadHelper {
|
||||
// 有网就正常上报
|
||||
ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
|
||||
// 上报即成功
|
||||
ServiceApisManager.serviceApis.tanluUiApi.shareSuccess(type.eventType, type.location)
|
||||
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")
|
||||
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
|
||||
TanluManager.getInstance(context).uploadRoadCondition(type)
|
||||
//语音播报
|
||||
showVoiceTip(context, type.eventType)
|
||||
|
||||
|
||||
@@ -43,25 +43,25 @@ public class TanluCardViewProvider implements IMogoTanluUiProvider {
|
||||
|
||||
@Override
|
||||
public void searchRoadCondition(String intentStr, String data, String city, String keywords) {
|
||||
// Disposable disposable = Single.create((SingleOnSubscribe<Intent>) emitter -> {
|
||||
// Logger.d(TAG, "searchRoadCondition---> intentStr: " + intentStr + " data: " + data + " " +
|
||||
// "city: " + city + " keywords: " + keywords);
|
||||
// Intent intent = new Intent(intentStr);
|
||||
// intent.putExtra("data", data);
|
||||
// intent.putExtra("city", city);
|
||||
// intent.putExtra("keywords", keywords);
|
||||
// Thread.sleep(3000);
|
||||
// emitter.onSuccess(intent);
|
||||
// }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(intent -> {
|
||||
// Logger.d(TAG, "searchRoadCondition---go real share");
|
||||
// tanluListWindow.realShare(intentStr, intent);
|
||||
// });
|
||||
Disposable disposable = Single.create((SingleOnSubscribe<Intent>) emitter -> {
|
||||
Logger.d(TAG, "searchRoadCondition---> intentStr: " + intentStr + " data: " + data + " " +
|
||||
"city: " + city + " keywords: " + keywords);
|
||||
Intent intent = new Intent(intentStr);
|
||||
intent.putExtra("data", data);
|
||||
intent.putExtra("city", city);
|
||||
intent.putExtra("keywords", keywords);
|
||||
Thread.sleep(3000);
|
||||
emitter.onSuccess(intent);
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(intent -> {
|
||||
Logger.d(TAG, "searchRoadCondition---go real share");
|
||||
tanluListWindow.realShare(intentStr, intent);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shareSuccess(String poiType, MogoLatLng location) {
|
||||
// MarkerInfo markerInfo = new MarkerInfo(poiType, "", location.lon, location.lat, true, "1");
|
||||
// EventBus.getDefault().post(markerInfo);
|
||||
MarkerInfo markerInfo = new MarkerInfo(poiType, "", location.lon, location.lat, true, "1");
|
||||
EventBus.getDefault().post(markerInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user