diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java index 621b7bd291..ce10423148 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java @@ -28,6 +28,7 @@ import com.mogo.service.module.IMogoActionManager; import com.mogo.service.module.IMogoMarkerService; import com.mogo.service.module.IMogoRegisterCenter; import com.mogo.service.module.IMogoSearchManager; +import com.mogo.service.share.IMogoShareManager; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.service.strategy.IMogoRefreshStrategyController; import com.mogo.service.windowview.IMogoTopViewManager; @@ -64,6 +65,7 @@ public class V2XServiceManager { private static IMogoRegisterCenter mMogoRegisterCenter; private static IMogoRefreshStrategyController mIMogoRefreshStrategyController; private static IMogoMarkerService mIMogoMarkerService; + private static IMogoShareManager mIMogoShareManager; private static IMogoActionManager mMogoActionManager; private static ICarsChattingProvider mCarsChattingProvider; @@ -102,6 +104,7 @@ public class V2XServiceManager { mMogoTopViewManager = mMogoServiceApis.getTopViewManager(); mIMogoSearchManager = mMogoServiceApis.getSearchManagerApi(); mIMogoMarkerService = mMogoServiceApis.getMarkerService(); + mIMogoShareManager = mMogoServiceApis.getShareManager(); mMarkerManager = mMapService.getMarkerManager(context); mNavi = mMapService.getNavi(context); @@ -243,4 +246,8 @@ public class V2XServiceManager { public static V2XCalculateServer getV2XCalculateServer() { return mV2XCalculateServer; } + + public static IMogoShareManager getMogoShareManager() { + return mIMogoShareManager; + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt index c861d22fef..c3eb2c91de 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt @@ -79,7 +79,7 @@ class V2XEventPanelFragment : MvpFragment 0) { tvEventCount.visibility = View.VISIBLE tvEventCount.text = "${historyMessage.size}" diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java index 60d9a9c89b..3ffce33d8e 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java @@ -2,8 +2,10 @@ package com.mogo.module.v2x.fragment; import android.content.Context; import android.util.Log; +import android.view.View; import androidx.annotation.NonNull; +import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -16,6 +18,7 @@ import com.mogo.module.v2x.adapter.V2XScenarioHistoryAdapter; import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener; import com.mogo.module.v2x.manager.V2XStatusDescriptor; import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter; +import com.mogo.module.v2x.view.V2XListEmptyView; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.utils.GsonUtil; @@ -31,6 +34,8 @@ public class V2XScenarioHistoryFragment extends MvpFragment { private String TAG = "ScenarioHistoryFragment"; + private V2XListEmptyView mEmptyView; + private CoordinatorLayout mClHistoryList; private RecyclerView mRecyclerView; private V2XScenarioHistoryAdapter mV2XScenarioHistoryAdapter; private ArrayList mV2XHistoryScenarioData = new ArrayList<>(); @@ -43,7 +48,10 @@ public class V2XScenarioHistoryFragment @Override protected void initViews() { Log.d(TAG, "initViews --------> "); - mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + + mEmptyView = findViewById(R.id.viewEmpty); + mClHistoryList = findViewById(R.id.clHistoryList); + mRecyclerView = findViewById(R.id.recyclerView); mV2XScenarioHistoryAdapter = new V2XScenarioHistoryAdapter(mV2XHistoryScenarioData); mRecyclerView.setAdapter(mV2XScenarioHistoryAdapter); mRecyclerView.addItemDecoration(new SpacesItemDecoration(14)); @@ -51,12 +59,28 @@ public class V2XScenarioHistoryFragment LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); mRecyclerView.setLayoutManager(layoutManager); initListener(); + + mEmptyView.setTripMessage("暂无交通事件"); + mEmptyView.setRefreshVisibility(false); } /** * 初始化页面用到得监听 */ private void initListener() { + mEmptyView.setOnControlListener(new V2XListEmptyView.OnControlListener() { + @Override + public void onShearClick() { + V2XServiceManager.getMogoShareManager().showShareDialog(); + } + + @Override + public void onRefreshClick() { + + } + }); + + V2XServiceManager.getMoGoV2XStatusManager() .registerStatusChangedListener( TAG, @@ -85,7 +109,14 @@ public class V2XScenarioHistoryFragment public void loadHistory(List v2XHistoryScenarioData) { Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData)); mV2XHistoryScenarioData.clear(); - mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData); + if (v2XHistoryScenarioData.size() > 0) { + mEmptyView.setVisibility(View.GONE); + mClHistoryList.setVisibility(View.VISIBLE); + mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData); + } else { + mEmptyView.setVisibility(View.VISIBLE); + mClHistoryList.setVisibility(View.GONE); + } mV2XScenarioHistoryAdapter.notifyDataSetChanged(); } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java index e1eb9f6112..47e52c8be5 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/V2XSQLiteUtils.java @@ -73,6 +73,15 @@ public class V2XSQLiteUtils { return getScenarioHistoryDao().query(new V2XHistoryScenarioData(), "triggerTime", true); } + /** + * 查询当天的未评价V2X数据 + */ + public static List getScenarioHistoryUnDisposeData() { + V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData(); + v2XHistoryScenarioData.isDispose = false; + return getScenarioHistoryDao().query(v2XHistoryScenarioData, "triggerTime", true); + } + /** * 修改指定的数据 */ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XListEmptyView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XListEmptyView.java new file mode 100644 index 0000000000..e6c4717760 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XListEmptyView.java @@ -0,0 +1,97 @@ +package com.mogo.module.v2x.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import com.mogo.module.v2x.R; + +/** + * 列表空白布局View + * + * @author donghongyu + */ +public class V2XListEmptyView extends LinearLayout { + + private ImageView mIvEmptyView; + private TextView mTvTrip; + private Button mBtnShear; + private Button mBtnRefresh; + + private OnControlListener mOnControlListener; + + public V2XListEmptyView(Context context) { + this(context, null); + } + + public V2XListEmptyView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } + + public V2XListEmptyView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + LayoutInflater.from(context).inflate(R.layout.view_history_empty, this); + initView(); + } + + private void initView() { + mIvEmptyView = findViewById(R.id.ivEmptyView); + mTvTrip = findViewById(R.id.tvTrip); + mBtnShear = findViewById(R.id.btnShear); + mBtnRefresh = findViewById(R.id.btnRefresh); + + mBtnShear.setOnClickListener(v -> { + if (mOnControlListener != null) { + mOnControlListener.onShearClick(); + } + }); + mBtnRefresh.setOnClickListener(v -> { + if (mOnControlListener != null) { + mOnControlListener.onRefreshClick(); + } + }); + } + + public void setTripMessage(String tripMsg) { + if (mTvTrip != null) { + mTvTrip.setText(tripMsg); + } + } + + public void setShearVisibility(boolean visibility) { + if (mBtnShear != null) { + if (visibility) { + mBtnShear.setVisibility(VISIBLE); + } else { + mBtnShear.setVisibility(GONE); + } + } + } + + public void setRefreshVisibility(boolean visibility) { + if (mBtnRefresh != null) { + if (visibility) { + mBtnRefresh.setVisibility(VISIBLE); + } else { + mBtnRefresh.setVisibility(GONE); + } + } + } + + public void setOnControlListener(OnControlListener onControlListener) { + this.mOnControlListener = onControlListener; + } + + public interface OnControlListener { + void onShearClick(); + + void onRefreshClick(); + } + +} diff --git a/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_blank_history_event.png b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_blank_history_event.png new file mode 100644 index 0000000000..c77748e661 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-ldpi/icon_blank_history_event.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_more_bkg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_more_bkg.xml index 99e433a31f..05b8d4a553 100644 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_more_bkg.xml +++ b/modules/mogo-module-v2x/src/main/res/drawable/v2x_drawable_event_more_bkg.xml @@ -1,8 +1,10 @@ - - + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg.xml deleted file mode 100644 index e90fdc8ce3..0000000000 --- a/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg_dark.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg_dark.xml new file mode 100644 index 0000000000..b359c203e9 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg_dark.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg_light.xml b/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg_light.xml new file mode 100644 index 0000000000..1c9c0b5e05 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/drawable/v2xt_dw_common_corner_bkg_light.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_event_panel.xml b/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_event_panel.xml index d6a0c423da..ec35978846 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_event_panel.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_event_panel.xml @@ -30,13 +30,11 @@ android:layout_marginEnd="@dimen/dp_12" android:background="@drawable/v2x_drawable_event_message_bkg" android:paddingStart="@dimen/dp_10" - android:paddingTop="@dimen/dp_0_5" android:paddingEnd="@dimen/dp_10" - android:paddingBottom="@dimen/dp_0_5" android:textColor="#FFFFFF" android:textSize="@dimen/dp_28" android:visibility="gone" - tools:text="99" + tools:text="9" tools:visibility="visible" /> diff --git a/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_scenario_history.xml b/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_scenario_history.xml index 2741d1cff2..4f91e0dbcb 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_scenario_history.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_panel_fragment_scenario_history.xml @@ -1,35 +1,49 @@ - - - - - - - - - + android:visibility="gone" + tools:visibility="visible" /> + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/view_history_empty.xml b/modules/mogo-module-v2x/src/main/res/layout/view_history_empty.xml new file mode 100644 index 0000000000..2ed3141746 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/layout/view_history_empty.xml @@ -0,0 +1,62 @@ + + + + + + + +