This commit is contained in:
lixiaopeng
2020-08-12 18:15:07 +08:00
parent f3d08f8260
commit 9b1f74b1a9
9 changed files with 45 additions and 26 deletions

View File

@@ -57,6 +57,7 @@ class MainService : Service() {
var picType: Int = 0
var videoType: Int = 0
var shareType: String = "type"
var fromType: String = ""
var isCustom: Boolean = false
var params: UploadParams? = null
@@ -88,6 +89,7 @@ class MainService : Service() {
params = intent.getParcelableExtra("params")
params?.let {
shareType = it.eventType
fromType = it.fromType
Log.d(TAG, "onStartCommand shareType = $shareType")
if (shareType == TANLU_ROAD_CONGESTION || shareType == TANLU_TRAFFIC_CHECK || shareType == TANLU_ROAD_CLOSURE || shareType == TANLU_ROAD_CURRENT
|| shareType == TANLU_ROAD_PONDING || shareType == TANLU_ROAD_ICING || shareType == TANLU_ROAD_HEAVY_FOG
@@ -207,6 +209,7 @@ class MainService : Service() {
private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
var intent = Intent()
intent.action = "com.zhidao.roadcondition.marker.info"
@@ -215,6 +218,7 @@ class MainService : Service() {
intent.putExtra("lat", lat)
intent.putExtra("lon", lon)
intent.putExtra("custom", isCustom)
intent.putExtra("fromType", fromType)
sendBroadcast(intent)
}

View File

@@ -1062,8 +1062,9 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度
Logger.d(TAG, "onMarkerInfo event.type = " + event.type + " >>event.lat = " + event.lat + " >>event.lon = " + event.lon + " >>event.imageUrl =" + event.imageUrl);
String poiType = event.type;
String fromType = event.fromType;
boolean isCumtom = event.isCumtom;
Logger.d(TAG, "onMarkerInfo share poiType = " + poiType + " --isCumtom = " + isCumtom + " >> getMathRandom = " + getMathRandom() + " >>> bearing = " + bearing);
Logger.d(TAG, "onMarkerInfo share poiType = " + poiType + " --isCumtom = " + isCumtom + " >> getMathRandom = " + getMathRandom() + " >>> bearing = " + bearing + ">>>fromType = " + fromType);
if (isCumtom && !poiType.equals("0")) {
double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
double lon = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
@@ -1085,9 +1086,11 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
markerShowEntity.setMarkerType(TanluConstants.MODEL_NAME);
markerShowEntity.setMarkerLocation(markerLocation);
AIAssist.getInstance(getContext()).speakTTSVoice((
String.format(voiceShareSuccessTts, getMathRandom())), null);
TipToast.shortTip("分享成功");
if (!fromType.equals("5")) {
AIAssist.getInstance(getContext()).speakTTSVoice((
String.format(voiceShareSuccessTts, getMathRandom())), null);
TipToast.shortTip("分享成功");
}
IMogoMarker mogoMarker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity);
mogoMarker.setClickable(false);

View File

@@ -9,17 +9,19 @@ import java.io.Serializable;
*/
public class MarkerInfo implements Serializable {
public String type; //封路,还是上报
public String fromType; //来源 主动,被动,策略。
public String imageUrl; //上传完cos图片
public double lon; //经度
public double lat; //纬度
public boolean isCumtom; //是否主动上报
public MarkerInfo(String type, String imageUrl, double lon, double lat, boolean isCumtom) {
public MarkerInfo(String type, String imageUrl, double lon, double lat, boolean isCumtom, String fromType) {
this.type = type;
this.imageUrl = imageUrl;
this.lon = lon;
this.lat = lat;
this.isCumtom = isCumtom;
this.fromType = fromType;
}
}

View File

@@ -14,12 +14,13 @@ class MarkerInfoReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == "com.zhidao.roadcondition.marker.info"){
var type = intent.getStringExtra("type")
var fromType = intent.getStringExtra("fromType")
var imageUrl = intent.getStringExtra("imageUrl")
var lat = intent.getDoubleExtra("lat",0.0)
var lon = intent.getDoubleExtra("lon",0.0) //经度
var custom = intent.getBooleanExtra("custom", false)
Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + " --custom = " + custom + "---imageUrl =" + imageUrl)
EventBus.getDefault().post(MarkerInfo(type, imageUrl,lon, lat, custom))
EventBus.getDefault().post(MarkerInfo(type, imageUrl,lon, lat, custom, fromType))
}
}
}

View File

@@ -59,6 +59,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
private static final String TAG = "SurroundingFragment";
private RecyclerView mRecyclerView;
private TextView mTotalTv;
private RelativeLayout mTopLayout;
private RelativeLayout mEmptyLayout;
private TextView mTopFreshTv;
private TextView mShareTv;
@@ -79,6 +80,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
Log.d(TAG, "initViews --------> ");
mRecyclerView = findViewById(R.id.surrounding_recycleview);
mTotalTv = findViewById(R.id.tv_brief);
mTopLayout = findViewById(R.id.layout_top);
mEmptyLayout = findViewById(R.id.layout_empty_data_show);
mTopFreshTv = findViewById(R.id.tv_top_refresh);
mShareTv = findViewById(R.id.tv_main_share);
@@ -145,6 +147,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
public void showSurroudingData(List<MarkerExploreWay> exploreWayList) {
if (exploreWayList != null && exploreWayList.size() > 0) {
//展示数据
mTopLayout.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.VISIBLE);
mEmptyLayout.setVisibility(View.GONE);
@@ -162,6 +165,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
spannableString.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTotalTv.setText(spannableString);
} else {
mTopLayout.setVisibility(View.GONE);
mRecyclerView.setVisibility(View.GONE);
mEmptyLayout.setVisibility(View.VISIBLE);
}

View File

@@ -39,7 +39,7 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
private IMogoNetwork mNetWork;
private IMogoServiceApis mApis;
private V2XApiService eventApiService;
private static final String TAG = "SurroundingEvent";
private static final String TAG = "V2XSurroundingFragment";
public SurroundingEventPresenter(Context context, SurroundingEventView view) {
@@ -72,13 +72,15 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
@Override
public void onError(Throwable e) {
super.onError(e);
mView.showSurroudingData(null);
Logger.e(TAG, "onError e = " + e);
e.printStackTrace();
}
@Override
public void onSuccess(SurroundingResponse data) {
super.onSuccess(data);
Logger.d("SurroundingFragment", "onSuccess ------> ");
Logger.d(TAG, "onSuccess ------> ");
if (data != null && data.getResult() != null) {
mView.showSurroudingData(data.getResult().getExploreWay());
}
@@ -88,7 +90,7 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
public void onError(String message, int code) {
super.onError(message, code);
mView.showSurroudingData(null);
Logger.e("SurroundingFragment", "onError message = " + message + " >>> code = " + code);
Logger.e(TAG, "onError message = " + message + " >>> code = " + code);
}
});

View File

@@ -3,6 +3,7 @@ package com.mogo.module.v2x.scenario.scene.road;
import android.view.View;
import android.view.ViewGroup;
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.service.ServiceConst;
@@ -60,11 +61,13 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
if (v2XRoadEventEntity != null) {
//上报路况
V2XServiceManager.getMoGoStatusManager().setUploadingStatus(ServiceConst.CARD_TYPE_ROAD_CONDITION, true);
TanluUploadParams params = new TanluUploadParams(v2XRoadEventEntity.getPoiType(),
IMogoTanluProvider.UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO);
V2XServiceManager.getTanluManager().uploadRoadCondition(params);
//上报事故
if (v2XRoadEventEntity.getPoiType() != null && v2XRoadEventEntity.getPoiType().equals(MarkerPoiTypeEnum.FOURS_ACCIDENT)) {
V2XServiceManager.getMoGoStatusManager().setUploadingStatus(ServiceConst.CARD_TYPE_ROAD_CONDITION, true);
TanluUploadParams params = new TanluUploadParams(v2XRoadEventEntity.getPoiType(),
IMogoTanluProvider.UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO);
V2XServiceManager.getTanluManager().uploadRoadCondition(params);
}
if (v2XMessageEntity.isShowState()) {
if (!isSameScenario(v2XMessageEntity)) {

View File

@@ -30,7 +30,7 @@
android:layout_marginRight="20px"
android:background="@drawable/bg_v2x_refresh"
android:gravity="center"
android:text="刷新"
android:text="@string/v2x_surrounding_refresh"
android:textColor="@color/white"
android:textSize="18px"
android:textStyle="bold" />
@@ -64,8 +64,8 @@
<ImageView
android:id="@+id/iv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="194px"
android:layout_height="194px"
android:layout_centerHorizontal="true"
android:layout_marginTop="59px"
android:src="@drawable/mogo_image_blank_nor" />
@@ -79,7 +79,7 @@
android:layout_marginTop="15px"
android:gravity="center_horizontal"
android:text="周边5公里暂无交通事件"
android:textColor="@color/transparent_white_30"
android:textColor="@color/white"
android:textSize="18px"
android:textStyle="bold" />
@@ -89,7 +89,7 @@
android:layout_height="wrap_content"
android:layout_below="@+id/tv_main_empty_1"
android:layout_centerHorizontal="true"
android:layout_marginTop="2px"
android:layout_marginTop="1px"
android:gravity="center_horizontal"
android:text="你可以试着分享一个事件给其他车主"
android:textColor="@color/transparent_white_30"
@@ -101,11 +101,11 @@
android:layout_width="150px"
android:layout_height="48px"
android:layout_below="@+id/tv_main_empty_2"
android:layout_marginLeft="110px"
android:layout_marginTop="33px"
android:layout_marginLeft="70px"
android:layout_marginTop="32px"
android:background="@drawable/bg_v2x_go_to_share"
android:gravity="center"
android:text="去分享"
android:text="@string/v2x_surrounding_go_to_share"
android:textColor="@color/white"
android:textSize="18px"
android:textStyle="bold" />
@@ -116,11 +116,11 @@
android:layout_height="48px"
android:layout_below="@+id/tv_main_empty_2"
android:layout_alignParentRight="true"
android:layout_marginTop="33px"
android:layout_marginRight="110px"
android:layout_marginTop="32px"
android:layout_marginRight="70px"
android:background="@drawable/bg_v2x_refresh"
android:gravity="center"
android:text="刷新"
android:text="@string/v2x_surrounding_refresh"
android:textColor="@color/white"
android:textSize="18px"
android:textStyle="bold" />

View File

@@ -6,7 +6,7 @@
<string name="v2x_report_pop_submit_txt">已提交</string>
<string name="v2x_report_pop_thank_txt">感谢已送达</string>
<string name="v2x_surrounding_top_brief">周围5公里共 %d 条交通信息</string>
<string name="v2x_surrounding_go_to_share">分享</string>
<string name="v2x_surrounding_go_to_share">分享</string>
<string name="v2x_surrounding_refresh">刷新</string>
</resources>