From: luozheng <1732036298@qq.com> Date: Sat, 15 Jun 2024 02:26:32 +0000 (+0800) Subject: 显示方式视图修改 X-Git-Tag: release_V1.2.70_20241020_135402~999 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.js?a=commitdiff_plain;h=10b21751285665d0f36195f93423bced34a3f826;p=mirrors%2FFD230.git 显示方式视图修改 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp index 3771bf5ea..9f3952bce 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-08 16:43:48 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-14 19:39:03 + * @LastEditTime: 2024-06-15 10:07:09 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThemeStylePresenter.cpp */ @@ -58,35 +58,39 @@ namespace OHOS { UNUSED(event); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStylePresenter::OnClick"); - UILabelButtonExt *LabelButtonExt = dynamic_cast(&view); - std::string viewId = LabelButtonExt->GetViewId(); + + UILabelButtonExt *labelButtonExt = dynamic_cast(&view); + if (!labelButtonExt) + { + // 处理无法将 view 转换为 UILabelButtonExt 的情况 + return false; + } + + std::string viewId = labelButtonExt->GetViewId(); if (viewId == THEMESTYLEVIEWEXIT) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); return true; } + + if (viewId == THEME_STYLE_LIST) + { + ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::APPLIST_STYLE); + } + else if (viewId == THEME_STYLE_HEXAGONS) + { + ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::HEXAGONS_STYLE); + } + + uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + if (preSlice == VIEW_APPLIST) + { + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + } else { - if (viewId == THEME_STYLE_LIST) - { - ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::APPLIST_STYLE); - } - else if (viewId == THEME_STYLE_HEXAGONS) - { - ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::HEXAGONS_STYLE); - } - // LabelButtonExt->SetImageSrc(PNG_CHECKBOX_ON_IMAGE, PNG_CHECKBOX_ON_IMAGE); - // LabelButtonExt->Invalidate(); - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - if (preSlice == VIEW_APPLIST) - { - NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); - } - else - { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); - NativeAbility::GetInstance().ClearSliceIdStack(); - } + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + NativeAbility::GetInstance().ClearSliceIdStack(); } return true;