From 6f9b9252334aae18b2537de0baee1e0f5d96707b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Wed, 12 Aug 2020 10:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=8C=89=E9=92=AE=E5=B1=82=E7=BA=A7=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/fragment/V2XEventPanelFragment.kt | 14 +++-- .../view/V2XEventPanelHistoryCountView.java | 53 +++++++++++++++++++ .../item_v2x_scennario_history_other_help.xml | 3 +- ...e_v2x_event_panel_fragment_event_panel.xml | 33 ------------ .../layout/view_event_panel_history_count.xml | 35 ++++++++++++ 5 files changed, 99 insertions(+), 39 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/V2XEventPanelHistoryCountView.java create mode 100644 modules/mogo-module-v2x/src/main/res/layout/view_event_panel_history_count.xml 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