From 3e239ed7fc39abfd6cf57a7cc1801f83509f6461 Mon Sep 17 00:00:00 2001 From: Caisking Date: Mon, 28 Apr 2025 17:36:28 +0800 Subject: [PATCH] =?utf8?q?=E3=80=90=E9=80=9A=E8=AF=9D=E8=AE=B0=E5=BD=95?= =?utf8?q?=E3=80=91UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../callerlog/include/CallerItemView.h | 2 + .../callerlog/include/CallerLogModel.h | 119 ++++- .../callerlog/include/CallerLogPresenter.h | 13 +- .../callerlog/include/CallerLogView.h | 8 +- .../nativeui/callerlog/src/CallerLogModel.cpp | 483 +++++++++++++++--- .../callerlog/src/CallerLogPresenter.cpp | 47 +- .../nativeui/callerlog/src/CallerLogView.cpp | 55 +- 7 files changed, 616 insertions(+), 111 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerItemView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerItemView.h index 50f2c345d..d61864211 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerItemView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerItemView.h @@ -9,6 +9,7 @@ #define CALLER_ITEM_VIEW_H #include "components/ui_label.h" +#include "components/ui_label_ext.h" #include "components/ui_view_group.h" #include "components/ui_image_view.h" #include "components/ui_label_button.h" @@ -17,6 +18,7 @@ #include "UiConfig.h" #include "PhoneService.h" + namespace OHOS { class CallerItemView : public UIViewGroup { public: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogModel.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogModel.h index 22e6b403a..6aa7511e0 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogModel.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogModel.h @@ -7,9 +7,12 @@ #ifndef CALLER_LOG_MODEL_H #define CALLER_LOG_MODEL_H +#include "los_mux.h" #include "string" #include "PhoneService.h" #include "AppViewIDs.h" +#include "components/ui_label_ext.h" +#include"ui_resource_string.h" #include "message.h" #include "msg_center.h" @@ -28,21 +31,73 @@ enum PhoneStatus { PHONE_SINGLE_STATUS }; +void g_callTimesclean(); + +void g_callTimesadd(); +int get_g_callTimes(); bool MulitplePhoneTextReplaces(); bool FindCallListInfoAndSetPriorityNumber(); void PhoneScoStatausCallback(hfp_sco_connect_state_t state); void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall); void PhoneErrorCallback(PhoneServiceErrorType type, int volume); void UsingPhoneScoStatausCallback(hfp_sco_connect_state_t state); +void StatusReset(void); void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall); void UsingPhoneErrorCallback(PhoneServiceErrorType type); +void CAT1_ChangeStatusScreendisplay(int lastStatus); +void InitCallingTimer(); + +void calllognameupdate(void); +void Call_headset_state_updata(int data); namespace OHOS { + + class CallerLogModel { public: +typedef enum { + callleisure, + CallphoneWait, + CallCat1Wait, + CallSourcePhone, + CallSourceCat1, + } CallSource; + +typedef enum { + HFP_WATCH_DIAL, + HFP_PHONE_DIAL, + } Calldial; + + + void InitPhoneService(); static CallerLogModel *GetInstance(void); + std::string Getphonename(void) + { + return call_name; + } + + std::string Getphonenumberpbap(void) + { + return call_number; + } + + void Setphonebname(char *name,uint8_t name_len) + { + call_name.clear(); + if(name_len) + call_name.append(reinterpret_cast(name), name_len); + + //printf("%s\r\n",call_name.c_str()); + } + + void Setphonenumber(char *number,uint8_t number_len) + { + call_number.clear(); + call_number.append(reinterpret_cast(number), number_len); + } + std::string GetPhoneNumber(void); void SetoperateNumber(const char *number, char number_len); @@ -65,12 +120,66 @@ public: void SetDialingStatus(const char *text); std::string InitDateHourTime(); - std::string& DisplayCallDuration(); + std::string &DisplayCallDuration(); int CurrCallNum(); bool GetNotifyFlag(void); void SetNotifyFlag(bool flag); bool IsMulitplePhoneStatus(void); +CallSource GetCallSource(void) + { + return callsrc; + } + void SetCallSource(CallSource source) + { + callsrc = source; + } + + uint8_t GetCallDial(void) + { + return calldial; + } + void SetCallDial(uint8_t dial) + { + calldial = dial; + } + uint8_t get_RejectIncomingCall_falg() + { + return auto_RejectIncomingCall; + } + + void set_RejectIncomingCall_falg(uint8_t data) + { + auto_RejectIncomingCall=data; + } + + + /* 设置cat1临时来电号码显示 */ + void tempSetoperateNumberCAT1(const char *number, char number_len) + { + phoneNumberCAT1.clear(); + phoneNumberCAT1.append(reinterpret_cast(number), number_len); + } + + /* 设置cat1临时来电号码显示 */ + void tempSetoperateNumberCAT1END(const char *number, char number_len) + { + phoneNumberCAT1END.clear(); + phoneNumberCAT1END.append(reinterpret_cast(number), number_len); + } + + std::string GettempPhoneNumber(void) + { + return phoneNumberCAT1; + } + + std::string GettempPhoneendNumber(void) + { + return phoneNumberCAT1END; + } + + + private: CallerLogModel(); CallerLogModel(const CallerLogModel &); @@ -81,12 +190,20 @@ private: std::string timers; // 时间显示 std::string callDuration; // 通话时长 std::string phoneNumber; // 电话号码 + std::string phoneNumberCAT1; // 4G电话号码 + std::string phoneNumberCAT1END; // 4G挂断电话号码 + std ::string call_name; + std ::string call_number; bool mulitplePhoneStatus{false}; // 判断是否多路通话界面 bool waitingStatus{false}; // 判断是否等待提醒界面 bool volumeStatus{false}; // 判断是否音量界面 bool phoneStatus{false}; // 判断是拨打界面还是呼入界面 bool callStatus{false}; // 判断是否正在接听电话 bool notifyFlag{false}; // 判断是否来电呼入 由notify生成界面 + + CallSource callsrc{CallSourcePhone}; //电话来源 + uint8_t calldial{HFP_PHONE_DIAL}; + uint8_t auto_RejectIncomingCall{0}; }; } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h index d5cde172c..dc049dc78 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h @@ -11,9 +11,8 @@ #include "Presenter.h" #include "ohos_types.h" #include "CallerLogModel.h" -#include "graphic_timer.h" -#include "sys/time.h" +#include "cmsis_os.h" namespace OHOS { class CallerLogView; @@ -21,14 +20,20 @@ class CallerLogPresenter : public Presenter, public UIView::OnCli public: CallerLogPresenter(); ~CallerLogPresenter() override; + + void OnStart() override; + void OnPause() override; + void OnResume() override; void OnStop() override; + static CallerLogPresenter *GetInstance(void); bool OnClick(UIView &view, const ClickEvent &event) override; - void BuletoothHintsCallbackProc(void* data); + void BuletoothHintsCallbackProc(int data); private: void InitBluetoothHints(); void DisableBluetoothHints(); - GraphicTimer* hintsCounting{nullptr}; + + osTimerId_t hintsCounting{nullptr}; }; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogView.h index 0fbe3a4ce..5fda17fea 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/include/CallerLogView.h @@ -11,10 +11,12 @@ #include "View.h" #include "CallerLogPresenter.h" #include "CallerItemView.h" + #include "components/ui_view_group.h" #include "components/ui_image_animator.h" #include "components/ui_scroll_view.h" #include "components/ui_label.h" +#include "components/ui_label_ext.h" #include "components/ui_label_button.h" #include "components/ui_list.h" #include "components/abstract_adapter.h" @@ -55,9 +57,11 @@ public: class CallerLogView : public View { public: CallerLogView(); - ~CallerLogView() override; + ~CallerLogView(); void OnStart() override; + + UIViewGroup* GetHintsGroup(); CallerUIScrollView *GetGroupView(); CallerUIScrollView *GetContainerView(); @@ -79,7 +83,7 @@ private: UIViewGroup *groupFirst{nullptr}; UIViewGroup *groupFinal{nullptr}; UIViewGroup *hintsGroup{nullptr}; - CallerUIScrollView *container{nullptr}; + CallerUIScrollView *scrollview{nullptr}; CallerUIScrollView *group{nullptr}; UIImageView *imageView{nullptr}; UIImageView *hintsImageView{nullptr}; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp index 2dcb6441c..adcb138f5 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp @@ -8,12 +8,34 @@ #include "CallerLogView.h" #include "DialingScreenView.h" #include "CallingView.h" -#include "ohos_timer.h" -#include "graphic_timer.h" +#include "service_id_define.h" +#include "cmsis_os.h" #include "samgr_lite.h" #include "MainCallingPresenter.h" #include "PlayersModel.h" #include "graphic_service.h" +#include "notification_manager.h" +#include "osal_timer.h" +#include "cmsis_os2.h" +#include "custom_utils.h" +#include "ConfigModel.h" +#include "vibrator_service.h" +#include "custom_runtime.h" +#include "MainCallingView.h" + +#ifdef FD230_650 +#include "dial_sos_c.h" +#endif + +#include "cat1_ctl.h" +#include "cat1_server.h" +#include "AlarmClockModel.h" + +#ifdef SUPPORT_PHONE_SERVICE +#include "PhoneAGService.h" +#endif + +#include "custom_save_runtime.h" #ifdef __cplusplus extern "C" { @@ -29,8 +51,11 @@ static int g_isCall{NO_NUMBER_STATUS}; // 电话状态 static PhoneCallInfo callInfo{}; static int g_retNum{0}; // 电话个数 static int g_volumeLocal{0}; // 错误码返回 -GraphicTimer* g_startCounting = nullptr; // 定时器 -static constexpr uint64_t MS_ONE_SECONDS = 1000; +osTimerId_t g_startCounting = nullptr; // 定时器 +// +osTimerId_t g_shake = nullptr; // 循环震动定时器 + +static constexpr uint64_t MS_ONE_SECONDS = 2000; static PhoneCallInfo callList[MULTI_CALL_MAX_NUME]{}; // 电话优先级标志位 static int g_firstPriority = NO_NUMBER_STATUS; @@ -40,11 +65,28 @@ static int g_fourthPriority = NO_NUMBER_STATUS; // 是否为手表接听状态 static bool g_isWatchCallView = false; +void g_callTimesclean() +{ + g_callTimes=0; +} + +int get_g_callTimes() +{ + return g_callTimes; +} +void g_callTimesadd() +{ + g_callTimes++; +} + + static void SetPriorityNumber() { time_t seconds; time(&seconds); + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSourcePhone); + // 接听和挂起状态需要持续显示通话计时 if (g_firstPriority != NO_NUMBER_STATUS) { // 接听 CallerLogModel::GetInstance()->SetoperateNumber(callList[g_firstPriority].unitCalls.number, @@ -64,79 +106,274 @@ static void SetPriorityNumber() return; } + +static void DisshakeTimer() +{ + if (g_shake != nullptr) { + osStatus_t ret = osTimerDelete(g_shake); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); + return; + } + g_shake = nullptr; + } +} + /* 关闭定时器 */ static void DisableCallingTimer() -{ +{ if (g_startCounting != nullptr) { - delete g_startCounting; + osStatus_t ret = osTimerDelete(g_startCounting); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); + return; + } g_startCounting = nullptr; g_callTimes = 0; } } + +void calllognameupdate() +{ + if(MainCallingView::GetInstance()) + { + MainCallingView::GetInstance()->updataCallingname(); + } +} + /* 状态复位 */ -static void StatusReset() +void StatusReset(void) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "状态复位"); + uapi_save_runtime_log(RUNTIME_LOG_PHONE_RESET); + CallerLogModel::GetInstance()->SetCallStatus(false); CallerLogModel::GetInstance()->SetWaitingStatus(false); DisableCallingTimer(); + + + + CallerLogModel::GetInstance()->Setphonebname("",0); + CallerLogModel::GetInstance()->SetCallDial(CallerLogModel::HFP_PHONE_DIAL); + CallerLogModel::GetInstance()->set_RejectIncomingCall_falg(0); + NotificationManager::GetInstance()->SetWatchCallStatus(false); + + DisshakeTimer(); + set_call_hungup_flag(0); + + #ifdef FD230_650 + set_TransCallToMobilePhone_falg(0); + #endif + + OHOS::AlarmClockModel::GetInstance()->AlarmPlayerStop(); + // If the call is handling in the notification, the slice is not switched - if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); - } else { - g_isWatchCallView = false; + //if (!CallerLogModel::GetInstance()->GetNotifyFlag()) + + #ifdef FD230_650 + if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourceCat1) + { + if(headset_SCO_Is_connect()==false) + { + #ifdef SUPPORT_CAT1_HFP_AG_SERV + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_AUDIO_END, nullptr, 0); + #endif + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_STOP, nullptr, 0); + } + else + { + #ifdef SUPPORT_CAT1_HFP_AG_SERV + if(headset_Is_connect()) + { + cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL); + } + #endif + } + CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); } + + + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxx"); + PhoneServiceScreenCtr(false); + if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL) + { + NativeAbility::GetInstance().Back_CountSlice_make_phone(); + } + else if (!uapi_dev_runtime_get_train_status())// || NativeAbility::GetInstance().GetCurSliceId() == VIEW_BLUETOOTH_EARPHONE ) + { + NativeAbility::GetInstance().ClearSliceIdStack(); + } + + + } + + #endif + // } else { + // g_isWatchCallView = false; + // } return; } /* 定时器回调函数 */ -static void CallTimerCallbackProc(void* data) +static void CallTimerCallbackProc(int data) { - g_callTimes++; - - if (CallingView::GetInstance() == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] GetInstance is nullptr"); + if(MainCallingView::GetInstance()==nullptr) + { return; + } + + + + if(MainCallingView::GetInstance()->GetCallingView()) + { + if (MainCallingView::GetInstance()->GetCallingView()->GetCallingDurationLabel()) + { + + MainCallingView::GetInstance()->GetCallingView()->GetCallingDurationLabel()-> + SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + MainCallingView::GetInstance()->GetCallingView()->GetCallingDurationLabel()->Invalidate(); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::xxx"); + } + } + + if( CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1 + && NotificationManager::GetInstance()->GetWatchCallStatus()==true) + { + if(MainCallingView::GetInstance()->GetDisplayGroup()) + { + #ifdef SUPPORT_CAT1_HFP_AG_SERV + if(!MainCallingView::GetInstance()->GetDisplayGroup()->IsVisible()) + { + + if( headset_SCO_Is_connect()==false && volte_voice_state()!=1) + { + if(volte_voice_state()==2) + { + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_STOP, nullptr, 0); + } + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0); + } + if(headset_SCO_Is_connect()==true && volte_voice_state()!=2) + { + if(volte_voice_state()==2) + { + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_STOP, nullptr, 0); + } + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0); + } + } + #endif + + } + + + { + if(get_call_hungup_flag()>=2) + { + cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + } + else if(get_call_hungup_flag()) + { + set_call_hungup_flag(get_call_hungup_flag()+1); + } + } + + } +} + + + + +static void snakeCallback(int data) +{ + if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + { + ui_api_vibrate_once_func(); } +} - if (CallingView::GetInstance()->GetCallingDurationLabel() == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] GetInstance()->GetCallingDurationLabel is nullptr"); + +static void CallTimerCallback(int data) +{ + GraphicService::GetInstance()->PostGraphicEvent(std::bind(CallTimerCallbackProc, data)); +} + +static void Call_headset_state_updata_Proc(int data) +{ + if(MainCallingView::GetInstance()==nullptr) + { return; - } + } + + MainCallingView::GetInstance()->update_headset_state((uint8_t)data); - CallingView::GetInstance()->GetCallingDurationLabel()-> - SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); } -static void CallTimerCallback(void* data) +void Call_headset_state_updata(int data) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(CallTimerCallbackProc, data)); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(Call_headset_state_updata_Proc, data)); } + /* 开启定时器 */ -static void InitCallingTimer() +void InitCallingTimer() { if (g_startCounting != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer already exists!!"); return; } - uint32 tick = GetOSTick(MS_ONE_SECONDS); - g_startCounting = new GraphicTimer(tick, CallTimerCallback, nullptr, true); + g_startCounting = osTimerNew((osTimerFunc_t)CallTimerCallback, osTimerPeriodic, nullptr, nullptr); if (g_startCounting == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer new GraphicTimer failed!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerNew failed!!"); return; } - bool retTimer = g_startCounting->Start(); - if (!retTimer) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer Start failed, ret = %lx!!", retTimer); + int tick = osMs2Tick(MS_ONE_SECONDS); + osStatus_t retTimer = osTimerStart(g_startCounting, tick); + if (retTimer != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerStart failed, ret = %lx!!", retTimer); if (g_startCounting != nullptr) { - delete g_startCounting; + retTimer = osTimerDelete(g_startCounting); + if (retTimer != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::osTimerDelete failed, ret = %lx!!", retTimer); + return; + } g_startCounting = nullptr; } return; } } +static void InitshakeTimer() +{ + if (g_shake != nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer already exists!!"); + return; + } + g_shake = osTimerNew((osTimerFunc_t)snakeCallback, osTimerPeriodic, nullptr, nullptr); + if (g_shake == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerNew failed!!"); + return; + } + int tick = osMs2Tick(MS_ONE_SECONDS); + osStatus_t retTimer = osTimerStart(g_shake, tick); + if (retTimer != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerStart failed, ret = %lx!!", retTimer); + if (g_shake != nullptr) { + retTimer = osTimerDelete(g_shake); + if (retTimer != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::osTimerDelete failed, ret = %lx!!", retTimer); + return; + } + g_shake = nullptr; + } + return; + } +} + + + /* 判断是否有电话,判断优先级 */ bool FindCallListInfoAndSetPriorityNumber() { @@ -210,33 +447,43 @@ static int g_callOperate = OPERATE_NO_OPE; static void ExitMakePhoneSlice(void) { - if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE) { + + if( CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1 + && NotificationManager::GetInstance()->GetWatchCallStatus()==true) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4G 通话中不能结束"); + return; + } + + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL) { WEARABLE_LOGD(HILOG_MODULE_AAFWK, "ExitMakePhoneSlice"); if (GetCurrCallNum() == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + //NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); CallModelPostGraphicEvent(CallModelResumePlayer); } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + //NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); } } - CallerLogModel::GetInstance()->SetCallStatus(false); - DisableCallingTimer(); - if (CallerLogModel::GetInstance()->GetNotifyFlag()) { - g_isWatchCallView = false; + if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL) + { + StatusReset();//状态复位 } + g_isWatchCallView = false; } static void DialingHandle(void) { CallerLogModel::GetInstance()->SetDialingStatus("正在拨号"); CallerLogModel::GetInstance()->SetMakePhoneStatus(true); + NotificationManager::GetInstance()->SetWatchCallStatus(true); } static void AlertingHandle(void) { CallerLogModel::GetInstance()->SetDialingStatus("正在响铃"); CallerLogModel::GetInstance()->SetMakePhoneStatus(true); + NotificationManager::GetInstance()->SetWatchCallStatus(true); } static void IncomingHandle(void) @@ -244,6 +491,7 @@ static void IncomingHandle(void) CallerLogModel::GetInstance()->SetMakePhoneStatus(false); } + // 来电等待界面 static void WaitingOpreate() { @@ -251,21 +499,23 @@ static void WaitingOpreate() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] is not complete call flow"); return; } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[WaitingOpreate] WaitingOpreate"); - CallerLogModel::GetInstance()->SetCallStatus(false); - CallerLogModel::GetInstance()->SetWaitingStatus(true); - // If the call is handling in the notification, the slice is not switched - if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, - PRIORITY_ONE); - } else { - g_isWatchCallView = true; + + if(NotificationManager::GetInstance()->GetWatchCallStatus()) + { + + if(RejectIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::[HintsHandupClick] RejectIncomingCall error"); + return ; + } + CustomEventPublish(TOPIC_EVENT_HFP_HINT,NULL,0); + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[WaitingOpreate] WaitingOpreate"); } static void WatchActiveHandle(const PhoneCallInfo *phoneCall) { - if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || NativeAbility::GetInstance().GetCurSliceId() == VIEW_OFFLINEVOICE || CallerLogModel::GetInstance()->GetNotifyFlag()) { time_t seconds; @@ -282,7 +532,7 @@ static void WatchActiveHandle(const PhoneCallInfo *phoneCall) static void PhoneActiveHandle(void) { - if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || g_isWatchCallView) { if (GetCurrCallNum() > 1) { g_phoneStatus = PHONE_MULTI_STATUS; @@ -293,7 +543,8 @@ static void PhoneActiveHandle(void) TransCallToMobilePhone(); // If the call is handling in the notification, the slice is not switched if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); // 退出通话界面,回到主表盘应用 + //NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); // 退出通话界面,回到主表盘应用 + StatusReset(); } else { g_isWatchCallView = false; } @@ -305,7 +556,7 @@ static void PhoneActiveHandle(void) static void OppoActiveHandle(const PhoneCallInfo *phoneCall) { - if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || g_isWatchCallView) { if (GetCurrCallNum() > 1) { g_phoneStatus = PHONE_MULTI_STATUS; @@ -348,7 +599,7 @@ bool MulitplePhoneTextReplaces() return false; } - CallingView::GetInstance()->GetCallingDisplayLabel()->SetText("正在通话"); + // CallingView::GetInstance()->GetCallingDisplayLabel()->SetTextId(STR_CALLING); CallingView::GetInstance()->GetCallingDurationLabel()->SetText(""); return true; } @@ -357,13 +608,13 @@ bool MulitplePhoneTextReplaces() static bool MultiplePhonesViewDisplay() { if (g_phoneStatus == PHONE_MULTI_STATUS) { - if (NativeAbility::GetInstance().GetCurSliceId() != VIEW_MAEKPHONE_SAMPLE) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay]GetCurSliceId no VIEW_MAEKPHONE_SAMPLE"); + if (NativeAbility::GetInstance().GetCurSliceId() != VIEW_INCOMING_CALL) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay]GetCurSliceId no VIEW_INCOMING_CALL"); DisableCallingTimer(); CallerLogModel::GetInstance()->SetMulitplePhoneStatus(true); CallerLogModel::GetInstance()->SetCallStatus(true); if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, PRIORITY_ONE); } else { g_isWatchCallView = true; @@ -381,7 +632,7 @@ static bool MultiplePhonesViewDisplay() /* 非手表挂断 */ static void NonWatchFinishHandle(int laststatus) { - if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || CallerLogModel::GetInstance()->GetNotifyFlag()) { if (GetCurrCallNum() == 0) { StatusReset(); @@ -399,7 +650,7 @@ static void NonWatchFinishHandle(int laststatus) } // If the call is handling in the notification, the slice is not switched if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, PRIORITY_ONE); } else { g_isWatchCallView = true; @@ -409,15 +660,34 @@ static void NonWatchFinishHandle(int laststatus) CallerLogModel::GetInstance()->SetNotifyFlag(false); } } + + #ifdef FD230_650 + if (GetCurrCallNum() == 0) { g_phoneStatus = PHONE_SINGLE_STATUS; + StatusReset(); + set_TransCallToMobilePhone_falg(0); + } + + + + if(get_falg_SOS()) + { + sos_falg_add(); } + + #endif } static void WatchFinishHandle(void) { - if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || - CallerLogModel::GetInstance()->GetNotifyFlag()) { + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchFinishHandle"); + + if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_INCOMING_CALL || + CallerLogModel::GetInstance()->GetNotifyFlag()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchFinishHandle"); if (GetCurrCallNum() == 0) { StatusReset(); CallerLogModel::GetInstance()->SetNotifyFlag(false); @@ -428,47 +698,80 @@ static void WatchFinishHandle(void) } } } + else + { + StatusReset(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "??????????????????????"); + } g_phoneStatus = PHONE_SINGLE_STATUS; + + #ifdef FD230_650 + sos_falg_clean(); + #endif + } + +void CAT1_ChangeStatusScreendisplay(int lastStatus) +{ + // If the call is handling in the notification, the slice is not switched + if (lastStatus != OPERATE_PHONE_ACTIVE) { + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); + } } static void ChangeStatusScreendisplay(int lastStatus) { if (GetScoConnectState() != HFP_SCO_STATE_CONNECTED) { if (lastStatus == HFP_HF_CALL_STATE_ACTIVE) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE"); StatusReset(); return; } else if (lastStatus == HFP_HF_CALL_STATE_INCOMING) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING"); } else if (GetCurrCallNum() == 1 && (lastStatus == HFP_HF_CALL_STATE_DIALING || lastStatus == HFP_HF_CALL_STATE_ALERTING)) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING"); } else if (GetCurrCallNum() > 1) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE"); DisableCallingTimer(); return; } } if (!IsCompleteCallFlow()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow"); return; } if (MultiplePhonesViewDisplay()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay"); return; } // If the call is handling in the notification, the slice is not switched if (g_callOperate != OPERATE_PHONE_ACTIVE && (!CallerLogModel::GetInstance()->GetNotifyFlag())) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, PRIORITY_ONE); } } void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d", + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] operate:%d, callNUm:%d, call flow:%d", phoneCall->operate, GetCurrCallNum(), IsCompleteCallFlow()); + DisshakeTimer(); + + #ifdef FD230_650 + if(phoneCall->operate==OPERATE_INCOMING) + { + uapi_SetSpeaker_Mute(true); + } + else + { + uapi_SetSpeaker_Mute(false); + //OHOS::AlarmClockModel::GetInstance()->AlarmPlayerStop(); + } + #endif + if (phoneCall->operate == OPERATE_WATCH_FINISH && GetCurrCallNum() == 0) { g_callOperate = OPERATE_WATCH_FINISH; WatchFinishHandle(); @@ -488,7 +791,12 @@ void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall) break; case OPERATE_INCOMING: // 显示电话呼入 - IncomingHandle(); + { + InitshakeTimer(); + + IncomingHandle(); + + } break; case OPERATE_WAITING: // 震动一下,提示有新电话呼入 还未对齐 @@ -544,11 +852,27 @@ static void ScoConnectHandle(void) return; } + if(g_isCall==HFP_HF_CALL_STATE_INCOMING) + { + #ifdef FD230_650 + uapi_SetSpeaker_Mute(true); + #endif + } + else + { + #ifdef FD230_650 + uapi_SetSpeaker_Mute(false); + #endif + OHOS::AlarmClockModel::GetInstance()->AlarmPlayerStop(); + } + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectHandle] g_isCall = %d", g_isCall); switch (g_isCall) { case HFP_HF_CALL_STATE_ACTIVE: if (g_callOperate == OPERATE_PHONE_ACTIVE) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectHandle] OPERATE_PHONE_ACTIVE"); + TransCallToMobilePhone(); return; } CallerLogModel::GetInstance()->SetCallStatus(true); @@ -559,11 +883,20 @@ static void ScoConnectHandle(void) CallerLogModel::GetInstance()->SetMakePhoneStatus(true); break; case HFP_HF_CALL_STATE_DIALING: + + if(OHOS::CallerLogModel::GetInstance()->GetCallDial() == OHOS::CallerLogModel::HFP_PHONE_DIAL) + { + TransCallToMobilePhone(); + return; + } CallerLogModel::GetInstance()->SetDialingStatus("正在拨号"); CallerLogModel::GetInstance()->SetMakePhoneStatus(true); + + break; case HFP_HF_CALL_STATE_INCOMING: CallerLogModel::GetInstance()->SetMakePhoneStatus(false); + break; case HFP_HF_CALL_STATE_HELD: CallerLogModel::GetInstance()->SetCallStatus(true); @@ -583,7 +916,7 @@ static void ScoConnectHandle(void) } // If the call is handling in the notification, the slice is not switched if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + NativeAbility::GetInstance().ChangeSlice(VIEW_INCOMING_CALL, TransitionType::TRANSITION_INVALID, PRIORITY_ONE); } else { g_isWatchCallView = true; @@ -617,6 +950,7 @@ void PhoneChangeStatusCallback(const PhoneCallInfo *phoneCall) { (void)memset_s(&callInfo, sizeof(PhoneCallInfo), 0, sizeof(PhoneCallInfo)); (void)memcpy_s(&callInfo, sizeof(PhoneCallInfo), phoneCall, sizeof(PhoneCallInfo)); + WEARABLE_LOGE(HILOG_MODULE_AAFWK, "PhoneChangeStatusCallback"); GraphicService::GetInstance()->PostGraphicEvent(std::bind(UsingPhoneChangeStatusCallback, &callInfo)); } @@ -635,6 +969,8 @@ void PhoneScoStatausCallback(hfp_sco_connect_state_t state) namespace OHOS { static constexpr int32 NUM_TEN = 10; +static constexpr int16 ERROR = 0; +static constexpr int16 SUCCESS = 1; static constexpr int16 NUM_TIME_MIN = 60; static constexpr int16 NUM_TIME_HOUR = 3600; static constexpr int32 NUM_TIME_DAY = 86400; @@ -647,7 +983,7 @@ CallerLogModel::~CallerLogModel() {} void CallerLogModel::InitPhoneService() { WEARABLE_LOGD(HILOG_MODULE_AAFWK, "CallerLogModel::[InitPhoneService]::Init start"); - PhoneServiceInit(); + PhoneServiceCb serviceFoution; serviceFoution.callChanged = PhoneChangeStatusCallback; @@ -765,6 +1101,11 @@ void CallerLogModel::SetWaitingStatus(bool status) void CallerLogModel::SetCallStatus(bool status) { callStatus = status; + if(status){ + #ifdef FD230_650 + sos_falg_clean(); + #endif + } } bool CallerLogModel::GetCallStatus() @@ -790,6 +1131,8 @@ void CallerLogModel::SetoperateNumber(const char *number, char number_len) phoneNumber.append(reinterpret_cast(number), number_len); } + + std::string CallerLogModel::GetPhoneNumber(void) { return phoneNumber; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp index 96579e6dc..615054487 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp @@ -10,11 +10,12 @@ #include "common/task_manager.h" #include "wearable_log.h" #include "PhoneService.h" -#include "NativeRegisterManager.h" -namespace OHOS { +#include "NativeRegisterManager.h" -// REGIST_MENU(VIEW_CALLER_SAMPLE, CallerLogView, CallerLogPresenter, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_DEFAULT_IMG, "通话记录"); +namespace OHOS +{ + REGIST_SLICE(VIEW_CALLER_LOG, CallerLogView, CallerLogPresenter); static constexpr uint64_t MS_FOUR_SECONDS = 4000; // 定时器时间 static CallerLogPresenter *g_pMainView = nullptr; @@ -33,6 +34,21 @@ CallerLogPresenter *CallerLogPresenter::GetInstance(void) return g_pMainView; } +void CallerLogPresenter::OnStart() +{ + Presenter::OnStart(); +} + +void CallerLogPresenter::OnResume(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnResume()"); + Presenter::OnResume(); + + return; +} + +void CallerLogPresenter::OnPause(void) {} + void CallerLogPresenter::OnStop(void) { if (hintsCounting != nullptr) { @@ -46,7 +62,7 @@ void CallerLogPresenter::OnStop(void) } /* 定时器回调函数 */ -void BuletoothHintsCallback(void* data) +void BuletoothHintsCallback(int data) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&CallerLogPresenter::BuletoothHintsCallbackProc, CallerLogPresenter::GetInstance(), data)); } @@ -58,22 +74,27 @@ void CallerLogPresenter::InitBluetoothHints() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints already exists!"); return; } - hintsCounting = new GraphicTimer(MS_FOUR_SECONDS, BuletoothHintsCallback, nullptr, true); + hintsCounting = osTimerNew((osTimerFunc_t)BuletoothHintsCallback, osTimerPeriodic, nullptr, nullptr); if (hintsCounting == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints osTimerNew failed!"); return; } - bool retTimer = hintsCounting->Start(); - if (!retTimer) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints osTimerStart failed!!"); + int tick = osMs2Tick(MS_FOUR_SECONDS); + osStatus_t retTimer = osTimerStart(hintsCounting, tick); + if (retTimer != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints osTimerStart failed, ret = %lx!", retTimer); if (hintsCounting != nullptr) { - delete hintsCounting; + retTimer = osTimerDelete(hintsCounting); + if (retTimer != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::osTimerDelete failed, ret = %lx!", retTimer); + return; + } hintsCounting = nullptr; } return; } } -void CallerLogPresenter::BuletoothHintsCallbackProc(void* data) +void CallerLogPresenter::BuletoothHintsCallbackProc(int data) { if (CallerLogView::GetInstance() == nullptr) { return; @@ -92,7 +113,11 @@ void CallerLogPresenter::BuletoothHintsCallbackProc(void* data) void CallerLogPresenter::DisableBluetoothHints() { if (hintsCounting != nullptr) { - delete hintsCounting; + osStatus_t ret = osTimerDelete(hintsCounting); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanBuletoothHintsCallback osTimerDelete failed, ret = %lx!!", ret); + return; + } hintsCounting = nullptr; } } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogView.cpp index 5edabaa18..c6a04aea0 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogView.cpp @@ -32,7 +32,7 @@ CallerLogView::~CallerLogView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "::CallerLogView::~CallerLogView "); group->RemoveAll(); - container->RemoveAll(); + scrollview->RemoveAll(); hintsGroup->RemoveAll(); delete hintsImageView; @@ -49,7 +49,7 @@ CallerLogView::~CallerLogView() dragListener = nullptr; if (num != 0) { - delete[] info; + delete info; info = nullptr; groupFirst->RemoveAll(); @@ -68,8 +68,8 @@ CallerLogView::~CallerLogView() delete hintsGroup; hintsGroup = nullptr; - delete container; - container = nullptr; + delete scrollview; + scrollview = nullptr; g_pMainView = nullptr; } @@ -100,7 +100,7 @@ bool CallerLogView::CreateNoDataCallerLogViewGroup() CallerUIScrollView *CallerLogView::GetContainerView() { - return container; + return scrollview; } CallerUIScrollView *CallerLogView::GetGroupView() @@ -125,7 +125,7 @@ void CallerLogView::InitBluetoothHintsGroup() hintsImageView->SetSrc(PNG_BLUETOOTH_HINTS_PATH); hintsGroup->Add(hintsImageView); - AddViewToRootContainer(hintsGroup); + GetRootContainer()->Add(hintsGroup); hintsGroup->SetVisible(false); return; } @@ -147,7 +147,7 @@ void CallerLogView::ChangeLabelsStytleLog() groupFirst->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); labelLog.SetPosition(0, APP_ITEM_FONT_SIZE, HORIZONTAL_RESOLUTION, ICON_X + NUM_20); - labelLog.SetText("通话记录"); + // labelLog.SetTextId(STR_CALL_LIST); labelLog.SetTextColor(Color::White()); labelLog.SetFont(DEFAULT_VECTOR_FONT_FILENAME, HEAD_END_FONT_SIZE); labelLog.SetAlign(TEXT_ALIGNMENT_CENTER); @@ -169,7 +169,7 @@ void CallerLogView::ChangeLabelsStytleClear(int32 groupFinaly, int32 Index) groupFinal->SetOnClickListener(clickLeftListener); labelClear.SetPosition(0, NUM_20, HORIZONTAL_RESOLUTION, APP_ITEM_BUTTON_HEIGHT); - labelClear.SetText("全部清除"); + // labelClear.SetTextId(STR_DELETE_ALL); labelClear.SetTextColor(Color::White()); labelClear.SetFont(DEFAULT_VECTOR_FONT_FILENAME, HEAD_END_FONT_SIZE); labelClear.SetAlign(TEXT_ALIGNMENT_CENTER); @@ -188,26 +188,27 @@ bool CallerLogView::InitOrBandOnclickEvent() bool CallerLogView::CreateCallerLogViewGroup() { - container = new CallerUIScrollView(); - if (container == nullptr) { + scrollview = new CallerUIScrollView(); + if (scrollview == nullptr) { return false; } - container->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - container->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - container->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); - container->SetThrowDrag(true); - container->SetDraggable(true); + scrollview->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + scrollview->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + scrollview->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); + scrollview->SetThrowDrag(true); + scrollview->SetDraggable(true); return true; } void CallerLogView::OnStart() { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogView::OnStart"); if (!CreateNoDataCallerLogViewGroup()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::CreateNoDataCallerLogViewGroup error"); return; } - AddViewToRootContainer(group); + GetRootContainer()->Add(group); if (!CreateCallerLogViewGroup()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::CreateCallerLogViewGroup error"); @@ -219,6 +220,7 @@ void CallerLogView::OnStart() return; } + info = new CallLogInfo[sizeof(CallLogInfo) * CALL_LOG_MAX_NUM]; if (GetCallLog(&info, &num) == -1) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogModel::GetInstance()->ListIsEmpty"); return; @@ -226,7 +228,7 @@ void CallerLogView::OnStart() if (num != 0) { ChangeLabelsStytleLog(); - container->Add(groupFirst); + scrollview->Add(groupFirst); currentNumber = 0; for (int i = num; i != 0; i--) { @@ -235,11 +237,11 @@ void CallerLogView::OnStart() item[currentNumber]->SetItemInfo((info + i - 1), (info + i -1)->telLen); item[currentNumber]->SetViewIndex(currentNumber); item[currentNumber]->SetOnClickListener(clickLeftListener); - container->Add(item[currentNumber]); + scrollview->Add(item[currentNumber]); currentNumber++; } ChangeLabelsStytleClear((currentNumber + 1)*ITEM_GROUP_HEIGHT, currentNumber); - container->Add(groupFinal); + scrollview->Add(groupFinal); } dragListener = new CallerListOnDragListener(); @@ -247,14 +249,20 @@ void CallerLogView::OnStart() return; } InitBluetoothHintsGroup(); - container->SetOnDragListener(dragListener); + scrollview->SetOnDragListener(dragListener); group->SetOnDragListener(dragListener); - AddViewToRootContainer(container); + + if (scrollview == nullptr) { + return; + } + + GetRootContainer()->Add(scrollview); + if (num == 0) { group->SetVisible(true); - container->SetVisible(false); + scrollview->SetVisible(false); } else { - container->SetVisible(true); + scrollview->SetVisible(true); group->SetVisible(false); } } @@ -268,4 +276,5 @@ CallLogInfo *CallerLogView::GetCurrentCallInfo() { return info; } + } \ No newline at end of file -- 2.17.1