From: xue <2144439972@qq.com> Date: Mon, 15 Jun 2026 01:43:45 +0000 (+0800) Subject: 修改电量为20%触发 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=e028bfb2aff1874fc30dd47c08f05ed389afd18c;p=mirrors%2FFD230.git 修改电量为20%触发 --- diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGHistoryView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGHistoryView.cpp index 7d271bc4d..2f09d0673 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGHistoryView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGHistoryView.cpp @@ -287,7 +287,7 @@ void ECGHistoryView::RebuildList() { UILabel *bpmLabel = nullptr; std::string bpmStr = rec.bpm > 0 ? (std::to_string(rec.bpm) + " 次/分") : "-- 次/分"; - InitUILabel(bpmLabel, ECG_HISTORY_CARD_MARGIN + 40 + 38 + 8 + 8 + 120, y + 36 + 5 + 4, 119, 35, "ecg_list_bpm", + InitUILabel(bpmLabel, ECG_HISTORY_CARD_MARGIN + 40 + 38 + 8 + 8 + 120, y + 36 + 5 + 2, 119, 35, "ecg_list_bpm", bpmStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 28); bpmLabel->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.cpp index cfd45b8a0..3cee20dee 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.cpp @@ -20,6 +20,7 @@ UIViewGroup *CreateHealthMeasureLowPowerNotifyView() { return lowPowerShow(); } void ShowHealthMeasureLowBatteryNotifyImpl() { uapi_set_screen_on_api(); set_lowpower_falg(0); + set_lowpower_charge_remind_percent(kHealthMeasureMinBatteryPercent); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify( CreateHealthMeasureLowPowerNotifyView, TOPIC_EVENT_LOWPOWER_ALARM, true); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.h index 187861475..38db5f568 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/health/HealthMeasureBattery.h @@ -3,12 +3,12 @@ namespace OHOS { -static constexpr int kHealthMeasureMinBatteryPercent = 80; +static constexpr int kHealthMeasureMinBatteryPercent = 20; -/** 电量低于 10% 时不允许开始测量/校准 */ +/** 电量低于 kHealthMeasureMinBatteryPercent 时不允许开始测量/校准 */ bool IsBatteryTooLowForMeasure(); -/** 复用系统低电量充电提醒弹窗(charge_notification::lowPowerShow) */ +/** 复用系统低电量充电提醒弹窗,文案阈值与 kHealthMeasureMinBatteryPercent 一致 */ void ShowHealthMeasureLowBatteryNotify(); } // namespace OHOS diff --git a/code/sdk/application/wearable/n9/service/msg_center/include/notify/charge_notification.h b/code/sdk/application/wearable/n9/service/msg_center/include/notify/charge_notification.h index 9827724ae..9fad1fce5 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/include/notify/charge_notification.h +++ b/code/sdk/application/wearable/n9/service/msg_center/include/notify/charge_notification.h @@ -12,7 +12,11 @@ namespace OHOS UIViewGroup * ShowChargeingView(void); UIViewGroup* lowPowerShow(void); - + + /** 充电提醒弹窗文案中的电量阈值(0=使用 STR_LOW_POWER_NOTIF_1 默认 10%) 二代手表特有,需要修改*/ + void set_lowpower_charge_remind_percent(int percent); + void reset_lowpower_charge_remind_percent(void); + void set_lowpower_falg(uint8_t falg); void FreelowPower(void); void low_power_play(); diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/notify/charge_notification.cpp index 9c56845e9..efb9cbc7a 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/notify/charge_notification.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/notify/charge_notification.cpp @@ -18,6 +18,8 @@ #include "uicomponents/UIComponents.h" #include "charge_notification.h" +#include + // #include "ui_resource_string.h" namespace OHOS @@ -393,6 +395,37 @@ namespace OHOS } static uint8_t battery_falg = 0; + static int lowpower_charge_remind_percent = 0; + + void set_lowpower_charge_remind_percent(int percent) + { + lowpower_charge_remind_percent = percent > 0 ? percent : 0; + } + + void reset_lowpower_charge_remind_percent(void) + { + lowpower_charge_remind_percent = 0; + } + + static void apply_lowpower_charge_remind_text(UILabelExt *label) + { + if (label == nullptr) { + return; + } + if (lowpower_charge_remind_percent <= 0) { + label->SetTextId(STR_LOW_POWER_NOTIF_1); + return; + } + label->SetTextId(STR_LOW_POWER_NOTIF_1); + std::string result = UpdateLabel(label, lowpower_charge_remind_percent, STR_LOW_POWER_NOTIF_1); + const std::string percentStr = std::to_string(lowpower_charge_remind_percent); + if (result.find(percentStr) == std::string::npos) { + char buf[80] = {0}; + (void)snprintf(buf, sizeof(buf) - 1, "当前电量低于%d%%请及时充电", lowpower_charge_remind_percent); + label->SetText(buf); + } + } + void set_lowpower_falg(uint8_t falg) { battery_falg = falg; @@ -445,6 +478,7 @@ namespace OHOS delete UIViewGroup_lowpower; UIViewGroup_lowpower = nullptr; } + reset_lowpower_charge_remind_percent(); } void low_power_TimerCallBack(int data) @@ -546,8 +580,7 @@ namespace OHOS { alarm_UILabel->SetPosition(110, 252); alarm_UILabel->Resize(245, 70); - // alarm_UILabel->SetText("当前电量低于10%请及时充电"); - alarm_UILabel->SetTextId(STR_LOW_POWER_NOTIF_1); + apply_lowpower_charge_remind_text(alarm_UILabel); alarm_UILabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); alarm_UILabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); diff --git a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a index d1adaf574..515ce6543 100644 Binary files a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a and b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a differ