• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef OHOS_MAIN_ABILITY_SLICE_H
17 #define OHOS_MAIN_ABILITY_SLICE_H
18 
19 #include <cstdio>
20 
21 #include "ability_info.h"
22 #include "ability_loader.h"
23 #include "ability_manager.h"
24 #include "ability_slice.h"
25 #include "bundle_manager.h"
26 #include "components/ui_image_view.h"
27 #include "components/ui_label.h"
28 #include "components/ui_label_button.h"
29 #include "components/ui_list.h"
30 #include "components/ui_scroll_view.h"
31 #include "components/ui_toggle_button.h"
32 #include "element_name.h"
33 #include "event_listener.h"
34 #include "gfx_utils/list.h"
35 #include "module_info.h"
36 #include "parameter.h"
37 #include "pthread.h"
38 #include "setting_utils.h"
39 #include "want.h"
40 #include "wpa_work.h"
41 
42 namespace OHOS {
43 class MainAbilitySlice : public AbilitySlice {
44 public:
MainAbilitySlice()45     MainAbilitySlice()
46         : headView_(nullptr), scrollView_(nullptr), rootView_(nullptr), lablelFontSsid_(nullptr),
47           buttonWifiListener_(nullptr), buttonAppListener_(nullptr), buttonDisplayListener_(nullptr),
48           buttonAboutListener_(nullptr), buttonBackListener_(nullptr) {}
49     virtual ~MainAbilitySlice();
50 
51 protected:
52     void OnStart(const Want &want) override;
53     void OnInactive() override;
54     void OnActive(const Want &want) override;
55     void OnBackground() override;
56     void OnStop() override;
57 
58 private:
59     void SetButtonListenerWifi();
60     void SetButtonListenerApp();
61     void SetButtonListenerDisplay();
62     void SetButtonListenerAbout();
63     void SetAboutButtonView();
64     void SetAppButtonView();
65     void SetDisplayButtonView();
66     void SetWifiButtonView();
67     void SetScrollView();
68     void SetHead();
69 
70     UIViewGroup* headView_;
71     UIScrollView* scrollView_;
72     RootView* rootView_;
73     UILabel* lablelFontSsid_;
74     EventListener* buttonWifiListener_;
75     EventListener* buttonAppListener_;
76     EventListener* buttonDisplayListener_;
77     EventListener* buttonAboutListener_;
78     EventListener* buttonBackListener_;
79 
80     constexpr static int WIFI_BUTTON_X = 0;
81     constexpr static int WIFI_BUTTON_Y = 0;
82     constexpr static int WIFI_BUTTON_TEXT_WIFI_Y = 13;
83     constexpr static int WIFI_BUTTON_TEXT_SSID_X = 18;
84     constexpr static int WIFI_BUTTON_TEXT_SSID_Y = 45;
85 
86     constexpr static int APP_BUTTON_X = 0;
87     constexpr static int APP_BUTTON_Y = 95;
88 
89     constexpr static int DISPALY_BUTTON_X = 0;
90     constexpr static int DISPALY_BUTTON_Y = 190;
91 
92     constexpr static int ABOUT_BUTTON_X = 0;
93     constexpr static int ABOUT_BUTTON_Y = 190;
94     constexpr static int ABOUT_BUTTON_HEIGHT = 113;
95     constexpr static int ABOUT_BUTTON_TEXT_ABOUT_Y = 5;
96     constexpr static int ABOUT_BUTTON_TEXT_SYSTEM_X = 18;
97     constexpr static int ABOUT_BUTTON_TEXT_SYSTEM_Y = 39;
98     constexpr static int ABOUT_BUTTON_TEXT_DEVICE_X = 18;
99     constexpr static int ABOUT_BUTTON_TEXT_DEVICE_Y = 72;
100     constexpr static int ABOUT_BUTTON_IMAGE_Y = 34;
101 };
102 }
103 
104 #endif // OHOS_MAIN_ABILITY_SLICE_H
105