|
@@ -4,16 +4,12 @@ import android.os.Bundle;
|
4
|
4
|
import android.support.annotation.NonNull;
|
5
|
5
|
import android.support.annotation.Nullable;
|
6
|
6
|
|
|
7
|
+import com.reactnativenavigation.params.AppStyle;
|
7
|
8
|
import com.reactnativenavigation.params.StyleParams;
|
8
|
9
|
|
9
|
10
|
public class StyleParamsParser {
|
10
|
|
- private static StyleParams appStyle;
|
11
|
11
|
private Bundle params;
|
12
|
12
|
|
13
|
|
- public static void setAppStyle(Bundle params) {
|
14
|
|
- StyleParamsParser.appStyle = new StyleParamsParser(params.getBundle("appStyle")).parse();
|
15
|
|
- }
|
16
|
|
-
|
17
|
13
|
public StyleParamsParser(Bundle params) {
|
18
|
14
|
this.params = params;
|
19
|
15
|
}
|
|
@@ -50,66 +46,66 @@ public class StyleParamsParser {
|
50
|
46
|
|
51
|
47
|
@Nullable
|
52
|
48
|
private StyleParams.Color getDefaultNavigationColor() {
|
53
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.navigationBarColor;
|
|
49
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.navigationBarColor;
|
54
|
50
|
}
|
55
|
51
|
|
56
|
52
|
@Nullable
|
57
|
53
|
private StyleParams.Color getDefaultSelectedBottomTabsButtonColor() {
|
58
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.selectedBottomTabsButtonColor;
|
|
54
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.selectedBottomTabsButtonColor;
|
59
|
55
|
}
|
60
|
56
|
|
61
|
57
|
@Nullable
|
62
|
58
|
private StyleParams.Color getDefaultBottomTabsButtonColor() {
|
63
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.bottomTabsButtonColor;
|
|
59
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsButtonColor;
|
64
|
60
|
}
|
65
|
61
|
|
66
|
62
|
@Nullable
|
67
|
63
|
private StyleParams.Color getDefaultBottomTabsColor() {
|
68
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.bottomTabsColor;
|
|
64
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.bottomTabsColor;
|
69
|
65
|
}
|
70
|
66
|
|
71
|
67
|
private boolean isDefaultBottomTabsHiddenOnScroll() {
|
72
|
|
- return appStyle != null && appStyle.bottomTabsHiddenOnScroll;
|
|
68
|
+ return AppStyle.appStyle != null && AppStyle.appStyle.bottomTabsHiddenOnScroll;
|
73
|
69
|
}
|
74
|
70
|
|
75
|
71
|
private boolean isDefaultBottomTabsHidden() {
|
76
|
|
- return appStyle != null && appStyle.bottomTabsHidden;
|
|
72
|
+ return AppStyle.appStyle != null && AppStyle.appStyle.bottomTabsHidden;
|
77
|
73
|
}
|
78
|
74
|
|
79
|
75
|
private boolean isDefaultScreenBelowTopBar() {
|
80
|
|
- return appStyle == null || appStyle.drawScreenBelowTopBar;
|
|
76
|
+ return AppStyle.appStyle == null || AppStyle.appStyle.drawScreenBelowTopBar;
|
81
|
77
|
}
|
82
|
78
|
|
83
|
79
|
private boolean isDefaultTopTabsHidden() {
|
84
|
|
- return appStyle != null && appStyle.topTabsHidden;
|
|
80
|
+ return AppStyle.appStyle != null && AppStyle.appStyle.topTabsHidden;
|
85
|
81
|
}
|
86
|
82
|
|
87
|
83
|
private boolean isDefaultBackButtonHidden() {
|
88
|
|
- return appStyle != null && appStyle.backButtonHidden;
|
|
84
|
+ return AppStyle.appStyle != null && AppStyle.appStyle.backButtonHidden;
|
89
|
85
|
}
|
90
|
86
|
|
91
|
87
|
@Nullable
|
92
|
88
|
private StyleParams.Color getDefaultTitleBarColor() {
|
93
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.titleBarTitleColor;
|
|
89
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarTitleColor;
|
94
|
90
|
}
|
95
|
91
|
|
96
|
92
|
@Nullable
|
97
|
93
|
private StyleParams.Color getTitleBarButtonColor() {
|
98
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.titleBarButtonColor;
|
|
94
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.titleBarButtonColor;
|
99
|
95
|
}
|
100
|
96
|
|
101
|
97
|
private boolean isDefaultTopBarHidden() {
|
102
|
|
- return appStyle != null && appStyle.titleBarHidden;
|
|
98
|
+ return AppStyle.appStyle != null && AppStyle.appStyle.titleBarHidden;
|
103
|
99
|
}
|
104
|
100
|
|
105
|
101
|
@Nullable
|
106
|
102
|
private StyleParams.Color getDefaultTopBarColor() {
|
107
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.topBarColor;
|
|
103
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.topBarColor;
|
108
|
104
|
}
|
109
|
105
|
|
110
|
106
|
@Nullable
|
111
|
107
|
private StyleParams.Color getDefaultStatusBarColor() {
|
112
|
|
- return appStyle == null ? new StyleParams.Color() : appStyle.statusBarColor;
|
|
108
|
+ return AppStyle.appStyle == null ? new StyleParams.Color() : AppStyle.appStyle.statusBarColor;
|
113
|
109
|
}
|
114
|
110
|
|
115
|
111
|
private boolean getBoolean(String titleBarHidden, boolean defaultValue) {
|