1 /*
2  * Copyright (c) 2020 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 #ifndef OHOS_ACELITE_PANEL_VIEW_H
16 #define OHOS_ACELITE_PANEL_VIEW_H
17 
18 #include "acelite_config.h"
19 #if (FEATURE_COMPONENT_VIDEO == 1)
20 
21 #include "ace_log.h"
22 #include "flex_layout.h"
23 #include "js_fwk_common.h"
24 #include "memory_heap.h"
25 #include "non_copyable.h"
26 #include "ui_image_view.h"
27 #include "ui_label.h"
28 #include "ui_slider.h"
29 #include "video_panel_image_res.h"
30 
31 namespace OHOS {
32 namespace ACELite {
33 class PanelView : public FlexLayout, public MemoryHeap {
34 public:
35     ACE_DISALLOW_COPY_AND_MOVE(PanelView);
36     PanelView();
37     ~PanelView();
38 
39     const UILabel* GetCurTimeText() const;
40 
41     const UILabel* GetVideoTotalTimeText() const;
42 
43     const UISlider* GetVideoSlider() const;
44 
45     const UIImageView* GetVideoPlayImage() const;
46 
47     const UIImageView* GetVideoMutedImage() const;
48 
49     bool InitView();
50 
51     void SetVideoSlider();
52 
53     void SetTextInPanel(UILabel* label);
54 
55     void SetImageInPanel(UIImageView* image, int16_t imageWidth, int16_t imageHeight, const ImageInfo* imageSrc);
56 
57     static const char * const DEFAULT_PLAY_TIME;
58     static const uint16_t DEFAULT_VOLUME_VALUE;
59     static const uint16_t DEFAULT_PANEL_HEIGHT;
60     static const uint8_t SECONDS_PER_MINUTE;
61     static const uint16_t MILLIONS_PER_SECOND;
62     static const uint16_t SECONDS_PER_HOUR;
63     static const uint8_t MAX_HOURS;
64     static const uint16_t THOUSAND_MILLISECOND;
65     static const int64_t MAX_SHOW_TIME;
66     static const uint16_t UPDATE_CYCLE;
67     static const uint32_t UPDATE_CYCLE_MICRO_SECONDS;
68 private:
69     UILabel* curTimeLabel_;
70     UIImageView* playImage_;
71     UISlider* videoSlider_;
72     UILabel* totalTimeLabel_;
73     UIImageView* mutedImage_;
74 };
75 } // namespace ACELite
76 } // namespace OHOS
77 
78 #endif // FEATURE_COMPONENT_VIDEO
79 #endif // OHOS_ACELITE_PANEL_VIEW_H
80