\r
void SetCountDownTime(const std::string &countdowntime); // 设置倒计时时间\r
std::string GetCountDownTime(void); // 获取倒计时时间\r
+ std::string GetBackupCountDownTime(void);\r
void SetRingTime(const std::string &ringtime); // 设置响铃时间\r
std::string GetRingTime(void); // 获取响铃时间\r
void ParseCountDownTime(const char *countdowntime);\r
std::string countdownDuration{nullptr};\r
std::string RingTime{"00:00:00"}; // 响铃时间\r
std::string CountTime{"00:00:00"}; // 倒计时时间\r
+ std::string CountTimeBackup{"00:00:00"};\r
};\r
}\r
#endif
\ No newline at end of file
static CountDownTimeConfigView *GetInstance(void);\r
UIScrollView *CountDownTimeConfigViewInit(void);\r
void ClearAll(void);\r
+ UITimePicker * GetTimePicker(void);\r
\r
private:\r
UIScrollView *scrollView = nullptr;\r
static constexpr const char *EndButton_ImagePath = "/user/res/countdown/COUNTDOWM_END.bin"; // 结束返回按钮图片\r
static constexpr const char *CountDown_Play_ImagePath = "/user/res/countdown/COUNTDOWM_PLAY.bin"; // 开始倒计时image\r
static constexpr const char *CountDown_PAUSE_ImagePath = "/user/res/countdown/COUNTDOWM_PAUSE.bin"; // 暂停倒计时image\r
+ static constexpr const char * RepeatButtonImagePath = "/user/res/countdown/repeat_button.bin";\r
static constexpr const char *VectorImagesPath = "/user/res/countdown/COUNTDOWM_VECTOR.bin";\r
static constexpr const char *PlayOrPauseToggleButton_ViewID = "PlayOrPauseToggleButton"; // 暂停和开始toggleButton视图id\r
static constexpr const char *STARTCOUNTDOWNVIEWRETURNBUTTON = "StartCountDownViewReturnButton";\r
static constexpr const char *STARTCOUNTDOWNVIEW = "StartCountDownView";\r
+ static constexpr const char * RepeatButtonViewID = "RepeatButtonViewID";\r
class StartCountDownView\r
{\r
\r
UILabelExt *GetShowCountDownTimelabel(void); // 获取显示倒计时时间标签\r
UILabelExt *GetShowTheRingTimelabel(void); // 获取显示响铃时间标签\r
UIToggleButton *GetPlayOrPauseToggleButton(void);\r
+ UIButton * GetRepeatButton(void);\r
\r
private:\r
UIScrollView *scrollView = nullptr;\r
UIImageView *vectorImage = nullptr;\r
UIToggleButton *play_or_pause_toggleButton = nullptr;\r
UIButton *endbutton = nullptr;\r
+ UIButton * RepeatButton = nullptr;\r
bool viewInitStatus{false};\r
};\r
} // namespace OHOS\r
void CountDownModel::SetCountDownTime(const std::string &countdowntime)\r
{\r
CountTime = countdowntime;\r
+ CountTimeBackup = countdowntime;\r
ParseCountDownTime(CountTime.c_str());\r
}\r
\r
return CountTime;\r
}\r
\r
+ std::string CountDownModel::GetBackupCountDownTime(void)\r
+ {\r
+ return CountTimeBackup;\r
+ }\r
+\r
// 设置响铃时间\r
void CountDownModel::SetRingTime(const std::string &ringtime)\r
{\r
// 检查倒计时是否结束\r
if (CountDownModel::g_CountDownTimes <= 0)\r
{\r
- MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetState(false);\r
- MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetTouchable(false);\r
+ MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(false);\r
+ MainCountDownView::GetInstance()->GetStartCountDownView()->GetRepeatButton()->SetVisible(true);\r
CountDownModel::GetInstance()->CountDown_StopTimer(); // 停止定时器\r
MainCountDownView::GetInstance()->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText("倒计时结束");\r
// 进行倒计时结束时的额外操作,比如播放声音、显示通知等\r
}
return scrollView;
}
+
+ UITimePicker * CountDownTimeConfigView::GetTimePicker(void)
+ {
+ return timePicker;
+ }
}
\ No newline at end of file
// Update label texts if necessary\r
if (p_MainCountDownView->GetStartCountDownView() != nullptr)\r
{\r
- p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(timeValue.c_str());\r
- p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(timeValue.c_str());\r
+ // p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(timeValue.c_str());\r
+ // p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(timeValue.c_str());\r
+ p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str());\r
+ p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(CountDownModel::GetInstance()->GetRingTime().c_str());\r
+ p_MainCountDownView->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(true);\r
+ p_MainCountDownView->GetStartCountDownView()->GetRepeatButton()->SetVisible(false);\r
}\r
\r
p_MainCountDownView->ChangeView(MAIN_COUNTDOWN, START_COUNTDOWN);\r
\r
if (strcmp(view.GetViewId(), STARTCOUNTDOWN_BUTTON) == 0) // 在自定义倒计时界面点击开始按钮跳转到开始倒计时界面\r
{\r
+ UITimePicker * timePicker = CountDownTimeConfigView::GetInstance()->GetTimePicker();\r
+ if(nullptr != timePicker && ("00:00:00" != timePicker->GetSelectValue()))\r
+ {\r
+ CountDownModel::GetInstance()->SetCountDownTime(timePicker->GetSelectValue()); // 设置倒计时时间\r
+ CountDownModel::GetInstance()->SetRingTime(timePicker->GetSelectValue()); // 设置响铃时间\r
+ }\r
+\r
if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0)\r
{\r
p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, COUNTDOWN_TIMENOTNULL);\r
{\r
p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str());\r
p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(CountDownModel::GetInstance()->GetRingTime().c_str());\r
+ p_MainCountDownView->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(true);\r
+ p_MainCountDownView->GetStartCountDownView()->GetRepeatButton()->SetVisible(false);\r
}\r
\r
p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN);\r
p_MainCountDownView->ChangeView(START_COUNTDOWN, MAIN_COUNTDOWN);\r
return true;\r
}\r
+\r
+ // repeat button cb\r
+ if(0 == strcmp(view.GetViewId(), RepeatButtonViewID))\r
+ {\r
+ // close prompt\r
+ CountDownModel::GetInstance()->StopRingtonePlaybackAndReleaseResources();\r
+\r
+ // set param & change view\r
+ CountDownModel *model = CountDownModel::GetInstance();\r
+ const std::string timeValue = model->GetBackupCountDownTime();\r
+ model->SetCountDownTime(timeValue);\r
+ model->SetRingTime(timeValue);\r
+\r
+ if (nullptr != p_MainCountDownView->GetStartCountDownView())\r
+ {\r
+ p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str());\r
+ p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(CountDownModel::GetInstance()->GetRingTime().c_str());\r
+\r
+ p_MainCountDownView->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(true);\r
+ p_MainCountDownView->GetStartCountDownView()->GetRepeatButton()->SetVisible(false);\r
+ }\r
+\r
+ // start timer\r
+ CountDownModel::GetInstance()->CountDown_StartTimer(COUNTDOWN_TIMER_DURATION);\r
+\r
+ return true;\r
+ }\r
+\r
return true;\r
}\r
\r
endbutton = nullptr;\r
}\r
\r
+ if (nullptr != RepeatButton)\r
+ {\r
+ delete RepeatButton;\r
+ RepeatButton = nullptr;\r
+ }\r
+\r
if (scrollView != nullptr)\r
{\r
delete scrollView;\r
play_or_pause_toggleButton->SetImages(CountDown_Play_ImagePath, CountDown_PAUSE_ImagePath);\r
UICheckBox::OnChangeListener *ToggleButtonChange = static_cast<UICheckBox::OnChangeListener *>(MainCountDownPresenter::GetInstance());\r
play_or_pause_toggleButton->SetOnChangeListener(ToggleButtonChange);\r
+ play_or_pause_toggleButton->SetVisible(true);\r
+\r
/* -------------------------------------------------------------------------- */\r
// Add Button to App\r
if (endbutton == nullptr)\r
UIView::OnClickListener *buttonClick = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
endbutton->SetOnClickListener(buttonClick);\r
/* ----------------------------------- Add ---------------------------------- */\r
+\r
+ if (nullptr == RepeatButton)\r
+ {\r
+ RepeatButton = new UIButton();\r
+ }\r
+ RepeatButton->SetPosition(248, 321);\r
+ RepeatButton->Resize(100, 100);\r
+ RepeatButton->SetViewId(RepeatButtonViewID);\r
+ RepeatButton->SetStyle(STYLE_BACKGROUND_COLOR, 0x00);\r
+ RepeatButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+ RepeatButton->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+ RepeatButton->SetImageSrc(RepeatButtonImagePath, RepeatButtonImagePath);\r
+ RepeatButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+ RepeatButton->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+ UIView::OnClickListener * RepeatButtonClick = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
+ RepeatButton->SetOnClickListener(RepeatButtonClick);\r
+ RepeatButton->SetVisible(false);\r
+\r
scrollView->Add(Title);\r
scrollView->Add(showCountDownTimelabel);\r
scrollView->Add(vectorImage);\r
scrollView->Add(showTheRingTime);\r
scrollView->Add(endbutton);\r
scrollView->Add(play_or_pause_toggleButton);\r
+ scrollView->Add(RepeatButton);\r
}\r
\r
return scrollView;\r
{\r
return play_or_pause_toggleButton;\r
}\r
+\r
+ UIButton * StartCountDownView::GetRepeatButton(void)\r
+ {\r
+ return RepeatButton;\r
+ }\r
}
\ No newline at end of file
--- /dev/null
+version https://git-lfs.github.com/spec/v1
+oid sha256:2f269933acf22c827c77fc25b248e3f7c81af8975400b5f4e92a8eabc99f5025
+size 6824