|
@@ -10,6 +10,7 @@ import android.support.design.widget.AppBarLayout;
|
10
|
10
|
import android.support.v4.view.ViewPager;
|
11
|
11
|
import android.support.v7.widget.Toolbar;
|
12
|
12
|
import android.view.View;
|
|
13
|
+import android.view.ViewGroup;
|
13
|
14
|
import android.widget.RelativeLayout;
|
14
|
15
|
import android.widget.TextView;
|
15
|
16
|
|
|
@@ -23,6 +24,8 @@ import com.reactnativenavigation.parse.params.Button;
|
23
|
24
|
import com.reactnativenavigation.parse.params.Color;
|
24
|
25
|
import com.reactnativenavigation.parse.params.Number;
|
25
|
26
|
import com.reactnativenavigation.utils.CompatUtils;
|
|
27
|
+import com.reactnativenavigation.utils.UiUtils;
|
|
28
|
+import com.reactnativenavigation.utils.ViewUtils;
|
26
|
29
|
import com.reactnativenavigation.viewcontrollers.ReactViewCreator;
|
27
|
30
|
import com.reactnativenavigation.viewcontrollers.TopBarButtonController;
|
28
|
31
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarBackgroundViewController;
|
|
@@ -70,6 +73,16 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
|
70
|
73
|
return new TitleBar(context, buttonCreator, reactViewCreator, onClickListener);
|
71
|
74
|
}
|
72
|
75
|
|
|
76
|
+ public void setHeight(int height) {
|
|
77
|
+ ViewGroup.LayoutParams lp = getLayoutParams();
|
|
78
|
+ lp.height = (int) UiUtils.dpToPx(getContext(), height);
|
|
79
|
+ setLayoutParams(lp);
|
|
80
|
+ }
|
|
81
|
+
|
|
82
|
+ public void setTitleHeight(int height) {
|
|
83
|
+ titleBar.setHeight(height);
|
|
84
|
+ }
|
|
85
|
+
|
73
|
86
|
public void setTitle(String title) {
|
74
|
87
|
titleBar.setTitle(title);
|
75
|
88
|
}
|
|
@@ -125,7 +138,7 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
|
125
|
138
|
public void setBackgroundComponent(Component component) {
|
126
|
139
|
if (component.hasValue()) {
|
127
|
140
|
topBarBackgroundViewController.setComponent(component);
|
128
|
|
- RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT, getHeight());
|
|
141
|
+ RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT, ViewUtils.getPreferredHeight(this));
|
129
|
142
|
root.addView(topBarBackgroundViewController.getView(), 0, lp);
|
130
|
143
|
}
|
131
|
144
|
}
|
|
@@ -213,7 +226,7 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
|
213
|
226
|
if (visibility == View.GONE) {
|
214
|
227
|
this.parentView.removeView(this);
|
215
|
228
|
} else if (visibility == View.VISIBLE && this.getParent() == null) {
|
216
|
|
- this.parentView.addView(this, MATCH_PARENT, WRAP_CONTENT);
|
|
229
|
+ this.parentView.addView(this);
|
217
|
230
|
}
|
218
|
231
|
}
|
219
|
232
|
|