• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ui/base/agingadapation/aging_adapation_dialog_util.h"
17 
18 #include "core/common/agingadapation/aging_adapation_dialog_util.h"
19 #include "interfaces/inner_api/ace_kit/src/view/frame_node_impl.h"
20 #include "ui/base/utils/utils.h"
21 
22 namespace OHOS::Ace::Kit {
23 
ShowLongPressDialog(const std::string & message,const int32_t iconNodeId,const IconNodeType type)24 RefPtr<FrameNode> AgingAdapationDialogUtil::ShowLongPressDialog(
25     const std::string& message, const int32_t iconNodeId, const IconNodeType type)
26 {
27     auto uiNode = ElementRegister::GetInstance()->GetUINodeById(iconNodeId);
28     CHECK_NULL_RETURN(uiNode, nullptr);
29     auto frameNode = AceType::DynamicCast<NG::FrameNode>(uiNode);
30     CHECK_NULL_RETURN(frameNode, nullptr);
31     RefPtr<AceNode> dialogNode = nullptr;
32     switch (type) {
33         case IconNodeType::SYMBOL:
34             dialogNode = OHOS::Ace::NG::AgingAdapationDialogUtil::ShowLongPressDialog(message, frameNode);
35             break;
36         case IconNodeType::IMAGE:
37             {
38                 auto imageProperty = frameNode->GetLayoutProperty<NG::ImageLayoutProperty>();
39                 CHECK_NULL_RETURN(imageProperty, nullptr);
40                 ImageSourceInfo sourceInfo = imageProperty->GetImageSourceInfoValue();
41                 dialogNode = OHOS::Ace::NG::AgingAdapationDialogUtil::ShowLongPressDialog(message, sourceInfo);
42                 break;
43             }
44         default:
45             break;
46     }
47     CHECK_NULL_RETURN(dialogNode, nullptr);
48     RefPtr<FrameNode> node = AceType::MakeRefPtr<FrameNodeImpl>(dialogNode);
49     return node;
50 }
51 
GetDialogBigFontSizeScale()52 float AgingAdapationDialogUtil::GetDialogBigFontSizeScale()
53 {
54     return OHOS::Ace::NG::AgingAdapationDialogUtil::GetDialogBigFontSizeScale();
55 }
56 
GetDialogLargeFontSizeScale()57 float AgingAdapationDialogUtil::GetDialogLargeFontSizeScale()
58 {
59     return OHOS::Ace::NG::AgingAdapationDialogUtil::GetDialogLargeFontSizeScale();
60 }
61 
GetDialogMaxFontSizeScale()62 float AgingAdapationDialogUtil::GetDialogMaxFontSizeScale()
63 {
64     return OHOS::Ace::NG::AgingAdapationDialogUtil::GetDialogMaxFontSizeScale();
65 }
66 } // OHOS::Ace::Kit