From: 罗正yun <1732036298@qq.com> Date: Wed, 20 Dec 2023 08:32:41 +0000 (+0800) Subject: 提醒视图中:解绑设备gif设置 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=465effb72541911cd1a48fd5d3734dfa815582e5;p=mirrors%2FFD230.git 提醒视图中:解绑设备gif设置 --- diff --git a/code/sdk/application/wearable/nativeapp/nativeui/remind/include/RemindView3.h b/code/sdk/application/wearable/nativeapp/nativeui/remind/include/RemindView3.h index 31e5bbb5a..cd746cf6b 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/remind/include/RemindView3.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/remind/include/RemindView3.h @@ -7,6 +7,7 @@ #include "components/ui_label.h" #include "components/ui_image_animator.h" #include "components/ui_button.h" +#include "traing/include/TraingWinView.h" namespace OHOS { class RemindView3 @@ -23,6 +24,8 @@ namespace OHOS private: UIScrollView *scrollView1_ = nullptr; UIImageAnimatorView *UnBindImageAnimator = nullptr; //解绑的图标动画 + const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages); + TraingWinView *p_TraingWinView{nullptr}; UILabel *label11_ = nullptr; UILabel *label2_ = nullptr; UILabel *label1_ = nullptr; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/remind/src/MainRemindView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/remind/src/MainRemindView.cpp index 04f848dcb..b02028fc3 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/remind/src/MainRemindView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/remind/src/MainRemindView.cpp @@ -222,7 +222,7 @@ namespace OHOS { InitView(); viewInitStatus = true; - ChangeView(0, 5); + ChangeView(0, 3); } } void MainRemindView::OnStart() diff --git a/code/sdk/application/wearable/nativeapp/nativeui/remind/src/RemindView3.cpp b/code/sdk/application/wearable/nativeapp/nativeui/remind/src/RemindView3.cpp index 04357abc6..74b6e64e4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/remind/src/RemindView3.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/remind/src/RemindView3.cpp @@ -3,12 +3,6 @@ namespace OHOS { - - static ImageAnimatorInfo g_imageAnimator1Info[2] = { - {"/user/res/1.bin", {193, 112}, 80, 80, IMG_SRC_FILE_PATH}, - {"/user/res/15.bin", {193, 112}, 80, 80, IMG_SRC_FILE_PATH},//图片桢有52å¼  - }; - /* -------------------------------------------------------------------------- */ static RemindView3 *g_pRemindView2{nullptr}; RemindView3::RemindView3() @@ -31,6 +25,25 @@ namespace OHOS return g_pRemindView2; } + /** + * 创建包含图片文件路径的数组 + * @param basePath 包含图片文件的基本路径 + * @param fileExtension 图片文件的扩展名 + * @param numImages 图片文件的数量 + * @return 返回包含图片文件路径的数组 + */ + const char **RemindView3::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages) + { + const char **imagePaths = new const char *[numImages]; + char buffer[256]; + for (int i = 0; i < numImages; i++) + { + snprintf(buffer, sizeof(buffer), "%s/%d.%s", basePath, i + 1, fileExtension); + imagePaths[i] = strdup(buffer); + } + return imagePaths; + } + // 提醒视图3:进行设备解绑时弹出该视图 UIScrollView *RemindView3::InitRemindView3() { @@ -64,24 +77,15 @@ namespace OHOS scrollView1_->Add(label11_); label11_->SetVisible(true); /* -------------------------------------------------------------------------- */ - // Add ImageAnimatorView to App - if (UnBindImageAnimator == nullptr) + if (p_TraingWinView == nullptr) { - UnBindImageAnimator = new UIImageAnimatorView(); + p_TraingWinView = new TraingWinView(); } - UnBindImageAnimator->SetPosition(193, 112); - UnBindImageAnimator->Resize(80, 80); - UnBindImageAnimator->SetViewId("imageAnimator1"); - UnBindImageAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0x00); - UnBindImageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - - // Set additional property - UnBindImageAnimator->SetImageAnimatorSrc(g_imageAnimator1Info, 2, 200); - UnBindImageAnimator->SetTimeOfPause(200); - UnBindImageAnimator->SetRepeatTimes(1); - UnBindImageAnimator->SetReverse(true); + /* -------------------------------------------------------------------------- */ + const char **imagePaths = CreateImagePathsArray("/user/res/remind/unbind/","bin",52); + p_TraingWinView->InitImageAnimatorSource(UnBindImageAnimator, imagePaths,52,193,118,80,80,"imageAnimator1",50); UnBindImageAnimator->Start(); - + /* -------------------------------------------------------------------------- */ // Add to scrollView1 scrollView1_->Add(UnBindImageAnimator); UnBindImageAnimator->SetVisible(true);