From: luozheng <1732036298@qq.com> Date: Sat, 24 Aug 2024 10:38:19 +0000 (+0800) Subject: 录音界面修改 X-Git-Tag: release_V1.2.70_20241020_135402~563^2~31 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=0f2a191043ccd83b7b7896c14415a8af5570b884;p=mirrors%2FFD230.git 录音界面修改 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index c023335ef..721202205 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -232,8 +232,6 @@ namespace OHOS static constexpr const char *PNG_ALIPAY_YSE_ICON = APP_RES_PATH "/alipay/yes.bin"; static constexpr const char *PNG_ALIPAY_NO_ICON = APP_RES_PATH "/alipay/no.bin"; /* ----------------------------------- 录音 ----------------------------------- */ - static constexpr const char *PNG_ANIMATOR1_IMAGE = APP_RES_PATH "/record/animator1.bin"; - static constexpr const char *PNG_ANIMATOR2_IMAGE = APP_RES_PATH "/record/animator2.bin"; static constexpr const char *PNG_RECORD1_IMAGE = APP_RES_PATH "/record/RECORD1.bin"; static constexpr const char *PNG_RECORD2_IMAGE = APP_RES_PATH "/record/RECORD2.bin"; static constexpr const char *PNG_RECORD3_IMAGE = APP_RES_PATH "/record/RECORD3.bin"; diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordListView.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordListView.h index 76a195314..9314a660b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordListView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordListView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 10:00:02 + * @LastEditTime: 2024-08-24 17:24:22 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordListView.h */ #ifndef RECORD_LIST_VIEW_H @@ -51,7 +51,6 @@ namespace OHOS bool RecordListListViewInit(void); void AddRecordingToList(const RecordingListItem &item); void InitRecordingInfo(void); - void UpdateVisibilityBasedOnRecordingList(); void ClearAll(void); void IsVisibleLabel(bool value); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h index 4fed53c41..6324b81ad 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 11:06:56 + * @LastEditTime: 2024-08-24 16:01:13 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/include/RecordingView.h */ #ifndef RECORD_VIEW_H @@ -95,6 +95,7 @@ namespace OHOS UILabelExt *AttentionLabel{nullptr}; UIImageAnimatorView *RecordingViewImageAnimator{nullptr}; UIImageView *RECORD1_Image = nullptr; + UIImageView *pullUp_Image = nullptr; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordDeleteView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordDeleteView.cpp index 4e2a337b9..92733bad7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordDeleteView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordDeleteView.cpp @@ -97,14 +97,14 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordDeleteView::RecordDeleteLabelViewInit"); LabelConfig labelconfig = { .left = 83, - .top = 52, + .top = 50, .width = 300, .height = 35, .fontSize = 30, .lineHeigh = 35, //.text = "删除录音", .textId = STR_DELETE_RECORDING, - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; TitleLabel = CreateRecordDeleteLabel(labelconfig); if (nullptr == TitleLabel) @@ -123,7 +123,7 @@ namespace OHOS .lineHeigh = 35, //.text = "是否永久删除", .textId = STR_DELETE_PERMANENTLY, - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; AttentionLabel = CreateRecordDeleteLabel(labelconfig); if (nullptr == AttentionLabel) diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp index 739b81161..19fcf2016 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordGoingView.cpp @@ -143,14 +143,14 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordGoingView::RecordGoingLabelViewInit"); LabelConfig labelconfig = { .left = 83, - .top = 52, + .top = 50, .width = 300, .height = 35, .fontSize = 30, .lineHeigh = 35, //.text = "录音机", .textId = STR_RECORDER, - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; TitleLabel = CreateRecordGoingLabelExt(labelconfig); @@ -169,7 +169,7 @@ namespace OHOS .lineHeigh = 35, //.text = "录音机", .textId = STR_RECORDING, - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; RecordGoingLabel = CreateRecordGoingLabelExt(labelconfig); if (nullptr == RecordGoingLabel) @@ -186,7 +186,7 @@ namespace OHOS .fontSize = 65, .lineHeigh = 76, .text = "00:00:00", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; Timer = CreateRecordGoingLabel(labelconfig); if (nullptr == Timer) diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp index 440e98a10..349d2ac57 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com - * @Date: 2024-02-27 09:16:52 + * @Date: 2024-02-27 09:16:50 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 09:42:18 + * @LastEditTime: 2024-08-24 18:35:24 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp */ @@ -14,7 +14,6 @@ namespace OHOS { static RecordListView *g_pRecordListView{nullptr}; - RecordListView::RecordListView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordListView::RecordListView"); @@ -35,55 +34,64 @@ namespace OHOS void RecordListView::ClearAll() { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClearAll"); if (RecordListScrollView != nullptr) { // 首先移除所有子视图 RecordListScrollView->RemoveAll(); - - // 释放各个资源 - delete RecordListViewAttentionLabel; - RecordListViewAttentionLabel = nullptr; - - delete RecordListViewTitleLabel; - RecordListViewTitleLabel = nullptr; - - delete p_RecordingListAdapter; - p_RecordingListAdapter = nullptr; - + if (RecordListViewAttentionLabel != nullptr) + { + delete RecordListViewAttentionLabel; + RecordListViewAttentionLabel = nullptr; + } + if (RecordListViewTitleLabel != nullptr) + { + delete RecordListViewTitleLabel; + RecordListViewTitleLabel = nullptr; + } + if (p_RecordingListAdapter != nullptr) + { + delete p_RecordingListAdapter; + p_RecordingListAdapter = nullptr; + } // 释放点击监听器 if (UIView::OnClickListener *clicklister = recordList->GetOnClickListener()) { delete clicklister; clicklister = nullptr; } - // 释放拖动监听器 if (UIView::OnDragListener *dragLister = RecordListScrollView->GetOnDragListener()) { delete dragLister; dragLister = nullptr; } - if (clickListener != nullptr) { delete clickListener; clickListener = nullptr; } - // 最后释放 RecordListScrollView 及其子视图 - delete recordList; - recordList = nullptr; - - delete RecordListScrollView; - RecordListScrollView = nullptr; + if (recordList != nullptr) + { + delete recordList; + recordList = nullptr; + } + if (RecordListScrollView != nullptr) + { + delete RecordListScrollView; + RecordListScrollView = nullptr; + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClearAll"); } } // 添加录音到list void RecordListView::AddRecordingToList(const RecordingListItem &item) { - p_RecordingListAdapter->AddListItem(item); + if (p_RecordingListAdapter != nullptr) + { + p_RecordingListAdapter->AddListItem(item); + } } // 把录音信息数据拿到存储到list中 @@ -99,18 +107,38 @@ namespace OHOS // 每次录音完将数据刷新显示到list void RecordListView::RefreshRecordingListData(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordListView::RefreshRecordingListData"); - RecordingModel::GetInstance()->InitRecordingListItem(); - p_RecordingListAdapter->ClearData(); - InitRecordingInfo(); - recordList->RefreshList(); - if (RecordingModel::GetInstance()->GetRecordingListNum() == 0) + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListView::RefreshRecordingListData"); + RecordingModel::GetInstance()->InitRecordingListItem(); // 这行应放到删除后调用 + int num = RecordingModel::GetInstance()->GetRecordingListNum(); + if (p_RecordingListAdapter != nullptr && recordList != nullptr) { - IsVisibleLabel(true); - } - else - { - IsVisibleLabel(false); + if (num == 0) + { + IsVisibleLabel(true); + } + else + { + /* -------------------------------------------------------------------------- */ + IsVisibleLabel(false); + /* -------------------------------------------------------------------------- */ + if (num == 1) + { + recordList->SetHeight(120 * num); + } + else if (num == 2) + { + recordList->SetHeight(120 * num); + } + else + { + recordList->SetHeight(340); + } + p_RecordingListAdapter->ClearData(); + InitRecordingInfo(); + recordList->RefreshList(); + recordList->Invalidate(); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListView::RefreshRecordingListData over!!"); } return; } @@ -122,26 +150,11 @@ namespace OHOS { RecordListViewAttentionLabel->SetVisible(true); recordList->SetVisible(false); // 列表设置不可见 - RecordListScrollView->SetVerticalScrollState(false); } else { RecordListViewAttentionLabel->SetVisible(false); recordList->SetVisible(true); // 列表设置可见 - RecordListScrollView->SetVerticalScrollState(true); - } - } - - //根据录音列表中录音的数量来更新某个标签或视图的可见性。 - void RecordListView::UpdateVisibilityBasedOnRecordingList() - { - if (RecordingModel::GetInstance()->GetRecordingListNum() == 0) - { - IsVisibleLabel(true); - } - else - { - IsVisibleLabel(false); } } @@ -192,14 +205,13 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordListView::SetUpRecordListViewLabel"); LabelConfig labelconfig = { .left = 83, - .top = 52, + .top = 50, .width = 300, .height = 35, .fontSize = 30, .lineHeigh = 35, - //.text = "录音列表", - .textId = STR_RECORDING_LIST, - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .textId = STR_RECORDING_LIST, // 录音列表 + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; RecordListViewTitleLabel = CreateRecordListLabel(labelconfig); @@ -210,15 +222,14 @@ namespace OHOS } labelconfig = { - .left = 33, - .top = 273, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, - //.text = "当前录音列表为空", - .textId = STR_CRLEMPTY, - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .left = 53, + .top = 280, + .width = 360, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .textId = STR_CRLEMPTY, // 当前录音列表为空 + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; RecordListViewAttentionLabel = CreateRecordListLabel(labelconfig); if (nullptr == RecordListViewAttentionLabel) @@ -237,27 +248,44 @@ namespace OHOS bool RecordListView::RecordListListViewInit(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordListView::RecordListViewInit"); - p_RecordingListAdapter = new RecordingListAdapter(); - clickListener = static_cast(new RecordListViewListener()); - p_RecordingListAdapter->SetItemClickListener(clickListener); - recordList = new UIList(); + if (p_RecordingListAdapter == nullptr) + { + p_RecordingListAdapter = new RecordingListAdapter(); + if (p_RecordingListAdapter == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListView::p_RecordingListAdapter is nullptr!"); + return false; + } + clickListener = static_cast(new RecordListViewListener()); + if (clickListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListView::clickListener is nullptr!"); + return false; + } + p_RecordingListAdapter->SetItemClickListener(clickListener); + } if (recordList == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListView::recordList is nullptr!"); - return false; + recordList = new UIList(); + if (recordList == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListView::recordList is nullptr!"); + return false; + } } - recordList->SetPosition(43, 120, 380, 300); + recordList->SetPosition(43, 120, 380, 340); recordList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); - recordList->SetSelectPosition(233); recordList->SetThrowDrag(true); // 设置手指抬起屏幕后是否继续滚动。 recordList->SetTouchable(true); recordList->SetDraggable(true); recordList->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。 - recordList->SetReboundSize(50); + recordList->SetDragACCLevel(5); + recordList->SetSwipeACCLevel(800); /*设置手指抬起屏幕后的补偿距离。*/ + recordList->SetReboundSize(30); recordList->SetIntercept(true); // 设置是否拦截输入事件。如果被截获,视图在本地处理后不会将输入事件传递给父视图。 - InitRecordingInfo(); + // InitRecordingInfo(); recordList->SetAdapter(p_RecordingListAdapter); - recordList->RefreshList(); + // recordList->RefreshList(); RecordListScrollView->Add(recordList); return true; } @@ -271,16 +299,6 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordListViewInit fail!!"); return nullptr; } - - if (RecordingModel::GetInstance()->GetRecordingListNum() == 0) - { - IsVisibleLabel(true); - } - else - { - IsVisibleLabel(false); - } - return RecordListScrollView; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp index bbe437339..052e92461 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-02 20:10:18 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 11:41:18 + * @LastEditTime: 2024-08-24 17:40:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp */ #include "record/include/RecordingListitemView.h" @@ -14,7 +14,7 @@ namespace OHOS RecordingListitemView::RecordingListitemView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingListitemView::RecordingListitemView"); - SetPosition(43, 100, 380, 120); + SetPosition(0, 0, 380, 120); SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); SetStyle(STYLE_BACKGROUND_OPA, 255); SetTouchable(true); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp index f726b4e6c..89b654f5b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp @@ -538,6 +538,7 @@ namespace OHOS Recordings.push_back({i, fileNames[i].c_str(), "09:51", yyyymmhhh_date}); } } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingModel::InitRecordingListItem over!!"); } /* @@ -563,7 +564,7 @@ namespace OHOS */ int &RecordingModel::GetRecordingListNum(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingModel::GetRecordingListNum"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingModel::GetRecordingListNum %d",RecordingMp3FileCount); return RecordingMp3FileCount; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp index 964f1ee86..d71577e28 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPlayerView.cpp @@ -132,13 +132,13 @@ namespace OHOS { LabelConfig labelconfig = { .left = 83, - .top = 52, + .top = 50, .width = 300, .height = 35, .fontSize = 30, .lineHeigh = 35, .text = "录音3", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; RecordingFileName = SetUpLabel(labelconfig); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index 65a93fbb9..c919d1585 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-23 18:35:16 + * @LastEditTime: 2024-08-24 17:13:46 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingView.cpp index 6781eefce..7e52995f0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingView.cpp @@ -5,24 +5,88 @@ #include "../include/RecordingModel.h" namespace OHOS { - static ImageAnimatorInfo RecordingViewImageAnimatorInfo[2] = { - {PNG_ANIMATOR1_IMAGE, {213, 400}, 40, 40, IMG_SRC_FILE_PATH}, - {PNG_ANIMATOR2_IMAGE, {213, 400}, 40, 40, IMG_SRC_FILE_PATH}, - }; - static RecordingView *g_pRecordView{nullptr}; - RecordingView::RecordingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::RecordingView"); g_pRecordView = this; } - RecordingView::~RecordingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::~RecordingView"); g_pRecordView = nullptr; } + void RecordingView::ClearAll(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::~RecordingView"); + if (container_ != nullptr) + { + container_->RemoveAll(); + if (RecordingViewScrollView[RECORDINGVIEW] != nullptr) + { + RecordingViewScrollView[RECORDINGVIEW]->RemoveAll(); + + if (RecordingViewTitleLabel != nullptr) + { + delete RecordingViewTitleLabel; + RecordingViewTitleLabel = nullptr; + } + if (RecordingViewButton != nullptr) + { + delete RecordingViewButton; + RecordingViewButton = nullptr; + } + if (AttentionLabel != nullptr) + { + delete AttentionLabel; + AttentionLabel = nullptr; + } + if (RECORD1_Image != nullptr) + { + delete RECORD1_Image; + RECORD1_Image = nullptr; + } + if (pullUp_Image != nullptr) + { + delete pullUp_Image; + pullUp_Image = nullptr; + } + delete RecordingViewScrollView[RECORDINGVIEW]; + RecordingViewScrollView[RECORDINGVIEW] = nullptr; + } + if (p_RecordListView != nullptr) + { + delete p_RecordListView; + p_RecordListView = nullptr; + } + if (p_RecordGoingView != nullptr) + { + delete p_RecordGoingView; + p_RecordGoingView = nullptr; + } + if (p_RecordingPlayerView != nullptr) + { + delete p_RecordingPlayerView; + p_RecordingPlayerView = nullptr; + } + if (p_RecordDeleteView != nullptr) + { + delete p_RecordDeleteView; + p_RecordDeleteView = nullptr; + } + if (p_RecordingVolumeSettingView != nullptr) + { + delete p_RecordingVolumeSettingView; + p_RecordingVolumeSettingView = nullptr; + } + for (int i = RECORDINGVIEW; i < MAX_RECORDINGVIEWID; i++) + { + RecordingViewScrollView[i] = nullptr; + } + delete container_; + container_ = nullptr; + } + } RecordingView *RecordingView::GetInstance() { @@ -79,9 +143,9 @@ namespace OHOS RecordingViewScrollView[thisView] = p_RecordListView->RecordListViewInit(); container_->Add(RecordingViewScrollView[thisView]); } - else + if (p_RecordListView) { - RecordListView::GetInstance()->RefreshRecordingListData(); + p_RecordListView->RefreshRecordingListData(); } return true; } @@ -218,68 +282,6 @@ namespace OHOS Draw(); } - void RecordingView::ClearAll(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::~RecordingView"); - if (container_ != nullptr) - { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } - - if (RecordingViewScrollView[RECORDINGVIEW] != nullptr) - { - RecordingViewScrollView[RECORDINGVIEW]->RemoveAll(); - delete RecordingViewScrollView[RECORDINGVIEW]; - RecordingViewScrollView[RECORDINGVIEW] = nullptr; - } - - RecordingViewImageAnimator->Stop(); - delete RecordingViewImageAnimator; - RecordingViewImageAnimator = nullptr; - - delete RecordingViewTitleLabel; - RecordingViewTitleLabel = nullptr; - - delete RecordingViewButton; - RecordingViewButton = nullptr; - - delete AttentionLabel; - AttentionLabel = nullptr; - - delete RECORD1_Image; - RECORD1_Image = nullptr; - - if (p_RecordListView != nullptr) - { - delete p_RecordListView; - p_RecordListView = nullptr; - } - if (p_RecordGoingView != nullptr) - { - delete p_RecordGoingView; - p_RecordGoingView = nullptr; - } - if (p_RecordingPlayerView != nullptr) - { - delete p_RecordingPlayerView; - p_RecordingPlayerView = nullptr; - } - - if (p_RecordDeleteView != nullptr) - { - delete p_RecordDeleteView; - p_RecordDeleteView = nullptr; - } - - if (p_RecordingVolumeSettingView != nullptr) - { - delete p_RecordingVolumeSettingView; - p_RecordingVolumeSettingView = nullptr; - } - } - UIButton *RecordingView::SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener) { UIButton *button = new UIButton(); @@ -319,35 +321,39 @@ namespace OHOS bool RecordingView::RecordingLabelViewInit(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::RecordingLabelViewInit"); - RecordingViewTitleLabel = new UILabelExt(); if (RecordingViewTitleLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingViewTitleLabel new fail!"); - return false; + RecordingViewTitleLabel = new UILabelExt(); + if (RecordingViewTitleLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingViewTitleLabel new fail!"); + return false; + } } - RecordingViewTitleLabel->SetPosition(83, 52, 300, 35); + RecordingViewTitleLabel->SetPosition(83, 50, 300, 35); RecordingViewTitleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); RecordingViewTitleLabel->SetStyle(STYLE_TEXT_FONT, 30); RecordingViewTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // RecordingViewTitleLabel->SetText("录音机"); - RecordingViewTitleLabel->SetTextId(STR_RECORDER); - RecordingViewTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + RecordingViewTitleLabel->SetTextId(STR_RECORDER); // 录音机 + RecordingViewTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); RecordingViewTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); RecordingViewTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ - AttentionLabel = new UILabelExt(); if (AttentionLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionLabel new fail!"); - return false; + AttentionLabel = new UILabelExt(); + if (AttentionLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionLabel new fail!"); + return false; + } } AttentionLabel->SetPosition(53, 330, 360, 35); AttentionLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30); AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // AttentionLabel->SetText("点击开始录音"); - AttentionLabel->SetTextId(STR_CLICK_TO_RECORD); - AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + AttentionLabel->SetTextId(STR_CLICK_TO_RECORD); // 点击开始录音 + AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); AttentionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -376,35 +382,32 @@ namespace OHOS bool RecordingView::RecordingImageViewInit(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::RecordingImageViewInit"); - RECORD1_Image = new UIImageView(); if (RECORD1_Image == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RECORD1_Image new fail!"); - return false; + RECORD1_Image = new UIImageView(); + if (RECORD1_Image == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RECORD1_Image new fail!"); + return false; + } } RECORD1_Image->SetPosition(158, 129, 150, 150); RECORD1_Image->SetStyle(STYLE_BORDER_RADIUS, 10); RECORD1_Image->SetSrc(PNG_RECORD1_IMAGE); - - return true; - } - - bool RecordingView::RecordingImageAnimatorViewInit(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::RecordingImageAnimatorViewInit"); - RecordingViewImageAnimator = new UIImageAnimatorView(); - if (RecordingViewImageAnimator == nullptr) + /* -------------------------------------------------------------------------- */ + if (pullUp_Image == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingViewImageAnimator new fail!"); - return false; + pullUp_Image = new UIImageView(); + if (pullUp_Image == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "pullUp_Image new fail!"); + return false; + } } - RecordingViewImageAnimator->SetPosition(213, 400, 40, 40); - RecordingViewImageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - RecordingViewImageAnimator->SetImageAnimatorSrc(RecordingViewImageAnimatorInfo, 2, 200); - RecordingViewImageAnimator->SetTimeOfPause(200); - RecordingViewImageAnimator->SetRepeatTimes(1); - RecordingViewImageAnimator->SetReverse(true); - RecordingViewImageAnimator->Start(); + pullUp_Image->SetPosition(213, 400, 40, 40); + pullUp_Image->SetAutoEnable(false); + pullUp_Image->SetResizeMode(UIImageView::CONTAIN); + pullUp_Image->SetSrc("/user/res/Sleep/up.bin"); return true; } @@ -415,7 +418,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RecordingView::RecordingViewInit"); // 如果其中任何一个初始化函数返回 false(即初始化失败),则会打印错误日志并返回空指针。 if (!RecordingScrollViewInit() || !RecordingLabelViewInit() || - !RecordingButtonViewInit() || !RecordingImageViewInit() || !RecordingImageAnimatorViewInit()) + !RecordingButtonViewInit() || !RecordingImageViewInit()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingViewInit fail!!"); return; @@ -424,7 +427,7 @@ namespace OHOS RecordingViewScrollView[RECORDINGVIEW]->Add(RECORD1_Image); RecordingViewScrollView[RECORDINGVIEW]->Add(RecordingViewButton); RecordingViewScrollView[RECORDINGVIEW]->Add(AttentionLabel); - RecordingViewScrollView[RECORDINGVIEW]->Add(RecordingViewImageAnimator); + RecordingViewScrollView[RECORDINGVIEW]->Add(pullUp_Image); container_->Add(RecordingViewScrollView[RECORDINGVIEW]); } @@ -434,7 +437,6 @@ namespace OHOS View::OnStart(); SetContainerView(new UIViewGroup()); container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - // container_->SetOnDragListener(presenter_); container_->SetTouchable(true); container_->SetDraggable(true); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp index 28c8f5448..98e5ba2c1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp @@ -2,12 +2,13 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-13 17:38:18 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-13 11:21:31 + * @LastEditTime: 2024-08-24 15:42:50 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingVolumeSettingView.cpp */ #include "record/include/RecordingVolumeSettingView.h" #include "record/include/RecordingPresenter.h" - +#include "wearable_log.h" +#include "ConfigModel.h" namespace OHOS { @@ -50,7 +51,7 @@ namespace OHOS return nullptr; } RecordingVolumeSettingViewScrollView = p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess(); - UIView::OnDragListener * volumeDragListener = static_cast(RecordingPresenter::GetInstance()); + UIView::OnDragListener *volumeDragListener = static_cast(RecordingPresenter::GetInstance()); if (volumeDragListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPresenter GetInstance fail"); @@ -63,7 +64,7 @@ namespace OHOS return nullptr; } - p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC)); + p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(ConfigModel::GetInstance()->GetSystemVolume()); initViewStatus = true; return RecordingVolumeSettingViewScrollView; diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/record/animator1.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/record/animator1.bin deleted file mode 100644 index 25931175f..000000000 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/record/animator1.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:48cee7cf0d85cf1a537ba3c456e9dcfc6f2b439863e5106211519e57ca6d18fd -size 1144 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/record/animator2.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/record/animator2.bin deleted file mode 100644 index 4fdc1b74a..000000000 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/record/animator2.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:389beb90ee0bfe28a4969e4d2ba0aee17fb8f6b524356611c00ad2127254d199 -size 4504