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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_REFRESH_MODEL_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_REFRESH_MODEL_H 18 19 #include <string> 20 21 #include "frameworks/base/geometry/dimension.h" 22 #include "frameworks/base/utils/macros.h" 23 #include "frameworks/core/components/common/properties/color.h" 24 #include "frameworks/core/components_ng/pattern/refresh/refresh_pattern.h" 25 26 namespace OHOS::Ace { 27 28 class ACE_EXPORT RefreshModel { 29 public: 30 static RefreshModel* GetInstance(); 31 virtual ~RefreshModel() = default; 32 33 virtual void Create() = 0; 34 virtual void Pop() = 0; 35 virtual void SetRefreshing(bool isRefreshing) = 0; 36 virtual void SetRefreshDistance(const Dimension& refreshDistance) = 0; 37 virtual void SetUseOffset(bool isUseOffset) = 0; 38 virtual void SetIndicatorOffset(const Dimension& indicatorOffset) = 0; 39 virtual void SetFriction(int32_t friction) = 0; 40 virtual void IsRefresh(bool isRefresh) = 0; 41 42 virtual void SetLoadingDistance(const Dimension& loadingDistance) = 0; 43 virtual void SetProgressDistance(const Dimension& progressDistance) = 0; 44 virtual void SetProgressDiameter(const Dimension& progressDiameter) = 0; 45 virtual void SetMaxDistance(const Dimension& maxDistance) = 0; 46 virtual void SetIsShowLastTime(bool IsShowLastTime) = 0; 47 virtual void SetShowTimeDistance(const Dimension& showTimeDistance) = 0; 48 49 virtual void SetTextStyle(const TextStyle& textStyle) = 0; 50 virtual void SetProgressColor(const Color& progressColor) = 0; 51 virtual void SetProgressBackgroundColor(const Color& backgroundColor) = 0; 52 virtual void SetOnStateChange(std::function<void(const int32_t)>&& stateChange) = 0; 53 virtual void SetOnRefreshing(std::function<void()>&& refreshing) = 0; 54 virtual void SetChangeEvent(std::function<void(const std::string)>&& changeEvent) = 0; 55 private: 56 static std::unique_ptr<RefreshModel> instance_; 57 }; 58 } // namespace OHOS::Ace 59 60 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_REFRESH_MODEL_H