Browse Source

Rename getTitleView to findTitleView

Guy Carmeli 6 years ago
parent
commit
b4527273c9

+ 7
- 6
lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java View File

@@ -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
     }

+ 1
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/topbar/TopBar.java View File

@@ -21,7 +21,6 @@ import com.reactnativenavigation.parse.Alignment;
21 21
 import com.reactnativenavigation.parse.AnimationOptions;
22 22
 import com.reactnativenavigation.parse.params.Button;
23 23
 import com.reactnativenavigation.parse.params.Color;
24
-import com.reactnativenavigation.parse.params.Fraction;
25 24
 import com.reactnativenavigation.parse.params.Number;
26 25
 import com.reactnativenavigation.parse.params.Text;
27 26
 import com.reactnativenavigation.utils.CompatUtils;
@@ -226,6 +225,6 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
226 225
 
227 226
     @RestrictTo(RestrictTo.Scope.TESTS)
228 227
     public TextView getTitleTextView() {
229
-        return titleBar.getTitleTextView();
228
+        return titleBar.findTitleTextView();
230 229
     }
231 230
 }