static constexpr int16_t AIVOICE_CONNECTING_IMAGE_ANIMATOR_DELAY = 50; // 图片更新间隔
static constexpr const char *AIVoiceListeningImagePaths = "/user/res/connect/";
+ const char *connecting_path_array[] = {
+ "/user/res/connect/1.bin",
+ "/user/res/connect/2.bin",
+ "/user/res/connect/3.bin",
+ "/user/res/connect/4.bin",
+ "/user/res/connect/5.bin",
+ "/user/res/connect/6.bin",
+ "/user/res/connect/7.bin",
+ "/user/res/connect/8.bin",
+ "/user/res/connect/9.bin",
+ "/user/res/connect/10.bin",
+ "/user/res/connect/11.bin",
+ "/user/res/connect/12.bin",
+ "/user/res/connect/13.bin",
+ "/user/res/connect/14.bin",
+ "/user/res/connect/15.bin",
+ "/user/res/connect/16.bin",
+ "/user/res/connect/17.bin",
+ "/user/res/connect/18.bin",
+ "/user/res/connect/19.bin",
+ "/user/res/connect/20.bin",
+ "/user/res/connect/21.bin",
+ "/user/res/connect/22.bin",
+ "/user/res/connect/23.bin",
+ "/user/res/connect/24.bin",
+ "/user/res/connect/25.bin",
+ "/user/res/connect/26.bin",
+ "/user/res/connect/27.bin",
+ "/user/res/connect/28.bin",
+ "/user/res/connect/29.bin",
+ "/user/res/connect/30.bin",
+ "/user/res/connect/31.bin",
+ "/user/res/connect/32.bin",
+ "/user/res/connect/33.bin",
+ "/user/res/connect/34.bin",
+ "/user/res/connect/35.bin",
+ "/user/res/connect/36.bin",
+ "/user/res/connect/37.bin",
+ "/user/res/connect/38.bin",
+ "/user/res/connect/39.bin",
+ "/user/res/connect/40.bin",
+ "/user/res/connect/41.bin",
+ "/user/res/connect/42.bin",
+ "/user/res/connect/43.bin",
+ "/user/res/connect/44.bin",
+ "/user/res/connect/45.bin",
+ "/user/res/connect/46.bin",
+ "/user/res/connect/47.bin",
+ "/user/res/connect/48.bin",
+ "/user/res/connect/49.bin",
+ "/user/res/connect/50.bin",
+ "/user/res/connect/51.bin",
+ "/user/res/connect/52.bin",
+ "/user/res/connect/53.bin",
+ "/user/res/connect/54.bin",
+ "/user/res/connect/55.bin",
+ "/user/res/connect/56.bin",
+ "/user/res/connect/57.bin",
+ "/user/res/connect/58.bin",
+ "/user/res/connect/59.bin",
+ "/user/res/connect/60.bin",
+ };
+
static AiVoiceConnectingView *g_pAiVoiceConnecting{nullptr};
AiVoiceConnectingView::AiVoiceConnectingView()
{
connectingAnimatorView->Stop();
delete connectingAnimatorView;
connectingAnimatorView = nullptr;
- FreeImageInfoArray(connectingPathsArray, AIVoiceListeningImagePaths, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+ for (int i = 0; i < AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+ {
+ ImageCacheManager::GetInstance().UnloadSingleRes(connecting_path_array[i]);
+ }
}
if (cancelLabel)
{
bool AiVoiceConnectingView::CreateAivoiceConnectingImageAnimator(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::CreateAivoiceConnectingImageAnimator");
- if (connectingPathsArray == nullptr)
- {
- connectingPathsArray = CreateImageInfoArray(AIVoiceListeningImagePaths, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
- if (connectingPathsArray == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::connectingPathsArray is nullptr!!");
- return false;
- }
- }
-
- ImageAnimatorConfig imageanimatorconfig = {
- .x = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_X,
- .y = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_Y,
- .width = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_W,
- .height = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_H,
- .imageInfoArray = connectingImageInfo,
- .pathsArray = connectingPathsArray,
- .numFrames = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES,
- .delay = AIVOICE_CONNECTING_IMAGE_ANIMATOR_DELAY,
- };
if (connectingAnimatorView == nullptr)
{
- connectingAnimatorView = connectingImageAnimatorInit(imageanimatorconfig);
+ connectingAnimatorView = new UIImageAnimatorView();
if (connectingAnimatorView == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::connectingAnimatorView new fail");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::CreateAivoiceConnectingImageAnimator new connectingAnimatorView fail");
return false;
}
}
+ for (uint8_t i = 0; i < AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+ {
+ connectingImageInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(connecting_path_array[i]);
+ connectingImageInfo[i].imageType = IMG_SRC_IMAGE_INFO;
+ connectingImageInfo[i].pos.x = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_X;
+ connectingImageInfo[i].pos.y = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_Y;
+ connectingImageInfo[i].width = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_W;
+ connectingImageInfo[i].height = AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_H;
+ }
+ connectingAnimatorView->SetPosition(AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_X, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_Y,
+ AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_W, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_H);
+ connectingAnimatorView->SetImageAnimatorSrc(connectingImageInfo, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, AIVOICE_CONNECTING_IMAGE_ANIMATOR_DELAY);
+ connectingAnimatorView->SetRepeat(true);
+ connectingAnimatorView->SetAutoEnable(false);
+ connectingAnimatorView->SetResizeMode(UIImageView::FILL);
+ scrollView->Add(connectingAnimatorView);
+ connectingAnimatorView->Start();
return true;
}