From: Caisking Date: Tue, 30 Sep 2025 08:44:25 +0000 (+0800) Subject: 同步星历下载的交互 X-Git-Tag: V1.0.9_20251128_194606_LN~274^2~6 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F2456%2F1;p=mirrors%2FFD230.git 同步星历下载的交互 --- diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp index 88ef07c05..1a1a53fe4 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp @@ -27,13 +27,9 @@ EphemerisDownloadPresenter::~EphemerisDownloadPresenter() {} void EphemerisDownloadPresenter::OnResume() { RootView::GetInstance()->SetOnKeyActListener(this); - // 启动定时器 - EphemerisDownloadModel::GetInstance().ephemeris_data_timer(1000); // 1秒间隔 } void EphemerisDownloadPresenter::OnStop() { - // 停止定时器 - EphemerisDownloadModel::GetInstance().ephemeris_stop_data_timer(); } EphemerisDownloadPresenter* EphemerisDownloadPresenter::GetInstance() { @@ -102,8 +98,14 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0) { - std::string progress = "下载中,正在下载"+std::to_string(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress())+"%"; - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress.c_str()); + // 进度需要*10 + int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() * 10; + if(progress > 100) + { + progress = 100; + } + std::string progress_str = "下载中,正在下载"+std::to_string(progress)+"%"; + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str()); } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10) { @@ -122,6 +124,11 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText( "下载成功"); } + //更新有效期 + if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) { + EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()->SetText( + EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod().c_str()); + } } break; case EphemerisDownloadStatus::FAILED: diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp index 88ef07c05..1a1a53fe4 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp @@ -27,13 +27,9 @@ EphemerisDownloadPresenter::~EphemerisDownloadPresenter() {} void EphemerisDownloadPresenter::OnResume() { RootView::GetInstance()->SetOnKeyActListener(this); - // 启动定时器 - EphemerisDownloadModel::GetInstance().ephemeris_data_timer(1000); // 1秒间隔 } void EphemerisDownloadPresenter::OnStop() { - // 停止定时器 - EphemerisDownloadModel::GetInstance().ephemeris_stop_data_timer(); } EphemerisDownloadPresenter* EphemerisDownloadPresenter::GetInstance() { @@ -102,8 +98,14 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0) { - std::string progress = "下载中,正在下载"+std::to_string(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress())+"%"; - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress.c_str()); + // 进度需要*10 + int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() * 10; + if(progress > 100) + { + progress = 100; + } + std::string progress_str = "下载中,正在下载"+std::to_string(progress)+"%"; + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str()); } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10) { @@ -122,6 +124,11 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText( "下载成功"); } + //更新有效期 + if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) { + EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()->SetText( + EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod().c_str()); + } } break; case EphemerisDownloadStatus::FAILED: diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp index 88ef07c05..1a1a53fe4 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ephemeris_download/src/EphemerisDownloadPresenter.cpp @@ -27,13 +27,9 @@ EphemerisDownloadPresenter::~EphemerisDownloadPresenter() {} void EphemerisDownloadPresenter::OnResume() { RootView::GetInstance()->SetOnKeyActListener(this); - // 启动定时器 - EphemerisDownloadModel::GetInstance().ephemeris_data_timer(1000); // 1秒间隔 } void EphemerisDownloadPresenter::OnStop() { - // 停止定时器 - EphemerisDownloadModel::GetInstance().ephemeris_stop_data_timer(); } EphemerisDownloadPresenter* EphemerisDownloadPresenter::GetInstance() { @@ -102,8 +98,14 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() > 0) { - std::string progress = "下载中,正在下载"+std::to_string(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress())+"%"; - EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress.c_str()); + // 进度需要*10 + int progress = EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() * 10; + if(progress > 100) + { + progress = 100; + } + std::string progress_str = "下载中,正在下载"+std::to_string(progress)+"%"; + EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText(progress_str.c_str()); } else if(EphemerisDownloadModel::GetInstance().GetEphemerisDownloadProgress() == 10) { @@ -122,6 +124,11 @@ void EphemerisDownloadPresenter::UpdateDownloadStatus() { EphemerisDownloadView::GetInstance()->GetDownloadLabel()->SetText( "下载成功"); } + //更新有效期 + if(EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()) { + EphemerisDownloadView::GetInstance()->GetValidityPeriodLabel()->SetText( + EphemerisDownloadModel::GetInstance().GetEphemerisValidityPeriod().c_str()); + } } break; case EphemerisDownloadStatus::FAILED: