{
pressFlag = 1; // 短按标志
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnKeyPress: pressFlag = %d", pressFlag);
- #if 0
+ #if 1
uint16_t currentViewId = NativeAbility::GetInstance().GetCurSliceId();
uint16 keyID = event.GetKeyId();
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER))
{
if (longPressFlag == 0 && pressFlag == 1)
{
- HandlePowerKeyPress(currentViewId);
+ // HandlePowerKeyPress(currentViewId);
}
}
// 重置标志
{
if (mcu_pms_is_screen_on())
{
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN,TransitionType::TRANSITION_ZOOM);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN,TransitionType::TRANSITION_INVALID);
}
}
else // 当前页面是主表盘
else
{
if (ApplistModel::GetInstance().GetCurrentStyle() == AppListStyle::WATERFALL_STYLE) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ENTER_WATERFALL);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
} else {
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
}
}
}
{
pressFlag = 1; // 短按标志
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnKeyPress: pressFlag = %d", pressFlag);
- #if 0
+ #if 1
uint16_t currentViewId = NativeAbility::GetInstance().GetCurSliceId();
uint16 keyID = event.GetKeyId();
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER))
{
if (longPressFlag == 0 && pressFlag == 1)
{
- HandlePowerKeyPress(currentViewId);
+ // HandlePowerKeyPress(currentViewId);
}
}
// 重置标志
{
if (mcu_pms_is_screen_on())
{
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN,TransitionType::TRANSITION_ZOOM);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN,TransitionType::TRANSITION_INVALID);
}
}
else // 当前页面是主表盘
else
{
if (ApplistModel::GetInstance().GetCurrentStyle() == AppListStyle::WATERFALL_STYLE) {
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ENTER_WATERFALL);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
} else {
- NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM);
+ NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
}
}
}
return true;
}
+ static const int16 StressTestDestroyMapper[] = {
+ STRESSTESTVIEW,
+ STRESSTESTIDLEVIEW,
+ STRESSTESTRESULTVIEW,
+ STRESSTESTFAILVIEW,
+ };
+
+ void StressTestMainView::DestroyTempView(int16_t hideView)
+ {
+ int viewSize = sizeof(StressTestDestroyMapper) / sizeof(StressTestDestroyMapper[0]);
+ for (int i = 0; i < viewSize; i++)
+ {
+ if (hideView == StressTestDestroyMapper[i])
+ {
+ if (group[hideView] != nullptr)
+ {
+ GetRootContainer()->Remove(group[hideView]);
+ group[hideView] = nullptr;
+ }
+ break;
+ }
+ }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DestroyTempView:%d", hideView);
+ switch (hideView)
+ {
+ case STRESSTESTVIEW:
+ if (stressTestingView != nullptr)
+ {
+ delete stressTestingView;
+ stressTestingView = nullptr;
+ }
+ break;
+ case STRESSTESTIDLEVIEW:
+ if (standbyView != nullptr)
+ {
+ delete standbyView;
+ standbyView = nullptr;
+ }
+ break;
+ case STRESSTESTRESULTVIEW:
+ if (stressTestResultView != nullptr)
+ {
+ delete stressTestResultView;
+ stressTestResultView = nullptr;
+ }
+ break;
+ case STRESSTESTFAILVIEW:
+ if (stressTestFailView != nullptr)
+ {
+ delete stressTestFailView;
+ stressTestFailView = nullptr;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
void StressTestMainView::ChangeView(int16_t hideView, int16_t showView)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestMainView::ChangeView %d, %d", hideView, showView);
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group[%d] is nullptr", showView);
}
- Draw();
StressTestModel::GetInstance().SetCurrentView(showView);
+ DestroyTempView(hideView);
+ Draw();
}
}
\ No newline at end of file
namespace OHOS
{
+ static constexpr int STRESS_TESTING_IMAGE_ANIMATOR_VIEW_X = 103;
+ static constexpr int STRESS_TESTING_IMAGE_ANIMATOR_VIEW_Y = 60;
+ static constexpr int STRESS_TESTING_IMAGE_ANIMATOR_VIEW_W = 260;
+ static constexpr int STRESS_TESTING_IMAGE_ANIMATOR_VIEW_H = 260;
+ static constexpr int STRESS_TESTING_IMAGE_ANIMATOR_DELAY = 75; // 图片更新间隔
+
+ const char *stress_testing_image_path_array[] = {
+ "/user/res/stress/stress_gif/bg1_CS6.bin",
+ "/user/res/stress/stress_gif/bg2_CS6.bin",
+ "/user/res/stress/stress_gif/bg3_CS6.bin",
+ "/user/res/stress/stress_gif/bg4_CS6.bin",
+ "/user/res/stress/stress_gif/bg5_CS6.bin",
+ "/user/res/stress/stress_gif/bg6_CS6.bin",
+ "/user/res/stress/stress_gif/bg7_CS6.bin",
+ "/user/res/stress/stress_gif/bg8_CS6.bin",
+ "/user/res/stress/stress_gif/bg9_CS6.bin",
+ "/user/res/stress/stress_gif/bg10_CS6.bin",
+ "/user/res/stress/stress_gif/bg11_CS6.bin",
+ "/user/res/stress/stress_gif/bg12_CS6.bin",
+ "/user/res/stress/stress_gif/bg13_CS6.bin",
+ "/user/res/stress/stress_gif/bg14_CS6.bin",
+ "/user/res/stress/stress_gif/bg15_CS6.bin",
+ "/user/res/stress/stress_gif/bg16_CS6.bin",
+ "/user/res/stress/stress_gif/bg17_CS6.bin",
+ "/user/res/stress/stress_gif/bg18_CS6.bin",
+ "/user/res/stress/stress_gif/bg19_CS6.bin",
+ "/user/res/stress/stress_gif/bg20_CS6.bin",
+ "/user/res/stress/stress_gif/bg21_CS6.bin",
+ "/user/res/stress/stress_gif/bg22_CS6.bin",
+ "/user/res/stress/stress_gif/bg23_CS6.bin",
+ "/user/res/stress/stress_gif/bg24_CS6.bin",
+ "/user/res/stress/stress_gif/bg25_CS6.bin",
+ "/user/res/stress/stress_gif/bg26_CS6.bin",
+ "/user/res/stress/stress_gif/bg27_CS6.bin",
+ "/user/res/stress/stress_gif/bg28_CS6.bin",
+ "/user/res/stress/stress_gif/bg29_CS6.bin",
+ "/user/res/stress/stress_gif/bg30_CS6.bin",
+ "/user/res/stress/stress_gif/bg31_CS6.bin",
+ "/user/res/stress/stress_gif/bg32_CS6.bin",
+ };
+
StressTestingView::StressTestingView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::StressTestingView");
delete titleLabel;
titleLabel = nullptr;
}
+ if (stressTestingAnimatorView != nullptr)
+ {
+ stressTestingAnimatorView->Stop();
+ delete stressTestingAnimatorView;
+ stressTestingAnimatorView = nullptr;
+ }
if (cancelButton != nullptr)
{
delete cancelButton;
group->SetDraggable(true);
group->SetOnDragListener((UIView::OnDragListener *)OHOS::StressTestPresenter::GetInstance());
}
+ if (stressTestingAnimatorView == nullptr)
+ {
+ stressTestingAnimatorView = new UIImageAnimatorView();
+ if (stressTestingAnimatorView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::CreateStressTestingView new stressTestingAnimatorView fail");
+ return nullptr;
+ }
+
+ for (uint8_t i = 0; i < STRESS_TESTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
+ {
+ stressTestingImageInfo[i].imagePath = stress_testing_image_path_array[i];
+ stressTestingImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ stressTestingImageInfo[i].pos.x = STRESS_TESTING_IMAGE_ANIMATOR_VIEW_X;
+ stressTestingImageInfo[i].pos.y = STRESS_TESTING_IMAGE_ANIMATOR_VIEW_Y;
+ stressTestingImageInfo[i].width = STRESS_TESTING_IMAGE_ANIMATOR_VIEW_W;
+ stressTestingImageInfo[i].height = STRESS_TESTING_IMAGE_ANIMATOR_VIEW_H;
+ }
+ stressTestingAnimatorView->SetPosition(STRESS_TESTING_IMAGE_ANIMATOR_VIEW_X, STRESS_TESTING_IMAGE_ANIMATOR_VIEW_Y);
+ stressTestingAnimatorView->Resize(STRESS_TESTING_IMAGE_ANIMATOR_VIEW_W, STRESS_TESTING_IMAGE_ANIMATOR_VIEW_H);
+ stressTestingAnimatorView->SetImageAnimatorSrc(stressTestingImageInfo, STRESS_TESTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, STRESS_TESTING_IMAGE_ANIMATOR_DELAY);
+ stressTestingAnimatorView->SetRepeat(true);
+ stressTestingAnimatorView->SetAutoEnable(false);
+ stressTestingAnimatorView->SetResizeMode(UIImageView::FILL);
+ stressTestingAnimatorView->Start();
+ group->Add(stressTestingAnimatorView);
+ }
+
if (titleLabel == nullptr)
{
titleLabel = new UILabelExt();
titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
group->Add(titleLabel);
}
+
if (cancelButton == nullptr)
{
cancelButton = new UILabelButtonExt();