|
@@ -20,6 +20,8 @@ import com.reactnativenavigation.viewcontrollers.TopBarButtonController;
|
20
|
20
|
import java.util.ArrayList;
|
21
|
21
|
import java.util.List;
|
22
|
22
|
|
|
23
|
+import javax.annotation.Nullable;
|
|
24
|
+
|
23
|
25
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
24
|
26
|
|
25
|
27
|
@SuppressLint("ViewConstructor")
|
|
@@ -66,18 +68,17 @@ public class TitleBar extends Toolbar {
|
66
|
68
|
}
|
67
|
69
|
|
68
|
70
|
public void setTitleFontSize(float size) {
|
69
|
|
- TextView titleTextView = getTitleTextView();
|
|
71
|
+ TextView titleTextView = findTitleTextView();
|
70
|
72
|
if (titleTextView != null) titleTextView.setTextSize(size);
|
71
|
73
|
}
|
72
|
74
|
|
73
|
75
|
public void setTitleTypeface(Typeface typeface) {
|
74
|
|
- TextView titleTextView = getTitleTextView();
|
75
|
|
- if (titleTextView != null) {
|
76
|
|
- titleTextView.setTypeface(typeface);
|
77
|
|
- }
|
|
76
|
+ TextView titleTextView = findTitleTextView();
|
|
77
|
+ if (titleTextView != null) titleTextView.setTypeface(typeface);
|
78
|
78
|
}
|
79
|
79
|
|
80
|
|
- public TextView getTitleTextView() {
|
|
80
|
+ @Nullable
|
|
81
|
+ public TextView findTitleTextView() {
|
81
|
82
|
List<TextView> children = ViewUtils.findChildrenByClass(this, TextView.class);
|
82
|
83
|
return children.isEmpty() ? null : children.get(0);
|
83
|
84
|
}
|