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()
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()
{
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);