${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStyleModel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStylePresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStyleView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_time_format/src/SetTimeFormatModel.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_time_format/src/SetTimeFormatPresenter.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_time_format/src/SetTimeFormatView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/key/src/KeyInputListener.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/screennotify/src/ui_screennotify.cpp
#define TIMEVIEW_UP 0
#define TIMEVIEW_DOWN 1
#define SECONDTEST 0
-#define TIMEFORMAT 0
+#define TIMEFORMAT 1
std::string Enweekdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
std::string Cnweekdays[] = {"星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
uint8_t hour = local_time.tm_hour % HOURS_IN_DAY;
uint8_t minute = local_time.tm_min % MINUTES_IN_HOUR;
char timebuf[64] = {0};
-
- // Format time string based on defined macros
+ //时间显示样式
+ #if TIMEFORMAT
+ if (uapi_dev_runtime_get_time_hour_show_model() == HOUR_FORMAT_12) {
+ if (hour > HOUR_FORMAT_12) {
+ hour -= HOUR_FORMAT_12;
+ }
+ }
+ #endif
+ //是否显示秒
#if SECONDTEST
- uint8_t second = local_time.tm_sec;
- // uint16_t millisecond = local_time.tm_sec % 1000;
- sprintf(timebuf, "%02d:%02d:%02d", hour, minute, second);
- #else
- sprintf(timebuf, "%02d:%02d", hour, minute);
- #endif
-
- #if TIMEFORMAT
- // Handle 12-hour format display
- const char *phour = (uapi_dev_runtime_get_time_hour_show_model() == HOUR_FORMAT_12) ?
- (hour < HOUR_FORMAT_12 ? "AM" : "PM") : nullptr;
-
- if (phour) {
- if (hour > HOUR_FORMAT_12)
- hour -= HOUR_FORMAT_12;
- sprintf_s(timebuf, sizeof(timebuf), "%s %02d:%02d", phour, hour, minute);
- } else {
- sprintf_s(timebuf, sizeof(timebuf), "%02d:%02d", hour, minute);
- }
+ uint8_t second = local_time.tm_sec;
+ sprintf(timebuf, "%02d:%02d:%02d", hour, minute, second);
+ #else
+ sprintf_s(timebuf, sizeof(timebuf), "%02d:%02d", hour, minute);
#endif
// Update display labels
return;
power_ = power;
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d", power_);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d", power_);
if (batteryprogress != nullptr && batterylabel != nullptr) {
batteryprogress->SetValue(power_);
struct timeval tv;
gettimeofday(&tv, NULL); // 获取当前时间
localtime_r(&tv.tv_sec, &tblock_);
+
+ //需要判断显示的格式
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12)
+ {
+ if (tblock_.tm_hour > 12)
+ tblock_.tm_hour = tblock_.tm_hour - 12 ;
+ }
+
hour_tens = tblock_.tm_hour / 10; // 小时十位
out = static_cast<float>(hour_tens);
struct timeval tv;
gettimeofday(&tv, NULL); // 获取当前时间
localtime_r(&tv.tv_sec, &tblock_);
+
+ //需要判断显示的格式
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12)
+ {
+ if (tblock_.tm_hour > 12)
+ tblock_.tm_hour = tblock_.tm_hour - 12 ;
+ }
+
hour_units = tblock_.tm_hour % 10; // 小时十位
out = static_cast<float>(hour_units);
tblock_.tm_hour = tmp.tm_hour;
tblock_.tm_min = tmp.tm_min;
tblock_.tm_sec = tmp.tm_sec;
-
- if (tmp.tm_hour >=12)
- {
- pm_ = 1;
- }else {
- pm_ = 0;
- }
- if (uapi_dev_runtime_get_time_hour_show_model() == 12 )
+
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12)
{
if (tmp.tm_hour > 12)
tblock_.tm_hour = tmp.tm_hour - 12 ;
// Use ostringstream to format the time with leading zeros
std::ostringstream oss;
+
+ //需要判断显示的格式
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12)
+ {
+ if (tblock_.tm_hour > 12)
+ tblock_.tm_hour = tblock_.tm_hour - 12 ;
+ }
+
oss << std::setw(2) << std::setfill('0') << tblock_.tm_hour << ":"
- << std::setw(2) << std::setfill('0') << tblock_.tm_min;
+ << std::setw(2) << std::setfill('0') << tblock_.tm_min;
std::string timeStr = oss.str(); // Get the formatted time string
#include "custom_utils.h"\r
#include "UiConfig.h"\r
#include "wearable_log.h"\r
+\r
+#include "custom_runtime.h"\r
+\r
#define ANIMATION_TEST 0\r
extern "C"\r
{\r
(month < 10 ? "0" : "") + std::to_string(month) + "-" +\r
(day < 10 ? "0" : "") + std::to_string(day) + " " + weekStr;\r
\r
+ //需要判断显示的格式\r
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12)\r
+ {\r
+ if (pTM.tm_hour > 12)\r
+ hour = pTM.tm_hour - 12 ;\r
+ }\r
+ \r
std::string stringtime =\r
(hour < 10 ? "0" : "") + std::to_string(hour) + ":" +\r
(minute < 10 ? "0" : "") + std::to_string(minute);\r
struct {
const DialStyle style;
const char value[MAX_LEN];
- } values_[static_cast<int>(DialStyle::STYLE_NUM)] = {
+ }
+
+ values_[static_cast<int>(DialStyle::STYLE_NUM)] = {
{DialStyle::COVERFLOW, "DialStyle::COVERFLOW"},
{DialStyle::ROLLER, "DialStyle::ROLLER"},
};
Icon.SetSrc(itemInfo.icon);
settingLabelExt.SetVisible(true);
settingLabelExt.SetPosition(SETTINGLABELEXT_X, SETTINGLABELEXT_Y, SETTINGLABELEXT_W, SETTINGLABELEXT_H);
- settingLabelExt.SetTextId(itemInfo.textId);
+ if (itemInfo.viewId == VIEW_SET_TIME_FORMAT) {
+ settingLabelExt.SetText("时间显示样式");//TODO:多国语言
+ } else {
+ settingLabelExt.SetTextId(itemInfo.textId);
+ }
settingLabelExt.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
settingLabelButtonExt.SetVisible(true);
SetHeight(120);
settings[index++] = {VIEW_ADD_CARD, PNG_SETTINGS_CARDSET_IMAGE, STR_CARD_MANAGEMENT, true};
settings[index++] = {VIEW_SET_DIAL_STYLE, PNG_SETTINGS_CHANGEDIAL_IMAGE, STR_DIAL_BROWSING_SPECIAL_EFFECTS, true};
settings[index++] = {VIEW_SAVEELE, PNG_SETTINGS_SAVEELE_IMAGE, STR_POWER_SAVE_MODE, true};
+ settings[index++] = {VIEW_SET_TIME_FORMAT, PNG_SETTINGS_CHANGEDIAL_IMAGE, STR_TIME, true};//测试24小时格式与12小时
settings[index++] = {VIEW_SYSTEM, PNG_SETTINGS_SYSTEM, STR_SYSTEM, true};
settings[index++] = {VIEW_INVALID, nullptr, STR_MAX_ID, false};
usedLen = index;
#include "ui_resource_string.h"
#include "uicomponents/UIComponents.h"
#include <ui_scroll_view.h>
+#include "custom_runtime.h"
namespace OHOS {
// 解析时间
int hour = pTM.tm_hour;
+ //需要判断显示的格式
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12)
+ {
+ if (pTM.tm_hour > 12)
+ hour = pTM.tm_hour - 12 ;
+ }
+
int minute = pTM.tm_min;
// 将时间和日期转换为字符串
p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE,data->distance);
do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SET_USER_INFO, NULL);
- if(data->timeformat==0)
- p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR,24);
- else
- p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR,12);
+
+ // app端不修改手表端时间显示
+ // if(data->timeformat==0)
+ // p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR,24);
+ // else
+ // p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR,12);