!46949 挑单几笔PR到5.0.1Release

Merge pull request !46949 from 189******51/OpenHarmony-5.0.1-Release
This commit is contained in:
openharmony_ci 2024-10-29 01:50:23 +00:00 committed by Gitee
commit c87aad4ce6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 43 additions and 4 deletions

View File

@ -540,7 +540,7 @@ void ViewAbstractModelNG::DismissSheet()
{
auto sheetId = SheetManager::GetInstance().GetDismissSheet();
if (sheetId == -1) {
LOGE("Sheet Dismiss Id Invalid");
TAG_LOGE(AceLogTag::ACE_SHEET, "Sheet Dismiss Id Invalid");
return;
}
auto sheet = FrameNode::GetFrameNode(V2::SHEET_PAGE_TAG, sheetId);
@ -563,7 +563,7 @@ void ViewAbstractModelNG::SheetSpringBack()
{
auto sheetId = SheetManager::GetInstance().GetDismissSheet();
if (sheetId == -1) {
LOGE("Sheet SpringBack Id Invalid");
TAG_LOGE(AceLogTag::ACE_SHEET, "Sheet SpringBack Id Invalid");
return;
}
auto sheet = FrameNode::GetFrameNode(V2::SHEET_PAGE_TAG, sheetId);

View File

@ -22,8 +22,8 @@
#include "core/components_ng/pattern/navrouter/navdestination_layout_property.h"
#include "core/components_ng/pattern/navrouter/navdestination_pattern.h"
#include "core/components_ng/pattern/text/text_layout_property.h"
#include "core/components_ng/pattern/text/text_pattern.h"
#include "core/components_v2/inspector/inspector_constants.h"
#include "core/components_ng/pattern/text/text_pattern.h"
namespace OHOS::Ace::NG {
constexpr double HALF = 0.5;

View File

@ -420,6 +420,7 @@ float SheetPresentationLayoutAlgorithm::GetHeightBySheetStyle() const
} else {
height = sheetStyle_.height->ConvertToPx();
}
maxHeight = SheetInSplitWindow()
? maxHeight : std::max(maxHeight, static_cast<float>(SHEET_BIG_WINDOW_MIN_HEIGHT.ConvertToPx()));
if (LessNotEqual(height, 0.0f)) {

View File

@ -105,7 +105,7 @@ void SideBarContainerPattern::OnAttachToFrameNode()
void SideBarContainerPattern::OnDetachFromFrameNode(FrameNode* frameNode)
{
CHECK_NULL_VOID(frameNode);
auto pipeline = frameNode->GetContext();
auto pipeline = frameNode->GetContextWithCheck();
CHECK_NULL_VOID(pipeline);
pipeline->RemoveWindowSizeChangeCallback(frameNode->GetId());
pipeline->RemoveWindowFocusChangedCallback(frameNode->GetId());
@ -609,6 +609,7 @@ RefPtr<FrameNode> SideBarContainerPattern::CreateControlButton(const RefPtr<Side
buttonLayoutProperty->UpdateType(ButtonType::NORMAL);
auto butttonRadius = sideBarTheme->GetControlButtonRadius();
buttonLayoutProperty->UpdateBorderRadius(BorderRadiusProperty(butttonRadius));
buttonLayoutProperty->UpdateCreateWithLabel(false);
auto buttonRenderContext = buttonNode->GetRenderContext();
CHECK_NULL_RETURN(buttonRenderContext, nullptr);
buttonRenderContext->UpdateBackgroundColor(Color::TRANSPARENT);
@ -653,6 +654,7 @@ RefPtr<FrameNode> SideBarContainerPattern::CreateControlImage(
GetControlImageSize(imageWidth, imageHeight);
CalcSize imageCalcSize((CalcLength(imageWidth)), CalcLength(imageHeight));
imageLayoutProperty->UpdateUserDefinedIdealSize(imageCalcSize);
InitImageErrorCallback(sideBarTheme, imgNode);
return imgNode;
}
@ -1392,4 +1394,34 @@ void SideBarContainerPattern::SetAccessibilityEvent()
// use TEXT_CHANGE event to report information update
controlButton->OnAccessibilityEvent(AccessibilityEventType::TEXT_CHANGE, "", "");
}
void SideBarContainerPattern::InitImageErrorCallback(const RefPtr<SideBarTheme>& sideBarTheme,
const RefPtr<FrameNode>& imgNode)
{
auto eventHub = imgNode->GetEventHub<ImageEventHub>();
CHECK_NULL_VOID(eventHub);
auto errorCallback = [weakPattern = WeakClaim(this), weakNode = WeakClaim(RawPtr(imgNode)),
weakTheme = WeakClaim(RawPtr(sideBarTheme))] (const LoadImageFailEvent& info) {
auto imgNode = weakNode.Upgrade();
CHECK_NULL_VOID(imgNode);
auto imageLayoutProperty = imgNode->GetLayoutProperty<ImageLayoutProperty>();
CHECK_NULL_VOID(imageLayoutProperty);
auto imageSourceInfo = imageLayoutProperty->GetImageSourceInfo();
if (!imageSourceInfo.has_value()) {
return;
}
auto infoValue = imageSourceInfo.value();
infoValue.SetResourceId(InternalResource::ResourceId::SIDE_BAR);
auto sideBarTheme = weakTheme.Upgrade();
CHECK_NULL_VOID(sideBarTheme);
auto controlButtonColor = sideBarTheme->GetControlImageColor();
infoValue.SetFillColor(controlButtonColor);
imageLayoutProperty->UpdateImageSourceInfo(infoValue);
auto pattern = weakPattern.Upgrade();
CHECK_NULL_VOID(pattern);
pattern->SetImageInfo(infoValue);
imgNode->MarkModifyDone();
};
eventHub->SetOnError(errorCallback);
}
} // namespace OHOS::Ace::NG

View File

@ -156,6 +156,11 @@ public:
return showSideBar_;
}
void SetImageInfo(ImageSourceInfo imageInfo)
{
imageInfo_ = imageInfo;
}
private:
void WindowFocus(bool isFocus);
bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override;
@ -205,6 +210,7 @@ private:
void OnWindowSizeChanged(int32_t width, int32_t height, WindowSizeChangeReason type) override;
void RegisterElementInfoCallBack(const RefPtr<FrameNode>& buttonNode);
void SetAccessibilityEvent();
void InitImageErrorCallback(const RefPtr<SideBarTheme>& sideBarTheme, const RefPtr<FrameNode>& imgNode);
RefPtr<InputEvent> hoverEvent_;
RefPtr<InputEvent> dividerMouseEvent_;