From ebcda6aeda9db13204f3502b4929eface9264a7c Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 2 Aug 2024 16:22:35 +0800 Subject: [PATCH] =?utf8?q?=E6=90=AD=E5=BB=BA=E9=9F=B3=E4=B9=90=E6=92=AD?= =?utf8?q?=E6=94=BE=E5=99=A8=E5=9F=BA=E6=9C=AC=E6=A1=86=E6=9E=B6=EF=BC=8C?= =?utf8?q?=E5=B9=B6=E6=8F=90=E4=BE=9B=E5=AD=98=E6=94=BE=E9=9F=B3=E4=B9=90?= =?utf8?q?=E8=B7=AF=E5=BE=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/CMakeLists.txt | 6 + .../nativelauncher/include/AppViewIDs.h | 1 + .../nativelauncher/include/NativeLauncher.h | 1 + .../nativelauncher/src/NativeLauncher.cpp | 16 +++ .../include/MusicPlayerControlView.h | 22 ++++ .../musicplayer/include/MusicPlayerModel.h | 34 ++++++ .../include/MusicPlayerPresenter.h | 45 +++++++ .../musicplayer/include/MusicPlayerView.h | 39 ++++++ .../src/MusicPlayerControlView.cpp | 30 +++++ .../musicplayer/src/MusicPlayerModel.cpp | 30 +++++ .../musicplayer/src/MusicPlayerPresenter.cpp | 114 ++++++++++++++++++ .../musicplayer/src/MusicPlayerView.cpp | 109 +++++++++++++++++ .../fd230/fs/user/userdata/music/music.txt | 0 13 files changed, 447 insertions(+) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerControlView.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerModel.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerPresenter.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerView.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerControlView.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerModel.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerView.cpp create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/userdata/music/music.txt diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 246a61211..357eaf872 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -417,6 +417,12 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aimodels/src/AiModelsView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aimodels/src/AiModelsPresenter.cpp + #音乐播放器 + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/musicplayer/src/MusicPlayerControlView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/musicplayer/src/MusicPlayerModel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/musicplayer/src/MusicPlayerPresenter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/musicplayer/src/MusicPlayerView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index e88f7970f..9cd613bd6 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -68,6 +68,7 @@ typedef enum : uint16_t VIEW_AI_MODELS, // AI模型选择界面 VIEW_REBOOTANDSHUTDOWN, //(滑动关机和重启带恢复出厂设置) VIEW_RECORD, + VIEW_MUSIC_PLAYER, //音乐播放器 /* -------------------------------------------------------------------------- */ VIEW_OBU_MESSAGE, /* -------------------------------------------------------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index e6ba0aab6..85deb58a3 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -65,6 +65,7 @@ namespace OHOS void InitAiModelsSlice(void); void InitRebootAndShutdownSlice(void); void InitOBUMessageSlice(void); + void InitMusicPlayerSlice(void); /* --------------------------------界面------------------------------------ */ void InitRotateSlice(void); void InitBloodSlice(void); diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 3fd01158d..093716a32 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -220,6 +220,9 @@ #include "obumessage/include/OBUMessagePresenter.h" #include "obumessage/include/OBUMessageView.h" + +#include "musicplayer/include/MusicPlayerPresenter.h" +#include "musicplayer/include/MusicPlayerView.h" /* -------------------------------------------------------------------------- */ #include "traing/include/TraingView.h" #include "traing/include/TraingPresenter.h" @@ -316,6 +319,7 @@ namespace OHOS {VIEW_AI_VOICE, &NativeLauncher::InitAiVoiceSlice}, // Ai Voice(人工智能语音) {VIEW_AI_MODELS, &NativeLauncher::InitAiModelsSlice}, // Ai Models(Ai模型选择界面) {VIEW_REBOOTANDSHUTDOWN, &NativeLauncher::InitRebootAndShutdownSlice}, // 滑动关机和重启带恢复出厂设置 + {VIEW_MUSIC_PLAYER, &NativeLauncher::InitMusicPlayerSlice}, // 音乐播放器 /* -------------------------------------------------------------------------- */ {VIEW_OBU_MESSAGE, &NativeLauncher::InitOBUMessageSlice}, @@ -1401,6 +1405,18 @@ namespace OHOS NativeAbility::GetInstance().AddSliceProxy(VIEW_REBOOTANDSHUTDOWN, rebootandshutdown); } + /*音乐播放器*/ + void NativeLauncher::InitMusicPlayerSlice(void) + { + SliceProxy *musicplayer = new AbilitySliceProxy; + if (musicplayer == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "musicplayer"); + return; + } + NativeAbility::GetInstance().AddSliceProxy(VIEW_MUSIC_PLAYER, musicplayer); + } + /*OBU Message*/ void NativeLauncher::InitOBUMessageSlice(void) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerControlView.h b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerControlView.h new file mode 100644 index 000000000..9f46aa7d5 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerControlView.h @@ -0,0 +1,22 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-02 15:21:47 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 15:58:32 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerControlView.h + */ +#include "components/ui_card_page.h" + +namespace OHOS +{ + class MusicPlayerControlView : public UICardPage + { + public: + MusicPlayerControlView(); + ~MusicPlayerControlView(); + static MusicPlayerControlView *GetInstance(void); + + private: + }; + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerModel.h b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerModel.h new file mode 100644 index 000000000..16ae9bff1 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerModel.h @@ -0,0 +1,34 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-02 10:00:21 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 16:08:39 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerModel.h + */ + +#ifndef MUSIC_PLAYER_MODEL_H +#define MUSIC_PLAYER_MODEL_H + +#include "iostream" +#include "string" + +namespace OHOS +{ + class MusicPlayerModel + { + public: + static MusicPlayerModel &GetInstance(void); + std::string GetMusicPlayPath(void); + + private: + MusicPlayerModel(); + ~MusicPlayerModel(); + MusicPlayerModel(const MusicPlayerModel &) = delete; + MusicPlayerModel &operator=(const MusicPlayerModel &) = delete; + + private: + std::string musicPlayPath = "/user/userdata/music/"; /*音乐播放路径*/ + }; +} + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerPresenter.h new file mode 100644 index 000000000..a5e6ffa33 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerPresenter.h @@ -0,0 +1,45 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-07-08 09:39:10 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 14:54:01 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aimodels/include/MusicPlayerPresenter.h + */ + +#ifndef MUSIC_PLAYER_PRESENTER_H +#define MUSIC_PLAYER_PRESENTER_H + +#include "Presenter.h" +#include "View.h" + +namespace OHOS +{ + class MusicPlayerView; + class MusicPlayerModel; + class MusicPlayerPresenter : public Presenter, + public UIView::OnClickListener, + public UIView::OnDragListener, + public RootView::OnKeyActListener + { + public: + MusicPlayerPresenter(); + virtual ~MusicPlayerPresenter(); + static MusicPlayerPresenter *GetInstance(); + + void OnStart() override; + void OnResume() override; + void OnPause() override; + void OnStop() override; + + private: + bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 + + MusicPlayerModel *model; + bool X_DRAG_FLAG{false}; + }; +} + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerView.h b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerView.h new file mode 100644 index 000000000..452977770 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerView.h @@ -0,0 +1,39 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-01 18:02:51 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 15:57:46 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/musicplayer/include/MusicPlayerView.h + */ + + +#ifndef MUSIC_PLAYER_VIEW_H +#define MUSIC_PLAYER_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include "musicplayer/include/MusicPlayerControlView.h" +namespace OHOS +{ + + class MusicPlayerPresenter; + class MusicPlayerView : public View + { + public: + MusicPlayerView(); + ~MusicPlayerView(); + static MusicPlayerView *GetInstance(void); + + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; + + private: + void CreateMusicPlayerView(void); + void ClearAll(void); + MusicPlayerControlView *musicPlayerControlView{nullptr}; + bool viewInitStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerControlView.cpp new file mode 100644 index 000000000..ce48fb6f5 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerControlView.cpp @@ -0,0 +1,30 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-02 15:26:48 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 15:56:37 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerControlView.cpp + */ +#include "musicplayer/include/MusicPlayerControlView.h" +#include "wearable_log.h" +namespace OHOS +{ + static MusicPlayerControlView *g_pMusicPlayerControlView{nullptr}; + MusicPlayerControlView::MusicPlayerControlView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MusicPlayerControlView::MusicPlayerControlView"); + g_pMusicPlayerControlView = this; + } + + MusicPlayerControlView::~MusicPlayerControlView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MusicPlayerControlView::~MusicPlayerControlView"); + g_pMusicPlayerControlView = nullptr; + } + + MusicPlayerControlView *MusicPlayerControlView::GetInstance(void) + { + return g_pMusicPlayerControlView; + } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerModel.cpp new file mode 100644 index 000000000..954a9a0d1 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerModel.cpp @@ -0,0 +1,30 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-02 10:00:33 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 16:06:48 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerModel.cpp + */ + +#include "musicplayer/include/MusicPlayerModel.h" +#include "wearable_log.h" + +namespace OHOS +{ + MusicPlayerModel::MusicPlayerModel() {} + + MusicPlayerModel::~MusicPlayerModel() {} + + MusicPlayerModel &MusicPlayerModel::GetInstance() + { + static MusicPlayerModel instance; + return instance; + } + + /*获取音乐播放路径*/ + std::string MusicPlayerModel::GetMusicPlayPath(void) + { + return musicPlayPath; + } + +} diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp new file mode 100644 index 000000000..2d2b0e0b2 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp @@ -0,0 +1,114 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-02 09:59:59 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 14:54:21 + * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp + */ + +#include "AppViewIDs.h" +#include "NativeAbility.h" +#include "common/key_code.h" +#include +#include "UiConfig.h" +#include "musicplayer/include/MusicPlayerPresenter.h" +#include "musicplayer/include/MusicPlayerView.h" +#include "musicplayer/include/MusicPlayerModel.h" + +namespace OHOS +{ + + static MusicPlayerPresenter *g_pMusicPlayerPresenter = nullptr; + + MusicPlayerPresenter::MusicPlayerPresenter() + { + model = &MusicPlayerModel::GetInstance(); + g_pMusicPlayerPresenter = this; + } + + MusicPlayerPresenter::~MusicPlayerPresenter() + { + g_pMusicPlayerPresenter = nullptr; + } + + MusicPlayerPresenter *MusicPlayerPresenter::GetInstance() + { + return g_pMusicPlayerPresenter; + } + + // 启动时执行的逻辑 + void MusicPlayerPresenter::OnStart() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnStart"); + Presenter::OnStart(); + } + + // 页面已经展示后的调用逻辑 + void MusicPlayerPresenter::OnResume(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnResume"); + Presenter::OnResume(); + if (view_ == nullptr) + { + return; + } + } + + // 页面准备切换到后台前执行的逻辑 + void MusicPlayerPresenter::OnPause(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnPause"); + Presenter::OnPause(); + } + + // 页面完全置于后台时的逻辑。 + void MusicPlayerPresenter::OnStop(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnStop"); + Presenter::OnStop(); + } + + bool MusicPlayerPresenter::OnClick(UIView &view, const ClickEvent &event) + { + UNUSED(event); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnClick"); + return true; + } + + bool MusicPlayerPresenter::OnDrag(UIView &view, const DragEvent &event) + { + UNUSED(view); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnDrag"); + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 + { + MusicPlayerPresenter::X_DRAG_FLAG = true; + } + return true; + } + + bool MusicPlayerPresenter::OnDragEnd(UIView &view, const DragEvent &event) + { + UNUSED(view); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnDragEnd"); + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MusicPlayerPresenter::X_DRAG_FLAG) + { + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + MusicPlayerPresenter::X_DRAG_FLAG = false; + } + return true; + } + + bool MusicPlayerPresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件 + { + UNUSED(view); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerPresenter::OnKeyAct"); + uint16_t keyID = event.GetKeyId(); + uint16_t keyState = event.GetState(); + // 如果是power键,且是亮屏状态,按键释放就返回上一级 + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + { + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + } + return true; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerView.cpp b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerView.cpp new file mode 100644 index 000000000..8738d4b93 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerView.cpp @@ -0,0 +1,109 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-05-07 11:25:58 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-02 16:13:00 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/MusicPlayer/src/MusicPlayerView.cpp + */ +#include "musicplayer/include/MusicPlayerPresenter.h" +#include "musicplayer/include/MusicPlayerView.h" +#include "wearable_log.h" + +namespace OHOS +{ + + static MusicPlayerView *g_pMusicPlayerView{nullptr}; + MusicPlayerView::MusicPlayerView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::MusicPlayerView"); + g_pMusicPlayerView = this; + } + + MusicPlayerView::~MusicPlayerView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::~MusicPlayerView"); + g_pMusicPlayerView = nullptr; + } + + MusicPlayerView *MusicPlayerView::GetInstance() + { + return g_pMusicPlayerView; + } + + void MusicPlayerView::ClearAll(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::ClearAll"); + if (viewInitStatus) + { + } + } + + void MusicPlayerView::CreateMusicPlayerView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::CreateMusicPlayerView"); + if (musicPlayerControlView == nullptr) + { + musicPlayerControlView = new MusicPlayerControlView(); + if (musicPlayerControlView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "musicPlayerControlView new fail!!"); + return; + } + } + container_->Add(musicPlayerControlView); + } + + void MusicPlayerView::OnStart() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::OnStart"); + View::OnStart(); + SetContainerView(new UIViewGroup()); + if (GetContainer() == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetContainerView fail!!"); + return; + } + container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + container_->SetOnDragListener(presenter_); + container_->SetTouchable(true); + container_->SetDraggable(true); + + if (!viewInitStatus) + { + CreateMusicPlayerView(); + viewInitStatus = true; + } + + RootView::GetInstance()->SetOnKeyActListener(presenter_); + return; + } + void MusicPlayerView::OnSetUpView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::OnSetUpView"); + View::OnSetUpView(); + Draw(); + return; + } + + void MusicPlayerView::OnTearDownView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::OnTearDownView"); + View::OnTearDownView(); + return; + } + + void MusicPlayerView::OnStop() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerView::OnStop"); + View::OnStop(); + if (container_ != nullptr) + { + container_->RemoveAll(); + delete container_; + container_ = nullptr; + } + RootView::GetInstance()->ClearOnKeyActListener(); + ClearAll(); + return; + } +} \ No newline at end of file diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/userdata/music/music.txt b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/userdata/music/music.txt new file mode 100644 index 000000000..e69de29bb -- 2.17.1