• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #ifndef UPDATER_UI_BOX_PROGRESS_ADAPTER_H
17 #define UPDATER_UI_BOX_PROGRESS_ADAPTER_H
18 
19 #include "components/ui_box_progress.h"
20 #include "img_view_adapter.h"
21 #include "page/view_proxy.h"
22 #include "view_api.h"
23 
24 namespace Updater {
25 class BoxProgressAdapter : public OHOS::UIBoxProgress {
26     static constexpr uint32_t MAX_PROGRESS_VALUE = 100;
27     DISALLOW_COPY_MOVE(BoxProgressAdapter);
28 public:
29     using SpecificInfoType = UxBoxProgressInfo;
30     BoxProgressAdapter() = default;
31     explicit BoxProgressAdapter(const UxViewInfo &info);
~BoxProgressAdapter()32     virtual ~BoxProgressAdapter() {}
33     void SetValue(float value);
34     void SetVisible(bool isVisible);
35     [[nodiscard]] bool InitEp();
36     static bool IsValid(const UxBoxProgressInfo &info);
37 private:
38     OHOS::Point GetPosOfEp();
39     std::string viewId_ = {};
40     std::string epId_ = {};
41     bool hasEp_ = false;
42     ImgViewAdapter *ep_ = {};
43 };
44 } // namespace Updater
45 #endif // UPDATER_UI_PROGRESS_BAR_H
46