• 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 package ohos;
17 
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 
22 /**
23  * Ability form info.
24  *
25  */
26 public class AbilityFormInfo {
27 
28     /**
29      * Module window info.
30      *
31      */
32     public static class ModuleWindowInfo {
33         /**
34          * Indicates the designWidth of ModuleUsedScene.
35          */
36         public int designWidth = 0;
37         /**
38          * Indicates the autoDesignWidth of ModuleUsedScene.
39          */
40         public boolean autoDesignWidth = false;
41     }
42 
43     /**
44      * Indicates the name of ability form.
45      */
46     public String name = "";
47 
48     /**
49      * Indicates the type of ability form.
50      */
51     public String type = "";
52 
53     /**
54      * Indicates whether or not this form is allowed to update periodically.
55      */
56     public boolean updateEnabled = false;
57 
58     /**
59      * Indicates the scheduledUpdateTime of ability form.
60      */
61     public String scheduledUpdateTime = "";
62 
63     /**
64      * Indicates the update duration, unit: 30 mins.
65      */
66     public int updateDuration = 1;
67 
68     /**
69      * Indicates the supportDimensions of ability form.
70      */
71     public List<String> supportDimensions = new ArrayList<String>();
72 
73     /**
74      * Indicates the defaultDimension of ability form.
75      */
76     public String defaultDimension = "";
77 
78     /**
79      * Indicates the metaData of ability form.
80      */
81     public MetaData metaData = new MetaData();
82 
83     // stage module attributes
84     /**
85      * Indicates the description of ability form.
86      */
87     public String description = "";
88 
89     /**
90      * Indicates the src of ability form the attribute is corresponding to the UI code of the form.
91      */
92     public String src = "";
93 
94     /**
95      * Indicates the window of ability form.
96      */
97     public ModuleWindowInfo windowInfo = new ModuleWindowInfo();
98 
99     /**
100      * Indicates the isDefault of ability form.
101      */
102     public boolean isDefault = false;
103 
104     /**
105      * Indicates the colorMode of ability form.
106      */
107     public String colorMode = "auto";
108 
109     /**
110      * Indicates the formConfigAbility of ability form, it is the ability name for card.
111      */
112     public String formConfigAbility = "";
113 
114     /**
115      * Indicates the formVisibleNotify of ability form.
116      */
117     public boolean formVisibleNotify = false;
118 
119     /**
120      * Indicates the providerAbility of ability form.
121      */
122     public String providerAbility = "";
123 
124     /**
125      * Indicates the descriptions of ability form,for Multilingual.
126      */
127     private HashMap<String, String> descriptions = new HashMap<>();
128 
getDescriptions()129     public HashMap<String, String> getDescriptions() {
130         return descriptions;
131     }
132 
133     /**
134      * get the customize Data value defined in this ability form.
135      */
getCustomizeDataValue(String customizeDataName)136     public String getCustomizeDataValue(String customizeDataName) {
137         for (CustomizeData data : metaData.customizeDatas) {
138             if (customizeDataName.equals(data.name)) {
139                 return data.value;
140             }
141         }
142         return "";
143     }
144 
setDescriptions(HashMap<String, String> descriptions)145     public void setDescriptions(HashMap<String, String> descriptions) {
146         this.descriptions = descriptions;
147     }
148 }