[2.13.0]消息盒子

This commit is contained in:
xuxinchao
2022-12-01 18:10:50 +08:00
parent 9e86296939
commit 07c4d8ce7b
4 changed files with 27 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.marginTop
@@ -52,6 +53,14 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
linearLayoutManager.stackFromEnd = true
linearLayoutManager.reverseLayout = true
driverMsgBoxBubbleAdapter = DriverMsgBoxBubbleAdapter(context as Activity)
driverMsgBoxBubbleAdapter?.setChangeListener(object : DriverMsgBoxBubbleAdapter.ChangeViewListener{
override fun notifyView() {
if(dataList.isEmpty()){
rvBubbleList.visibility = View.GONE
}
}
})
rvBubbleList.adapter = driverMsgBoxBubbleAdapter
rvBubbleList.layoutManager = linearLayoutManager
}
@@ -71,6 +80,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
//弹出被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,context as Activity,true)
}else{
rvBubbleList.visibility = View.VISIBLE
dataList.add(msgBoxBean)
driverMsgBoxBubbleAdapter?.setData(dataList)
}

View File

@@ -36,6 +36,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val report: Int = 4
var countDownTimer: CountDownTimer?=null
private var changeViewListener: ChangeViewListener?=null
fun setData(data: ArrayList<MsgBoxBean>){
this.data = data
@@ -133,6 +134,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
override fun onFinish() {
data?.remove(msgBoxBean)
changeViewListener?.notifyView()
notifyDataSetChanged()
// notifyItemRemoved(index)
// notifyItemRangeChanged(index,recordTypeEntity.size-index)
@@ -186,4 +188,14 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}
interface ChangeViewListener{
fun notifyView()
}
}

View File

@@ -42,7 +42,7 @@
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvBubbleReportTitle"
app:layout_constraintLeft_toLeftOf="@id/tvBubbleReportTitle"
android:layout_marginTop="20px"
android:layout_marginTop="10px"
android:textColor="#B3FFFFFF"
android:textSize="28px"
/>
@@ -53,7 +53,7 @@
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvBubbleReportTime"
app:layout_constraintLeft_toLeftOf="@id/tvBubbleReportTime"
android:layout_marginTop="15px"
android:layout_marginTop="10px"
android:textColor="#B3FFFFFF"
android:textSize="28px"
/>

View File

@@ -10,6 +10,9 @@
android:id="@+id/rvBubbleList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10px"
android:paddingBottom="10px"
android:visibility="gone"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>