[6.0.0][魔方] 添加魔方低电状态;优化展示效果
This commit is contained in:
@@ -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}%"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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%"/>
|
||||
|
||||
</merge>
|
||||
Reference in New Issue
Block a user