|
@@ -84,16 +84,16 @@ public class TitleBar extends Toolbar {
|
84
|
84
|
|
85
|
85
|
private void centerTitle(final StyleParams params) {
|
86
|
86
|
final View titleView = getTitleView();
|
|
87
|
+ if (titleView == null) {
|
|
88
|
+ return;
|
|
89
|
+ }
|
87
|
90
|
ViewUtils.runOnPreDraw(titleView, new Runnable() {
|
88
|
91
|
@Override
|
89
|
92
|
public void run() {
|
90
|
93
|
if (params.titleBarTitleTextCentered) {
|
91
|
|
- if (titleView != null) {
|
92
|
|
- int[] location = new int[2];
|
93
|
|
- titleView.getLocationOnScreen(location);
|
94
|
|
- titleView.setTranslationX(titleView.getTranslationX() + (-location[0] + ViewUtils.getScreenWidth() / 2 - titleView.getWidth() / 2));
|
95
|
|
- }
|
96
|
|
-
|
|
94
|
+ int[] location = new int[2];
|
|
95
|
+ titleView.getLocationOnScreen(location);
|
|
96
|
+ titleView.setTranslationX(titleView.getTranslationX() + (-location[0] + ViewUtils.getScreenWidth() / 2 - titleView.getWidth() / 2));
|
97
|
97
|
}
|
98
|
98
|
|
99
|
99
|
}
|