• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_V2_PATTERN_LOCK_PATTERN_LOCK_THEME_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_PATTERN_LOCK_PATTERN_LOCK_THEME_H
18 #include "core/components/common/properties/color.h"
19 #include "core/components/theme/theme.h"
20 #include "core/components/theme/theme_constants.h"
21 #include "core/components/theme/theme_constants_defines.h"
22 #include "core/components/theme/theme_manager.h"
23 namespace OHOS::Ace::V2 {
24 class PatternLockTheme : public virtual Theme {
25     DECLARE_ACE_TYPE(PatternLockTheme, Theme);
26 
27 public:
28     class Builder {
29     public:
30         Builder() = default;
31         ~Builder() = default;
Build(const RefPtr<ThemeConstants> & themeConstants)32         RefPtr<PatternLockTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const
33         {
34             RefPtr<PatternLockTheme> theme = AceType::Claim(new PatternLockTheme());
35             if (!themeConstants) {
36                 return theme;
37             }
38             theme->regularColor_ = Color::BLACK;
39             theme->activeColor_ = Color::BLACK;
40             theme->selectedColor_ = Color::BLACK;
41             const int16_t redColor = 77;
42             const int16_t greenColor = 164;
43             const int16_t blueColor = 255;
44             theme->pathColor_ = Color::FromRGB(redColor, greenColor, blueColor);
45             return theme;
46         }
47     };
48     ~PatternLockTheme() override = default;
GetRegularColor()49     const Color& GetRegularColor() const
50     {
51         return regularColor_;
52     }
GetSelectedColor()53     const Color& GetSelectedColor() const
54     {
55         return selectedColor_;
56     }
GetActiveColor()57     const Color& GetActiveColor() const
58     {
59         return activeColor_;
60     }
GetPathColor()61     const Color& GetPathColor() const
62     {
63         return pathColor_;
64     }
65 
66 protected:
67     PatternLockTheme() = default;
68 
69 private:
70     Color regularColor_;
71     Color selectedColor_;
72     Color activeColor_;
73     Color pathColor_;
74 };
75 } // namespace OHOS::Ace::V2
76 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_PATTERN_LOCK_PATTERN_LOCK_THEME_H
77