Browse Source

Revert "Set default title and subtitle font sizes"

This reverts commit f36a8a44be.
Guy Carmeli 6 years ago
parent
commit
2289fb6251

+ 4
- 7
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java View File

12
 import com.reactnativenavigation.parse.TopTabOptions;
12
 import com.reactnativenavigation.parse.TopTabOptions;
13
 import com.reactnativenavigation.parse.TopTabsOptions;
13
 import com.reactnativenavigation.parse.TopTabsOptions;
14
 import com.reactnativenavigation.parse.params.Button;
14
 import com.reactnativenavigation.parse.params.Button;
15
-import com.reactnativenavigation.utils.UiUtils;
16
 import com.reactnativenavigation.viewcontrollers.IReactView;
15
 import com.reactnativenavigation.viewcontrollers.IReactView;
17
 import com.reactnativenavigation.views.Component;
16
 import com.reactnativenavigation.views.Component;
18
 import com.reactnativenavigation.views.topbar.TopBar;
17
 import com.reactnativenavigation.views.topbar.TopBar;
22
 public class OptionsPresenter {
21
 public class OptionsPresenter {
23
     private static final int DEFAULT_TITLE_COLOR = Color.BLACK;
22
     private static final int DEFAULT_TITLE_COLOR = Color.BLACK;
24
     private static final int DEFAULT_SUBTITLE_COLOR = Color.GRAY;
23
     private static final int DEFAULT_SUBTITLE_COLOR = Color.GRAY;
25
-    private static final float DEFAULT_TITLE_FONT_SIZE = UiUtils.dpToSp(18);
26
-    private static final float DEFAULT_SUBTITLE_FONT_SIZE = UiUtils.dpToSp(14);
27
 
24
 
28
     private TopBar topBar;
25
     private TopBar topBar;
29
 
26
 
44
     }
41
     }
45
 
42
 
46
     private void applyTopBarOptions(TopBarOptions options, AnimationsOptions animationOptions, Component component) {
43
     private void applyTopBarOptions(TopBarOptions options, AnimationsOptions animationOptions, Component component) {
47
-        topBar.setTitle(options.title.text.get(""));
44
+        if (options.title.text.hasValue()) topBar.setTitle(options.title.text.get());
48
         if (options.title.component.hasValue()) topBar.setTitleComponent(options.title.component.get(), options.title.alignment);
45
         if (options.title.component.hasValue()) topBar.setTitleComponent(options.title.component.get(), options.title.alignment);
49
-        topBar.setTitleFontSize(options.title.fontSize.get(DEFAULT_TITLE_FONT_SIZE));
46
+        if (options.title.fontSize.hasValue()) topBar.setTitleFontSize(options.title.fontSize.get());
50
         topBar.setTitleTextColor(options.title.color.get(DEFAULT_TITLE_COLOR));
47
         topBar.setTitleTextColor(options.title.color.get(DEFAULT_TITLE_COLOR));
51
         topBar.setTitleTypeface(options.title.fontFamily);
48
         topBar.setTitleTypeface(options.title.fontFamily);
52
 
49
 
53
-        topBar.setSubtitle(options.subtitle.text.get(""));
54
-        topBar.setSubtitleFontSize(options.subtitle.fontSize.get(DEFAULT_SUBTITLE_FONT_SIZE));
50
+        if (options.subtitle.text.hasValue()) topBar.setSubtitle(options.subtitle.text.get());
51
+        if (options.subtitle.fontSize.hasValue()) topBar.setSubtitleFontSize(options.subtitle.fontSize.get());
55
         topBar.setSubtitleColor(options.subtitle.color.get(DEFAULT_SUBTITLE_COLOR));
52
         topBar.setSubtitleColor(options.subtitle.color.get(DEFAULT_SUBTITLE_COLOR));
56
         topBar.setSubtitleFontFamily(options.subtitle.fontFamily);
53
         topBar.setSubtitleFontFamily(options.subtitle.fontFamily);
57
 
54
 

+ 0
- 4
lib/android/app/src/main/java/com/reactnativenavigation/utils/UiUtils.java View File

64
         float scale = NavigationApplication.instance.getResources().getDisplayMetrics().density;
64
         float scale = NavigationApplication.instance.getResources().getDisplayMetrics().density;
65
         return dp * scale + 0.5f;
65
         return dp * scale + 0.5f;
66
     }
66
     }
67
-
68
-    public static float dpToSp(float dp) {
69
-        return dpToPx(dp) / NavigationApplication.instance.getResources().getDisplayMetrics().density;
70
-    }
71
 }
67
 }