|
@@ -14,11 +14,15 @@ class CollapsingTopBarParamsParser extends Parser {
|
14
|
14
|
private Bundle params;
|
15
|
15
|
private boolean titleBarHideOnScroll;
|
16
|
16
|
private boolean drawBelowTopBar;
|
|
17
|
+ private final boolean hasReactView;
|
|
18
|
+ private final boolean hasBackgroundImage;
|
17
|
19
|
|
18
|
20
|
CollapsingTopBarParamsParser(Bundle params, boolean titleBarHideOnScroll, boolean drawBelowTopBar) {
|
19
|
21
|
this.params = params;
|
20
|
22
|
this.titleBarHideOnScroll = titleBarHideOnScroll;
|
21
|
23
|
this.drawBelowTopBar = drawBelowTopBar;
|
|
24
|
+ hasReactView = params.containsKey("collapsingToolBarComponent");
|
|
25
|
+ hasBackgroundImage = params.containsKey("collapsingToolBarImage");
|
22
|
26
|
}
|
23
|
27
|
|
24
|
28
|
public CollapsingTopBarParams parse() {
|
|
@@ -31,6 +35,7 @@ class CollapsingTopBarParamsParser extends Parser {
|
31
|
35
|
result.reactViewHeight = params.getInt("collapsingToolBarComponentHeight");
|
32
|
36
|
result.expendOnTopTabChange = params.getBoolean("expendCollapsingToolBarOnTopTabChange");
|
33
|
37
|
result.scrimColor = getColor(params, "collapsingToolBarCollapsedColor", new StyleParams.Color(Color.WHITE));
|
|
38
|
+ result.showTitleWhenCollapsed = hasReactView;
|
34
|
39
|
result.collapseBehaviour = getCollapseBehaviour();
|
35
|
40
|
return result;
|
36
|
41
|
}
|
|
@@ -39,12 +44,8 @@ class CollapsingTopBarParamsParser extends Parser {
|
39
|
44
|
return titleBarHideOnScroll || hasImageOrReactView();
|
40
|
45
|
}
|
41
|
46
|
|
42
|
|
- private boolean hasImageOrReactView() {
|
43
|
|
- return hasBackgroundImage() || hasReactView();
|
44
|
|
- }
|
45
|
|
-
|
46
|
47
|
private CollapseBehaviour getCollapseBehaviour() {
|
47
|
|
- if (hasBackgroundImage() || hasReactView()) {
|
|
48
|
+ if (hasImageOrReactView()) {
|
48
|
49
|
return new CollapseTopBarBehaviour();
|
49
|
50
|
}
|
50
|
51
|
if (titleBarHideOnScroll && drawBelowTopBar) {
|
|
@@ -53,11 +54,7 @@ class CollapsingTopBarParamsParser extends Parser {
|
53
|
54
|
return new TitleBarHideOnScrollBehaviour();
|
54
|
55
|
}
|
55
|
56
|
|
56
|
|
- private boolean hasBackgroundImage() {
|
57
|
|
- return params.containsKey("collapsingToolBarImage");
|
58
|
|
- }
|
59
|
|
-
|
60
|
|
- private boolean hasReactView() {
|
61
|
|
- return params.containsKey("collapsingToolBarComponent");
|
|
57
|
+ private boolean hasImageOrReactView() {
|
|
58
|
+ return hasBackgroundImage || hasReactView;
|
62
|
59
|
}
|
63
|
60
|
}
|