From: Caisking <3449750381@qq.com> Date: Tue, 24 Sep 2024 12:33:21 +0000 (+0800) Subject: #314 手表,消息通知,长消息超出框外显示 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7ac954390fe5dcf6bf40cca24ffc9c824ace62d3;p=mirrors%2FFD230.git #314 手表,消息通知,长消息超出框外显示 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp index 12b4ad39b..7ed7bff6c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp @@ -348,6 +348,8 @@ namespace OHOS data.labelTitle = messageInfo->title; data.timestamp = messageInfo->time; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddMessageData data.isRead is %d,data.labelDetails is %s,data.labelTitle is %s,data.timestamp is %d", data.isRead, data.labelDetails.c_str(), data.labelTitle.c_str(), data.timestamp); + char labelTime[20]; if (uapi_get_TIME_STR(data.timestamp, labelTime, '.', ':', DATE_Y_M_D_H_M) != ERRCODE_SUCC) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp index 306d9a429..3cc5de923 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp @@ -136,7 +136,7 @@ namespace OHOS int updatedLabelWidth = baseLabelWidth + (additionalLines * extraLabelWidthPerLine); // 输出配置结果 - messageButton->SetPosition(33, 157, 400, updatedRectWidth); + messageButton->SetPosition(33, 157, 380, updatedRectWidth); deleteButton->SetPosition(43, 157 + updatedRectWidth + 20, 380, 100); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "updatedRectWidth %d updatedLabelWidth %d lines %d \r\n", updatedRectWidth, updatedLabelWidth, lines); @@ -176,12 +176,18 @@ namespace OHOS time->SetVisible(true); /* -------------------------------------------------------------------------- */ /*初始化消息内容*/ - InitializeButton(messageButton, 33, 157, 400, defaultRectWidth, "message"); - messageButton->SetStyle(STYLE_BORDER_RADIUS, 30); + InitializeButton(messageButton, 33, 157, 380, defaultRectWidth, "message"); + messageButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); + messageButton->SetStyle(STYLE_BORDER_RADIUS, 20); + messageButton->SetStyle(STYLE_PADDING_LEFT, 15); + messageButton->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); messageButton->SetAlign(TEXT_ALIGNMENT_LEFT); - messageButton->SetTextColor(Color::Gray()); + messageButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + messageButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); + messageButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + messageButton->SetStyleForState(STYLE_BORDER_RADIUS, 20, UIButton::PRESSED); messageButton->SetTouchable(false); - // messageButton->SetText(messageStr.c_str()); + messageButton->SetText(messageStr.c_str()); // messageButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ InitUILabel(message, 63, 165, 340, 100, "message", messageStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -194,7 +200,7 @@ namespace OHOS container_->Add(title); container_->Add(time); container_->Add(messageButton); - container_->Add(message); + // container_->Add(message); container_->Add(deleteButton); /* -------------------------------------------------------------------------- */ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitView is ok!");