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_APP_ABILITY_SLICE_H 17 #define OHOS_APP_ABILITY_SLICE_H 18 19 #include "ability_info.h" 20 #include "ability_loader.h" 21 #include "ability_manager.h" 22 #include "ability_slice.h" 23 #include "bundle_manager.h" 24 #include "components/ui_image_view.h" 25 #include "components/ui_label.h" 26 #include "components/ui_label_button.h" 27 #include "components/ui_list.h" 28 #include "components/ui_scroll_view.h" 29 #include "components/ui_toggle_button.h" 30 #include "element_name.h" 31 #include "event_listener.h" 32 #include "gfx_utils/list.h" 33 #include "module_info.h" 34 #include "setting_utils.h" 35 #include "want.h" 36 #include "securec.h" 37 38 namespace OHOS { 39 class AppAbilitySlice : public AbilitySlice { 40 public: AppAbilitySlice()41 AppAbilitySlice() 42 : headView_(nullptr), scrollView_(nullptr), rootView_(nullptr), pBundleInfos_(nullptr), 43 buttonBackListener_(nullptr), buttonAppInfoListener_(nullptr) {} 44 virtual ~AppAbilitySlice(); 45 protected: 46 void OnStart(const Want& want) override; 47 void OnInactive() override; 48 void OnActive(const Want& want) override; 49 void OnBackground() override; 50 void OnStop() override; 51 52 private: 53 void SetButtonListener(); 54 void SetAppButtonListener(const char* appName); 55 void SetHead(); 56 void SetScrollView(); 57 void SetAnAppInfo(int count, BundleInfo& pBundleInfo); 58 UIViewGroup* headView_; 59 UIScrollView* scrollView_; 60 RootView* rootView_; 61 BundleInfo* pBundleInfos_; 62 EventListener* buttonBackListener_; 63 EventListener* buttonAppInfoListener_; 64 65 constexpr static int APP_IMAGE_X = 12; 66 constexpr static int APP_IMAGE_Y = 12; 67 constexpr static int APP_IMAGE_WIDTH = 64; 68 constexpr static int APP_IMAGE_HEIGHT = 64; 69 constexpr static int APP_NAME_X = 94; 70 constexpr static int APP_NAME_Y = 28; 71 }; 72 } // namespace OHOS 73 #endif 74