完成了事件面板中的样式以及数量标记

This commit is contained in:
董宏宇
2020-08-11 12:06:55 +08:00
parent 8276c6a929
commit 3a7a84465a
5 changed files with 64 additions and 19 deletions

View File

@@ -11,6 +11,7 @@ import com.mogo.module.v2x.V2XConst.MODULE_NAME
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.utils.logger.Logger
import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_event_panel.*
@@ -24,13 +25,10 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
private val TAG = "EventPanelFragment"
private val tabsTitle = arrayOf("出行动态", "周边事件", "我的分享")
private var fragments: Array<Fragment>? = null
private var mediator: TabLayoutMediator? = null
private var selectPosition = 0
companion object {
private val fragment = V2XEventPanelFragment()
fun getInstance(): V2XEventPanelFragment {
@@ -73,13 +71,21 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
hidePanel()
}
btnShowOrHidePanels.setOnClickListener {
if (clPanelContainer.visibility == View.GONE) {
llEventMore.setOnClickListener {
if (!isPanelShow()) {
showPanel()
} else {
hidePanel()
}
}
val historyMessage = V2XSQLiteUtils.getScenarioHistoryData()
if (historyMessage != null && historyMessage.size > 0) {
tvEventCount.visibility = View.VISIBLE
tvEventCount.text = "${historyMessage.size}"
} else {
tvEventCount.visibility = View.GONE
}
}
override fun onDestroyView() {
@@ -94,16 +100,13 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
fun showPanel() {
Logger.d(MODULE_NAME, "in fragment show panel")
clPanelContainer.visibility = View.VISIBLE
btnShowOrHidePanels.text = "隐藏面板"
V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, true)
}
fun hidePanel() {
Logger.d(MODULE_NAME, "in fragment hide panel")
clPanelContainer.visibility = View.GONE
btnShowOrHidePanels.text = "显示面板"
V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, false)
}
fun isPanelShow(): Boolean {

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

View File

@@ -0,0 +1,10 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="@dimen/dp_180" />
<gradient android:angle="90"
android:endColor="#D94848"
android:startColor="#C63F3F" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="@dimen/dp_30" />
<gradient android:angle="90" android:endColor="#3F456D" android:startColor="#3F435F" />
</shape>
</item>
</selector>

View File

@@ -5,6 +5,41 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/llEventMore"
android:layout_width="@dimen/dp_132"
android:layout_height="@dimen/dp_132"
android:background="@drawable/v2x_drawable_event_more_bkg"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:translationZ="1dp">
<ImageView
android:id="@+id/btnShowOrHidePanels"
android:layout_width="@dimen/dp_52"
android:layout_height="@dimen/dp_52"
android:layout_centerInParent="true"
android:src="@drawable/icon_event_panel_more" />
<TextView
android:id="@+id/tvEventCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_12"
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:visibility="visible" />
</RelativeLayout>
<com.mogo.module.v2x.view.RoundConstraintLayout
android:id="@+id/clPanelContainer"
android:layout_width="match_parent"
@@ -96,15 +131,4 @@
</com.mogo.module.v2x.view.RoundConstraintLayout>
<Button
android:id="@+id/btnShowOrHidePanels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:layout_marginEnd="10dp"
android:text="显示面板"
android:textColor="#000"
android:textSize="20sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>