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 25a29ab666..9fc30de182 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 @@ -12,6 +12,7 @@ import com.mogo.module.v2x.V2XServiceManager import com.mogo.module.v2x.adapter.V2XEventPagerAdapter import com.mogo.module.v2x.presenter.EventPanelPresenter import com.mogo.module.v2x.utils.V2XSQLiteUtils +import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView import com.mogo.utils.logger.Logger import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_event_panel.* @@ -29,6 +30,8 @@ class V2XEventPanelFragment : MvpFragment 0) { - tvEventCount.visibility = View.VISIBLE - tvEventCount.text = "${historyMessage.size}" + if (historyMessage != null) { + mV2XEventPanelHistoryCountView?.changeMsgCount(historyMessage.size) } else { - tvEventCount.visibility = View.GONE + mV2XEventPanelHistoryCountView?.changeMsgCount(0) } } } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java new file mode 100644 index 0000000000..b372bc373d --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java @@ -0,0 +1,53 @@ +package com.mogo.module.v2x.view; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import com.mogo.module.v2x.R; + +/** + * 事件面板的提示按钮 + * + * @author donghongyu + */ +public class V2XEventPanelHistoryCountView extends LinearLayout { + private RelativeLayout mLlEventMore; + private ImageView mBtnShowOrHidePanels; + private TextView mTvEventCount; + + public V2XEventPanelHistoryCountView(Context context) { + this(context, null); + } + + public V2XEventPanelHistoryCountView(Context context, @Nullable AttributeSet attrs) { + this(context, attrs, 0); + } + + public V2XEventPanelHistoryCountView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + LayoutInflater.from(context).inflate(R.layout.view_event_panel_history_count, this); + + mLlEventMore = (RelativeLayout) findViewById(R.id.llEventMore); + mBtnShowOrHidePanels = (ImageView) findViewById(R.id.btnShowOrHidePanels); + mTvEventCount = (TextView) findViewById(R.id.tvEventCount); + } + + public void changeMsgCount(int count) { + if (mTvEventCount != null) { + if (count > 0) { + mTvEventCount.setVisibility(View.VISIBLE); + } else { + mTvEventCount.setVisibility(View.GONE); + } + mTvEventCount.setText("" + count); + } + } +} diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_scennario_history_other_help.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_scennario_history_other_help.xml index 827dbace7b..16f6583eaa 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_scennario_history_other_help.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_scennario_history_other_help.xml @@ -95,7 +95,7 @@ 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 ec35978846..9379fbfae5 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 @@ -5,39 +5,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - - + + + + + + \ No newline at end of file