|
|
@@ -3,11 +3,8 @@ package com.reactnativenavigation.params.parsers;
|
|
3
|
3
|
import android.graphics.drawable.Drawable;
|
|
4
|
4
|
import android.os.Bundle;
|
|
5
|
5
|
|
|
6
|
|
-import com.reactnativenavigation.params.FabParams;
|
|
7
|
6
|
import com.reactnativenavigation.params.NavigationParams;
|
|
8
|
7
|
import com.reactnativenavigation.params.ScreenParams;
|
|
9
|
|
-import com.reactnativenavigation.params.TitleBarButtonParams;
|
|
10
|
|
-import com.reactnativenavigation.params.TitleBarLeftButtonParams;
|
|
11
|
8
|
import com.reactnativenavigation.params.TopTabParams;
|
|
12
|
9
|
import com.reactnativenavigation.react.ImageLoader;
|
|
13
|
10
|
|
|
|
@@ -17,10 +14,6 @@ public class ScreenParamsParser extends Parser {
|
|
17
|
14
|
private static final String KEY_TITLE = "title";
|
|
18
|
15
|
private static final String KEY_SCREEN_ID = "screenId";
|
|
19
|
16
|
private static final String KEY_NAVIGATION_PARAMS = "navigationParams";
|
|
20
|
|
- private static final String KEY_RIGHT_BUTTONS = "rightButtons";
|
|
21
|
|
- private static final String KEY_LEFT_BUTTON = "leftButton";
|
|
22
|
|
- private static final String KEY_FAB = "fab";
|
|
23
|
|
- private static final String KEY_BACK_BUTTON_HIDDEN = "backButtonHidden";
|
|
24
|
17
|
private static final String STYLE_PARAMS = "styleParams";
|
|
25
|
18
|
private static final String TOP_TABS = "topTabs";
|
|
26
|
19
|
private static final String FRAGMENT_CREATOR_CLASS_NAME = "fragmentCreatorClassName";
|
|
|
@@ -37,9 +30,9 @@ public class ScreenParamsParser extends Parser {
|
|
37
|
30
|
result.styleParams = new StyleParamsParser(params.getBundle(STYLE_PARAMS)).parse();
|
|
38
|
31
|
|
|
39
|
32
|
result.title = params.getString(KEY_TITLE);
|
|
40
|
|
- result.rightButtons = parseRightButton(params);
|
|
|
33
|
+ result.rightButtons = ButtonParser.parseRightButton(params);
|
|
41
|
34
|
result.overrideBackPressInJs = params.getBoolean(OVERRIDE_BACK_PRESS, false);
|
|
42
|
|
- result.leftButton = parseLeftButton(params);
|
|
|
35
|
+ result.leftButton = ButtonParser.parseLeftButton(params);
|
|
43
|
36
|
|
|
44
|
37
|
result.topTabParams = parseTopTabs(params);
|
|
45
|
38
|
|
|
|
@@ -48,7 +41,7 @@ public class ScreenParamsParser extends Parser {
|
|
48
|
41
|
result.fragmentCreatorPassProps = params.getBundle(FRAGMENT_CREATOR_PASS_PROPS);
|
|
49
|
42
|
}
|
|
50
|
43
|
|
|
51
|
|
- result.fabParams = parseFab(params);
|
|
|
44
|
+ result.fabParams = ButtonParser.parseFab(params);
|
|
52
|
45
|
|
|
53
|
46
|
result.tabLabel = getTabLabel(params);
|
|
54
|
47
|
result.tabIcon = getTabIcon(params);
|
|
|
@@ -82,35 +75,6 @@ public class ScreenParamsParser extends Parser {
|
|
82
|
75
|
return topTabParams;
|
|
83
|
76
|
}
|
|
84
|
77
|
|
|
85
|
|
- private static List<TitleBarButtonParams> parseRightButton(Bundle params) {
|
|
86
|
|
- List<TitleBarButtonParams> rightButtons = null;
|
|
87
|
|
- if (hasKey(params, KEY_RIGHT_BUTTONS)) {
|
|
88
|
|
- rightButtons = new TitleBarButtonParamsParser().parseButtons(params.getBundle(KEY_RIGHT_BUTTONS));
|
|
89
|
|
- }
|
|
90
|
|
- return rightButtons;
|
|
91
|
|
- }
|
|
92
|
|
-
|
|
93
|
|
- private static TitleBarLeftButtonParams parseLeftButton(Bundle params) {
|
|
94
|
|
- TitleBarLeftButtonParams leftButton = null;
|
|
95
|
|
- if (hasKey(params, KEY_LEFT_BUTTON)) {
|
|
96
|
|
- leftButton = new TitleBarLeftButtonParamsParser().parseSingleButton(params.getBundle(KEY_LEFT_BUTTON));
|
|
97
|
|
-
|
|
98
|
|
- boolean backButtonHidden = params.getBoolean(KEY_BACK_BUTTON_HIDDEN, false);
|
|
99
|
|
- if (backButtonHidden && leftButton.isBackButton()) {
|
|
100
|
|
- leftButton = null;
|
|
101
|
|
- }
|
|
102
|
|
- }
|
|
103
|
|
- return leftButton;
|
|
104
|
|
- }
|
|
105
|
|
-
|
|
106
|
|
- private static FabParams parseFab(Bundle params) {
|
|
107
|
|
- FabParams fabParams = null;
|
|
108
|
|
- if (hasKey(params, KEY_FAB)) {
|
|
109
|
|
- fabParams = new FabParamsParser().parse(params.getBundle(KEY_FAB));
|
|
110
|
|
- }
|
|
111
|
|
- return fabParams;
|
|
112
|
|
- }
|
|
113
|
|
-
|
|
114
|
78
|
public List<ScreenParams> parseTabs(Bundle params) {
|
|
115
|
79
|
return parseBundle(params, new ParseStrategy<ScreenParams>() {
|
|
116
|
80
|
@Override
|