|
@@ -1,13 +1,17 @@
|
1
|
1
|
package com.reactnativenavigation.parse;
|
2
|
2
|
|
3
|
3
|
|
|
4
|
+import android.graphics.Typeface;
|
4
|
5
|
import android.support.annotation.ColorInt;
|
|
6
|
+import android.support.annotation.Nullable;
|
|
7
|
+
|
|
8
|
+import com.reactnativenavigation.utils.TypefaceLoader;
|
5
|
9
|
|
6
|
10
|
import org.json.JSONObject;
|
7
|
11
|
|
8
|
12
|
public class TopBarOptions implements DEFAULT_VALUES {
|
9
|
13
|
|
10
|
|
- public static TopBarOptions parse(JSONObject json) {
|
|
14
|
+ public static TopBarOptions parse(TypefaceLoader typefaceManager, JSONObject json) {
|
11
|
15
|
TopBarOptions options = new TopBarOptions();
|
12
|
16
|
if (json == null) return options;
|
13
|
17
|
|
|
@@ -15,7 +19,7 @@ public class TopBarOptions implements DEFAULT_VALUES {
|
15
|
19
|
options.backgroundColor = json.optInt("backgroundColor", NO_COLOR_VALUE);
|
16
|
20
|
options.textColor = json.optInt("textColor", NO_COLOR_VALUE);
|
17
|
21
|
options.textFontSize = (float) json.optDouble("textFontSize", NO_FLOAT_VALUE);
|
18
|
|
- options.textFontFamily = json.optString("textFontFamily", NO_VALUE);
|
|
22
|
+ options.textFontFamily = typefaceManager.getTypeFace(json.optString("textFontFamily", NO_VALUE));
|
19
|
23
|
options.hidden = NavigationOptions.BooleanOptions.parse(json.optString("hidden"));
|
20
|
24
|
options.animateHide = NavigationOptions.BooleanOptions.parse(json.optString("animateHide"));
|
21
|
25
|
|
|
@@ -23,12 +27,10 @@ public class TopBarOptions implements DEFAULT_VALUES {
|
23
|
27
|
}
|
24
|
28
|
|
25
|
29
|
public String title = NO_VALUE;
|
26
|
|
- @ColorInt
|
27
|
|
- public int backgroundColor = NO_COLOR_VALUE;
|
28
|
|
- @ColorInt
|
29
|
|
- public int textColor = NO_COLOR_VALUE;
|
|
30
|
+ @ColorInt public int backgroundColor = NO_COLOR_VALUE;
|
|
31
|
+ @ColorInt public int textColor = NO_COLOR_VALUE;
|
30
|
32
|
public float textFontSize = NO_FLOAT_VALUE;
|
31
|
|
- public String textFontFamily = NO_VALUE;
|
|
33
|
+ @Nullable public Typeface textFontFamily;
|
32
|
34
|
public NavigationOptions.BooleanOptions hidden = NavigationOptions.BooleanOptions.False;
|
33
|
35
|
public NavigationOptions.BooleanOptions animateHide = NavigationOptions.BooleanOptions.False;
|
34
|
36
|
|
|
@@ -40,7 +42,7 @@ public class TopBarOptions implements DEFAULT_VALUES {
|
40
|
42
|
textColor = other.textColor;
|
41
|
43
|
if (other.textFontSize != NO_FLOAT_VALUE)
|
42
|
44
|
textFontSize = other.textFontSize;
|
43
|
|
- if (!NO_VALUE.equals(other.textFontFamily))
|
|
45
|
+ if (other.textFontFamily != null)
|
44
|
46
|
textFontFamily = other.textFontFamily;
|
45
|
47
|
if (other.hidden != NavigationOptions.BooleanOptions.NoValue) {
|
46
|
48
|
hidden = other.hidden;
|
|
@@ -59,7 +61,7 @@ public class TopBarOptions implements DEFAULT_VALUES {
|
59
|
61
|
textColor = defaultOptions.textColor;
|
60
|
62
|
if (textFontSize == NO_FLOAT_VALUE)
|
61
|
63
|
textFontSize = defaultOptions.textFontSize;
|
62
|
|
- if (NO_VALUE.equals(textFontFamily))
|
|
64
|
+ if (textFontFamily == null)
|
63
|
65
|
textFontFamily = defaultOptions.textFontFamily;
|
64
|
66
|
if (hidden == NavigationOptions.BooleanOptions.NoValue)
|
65
|
67
|
hidden = defaultOptions.hidden;
|