diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable-xhdpi/sweeper_icon_msg_box_close.png b/OCH/mogo-och-sweeper/src/main/res/drawable-xhdpi/sweeper_icon_msg_box_close.png new file mode 100644 index 0000000000..3396262088 Binary files /dev/null and b/OCH/mogo-och-sweeper/src/main/res/drawable-xhdpi/sweeper_icon_msg_box_close.png differ diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable-xhdpi/sweeper_icon_msg_box_open.png b/OCH/mogo-och-sweeper/src/main/res/drawable-xhdpi/sweeper_icon_msg_box_open.png new file mode 100644 index 0000000000..1ac1ab0eca Binary files /dev/null and b/OCH/mogo-och-sweeper/src/main/res/drawable-xhdpi/sweeper_icon_msg_box_open.png differ diff --git a/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_selector_msg_box.xml b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_selector_msg_box.xml new file mode 100644 index 0000000000..142a5bc514 --- /dev/null +++ b/OCH/mogo-och-sweeper/src/main/res/drawable/sweeper_selector_msg_box.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml index ad9534b576..1039ecdcc6 100644 --- a/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml +++ b/OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml @@ -150,6 +150,7 @@ android:layout_height="150dp" android:layout_marginEnd="@dimen/dp_30" android:layout_marginBottom="@dimen/dp_30" + app:bgDrawable="@drawable/sweeper_selector_msg_box" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt index 1bda3f2e9b..cdeb0b48cc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/DriverMsgBoxButtonView.kt @@ -4,12 +4,14 @@ import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater import android.view.View +import androidx.appcompat.content.res.AppCompatResources import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxEventListener import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager import com.mogo.eagle.core.function.hmi.R -import kotlinx.android.synthetic.main.view_driver_msg_box_button.view.* +import kotlinx.android.synthetic.main.view_driver_msg_box_button.view.cbMsgBoxDriver +import kotlinx.android.synthetic.main.view_driver_msg_box_button.view.msgBoxTipView /** * @author XuXinChao @@ -20,7 +22,7 @@ class DriverMsgBoxButtonView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -):ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener { +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener { companion object { const val TAG = "DriverMsgBoxButtonView" @@ -28,21 +30,35 @@ class DriverMsgBoxButtonView @JvmOverloads constructor( private var clickListener: ClickListener? = null - init{ + private val bgResources: Int + + init { LayoutInflater.from(context).inflate(R.layout.view_driver_msg_box_button, this, true) + val a = context.obtainStyledAttributes( + attrs, + R.styleable.DriverMsgBoxButtonView, + defStyleAttr, + 0 + ) + bgResources = a.getResourceId( + R.styleable.DriverMsgBoxButtonView_bgDrawable, + R.drawable.selector_msg_box + ) initView() } - private fun initView(){ + private fun initView() { cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked -> clickListener?.showMsgBoxList(isChecked) msgBoxTipView.visibility = View.GONE } + + cbMsgBoxDriver.background = AppCompatResources.getDrawable(context, bgResources) } override fun onAttachedToWindow() { super.onAttachedToWindow() - CallerMsgBoxEventListenerManager.addListener(TAG,this) + CallerMsgBoxEventListenerManager.addListener(TAG, this) } override fun onDetachedFromWindow() { @@ -59,9 +75,9 @@ class DriverMsgBoxButtonView @JvmOverloads constructor( * @param isShow true:展示;false:不展示 */ override fun onUpdateTipEvent(isShow: Boolean) { - if(isShow){ + if (isShow) { msgBoxTipView.visibility = View.VISIBLE - }else{ + } else { msgBoxTipView.visibility = View.GONE } } @@ -82,7 +98,7 @@ class DriverMsgBoxButtonView @JvmOverloads constructor( this.clickListener = clickListener } - interface ClickListener{ + interface ClickListener { fun showMsgBoxList(show: Boolean) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml index 4e1a2e3835..7887eb5c78 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/attr.xml @@ -80,4 +80,8 @@ + + + + \ No newline at end of file