mirror of
https://gitee.com/pp/SmsForwarder.git
synced 2026-09-03 05:24:33 +08:00
优化:自动任务·快捷指令的触发条件电池状态和充电器改为多选 #719
This commit is contained in:
@@ -6,75 +6,103 @@ import com.xuexiang.xutil.resource.ResUtils.getString
|
||||
import java.io.Serializable
|
||||
|
||||
data class ChargeSetting(
|
||||
var description: String = "", //描述
|
||||
var status: Int = BatteryManager.BATTERY_STATUS_UNKNOWN, //状态
|
||||
var plugged: Int = BatteryManager.BATTERY_PLUGGED_AC, //充电方式
|
||||
var description: String = "",
|
||||
var statusList: List<Int> = emptyList(), // 多选状态列表
|
||||
var pluggedList: List<Int> = emptyList(), // 多选充电方式列表,空=不限
|
||||
// 旧版字段,保留以兼容已存储的历史数据
|
||||
var status: Int = BatteryManager.BATTERY_STATUS_UNKNOWN,
|
||||
var plugged: Int = BatteryManager.BATTERY_PLUGGED_AC,
|
||||
) : Serializable {
|
||||
|
||||
constructor(statusCheckId: Int, pluggedCheckId: Int) : this() {
|
||||
status = when (statusCheckId) {
|
||||
R.id.rb_battery_charging -> BatteryManager.BATTERY_STATUS_CHARGING
|
||||
R.id.rb_battery_discharging -> BatteryManager.BATTERY_STATUS_DISCHARGING
|
||||
R.id.rb_battery_not_charging -> BatteryManager.BATTERY_STATUS_NOT_CHARGING
|
||||
R.id.rb_battery_full -> BatteryManager.BATTERY_STATUS_FULL
|
||||
R.id.rb_battery_unknown -> BatteryManager.BATTERY_STATUS_UNKNOWN
|
||||
else -> BatteryManager.BATTERY_STATUS_UNKNOWN
|
||||
constructor(statusCheckIds: List<Int>, pluggedCheckIds: List<Int>) : this() {
|
||||
statusList = statusCheckIds.mapNotNull { id ->
|
||||
when (id) {
|
||||
R.id.cb_battery_charging -> BatteryManager.BATTERY_STATUS_CHARGING
|
||||
R.id.cb_battery_discharging -> BatteryManager.BATTERY_STATUS_DISCHARGING
|
||||
R.id.cb_battery_not_charging -> BatteryManager.BATTERY_STATUS_NOT_CHARGING
|
||||
R.id.cb_battery_full -> BatteryManager.BATTERY_STATUS_FULL
|
||||
R.id.cb_battery_unknown -> BatteryManager.BATTERY_STATUS_UNKNOWN
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
plugged = when (pluggedCheckId) {
|
||||
R.id.rb_plugged_ac -> BatteryManager.BATTERY_PLUGGED_AC
|
||||
R.id.rb_plugged_usb -> BatteryManager.BATTERY_PLUGGED_USB
|
||||
R.id.rb_plugged_wireless -> BatteryManager.BATTERY_PLUGGED_WIRELESS
|
||||
R.id.rb_plugged_unlimited -> 0 //不限
|
||||
else -> BatteryManager.BATTERY_PLUGGED_AC
|
||||
pluggedList = if (pluggedCheckIds.contains(R.id.cb_plugged_unlimited)) {
|
||||
emptyList() // 不限 = 任意充电方式
|
||||
} else {
|
||||
pluggedCheckIds.mapNotNull { id ->
|
||||
when (id) {
|
||||
R.id.cb_plugged_ac -> BatteryManager.BATTERY_PLUGGED_AC
|
||||
R.id.cb_plugged_usb -> BatteryManager.BATTERY_PLUGGED_USB
|
||||
R.id.cb_plugged_wireless -> BatteryManager.BATTERY_PLUGGED_WIRELESS
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
description = String.format(getString(R.string.battery_status), getStatusStr(status))
|
||||
description += ", " + String.format(getString(R.string.battery_plugged), getPluggedStr(plugged))
|
||||
description = buildDescription()
|
||||
}
|
||||
|
||||
private fun getStatusStr(status: Int): String {
|
||||
return when (status) {
|
||||
BatteryManager.BATTERY_STATUS_CHARGING -> getString(R.string.battery_charging)
|
||||
BatteryManager.BATTERY_STATUS_DISCHARGING -> getString(R.string.battery_discharging)
|
||||
BatteryManager.BATTERY_STATUS_NOT_CHARGING -> getString(R.string.battery_not_charging)
|
||||
BatteryManager.BATTERY_STATUS_FULL -> getString(R.string.battery_full)
|
||||
BatteryManager.BATTERY_STATUS_UNKNOWN -> getString(R.string.battery_unknown)
|
||||
else -> getString(R.string.battery_unknown)
|
||||
// 兼容旧数据:statusList 为空时回退到旧字段 status
|
||||
private fun getEffectiveStatusList(): List<Int> =
|
||||
statusList.ifEmpty { listOf(status) }
|
||||
|
||||
// 兼容旧数据:statusList 为空时代表旧格式,回退到旧字段 plugged
|
||||
private fun getEffectivePluggedList(): List<Int> {
|
||||
if (statusList.isEmpty()) return if (plugged != 0) listOf(plugged) else emptyList()
|
||||
return pluggedList // 新格式:空列表 = 任意充电方式
|
||||
}
|
||||
|
||||
private fun buildDescription(): String {
|
||||
val statusStr = getEffectiveStatusList().joinToString("/") { getStatusStr(it) }
|
||||
val effectivePlugged = getEffectivePluggedList()
|
||||
val pluggedStr = if (effectivePlugged.isEmpty()) getString(R.string.battery_unlimited)
|
||||
else effectivePlugged.joinToString("/") { getPluggedStr(it) }
|
||||
return String.format(getString(R.string.battery_status), statusStr) + ", " +
|
||||
String.format(getString(R.string.battery_plugged), pluggedStr)
|
||||
}
|
||||
|
||||
private fun getStatusStr(s: Int): String = when (s) {
|
||||
BatteryManager.BATTERY_STATUS_CHARGING -> getString(R.string.battery_charging)
|
||||
BatteryManager.BATTERY_STATUS_DISCHARGING -> getString(R.string.battery_discharging)
|
||||
BatteryManager.BATTERY_STATUS_NOT_CHARGING -> getString(R.string.battery_not_charging)
|
||||
BatteryManager.BATTERY_STATUS_FULL -> getString(R.string.battery_full)
|
||||
else -> getString(R.string.battery_unknown)
|
||||
}
|
||||
|
||||
private fun getPluggedStr(p: Int): String = when (p) {
|
||||
BatteryManager.BATTERY_PLUGGED_AC -> getString(R.string.battery_ac)
|
||||
BatteryManager.BATTERY_PLUGGED_USB -> getString(R.string.battery_usb)
|
||||
BatteryManager.BATTERY_PLUGGED_WIRELESS -> getString(R.string.battery_wireless)
|
||||
else -> getString(R.string.battery_unlimited)
|
||||
}
|
||||
|
||||
fun getStatusCheckIds(): List<Int> = getEffectiveStatusList().mapNotNull { s ->
|
||||
when (s) {
|
||||
BatteryManager.BATTERY_STATUS_CHARGING -> R.id.cb_battery_charging
|
||||
BatteryManager.BATTERY_STATUS_DISCHARGING -> R.id.cb_battery_discharging
|
||||
BatteryManager.BATTERY_STATUS_NOT_CHARGING -> R.id.cb_battery_not_charging
|
||||
BatteryManager.BATTERY_STATUS_FULL -> R.id.cb_battery_full
|
||||
BatteryManager.BATTERY_STATUS_UNKNOWN -> R.id.cb_battery_unknown
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun getStatusCheckId(): Int {
|
||||
return when (status) {
|
||||
BatteryManager.BATTERY_STATUS_CHARGING -> R.id.rb_battery_charging
|
||||
BatteryManager.BATTERY_STATUS_DISCHARGING -> R.id.rb_battery_discharging
|
||||
BatteryManager.BATTERY_STATUS_NOT_CHARGING -> R.id.rb_battery_not_charging
|
||||
BatteryManager.BATTERY_STATUS_FULL -> R.id.rb_battery_full
|
||||
BatteryManager.BATTERY_STATUS_UNKNOWN -> R.id.rb_battery_unknown
|
||||
else -> R.id.rb_battery_charging
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPluggedStr(plugged: Int): String {
|
||||
return when (plugged) {
|
||||
BatteryManager.BATTERY_PLUGGED_AC -> getString(R.string.battery_ac)
|
||||
BatteryManager.BATTERY_PLUGGED_USB -> getString(R.string.battery_usb)
|
||||
BatteryManager.BATTERY_PLUGGED_WIRELESS -> getString(R.string.battery_wireless)
|
||||
else -> getString(R.string.battery_unlimited)
|
||||
}
|
||||
}
|
||||
|
||||
fun getPluggedCheckId(): Int {
|
||||
return when (plugged) {
|
||||
BatteryManager.BATTERY_PLUGGED_AC -> R.id.rb_plugged_ac
|
||||
BatteryManager.BATTERY_PLUGGED_USB -> R.id.rb_plugged_usb
|
||||
BatteryManager.BATTERY_PLUGGED_WIRELESS -> R.id.rb_plugged_wireless
|
||||
else -> R.id.rb_plugged_unlimited
|
||||
fun getPluggedCheckIds(): List<Int> {
|
||||
val effective = getEffectivePluggedList()
|
||||
if (effective.isEmpty()) return listOf(R.id.cb_plugged_unlimited)
|
||||
return effective.mapNotNull { p ->
|
||||
when (p) {
|
||||
BatteryManager.BATTERY_PLUGGED_AC -> R.id.cb_plugged_ac
|
||||
BatteryManager.BATTERY_PLUGGED_USB -> R.id.cb_plugged_usb
|
||||
BatteryManager.BATTERY_PLUGGED_WIRELESS -> R.id.cb_plugged_wireless
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getMsg(statusNew: Int, statusOld: Int, pluggedNew: Int, pluggedOld: Int, batteryInfo: String): String {
|
||||
|
||||
if (statusNew != status || (pluggedNew != plugged && plugged != 0)) return ""
|
||||
|
||||
val effectiveStatusList = getEffectiveStatusList()
|
||||
val effectivePluggedList = getEffectivePluggedList()
|
||||
if (effectiveStatusList.isNotEmpty() && statusNew !in effectiveStatusList) return ""
|
||||
if (effectivePluggedList.isNotEmpty() && pluggedNew !in effectivePluggedList) return ""
|
||||
return getString(R.string.battery_status_changed) + getStatusStr(statusOld) + "(" + getPluggedStr(pluggedOld) + ") → " + getStatusStr(statusNew) + "(" + getPluggedStr(pluggedNew) + ")" + batteryInfo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.xuexiang.xpage.annotation.Page
|
||||
import com.xuexiang.xrouter.annotation.AutoWired
|
||||
import com.xuexiang.xrouter.launcher.XRouter
|
||||
import com.xuexiang.xui.widget.actionbar.TitleBar
|
||||
import com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
|
||||
@Page(name = "Charge")
|
||||
@Suppress("PrivatePropertyName", "SameParameterValue")
|
||||
@@ -49,17 +50,27 @@ class ChargeFragment : BaseFragment<FragmentTasksConditionChargeBinding?>(), Vie
|
||||
return titleBar
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化控件
|
||||
*/
|
||||
override fun initViews() {
|
||||
Log.d(TAG, "initViews eventData:$eventData")
|
||||
if (eventData != null) {
|
||||
val settingVo = Gson().fromJson(eventData, ChargeSetting::class.java)
|
||||
Log.d(TAG, "initViews settingVo:$settingVo")
|
||||
binding!!.tvDescription.text = settingVo.description
|
||||
binding!!.rgStatus.check(settingVo.getStatusCheckId())
|
||||
binding!!.rgPlugged.check(settingVo.getPluggedCheckId())
|
||||
val statusIds = settingVo.getStatusCheckIds()
|
||||
binding!!.cbBatteryCharging.isChecked = R.id.cb_battery_charging in statusIds
|
||||
binding!!.cbBatteryDischarging.isChecked = R.id.cb_battery_discharging in statusIds
|
||||
binding!!.cbBatteryNotCharging.isChecked = R.id.cb_battery_not_charging in statusIds
|
||||
binding!!.cbBatteryFull.isChecked = R.id.cb_battery_full in statusIds
|
||||
binding!!.cbBatteryUnknown.isChecked = R.id.cb_battery_unknown in statusIds
|
||||
val pluggedIds = settingVo.getPluggedCheckIds()
|
||||
binding!!.cbPluggedAc.isChecked = R.id.cb_plugged_ac in pluggedIds
|
||||
binding!!.cbPluggedUsb.isChecked = R.id.cb_plugged_usb in pluggedIds
|
||||
binding!!.cbPluggedWireless.isChecked = R.id.cb_plugged_wireless in pluggedIds
|
||||
binding!!.cbPluggedUnlimited.isChecked = R.id.cb_plugged_unlimited in pluggedIds
|
||||
} else {
|
||||
// 新建任务的默认值(XML 的 android:checked 对 SmoothCheckBox 不一定生效)
|
||||
binding!!.cbBatteryCharging.isChecked = true
|
||||
binding!!.cbPluggedUnlimited.isChecked = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,24 +78,23 @@ class ChargeFragment : BaseFragment<FragmentTasksConditionChargeBinding?>(), Vie
|
||||
override fun initListeners() {
|
||||
binding!!.btnDel.setOnClickListener(this)
|
||||
binding!!.btnSave.setOnClickListener(this)
|
||||
binding!!.rgStatus.setOnCheckedChangeListener { _, _ ->
|
||||
checkSetting(true)
|
||||
}
|
||||
binding!!.rgPlugged.setOnCheckedChangeListener { _, _ ->
|
||||
checkSetting(true)
|
||||
}
|
||||
val listener = SmoothCheckBox.OnCheckedChangeListener { _, _ -> checkSetting(true) }
|
||||
listOf(
|
||||
binding!!.cbBatteryCharging, binding!!.cbBatteryDischarging,
|
||||
binding!!.cbBatteryNotCharging, binding!!.cbBatteryFull, binding!!.cbBatteryUnknown,
|
||||
binding!!.cbPluggedAc, binding!!.cbPluggedUsb,
|
||||
binding!!.cbPluggedWireless, binding!!.cbPluggedUnlimited
|
||||
).forEach { cb -> cb.setOnCheckedChangeListener(listener) }
|
||||
}
|
||||
|
||||
@SingleClick
|
||||
override fun onClick(v: View) {
|
||||
try {
|
||||
when (v.id) {
|
||||
|
||||
R.id.btn_del -> {
|
||||
popToBack()
|
||||
return
|
||||
}
|
||||
|
||||
R.id.btn_save -> {
|
||||
val settingVo = checkSetting()
|
||||
val intent = Intent()
|
||||
@@ -102,16 +112,26 @@ class ChargeFragment : BaseFragment<FragmentTasksConditionChargeBinding?>(), Vie
|
||||
}
|
||||
}
|
||||
|
||||
//检查设置
|
||||
private fun checkSetting(updateView: Boolean = false): ChargeSetting {
|
||||
val statusCheckId = binding!!.rgStatus.checkedRadioButtonId
|
||||
val pluggedCheckId = binding!!.rgPlugged.checkedRadioButtonId
|
||||
val settingVo = ChargeSetting(statusCheckId = statusCheckId, pluggedCheckId = pluggedCheckId)
|
||||
val statusCheckIds = mutableListOf<Int>()
|
||||
if (binding!!.cbBatteryCharging.isChecked) statusCheckIds.add(R.id.cb_battery_charging)
|
||||
if (binding!!.cbBatteryDischarging.isChecked) statusCheckIds.add(R.id.cb_battery_discharging)
|
||||
if (binding!!.cbBatteryNotCharging.isChecked) statusCheckIds.add(R.id.cb_battery_not_charging)
|
||||
if (binding!!.cbBatteryFull.isChecked) statusCheckIds.add(R.id.cb_battery_full)
|
||||
if (binding!!.cbBatteryUnknown.isChecked) statusCheckIds.add(R.id.cb_battery_unknown)
|
||||
|
||||
if (updateView) {
|
||||
binding!!.tvDescription.text = settingVo.description
|
||||
if (!updateView && statusCheckIds.isEmpty()) {
|
||||
throw Exception(getString(R.string.battery_status_required))
|
||||
}
|
||||
|
||||
val pluggedCheckIds = mutableListOf<Int>()
|
||||
if (binding!!.cbPluggedAc.isChecked) pluggedCheckIds.add(R.id.cb_plugged_ac)
|
||||
if (binding!!.cbPluggedUsb.isChecked) pluggedCheckIds.add(R.id.cb_plugged_usb)
|
||||
if (binding!!.cbPluggedWireless.isChecked) pluggedCheckIds.add(R.id.cb_plugged_wireless)
|
||||
if (binding!!.cbPluggedUnlimited.isChecked) pluggedCheckIds.add(R.id.cb_plugged_unlimited)
|
||||
|
||||
val settingVo = ChargeSetting(statusCheckIds = statusCheckIds, pluggedCheckIds = pluggedCheckIds)
|
||||
if (updateView) binding!!.tvDescription.text = settingVo.description
|
||||
return settingVo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,45 +62,138 @@
|
||||
android:text="@string/battery_status_title"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_status"
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_battery_charging"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:checked="true"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_charging" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_battery_discharging"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_discharging" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_battery_not_charging"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_not_charging" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_battery_charging"
|
||||
style="@style/rg_rb_style"
|
||||
android:checked="true"
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/battery_charging"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_battery_discharging"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_discharging"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_battery_full"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_battery_not_charging"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_not_charging"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_full" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_battery_full"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_full"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
</LinearLayout>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_battery_unknown"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_unknown"
|
||||
tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</RadioGroup>
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_battery_unknown"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_unknown" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
@@ -112,41 +205,107 @@
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:text="@string/battery_plugged_title"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_plugged"
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="DisableBaselineAlignment">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_plugged_ac"
|
||||
style="@style/rg_rb_style"
|
||||
android:checked="true"
|
||||
android:text="@string/battery_ac"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_plugged_usb"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_usb"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_plugged_ac"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_plugged_wireless"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_wireless"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_ac" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_plugged_unlimited"
|
||||
style="@style/rg_rb_style"
|
||||
android:text="@string/battery_unlimited"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
</LinearLayout>
|
||||
|
||||
</RadioGroup>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_plugged_usb"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_usb" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_plugged_wireless"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_wireless" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.xuexiang.xui.widget.button.SmoothCheckBox
|
||||
android:id="@+id/cb_plugged_unlimited"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:checked="true"
|
||||
app:scb_color_checked="@color/colorPrimary"
|
||||
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/battery_unlimited" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -831,6 +831,7 @@
|
||||
<string name="reach_level_min">[Battery Warning] The lower limit of the battery warning has been reached, please charge it in time!%s</string>
|
||||
<string name="reach_level_max">[Battery Warning] The upper limit of battery warning has been reached, please unplug the charger!%s</string>
|
||||
<string name="battery_status_changed">[Charging status] changes:</string>
|
||||
<string name="battery_status_required">Select at least one battery status</string>
|
||||
<string name="no_indentation_allowed_on_the_first_line">No indentation allowed on the first line</string>
|
||||
<string name="sign_required">The server enables the signing key, and the sign node required</string>
|
||||
<string name="timestamp_required">The server enables the signing key, and the timestamp node required</string>
|
||||
|
||||
@@ -832,6 +832,7 @@
|
||||
<string name="reach_level_min">【电量预警】已达到电量预警下限,请及时充电!%s</string>
|
||||
<string name="reach_level_max">【电量预警】已达到电量预警上限,请拔掉充电器!%s</string>
|
||||
<string name="battery_status_changed">【充电状态】发生变化:</string>
|
||||
<string name="battery_status_required">至少选择一个充电状态</string>
|
||||
<string name="no_indentation_allowed_on_the_first_line">第一行不允许缩进</string>
|
||||
<string name="sign_required">服务端启用签名密钥,sign节点必传</string>
|
||||
<string name="timestamp_required">服务端启用签名密钥,timestamp节点必传</string>
|
||||
|
||||
@@ -832,6 +832,7 @@
|
||||
<string name="reach_level_min">【電量預警】已達到電量預警下限,請及時充電!%s</string>
|
||||
<string name="reach_level_max">【電量預警】已達到電量預警上限,請拔掉充電器!%s</string>
|
||||
<string name="battery_status_changed">【充電狀態】發生變化:</string>
|
||||
<string name="battery_status_required">至少選擇一個充電狀態</string>
|
||||
<string name="no_indentation_allowed_on_the_first_line">第一行不允許縮進</string>
|
||||
<string name="sign_required">服務端啟用簽名密鑰,sign節點必傳</string>
|
||||
<string name="timestamp_required">服務端啟用簽名密鑰,timestamp節點必傳</string>
|
||||
|
||||
@@ -861,6 +861,7 @@
|
||||
<string name="reach_level_min">【电量预警】已达到电量预警下限,请及时充电!%s</string>
|
||||
<string name="reach_level_max">【电量预警】已达到电量预警上限,请拔掉充电器!%s</string>
|
||||
<string name="battery_status_changed">【充电状态】发生变化:</string>
|
||||
<string name="battery_status_required">至少选择一个充电状态</string>
|
||||
<string name="no_indentation_allowed_on_the_first_line">第一行不允许缩进</string>
|
||||
<string name="sign_required">服务端启用签名密钥,sign节点必传</string>
|
||||
<string name="timestamp_required">服务端启用签名密钥,timestamp节点必传</string>
|
||||
|
||||
Reference in New Issue
Block a user