Merge remote-tracking branch 'origin/dev_MogoAP_eagle-1030_211020_8.0.14' into dev_MogoAP_eagle-1030_211020_8.0.14

This commit is contained in:
donghongyu
2021-11-15 20:02:48 +08:00
12 changed files with 223 additions and 141 deletions

View File

@@ -55,7 +55,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
private TextView connect;//连接
private NoticeTrafficAdapter adapter;
private ArrayList dataArrayList = new ArrayList();
private NoticeTrafficStyleInfo mTrafficStyleInfo;
private NoticeTrafficStyleInfo.NoticeTrafficAccountInfo mTrafficStyleInfo;
public NoticeTrafficDialog(@NonNull Context context, NoticeTrafficStylePushData pushData) {
super(context);
@@ -139,7 +139,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
mRecyclerView.setLayoutManager(layoutManager);
layoutManager.setOrientation(GridLayoutManager.VERTICAL);
NoticeTrafficInfoGridItemDivider gridLayoutDivider = new NoticeTrafficInfoGridItemDivider(1,
(mContext.getResources().getColor(R.color.notice_check_dialog_bg_color)));
(mContext.getResources().getColor(R.color.notice_traffic_line)));
mRecyclerView.addItemDecoration(gridLayoutDivider);
} catch (Exception e) {
e.printStackTrace();
@@ -156,7 +156,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
private void feedBackTraffic(int i) {
CallerNoticeManager.getNoticeProvider().feedBackNoticeTraffic(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), i);
if (i == 1) {
startAutoPilot();
try {
startAutoPilot();
} catch (Exception e) {
e.printStackTrace();
}
}
dismiss();
}
@@ -364,38 +368,26 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
@Override
public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) {
Log.d(TAG, "交通事故详情::" + trafficInfo);
trafficInfo.setOperaStatus("已处理");
trafficInfo.setTroubleReasonName("逆向");
mTrafficStyleInfo = trafficInfo;
infoRefresh(trafficInfo);
mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo();
infoRefresh(mTrafficStyleInfo);
}
});
}
private void infoRefresh(NoticeTrafficStyleInfo info) {
private void infoRefresh(NoticeTrafficStyleInfo.NoticeTrafficAccountInfo info) {
if (dataArrayList.size() > 0) {
dataArrayList.clear();
}
NoticeValue laiYuan = new NoticeValue();
laiYuan.setKey("事故来源:");
laiYuan.setValue("--");
laiYuan.setValue(info.getUploadType());
dataArrayList.add(laiYuan);
NoticeValue zeRen = new NoticeValue();
zeRen.setKey("责 任 方:");
zeRen.setValue("--");
dataArrayList.add(zeRen);
NoticeValue cTime = new NoticeValue();
cTime.setKey("事故时间:");
cTime.setValue(DateTimeUtils.getTimeText(info.getDataCreateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm));
dataArrayList.add(cTime);
NoticeValue p = new NoticeValue();
p.setKey("责 任 人:");
p.setValue("--");
dataArrayList.add(p);
NoticeValue hTime = new NoticeValue();
hTime.setKey("处理时间:");
hTime.setValue(DateTimeUtils.getTimeText(info.getDataHandleTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm));
@@ -403,12 +395,16 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
NoticeValue reason = new NoticeValue();
reason.setKey("事故原因:");
reason.setValue(info.getTroubleReasonName());
reason.setValue(info.getReason());
dataArrayList.add(reason);
NoticeValue status = new NoticeValue();
status.setKey("处理状态:");
status.setValue(info.getOperaStatus());
if (info.getOperaStatus() == "0"){
status.setValue("待处理");
}else {
status.setValue("已处理");
}
dataArrayList.add(status);
NoticeValue location = new NoticeValue();
@@ -417,7 +413,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
dataArrayList.add(location);
NoticeValue style = new NoticeValue();
style.setKey("事故类型");
style.setKey("事故等级");
style.setValue(info.getTroubleTypeName());
dataArrayList.add(style);

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/notice_traffic_back__width"
android:layout_height="@dimen/notice_traffic_back__height"
android:layout_gravity="center"
android:background="@drawable/notice_dialog_check_background">
<ImageView
@@ -46,8 +47,8 @@
android:id="@+id/thumbnail_image"
android:layout_width="0dp"
android:layout_height="0dp"
android:src="@drawable/notice_traffic_placeholder"
android:scaleType="fitXY"
android:src="@drawable/notice_traffic_placeholder"
app:layout_constraintBottom_toBottomOf="@id/video_player"
app:layout_constraintEnd_toEndOf="@id/video_player"
app:layout_constraintStart_toStartOf="@id/video_player"
@@ -67,8 +68,8 @@
<TextView
android:id="@+id/notice_connect"
android:layout_width="@dimen/dp_310"
android:layout_height="@dimen/dp_100"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_65"
android:layout_marginBottom="@dimen/dp_40"
android:background="@drawable/notice_connect"
android:gravity="center"
@@ -86,7 +87,7 @@
android:layout_height="0dp"
android:layout_marginLeft="@dimen/dp_80"
android:layout_marginTop="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_80"
android:layout_marginRight="@dimen/dp_70"
android:layout_marginBottom="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="@+id/traffic_top_line"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -2,7 +2,9 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_575"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:paddingTop="4px"
android:background="@color/notice_banner_blue">
<LinearLayout
android:layout_width="match_parent"
@@ -18,7 +20,7 @@
android:layout_height="@dimen/dp_50"
android:gravity="left|center"
android:text="事故来源:"
android:textColor="#FFF"
android:textColor="#CCFFFFFF"
android:textSize="@dimen/dp_36" />
<TextView
@@ -28,7 +30,7 @@
android:gravity="left|center"
android:maxLines="2"
android:text="测试数据"
android:textColor="#FFF"
android:textColor="#CCFFFFFF"
android:textSize="@dimen/dp_36"
android:textStyle="bold" />
</LinearLayout>

View File

@@ -4,6 +4,6 @@
<color name="notice_text_blue">#1F9BFE</color>
<color name="notice_banner_blue">#5A8EFD</color>
<color name="notice_check_dialog_bg_color">#E63B4577</color>
<color name="notice_traffic_line">#D5D5D4</color>
<color name="notice_traffic_line">#CCD5D5D4</color>
<color name="notice_dialog_back">#3B4577</color>
</resources>

View File

@@ -24,7 +24,9 @@
<dimen name="dp_54">54px</dimen>
<dimen name="dp_56">56px</dimen>
<dimen name="dp_62">62px</dimen>
<dimen name="dp_70">70px</dimen>
<dimen name="dp_75">80px</dimen>
<dimen name="dp_80">80px</dimen>
<dimen name="dp_140">140px</dimen>
<dimen name="dp_150">150px</dimen>
<dimen name="dp_180">180px</dimen>

View File

@@ -7,9 +7,12 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
@@ -22,12 +25,12 @@ public interface NoticeApiService {
/**
* 获取道路事故详情
*
* @param accidentParameters 请求数据(sn;infoId)
* @return {@link BaseData}
* @param requestBody 请求体(infoId 交警任务id)
* @return {@link NoticeTrafficStyleInfo}
*/
@FormUrlEncoded
@Headers("Content-Type:application/json;charset=UTF-8")
@POST("/deva/accidentInfoManage/queryMyAccidentHandleInfo/server/v1")
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@Body RequestBody requestBody);
/**

View File

@@ -1,18 +1,24 @@
package com.mogo.eagle.core.function.notice.network;
import android.content.Context;
import android.util.ArrayMap;
import android.util.Log;
import com.google.gson.Gson;
import com.mogo.cloud.network.NetConstants;
import com.mogo.cloud.network.RetrofitFactory;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
import com.mogo.module.common.drawer.PushRoadConditionDrawer;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.HashMap;
import java.util.Map;
@@ -23,6 +29,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* @author Jing
@@ -54,14 +62,14 @@ public class NoticeNetWorkManager {
* 获取事故详细信息
*
* @param infoId 事故id
* @param sn 车机sn
* @param callBack 回调
*/
public void requestAccidentInfo(String infoId, String sn, NoticeNetCallBack callBack) {
Map<String, String> map = new HashMap<>();
map.put("sn", sn);
map.put("infoId", infoId);
mNoticeApiService.getAccidentInfo(map)
public void requestAccidentInfo(String infoId, String sn,NoticeNetCallBack callBack) {
NoticeRequest request = new NoticeRequest(infoId);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"),
GsonUtil.jsonFromObject(request));
mNoticeApiService.getAccidentInfo(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NoticeTrafficStyleInfo>() {
@@ -72,7 +80,8 @@ public class NoticeNetWorkManager {
@Override
public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) {
if (noticeTrafficStyleInfo != null) {
Log.d(TAG, "onNext:"+noticeTrafficStyleInfo);
if (noticeTrafficStyleInfo.getResult().getAccidentInfo() != null) {
callBack.callBackWithResult(noticeTrafficStyleInfo);
}
}
@@ -165,4 +174,5 @@ public class NoticeNetWorkManager {
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.notice.network;
/**
* @author Jing
* @description 描述
* @since: 11/15/21
*/
public class NoticeRequest {
private String infoId;
public NoticeRequest(String infoId) {
this.infoId = infoId;
}
public String getInfoId() {
return infoId;
}
public void setInfoId(String infoId) {
this.infoId = infoId;
}
}

View File

@@ -41,7 +41,7 @@ class TestNoticeBroadcastReceiver : BroadcastReceiver() {
val video: String = "https://view.2amok.com/20200219/012d8e2a55f227e90d76056bb6aab5e4.mp4"
pushData.poiImgUrl = video
pushData.type = 1
pushData.infoId = "909755160571400192"
pushData.infoId = "909754135789686784"
CallerHmiManager.showTrafficBanner(pushData)
}
}