diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/BlueToothView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/BlueToothView.kt index 307e14b55e..664e86855a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/BlueToothView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/BlueToothView.kt @@ -10,6 +10,7 @@ import android.widget.LinearLayout import com.mogo.eagle.core.function.api.devatools.mofang.* import com.mogo.eagle.core.function.call.devatools.* import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.ToastUtils import kotlinx.android.synthetic.main.view_blue_tooth.view.* /** @@ -26,6 +27,9 @@ open class BlueToothView: LinearLayout, IMoGoMoFangProvider.OnMoFangStatusListen LayoutInflater.from(context).inflate(R.layout.view_blue_tooth , this, true) visibility = View.GONE + + clipChildren = false + clipToPadding = false } companion object{ @@ -58,6 +62,21 @@ open class BlueToothView: LinearLayout, IMoGoMoFangProvider.OnMoFangStatusListen if (it.visibility != View.VISIBLE) { it.visibility = View.VISIBLE } + val oldTextColor = it.currentTextColor + if (battery <= 30) { + if (oldTextColor != Color.RED) { + it.setTextColor(Color.RED) + ivMoFangStatus?.drawable?.setTint(Color.RED) + postDelayed({ + ToastUtils.showShort("当前蘑方处理低电状态, 请及时充电") + }, 5000) + } + } else { + if (oldTextColor != Color.WHITE) { + it.setTextColor(Color.WHITE) + ivMoFangStatus?.drawable?.setTint(Color.WHITE) + } + } it.text = "${battery}%" } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_blue_tooth.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_blue_tooth.xml index 1080063127..24e8679ed0 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_blue_tooth.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_blue_tooth.xml @@ -19,10 +19,13 @@ android:id="@+id/ivMoFangBattery" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="12dip" + android:textSize="25dip" + android:textStyle="bold" android:textColor="@color/white" android:layout_gravity="bottom" android:visibility="gone" + android:layout_marginStart="-8dip" + android:layout_marginBottom="1dip" tools:text="18%"/> \ No newline at end of file