增加预警视图
2
.idea/misc.xml
generated
@@ -15,6 +15,8 @@
|
||||
<entry key="modules/mogo-module-left-panel/src/main/res/layout/module_left_panel_simple_speed.xml" value="0.202734375" />
|
||||
<entry key="modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml" value="0.25" />
|
||||
<entry key="modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml" value="0.202734375" />
|
||||
<entry key="modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml" value="0.28854166666666664" />
|
||||
<entry key="modules/mogo-module-warning/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.33094574464390436" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -138,7 +138,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
|
||||
@Override
|
||||
public void onCarStateData(CarStateInfo carStateInfo) {
|
||||
Logger.d(TAG, "onCarStateData " + carStateInfo);
|
||||
//Logger.d(TAG, "onCarStateData " + carStateInfo);
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.ownerCarStateInfo(gson.toJson(carStateInfo));
|
||||
|
||||
@@ -6,5 +6,7 @@ package com.mogo.module.warning;
|
||||
*/
|
||||
public class WaringConst {
|
||||
public static String MODULE_NAME = "MODULE_LEFT_PANEL";
|
||||
public static String PATH_NAME = "/left/panel";
|
||||
|
||||
public static String BROADCAST_TEST_CONTROL_TYPE_EXTRA_KEY = "waring_type";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.mogo.module.warning.notification;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.mogo.module.warning.R;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/3 5:50 下午
|
||||
@@ -7,4 +15,15 @@ package com.mogo.module.warning.notification;
|
||||
*/
|
||||
public class NotificationManager {
|
||||
|
||||
|
||||
public static void show(Activity activity) {
|
||||
LayoutInflater inflater = activity.getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.notification_v2x_msg_vr, null);
|
||||
Toast toast = new Toast(activity.getApplicationContext());
|
||||
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
|
||||
toast.setDuration(Toast.LENGTH_SHORT);
|
||||
toast.setView(view);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.module.warning.receiver;
|
||||
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.warning.WaringConst;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* V2X 测试面板广播接收,目的是可以通过广播调用起来面板
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class TestObuBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "TestPanelBroadcastReceiver";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
int waringType = intent.getIntExtra(WaringConst.BROADCAST_TEST_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
Logger.d(TAG, "waringType:" + waringType);
|
||||
|
||||
// 分发场景
|
||||
dispatchSceneTest(waringType);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分发处理场景
|
||||
*
|
||||
* @param sceneType 场景类型
|
||||
*/
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
Logger.d(TAG, "sceneType=" + sceneType);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +1,21 @@
|
||||
package com.mogo.module.warning.ui;
|
||||
package com.mogo.module.warning.ui
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.warning.R;
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.warning.R
|
||||
import com.mogo.module.warning.ui.WaringView
|
||||
import com.mogo.module.warning.ui.WaringPresenter
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/8/3 2:40 下午
|
||||
*/
|
||||
public class MoGoWarningFragment extends MvpFragment<WaringView, WaringPresenter> implements WaringView {
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_warning;
|
||||
class MoGoWarningFragment : MvpFragment<WaringView?, WaringPresenter?>(), WaringView {
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_warning
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
override fun initViews() {}
|
||||
override fun createPresenter(): WaringPresenter {
|
||||
return WaringPresenter(this)
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected WaringPresenter createPresenter() {
|
||||
return new WaringPresenter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#88000000" />
|
||||
<corners android:radius="30px" />
|
||||
</shape>
|
||||
@@ -1,6 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/bg_warning_bg"
|
||||
android:paddingStart="38px"
|
||||
android:paddingTop="27px"
|
||||
android:paddingEnd="38px"
|
||||
android:paddingBottom="27px">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_waring_icon"
|
||||
android:layout_width="132px"
|
||||
android:layout_height="132px"
|
||||
android:src="@drawable/icon_waring_v2x_abnormal_vehicle"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_waring_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="26px"
|
||||
android:text="预警信息"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="42px"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_waring_icon"
|
||||
app:layout_constraintLeft_toRightOf="@+id/iv_waring_icon"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_waring_icon"
|
||||
tools:text="前车碰撞预警" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||