@@ -65,6 +65,7 @@ public static Config get() {
65
65
private static final String defaultThemeName = "trime" ;
66
66
private String currentSchemaId , currentColorSchemeId ;
67
67
68
+ private Map <String , Object > generalStyle ;
68
69
private Map <String , String > fallbackColors ;
69
70
private Map <String , Map <String , String >> presetColorSchemes ;
70
71
private Map <String , Map <String , Object >> presetKeyboards ;
@@ -163,15 +164,16 @@ public void init(boolean skipDeployment) {
163
164
Objects .requireNonNull (fullThemeConfigMap , "The theme file cannot be empty!" );
164
165
Timber .d ("Fetching done" );
165
166
166
- style = new Style (( Map <String , Object >) fullThemeConfigMap .get ("style" ) );
167
+ generalStyle = ( Map <String , Object >) fullThemeConfigMap .get ("style" );
167
168
fallbackColors = (Map <String , String >) fullThemeConfigMap .get ("fallback_colors" );
168
169
Key .presetKeys = (Map <String , Map <String , Object >>) fullThemeConfigMap .get ("preset_keys" );
169
170
presetColorSchemes =
170
171
(Map <String , Map <String , String >>) fullThemeConfigMap .get ("preset_color_schemes" );
171
172
presetKeyboards =
172
173
(Map <String , Map <String , Object >>) fullThemeConfigMap .get ("preset_keyboards" );
173
174
liquidKeyboard = (Map <String , Object >) fullThemeConfigMap .get ("liquid_keyboard" );
174
- liquid = new Liquid (liquidKeyboard );
175
+ style = new Style (this );
176
+ liquid = new Liquid (this );
175
177
long end = System .currentTimeMillis ();
176
178
Timber .d ("Setting up all theme config map takes %s ms" , end - start );
177
179
initLiquidKeyboard ();
@@ -269,46 +271,46 @@ public static boolean obtainBoolean(Map<String, Object> map, @NonNull String key
269
271
}
270
272
271
273
public static class Style {
272
- private final Map < String , Object > styleConfigMap ;
274
+ private final Config theme ;
273
275
274
- public Style (final Map < String , Object > styleConfigMap ) {
275
- this .styleConfigMap = styleConfigMap ;
276
+ public Style (@ NonNull final Config theme ) {
277
+ this .theme = theme ;
276
278
}
277
279
278
280
public String getString (@ NonNull String key ) {
279
- return obtainString (styleConfigMap , key );
281
+ return obtainString (theme . generalStyle , key );
280
282
}
281
283
282
284
public int getInt (@ NonNull String key ) {
283
- return obtainInt (styleConfigMap , key );
285
+ return obtainInt (theme . generalStyle , key );
284
286
}
285
287
286
288
public float getFloat (@ NonNull String key ) {
287
- return obtainFloat (styleConfigMap , key );
289
+ return obtainFloat (theme . generalStyle , key );
288
290
}
289
291
290
292
public boolean getBoolean (@ NonNull String key ) {
291
- return obtainBoolean (styleConfigMap , key );
293
+ return obtainBoolean (theme . generalStyle , key );
292
294
}
293
295
294
296
public Object getObject (@ NonNull String key ) {
295
- return obtainValue (styleConfigMap , key );
297
+ return obtainValue (theme . generalStyle , key );
296
298
}
297
299
}
298
300
299
301
public static class Liquid {
300
- private final Map < String , Object > liquidConfigMap ;
302
+ private final Config theme ;
301
303
302
- public Liquid (@ NonNull Map < String , Object > liquidConfigMap ) {
303
- this .liquidConfigMap = liquidConfigMap ;
304
+ public Liquid (@ NonNull final Config theme ) {
305
+ this .theme = theme ;
304
306
}
305
307
306
308
public int getInt (@ NonNull String key ) {
307
- return obtainInt (liquidConfigMap , key );
309
+ return obtainInt (theme . liquidKeyboard , key );
308
310
}
309
311
310
312
public float getFloat (@ NonNull String key ) {
311
- return obtainFloat (liquidConfigMap , key , self .style .getFloat (key ));
313
+ return obtainFloat (theme . liquidKeyboard , key , theme .style .getFloat (key ));
312
314
}
313
315
}
314
316
0 commit comments