Sfoglia il codice sorgente

Rename Color to Colour

As RNN's Color is used frequently with Android's Color class, we had to use fully qualified names, the rename avoids this.
Guy Carmeli 6 anni fa
parent
commit
a322875c98
27 ha cambiato i file con 97 aggiunte e 89 eliminazioni
  1. 6
    6
      lib/android/app/src/main/java/com/reactnativenavigation/parse/BottomTabOptions.java
  2. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/BottomTabsOptions.java
  3. 4
    4
      lib/android/app/src/main/java/com/reactnativenavigation/parse/FabOptions.java
  4. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutOptions.java
  5. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/StatusBarOptions.java
  6. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/SubtitleOptions.java
  7. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/TitleOptions.java
  8. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/parse/TopBarBackgroundOptions.java
  9. 6
    6
      lib/android/app/src/main/java/com/reactnativenavigation/parse/TopBarOptions.java
  10. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/parse/TopTabsOptions.java
  11. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/params/Button.java
  12. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/params/Colour.java
  13. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/parse/params/NullColor.java
  14. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/parse/parsers/ColorParser.java
  15. 4
    3
      lib/android/app/src/main/java/com/reactnativenavigation/presentation/StackOptionsPresenter.java
  16. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java
  17. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/views/topbar/TopBar.java
  18. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabs.java
  19. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsStyleHelper.java
  20. 3
    1
      lib/android/app/src/test/java/com/reactnativenavigation/parse/OptionsTest.java
  21. 6
    5
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabOptionsPresenterTest.java
  22. 3
    2
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsControllerTest.java
  23. 2
    2
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsOptionsPresenterTest.java
  24. 3
    2
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java
  25. 13
    13
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackOptionsPresenterTest.java
  26. 11
    10
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarButtonControllerTest.java
  27. 3
    2
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/button/NavigationIconResolverTest.java

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/parse/BottomTabOptions.java Vedi File

@@ -3,7 +3,7 @@ package com.reactnativenavigation.parse;
3 3
 import android.graphics.Typeface;
4 4
 import android.support.annotation.Nullable;
5 5
 
6
-import com.reactnativenavigation.parse.params.Color;
6
+import com.reactnativenavigation.parse.params.Colour;
7 7
 import com.reactnativenavigation.parse.params.NullColor;
8 8
 import com.reactnativenavigation.parse.params.NullNumber;
9 9
 import com.reactnativenavigation.parse.params.NullText;
@@ -38,14 +38,14 @@ public class BottomTabOptions {
38 38
     }
39 39
 
40 40
     public Text text = new NullText();
41
-    public Color textColor = new NullColor();
42
-    public Color selectedTextColor = new NullColor();
41
+    public Colour textColor = new NullColor();
42
+    public Colour selectedTextColor = new NullColor();
43 43
     public Text icon = new NullText();
44
-    public Color iconColor = new NullColor();
45
-    public Color selectedIconColor = new NullColor();
44
+    public Colour iconColor = new NullColor();
45
+    public Colour selectedIconColor = new NullColor();
46 46
     public Text testId = new NullText();
47 47
     public Text badge = new NullText();
48
-    public Color badgeColor = new NullColor();
48
+    public Colour badgeColor = new NullColor();
49 49
     public Number fontSize = new NullNumber();
50 50
     public Number selectedFontSize = new NullNumber();
51 51
     @Nullable public Typeface fontFamily;

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/BottomTabsOptions.java Vedi File

@@ -1,7 +1,7 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3 3
 import com.reactnativenavigation.parse.params.Bool;
4
-import com.reactnativenavigation.parse.params.Color;
4
+import com.reactnativenavigation.parse.params.Colour;
5 5
 import com.reactnativenavigation.parse.params.NullBool;
6 6
 import com.reactnativenavigation.parse.params.NullColor;
7 7
 import com.reactnativenavigation.parse.params.NullNumber;
@@ -34,7 +34,7 @@ public class BottomTabsOptions {
34 34
 		return options;
35 35
 	}
36 36
 
37
-    public Color backgroundColor = new NullColor();
37
+    public Colour backgroundColor = new NullColor();
38 38
 	public Bool visible = new NullBool();
39 39
     public Bool drawBehind = new NullBool();
40 40
 	public Bool animate = new NullBool();

+ 4
- 4
lib/android/app/src/main/java/com/reactnativenavigation/parse/FabOptions.java Vedi File

@@ -2,7 +2,7 @@ package com.reactnativenavigation.parse;
2 2
 
3 3
 
4 4
 import com.reactnativenavigation.parse.params.Bool;
5
-import com.reactnativenavigation.parse.params.Color;
5
+import com.reactnativenavigation.parse.params.Colour;
6 6
 import com.reactnativenavigation.parse.params.NullBool;
7 7
 import com.reactnativenavigation.parse.params.NullColor;
8 8
 import com.reactnativenavigation.parse.params.NullText;
@@ -45,9 +45,9 @@ public class FabOptions {
45 45
     }
46 46
 
47 47
     public Text id = new NullText();
48
-    public Color backgroundColor = new NullColor();
49
-    public Color clickColor = new NullColor();
50
-    public Color rippleColor = new NullColor();
48
+    public Colour backgroundColor = new NullColor();
49
+    public Colour clickColor = new NullColor();
50
+    public Colour rippleColor = new NullColor();
51 51
     public Text icon = new NullText();
52 52
     public Bool visible = new NullBool();
53 53
     public ArrayList<FabOptions> actionsArray = new ArrayList<>();

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutOptions.java Vedi File

@@ -1,6 +1,6 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3
-import com.reactnativenavigation.parse.params.Color;
3
+import com.reactnativenavigation.parse.params.Colour;
4 4
 import com.reactnativenavigation.parse.params.NullColor;
5 5
 import com.reactnativenavigation.parse.params.NullNumber;
6 6
 import com.reactnativenavigation.parse.params.Number;
@@ -21,7 +21,7 @@ public class LayoutOptions {
21 21
         return result;
22 22
     }
23 23
 
24
-    public Color backgroundColor = new NullColor();
24
+    public Colour backgroundColor = new NullColor();
25 25
     public Number topMargin = new NullNumber();
26 26
     public OrientationOptions orientation = new OrientationOptions();
27 27
 

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/StatusBarOptions.java Vedi File

@@ -3,7 +3,7 @@ package com.reactnativenavigation.parse;
3 3
 import android.support.annotation.Nullable;
4 4
 
5 5
 import com.reactnativenavigation.parse.params.Bool;
6
-import com.reactnativenavigation.parse.params.Color;
6
+import com.reactnativenavigation.parse.params.Colour;
7 7
 import com.reactnativenavigation.parse.params.NullBool;
8 8
 import com.reactnativenavigation.parse.params.NullColor;
9 9
 import com.reactnativenavigation.parse.parsers.BoolParser;
@@ -50,7 +50,7 @@ public class StatusBarOptions {
50 50
         return result;
51 51
     }
52 52
 
53
-    public Color backgroundColor = new NullColor();
53
+    public Colour backgroundColor = new NullColor();
54 54
     public TextColorScheme textColorScheme = TextColorScheme.None;
55 55
     public Bool visible = new NullBool();
56 56
     public Bool drawBehind = new NullBool();

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/SubtitleOptions.java Vedi File

@@ -3,7 +3,7 @@ package com.reactnativenavigation.parse;
3 3
 import android.graphics.Typeface;
4 4
 import android.support.annotation.Nullable;
5 5
 
6
-import com.reactnativenavigation.parse.params.Color;
6
+import com.reactnativenavigation.parse.params.Colour;
7 7
 import com.reactnativenavigation.parse.params.Fraction;
8 8
 import com.reactnativenavigation.parse.params.NullColor;
9 9
 import com.reactnativenavigation.parse.params.NullFraction;
@@ -33,7 +33,7 @@ public class SubtitleOptions {
33 33
     }
34 34
 
35 35
     public Text text = new NullText();
36
-    public Color color = new NullColor();
36
+    public Colour color = new NullColor();
37 37
     public Fraction fontSize = new NullFraction();
38 38
     @Nullable public Typeface fontFamily;
39 39
     public Alignment alignment = Alignment.Default;

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/TitleOptions.java Vedi File

@@ -3,7 +3,7 @@ package com.reactnativenavigation.parse;
3 3
 import android.graphics.Typeface;
4 4
 import android.support.annotation.Nullable;
5 5
 
6
-import com.reactnativenavigation.parse.params.Color;
6
+import com.reactnativenavigation.parse.params.Colour;
7 7
 import com.reactnativenavigation.parse.params.Fraction;
8 8
 import com.reactnativenavigation.parse.params.NullColor;
9 9
 import com.reactnativenavigation.parse.params.NullFraction;
@@ -35,7 +35,7 @@ public class TitleOptions {
35 35
     }
36 36
 
37 37
     public Text text = new NullText();
38
-    public Color color = new NullColor();
38
+    public Colour color = new NullColor();
39 39
     public Fraction fontSize = new NullFraction();
40 40
     public Alignment alignment = Alignment.Default;
41 41
     @Nullable public Typeface fontFamily;

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/parse/TopBarBackgroundOptions.java Vedi File

@@ -1,6 +1,6 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3
-import com.reactnativenavigation.parse.params.Color;
3
+import com.reactnativenavigation.parse.params.Colour;
4 4
 import com.reactnativenavigation.parse.params.NullColor;
5 5
 import com.reactnativenavigation.parse.parsers.ColorParser;
6 6
 
@@ -15,13 +15,13 @@ public class TopBarBackgroundOptions {
15 15
         options.component = Component.parse(json.optJSONObject("component"));
16 16
 
17 17
         if (options.component.hasValue()) {
18
-            options.color = new Color(android.graphics.Color.TRANSPARENT);
18
+            options.color = new Colour(android.graphics.Color.TRANSPARENT);
19 19
         }
20 20
 
21 21
         return options;
22 22
     }
23 23
 
24
-    public Color color = new NullColor();
24
+    public Colour color = new NullColor();
25 25
     public Component component = new Component();
26 26
 
27 27
     void mergeWith(final TopBarBackgroundOptions other) {

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/parse/TopBarOptions.java Vedi File

@@ -5,7 +5,7 @@ import android.util.Log;
5 5
 
6 6
 import com.reactnativenavigation.BuildConfig;
7 7
 import com.reactnativenavigation.parse.params.Bool;
8
-import com.reactnativenavigation.parse.params.Color;
8
+import com.reactnativenavigation.parse.params.Colour;
9 9
 import com.reactnativenavigation.parse.params.Fraction;
10 10
 import com.reactnativenavigation.parse.params.NullBool;
11 11
 import com.reactnativenavigation.parse.params.NullColor;
@@ -62,13 +62,13 @@ public class TopBarOptions {
62 62
     public Number height = new NullNumber();
63 63
     public Fraction elevation = new NullFraction();
64 64
     public Fraction borderHeight = new NullFraction();
65
-    public Color borderColor = new NullColor();
65
+    public Colour borderColor = new NullColor();
66 66
 
67 67
     // Deprecated
68
-    public Color rightButtonColor = new NullColor();
69
-    public Color leftButtonColor = new NullColor();
70
-    public Color rightButtonDisabledColor = new NullColor();
71
-    public Color leftButtonDisabledColor = new NullColor();
68
+    public Colour rightButtonColor = new NullColor();
69
+    public Colour leftButtonColor = new NullColor();
70
+    public Colour rightButtonDisabledColor = new NullColor();
71
+    public Colour leftButtonDisabledColor = new NullColor();
72 72
 
73 73
     public TopBarOptions copy() {
74 74
         TopBarOptions result = new TopBarOptions();

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/parse/TopTabsOptions.java Vedi File

@@ -4,7 +4,7 @@ import android.support.annotation.NonNull;
4 4
 import android.support.annotation.Nullable;
5 5
 
6 6
 import com.reactnativenavigation.parse.params.Bool;
7
-import com.reactnativenavigation.parse.params.Color;
7
+import com.reactnativenavigation.parse.params.Colour;
8 8
 import com.reactnativenavigation.parse.params.NullBool;
9 9
 import com.reactnativenavigation.parse.params.NullColor;
10 10
 import com.reactnativenavigation.parse.params.NullNumber;
@@ -17,8 +17,8 @@ import org.json.JSONObject;
17 17
 
18 18
 public class TopTabsOptions {
19 19
 
20
-    @NonNull public Color selectedTabColor = new NullColor();
21
-    @NonNull public Color unselectedTabColor = new NullColor();
20
+    @NonNull public Colour selectedTabColor = new NullColor();
21
+    @NonNull public Colour unselectedTabColor = new NullColor();
22 22
     @NonNull public Number fontSize = new NullNumber();
23 23
     @NonNull public Bool visible = new NullBool();
24 24
     @NonNull public Number height = new NullNumber();

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/params/Button.java Vedi File

@@ -22,8 +22,8 @@ public class Button {
22 22
     public Bool enabled = new NullBool();
23 23
     public Bool disableIconTint = new NullBool();
24 24
     public Number showAsAction = new NullNumber();
25
-    public Color color = new NullColor();
26
-    public Color disabledColor = new NullColor();
25
+    public Colour color = new NullColor();
26
+    public Colour disabledColor = new NullColor();
27 27
     public Number fontSize = new NullNumber();
28 28
     private Text fontWeight = new NullText();
29 29
     @Nullable public Typeface fontFamily;

lib/android/app/src/main/java/com/reactnativenavigation/parse/params/Color.java → lib/android/app/src/main/java/com/reactnativenavigation/parse/params/Colour.java Vedi File

@@ -2,9 +2,9 @@ package com.reactnativenavigation.parse.params;
2 2
 
3 3
 import android.support.annotation.ColorInt;
4 4
 
5
-public class Color extends Param<Integer>{
5
+public class Colour extends Param<Integer>{
6 6
 
7
-    public Color(@ColorInt int color) {
7
+    public Colour(@ColorInt int color) {
8 8
         super(color);
9 9
     }
10 10
 

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/parse/params/NullColor.java Vedi File

@@ -1,6 +1,6 @@
1 1
 package com.reactnativenavigation.parse.params;
2 2
 
3
-public class NullColor extends Color {
3
+public class NullColor extends Colour {
4 4
 
5 5
     public NullColor() {
6 6
         super(0);

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/parse/parsers/ColorParser.java Vedi File

@@ -1,12 +1,12 @@
1 1
 package com.reactnativenavigation.parse.parsers;
2 2
 
3
-import com.reactnativenavigation.parse.params.Color;
3
+import com.reactnativenavigation.parse.params.Colour;
4 4
 import com.reactnativenavigation.parse.params.NullColor;
5 5
 
6 6
 import org.json.JSONObject;
7 7
 
8 8
 public class ColorParser {
9
-    public static Color parse(JSONObject json, String color) {
10
-        return json.has(color) ? new Color(json.optInt(color)) : new NullColor();
9
+    public static Colour parse(JSONObject json, String color) {
10
+        return json.has(color) ? new Colour(json.optInt(color)) : new NullColor();
11 11
     }
12 12
 }

+ 4
- 3
lib/android/app/src/main/java/com/reactnativenavigation/presentation/StackOptionsPresenter.java Vedi File

@@ -18,6 +18,7 @@ import com.reactnativenavigation.parse.TopBarOptions;
18 18
 import com.reactnativenavigation.parse.TopTabOptions;
19 19
 import com.reactnativenavigation.parse.TopTabsOptions;
20 20
 import com.reactnativenavigation.parse.params.Button;
21
+import com.reactnativenavigation.parse.params.Colour;
21 22
 import com.reactnativenavigation.utils.UiUtils;
22 23
 import com.reactnativenavigation.viewcontrollers.IReactView;
23 24
 import com.reactnativenavigation.viewcontrollers.TitleBarReactViewController;
@@ -165,7 +166,7 @@ public class StackOptionsPresenter {
165 166
         }
166 167
     }
167 168
 
168
-    private void applyButtons(TopBarOptions options, com.reactnativenavigation.parse.params.Color rightButtonColor, com.reactnativenavigation.parse.params.Color leftButtonColor, com.reactnativenavigation.parse.params.Color rightButtonDisabledColor, com.reactnativenavigation.parse.params.Color leftButtonDisabledColor) {
169
+    private void applyButtons(TopBarOptions options, Colour rightButtonColor, Colour leftButtonColor, Colour rightButtonDisabledColor, Colour leftButtonDisabledColor) {
169 170
         List<Button> rightButtons = mergeButtonsWithColor(options.buttons.right, rightButtonColor, rightButtonDisabledColor);
170 171
         List<Button> leftButtons = mergeButtonsWithColor(options.buttons.left, leftButtonColor, leftButtonDisabledColor);
171 172
         topBar.setRightButtons(rightButtons);
@@ -212,7 +213,7 @@ public class StackOptionsPresenter {
212 213
         if (orientationOptions.hasValue()) applyOrientation(orientationOptions);
213 214
     }
214 215
 
215
-    private void mergeButtons(TopBarButtons buttons, com.reactnativenavigation.parse.params.Color rightButtonColor, com.reactnativenavigation.parse.params.Color leftButtonColor, com.reactnativenavigation.parse.params.Color rightButtonDisabledColor, com.reactnativenavigation.parse.params.Color leftButtonDisabledColor) {
216
+    private void mergeButtons(TopBarButtons buttons, Colour rightButtonColor, Colour leftButtonColor, Colour rightButtonDisabledColor, Colour leftButtonDisabledColor) {
216 217
         List<Button> rightButtons = mergeButtonsWithColor(buttons.right, rightButtonColor, rightButtonDisabledColor);
217 218
         List<Button> leftButtons = mergeButtonsWithColor(buttons.left, leftButtonColor, leftButtonDisabledColor);
218 219
         if (buttons.right != null) topBar.setRightButtons(rightButtons);
@@ -221,7 +222,7 @@ public class StackOptionsPresenter {
221 222
     }
222 223
 
223 224
     @Nullable
224
-    private List<Button> mergeButtonsWithColor(List<Button> buttons, com.reactnativenavigation.parse.params.Color buttonColor, com.reactnativenavigation.parse.params.Color disabledColor) {
225
+    private List<Button> mergeButtonsWithColor(List<Button> buttons, Colour buttonColor, Colour disabledColor) {
225 226
         List<Button> result = null;
226 227
         if (buttons != null) {
227 228
             result = new ArrayList<>();

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java Vedi File

@@ -13,7 +13,7 @@ import android.widget.TextView;
13 13
 import com.reactnativenavigation.parse.Alignment;
14 14
 import com.reactnativenavigation.parse.BackButton;
15 15
 import com.reactnativenavigation.parse.params.Button;
16
-import com.reactnativenavigation.parse.params.Color;
16
+import com.reactnativenavigation.parse.params.Colour;
17 17
 import com.reactnativenavigation.utils.ButtonOptionsPresenter;
18 18
 import com.reactnativenavigation.utils.ImageLoader;
19 19
 import com.reactnativenavigation.utils.UiUtils;
@@ -57,7 +57,7 @@ public class TitleBar extends Toolbar {
57 57
         return super.getTitle() == null ? "" : (String) super.getTitle();
58 58
     }
59 59
 
60
-    public void setTitleTextColor(Color color) {
60
+    public void setTitleTextColor(Colour color) {
61 61
         if (color.hasValue()) setTitleTextColor(color.get());
62 62
     }
63 63
 
@@ -68,7 +68,7 @@ public class TitleBar extends Toolbar {
68 68
         addView(component);
69 69
     }
70 70
 
71
-    public void setBackgroundColor(Color color) {
71
+    public void setBackgroundColor(Colour color) {
72 72
         if (color.hasValue()) setBackgroundColor(color.get());
73 73
     }
74 74
 

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

@@ -29,7 +29,7 @@ import com.reactnativenavigation.parse.AnimationOptions;
29 29
 import com.reactnativenavigation.parse.BackButton;
30 30
 import com.reactnativenavigation.parse.Component;
31 31
 import com.reactnativenavigation.parse.params.Button;
32
-import com.reactnativenavigation.parse.params.Color;
32
+import com.reactnativenavigation.parse.params.Colour;
33 33
 import com.reactnativenavigation.parse.params.Number;
34 34
 import com.reactnativenavigation.utils.CompatUtils;
35 35
 import com.reactnativenavigation.utils.ImageLoader;
@@ -191,7 +191,7 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
191 191
         topTabs.setFontFamily(tabIndex, fontFamily);
192 192
     }
193 193
 
194
-    public void applyTopTabsColors(Color selectedTabColor, Color unselectedTabColor) {
194
+    public void applyTopTabsColors(Colour selectedTabColor, Colour unselectedTabColor) {
195 195
         topTabs.applyTopTabsColors(selectedTabColor, unselectedTabColor);
196 196
     }
197 197
 

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabs.java Vedi File

@@ -6,7 +6,7 @@ import android.support.design.widget.TabLayout;
6 6
 import android.support.v4.view.ViewPager;
7 7
 import android.view.ViewManager;
8 8
 
9
-import com.reactnativenavigation.parse.params.Color;
9
+import com.reactnativenavigation.parse.params.Colour;
10 10
 import com.reactnativenavigation.parse.params.Number;
11 11
 import com.reactnativenavigation.views.topbar.TopBar;
12 12
 
@@ -30,7 +30,7 @@ public class TopTabs extends TabLayout {
30 30
         return EMPTY_STATE_SET;
31 31
     }
32 32
 
33
-    public void applyTopTabsColors(Color selectedTabColor, Color unselectedTabColor) {
33
+    public void applyTopTabsColors(Colour selectedTabColor, Colour unselectedTabColor) {
34 34
         styleHelper.applyTopTabsColors(selectedTabColor, unselectedTabColor);
35 35
     }
36 36
 

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsStyleHelper.java Vedi File

@@ -5,7 +5,7 @@ import android.graphics.Typeface;
5 5
 import android.view.ViewGroup;
6 6
 import android.widget.TextView;
7 7
 
8
-import com.reactnativenavigation.parse.params.Color;
8
+import com.reactnativenavigation.parse.params.Colour;
9 9
 import com.reactnativenavigation.parse.params.Number;
10 10
 import com.reactnativenavigation.utils.Task;
11 11
 import com.reactnativenavigation.utils.ViewUtils;
@@ -24,7 +24,7 @@ class TopTabsStyleHelper {
24 24
         }
25 25
     }
26 26
 
27
-    void applyTopTabsColors(Color selected, Color unselected) {
27
+    void applyTopTabsColors(Colour selected, Colour unselected) {
28 28
         ColorStateList originalColors = topTabs.getTabTextColors();
29 29
         int selectedTabColor = originalColors != null ? originalColors.getColorForState(topTabs.getSelectedTabColors(), -1) : -1;
30 30
         int tabTextColor = originalColors != null ? originalColors.getColorForState(topTabs.getDefaultTabColors(), -1) : -1;

+ 3
- 1
lib/android/app/src/test/java/com/reactnativenavigation/parse/OptionsTest.java Vedi File

@@ -1,11 +1,13 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3
+import android.graphics.Color;
3 4
 import android.graphics.Typeface;
4 5
 import android.support.annotation.NonNull;
5 6
 
6 7
 import com.reactnativenavigation.BaseTest;
7 8
 import com.reactnativenavigation.mocks.TypefaceLoaderMock;
8 9
 import com.reactnativenavigation.parse.params.Bool;
10
+import com.reactnativenavigation.parse.params.Colour;
9 11
 import com.reactnativenavigation.parse.params.NullText;
10 12
 import com.reactnativenavigation.parse.params.Number;
11 13
 import com.reactnativenavigation.parse.params.Text;
@@ -269,7 +271,7 @@ public class OptionsTest extends BaseTest {
269 271
     @Test
270 272
     public void clear_bottomTabsOptions() {
271 273
         Options uut = new Options();
272
-        uut.bottomTabsOptions.backgroundColor = new com.reactnativenavigation.parse.params.Color(android.graphics.Color.RED);
274
+        uut.bottomTabsOptions.backgroundColor = new Colour(Color.RED);
273 275
         uut.clearBottomTabsOptions();
274 276
         assertThat(uut.bottomTabsOptions.backgroundColor.hasValue()).isFalse();
275 277
     }

+ 6
- 5
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabOptionsPresenterTest.java Vedi File

@@ -1,11 +1,12 @@
1 1
 package com.reactnativenavigation.viewcontrollers;
2 2
 
3 3
 import android.app.Activity;
4
+import android.graphics.Color;
4 5
 
5 6
 import com.reactnativenavigation.BaseTest;
6 7
 import com.reactnativenavigation.mocks.SimpleViewController;
7 8
 import com.reactnativenavigation.parse.Options;
8
-import com.reactnativenavigation.parse.params.Color;
9
+import com.reactnativenavigation.parse.params.Colour;
9 10
 import com.reactnativenavigation.parse.params.Text;
10 11
 import com.reactnativenavigation.presentation.BottomTabOptionsPresenter;
11 12
 import com.reactnativenavigation.views.BottomTabs;
@@ -81,16 +82,16 @@ public class BottomTabOptionsPresenterTest extends BaseTest {
81 82
     private Options createTab1Options() {
82 83
         Options options = new Options();
83 84
         options.bottomTabOptions.badge = new Text("tab1badge");
84
-        options.bottomTabOptions.iconColor = new Color(android.graphics.Color.RED);
85
-        options.bottomTabOptions.selectedIconColor = new Color(android.graphics.Color.RED);
85
+        options.bottomTabOptions.iconColor = new Colour(Color.RED);
86
+        options.bottomTabOptions.selectedIconColor = new Colour(Color.RED);
86 87
         return options;
87 88
     }
88 89
 
89 90
     private Options createTab2Options() {
90 91
         Options options = new Options();
91 92
         options.bottomTabOptions.badge = new Text("tab2badge");
92
-        options.bottomTabOptions.iconColor = new Color(android.graphics.Color.RED);
93
-        options.bottomTabOptions.selectedIconColor = new Color(android.graphics.Color.RED);
93
+        options.bottomTabOptions.iconColor = new Colour(Color.RED);
94
+        options.bottomTabOptions.selectedIconColor = new Colour(Color.RED);
94 95
         return options;
95 96
     }
96 97
 }

+ 3
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsControllerTest.java Vedi File

@@ -1,6 +1,7 @@
1 1
 package com.reactnativenavigation.viewcontrollers;
2 2
 
3 3
 import android.app.Activity;
4
+import android.graphics.Color;
4 5
 import android.support.annotation.NonNull;
5 6
 import android.view.View;
6 7
 import android.view.ViewGroup;
@@ -13,7 +14,7 @@ import com.reactnativenavigation.mocks.SimpleViewController;
13 14
 import com.reactnativenavigation.mocks.TitleBarReactViewCreatorMock;
14 15
 import com.reactnativenavigation.parse.Options;
15 16
 import com.reactnativenavigation.parse.params.Bool;
16
-import com.reactnativenavigation.parse.params.Color;
17
+import com.reactnativenavigation.parse.params.Colour;
17 18
 import com.reactnativenavigation.parse.params.Number;
18 19
 import com.reactnativenavigation.parse.params.Text;
19 20
 import com.reactnativenavigation.presentation.BottomTabOptionsPresenter;
@@ -157,7 +158,7 @@ public class BottomTabsControllerTest extends BaseTest {
157 158
     @Test
158 159
     public void applyOptions_bottomTabsOptionsAreClearedAfterApply() {
159 160
         Options options = new Options();
160
-        options.bottomTabsOptions.backgroundColor = new Color(android.graphics.Color.RED);
161
+        options.bottomTabsOptions.backgroundColor = new Colour(Color.RED);
161 162
         child1.mergeOptions(options);
162 163
         uut.ensureViewIsCreated();
163 164
 

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsOptionsPresenterTest.java Vedi File

@@ -6,7 +6,7 @@ import com.reactnativenavigation.BaseTest;
6 6
 import com.reactnativenavigation.mocks.SimpleViewController;
7 7
 import com.reactnativenavigation.parse.Options;
8 8
 import com.reactnativenavigation.parse.params.Bool;
9
-import com.reactnativenavigation.parse.params.Color;
9
+import com.reactnativenavigation.parse.params.Colour;
10 10
 import com.reactnativenavigation.presentation.BottomTabsOptionsPresenter;
11 11
 import com.reactnativenavigation.viewcontrollers.bottomtabs.TabSelector;
12 12
 import com.reactnativenavigation.views.BottomTabs;
@@ -46,7 +46,7 @@ public class BottomTabsOptionsPresenterTest extends BaseTest {
46 46
         uut.setDefaultOptions(defaultOptions);
47 47
 
48 48
         Options options = new Options();
49
-        options.bottomTabsOptions.backgroundColor = new Color(10);
49
+        options.bottomTabsOptions.backgroundColor = new Colour(10);
50 50
         uut.mergeChildOptions(options, (Component) tabs.get(0).getView());
51 51
         verify(bottomTabs).setBackgroundColor(options.bottomTabsOptions.backgroundColor.get());
52 52
         verifyNoMoreInteractions(bottomTabs);

+ 3
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java Vedi File

@@ -19,6 +19,7 @@ import com.reactnativenavigation.parse.Options;
19 19
 import com.reactnativenavigation.parse.SubtitleOptions;
20 20
 import com.reactnativenavigation.parse.TopBarBackgroundOptions;
21 21
 import com.reactnativenavigation.parse.params.Bool;
22
+import com.reactnativenavigation.parse.params.Colour;
22 23
 import com.reactnativenavigation.parse.params.Fraction;
23 24
 import com.reactnativenavigation.parse.params.Text;
24 25
 import com.reactnativenavigation.presentation.OptionsPresenter;
@@ -142,7 +143,7 @@ public class OptionsApplyingTest extends BaseTest {
142 143
         uut.onViewAppeared();
143 144
 
144 145
         Options opts = new Options();
145
-        opts.topBar.background.color = new com.reactnativenavigation.parse.params.Color(Color.RED);
146
+        opts.topBar.background.color = new Colour(Color.RED);
146 147
         uut.mergeOptions(opts);
147 148
 
148 149
         assertThat(((ColorDrawable) stackController.getTopBar().getBackground()).getColor()).isEqualTo(Color.RED);
@@ -156,7 +157,7 @@ public class OptionsApplyingTest extends BaseTest {
156 157
             public void onSuccess(String childId) {
157 158
                 Options opts = new Options();
158 159
                 opts.topBar.title.text = new Text("the title");
159
-                opts.topBar.title.color = new com.reactnativenavigation.parse.params.Color(Color.RED);
160
+                opts.topBar.title.color = new Colour(Color.RED);
160 161
                 uut.mergeOptions(opts);
161 162
 
162 163
                 assertThat(stackController.getTopBar().getTitleTextView()).isNotEqualTo(null);

+ 13
- 13
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackOptionsPresenterTest.java Vedi File

@@ -18,7 +18,7 @@ import com.reactnativenavigation.parse.SubtitleOptions;
18 18
 import com.reactnativenavigation.parse.TitleOptions;
19 19
 import com.reactnativenavigation.parse.params.Bool;
20 20
 import com.reactnativenavigation.parse.params.Button;
21
-import com.reactnativenavigation.parse.params.Color;
21
+import com.reactnativenavigation.parse.params.Colour;
22 22
 import com.reactnativenavigation.parse.params.Fraction;
23 23
 import com.reactnativenavigation.parse.params.Number;
24 24
 import com.reactnativenavigation.parse.params.Text;
@@ -154,15 +154,15 @@ public class StackOptionsPresenterTest extends BaseTest {
154 154
         title.text = new Text("abc");
155 155
         title.component.name = new Text("someComponent");
156 156
         title.component.componentId = new Text("compId");
157
-        title.color = new Color(0);
157
+        title.color = new Colour(0);
158 158
         title.fontSize = new Fraction(1.0f);
159 159
         title.fontFamily = Typeface.DEFAULT_BOLD;
160 160
         options.topBar.title = title;
161 161
         SubtitleOptions subtitleOptions = new SubtitleOptions();
162 162
         subtitleOptions.text = new Text("Sub");
163
-        subtitleOptions.color = new Color(1);
163
+        subtitleOptions.color = new Colour(1);
164 164
         options.topBar.subtitle = subtitleOptions;
165
-        options.topBar.background.color = new Color(0);
165
+        options.topBar.background.color = new Colour(0);
166 166
         options.topBar.testId = new Text("test123");
167 167
         options.topBar.animate = new Bool(false);
168 168
         options.topBar.visible = new Bool(false);
@@ -187,8 +187,8 @@ public class StackOptionsPresenterTest extends BaseTest {
187 187
         verify(topBar, times(0)).applyTopTabsFontSize(any());
188 188
         verify(topBar, times(0)).setTopTabsVisible(anyBoolean());
189 189
 
190
-        options.topTabs.selectedTabColor = new Color(1);
191
-        options.topTabs.unselectedTabColor = new Color(1);
190
+        options.topTabs.selectedTabColor = new Colour(1);
191
+        options.topTabs.unselectedTabColor = new Colour(1);
192 192
         options.topTabs.fontSize = new Number(1);
193 193
         options.topTabs.visible = new Bool(true);
194 194
         uut.mergeChildOptions(options, EMPTY_OPTIONS, child);
@@ -225,7 +225,7 @@ public class StackOptionsPresenterTest extends BaseTest {
225 225
     @Test
226 226
     public void mergeOptions_defaultOptionsAreNotApplied() {
227 227
         Options defaultOptions = new Options();
228
-        defaultOptions.topBar.background.color = new Color(10);
228
+        defaultOptions.topBar.background.color = new Colour(10);
229 229
         uut.setDefaultOptions(defaultOptions);
230 230
 
231 231
         Options childOptions = new Options();
@@ -242,8 +242,8 @@ public class StackOptionsPresenterTest extends BaseTest {
242 242
         Button rightButton2 = new Button();
243 243
         Button leftButton = new Button();
244 244
 
245
-        options.topBar.rightButtonColor = new Color(10);
246
-        options.topBar.leftButtonColor = new Color(100);
245
+        options.topBar.rightButtonColor = new Colour(10);
246
+        options.topBar.leftButtonColor = new Colour(100);
247 247
 
248 248
         options.topBar.buttons.right = new ArrayList<>();
249 249
         options.topBar.buttons.right.add(rightButton1);
@@ -269,8 +269,8 @@ public class StackOptionsPresenterTest extends BaseTest {
269 269
     @Test
270 270
     public void mergeChildOptions_buttonColorIsResolvedFromAppliedOptions() {
271 271
         Options appliedOptions = new Options();
272
-        appliedOptions.topBar.rightButtonColor = new Color(10);
273
-        appliedOptions.topBar.leftButtonColor = new Color(100);
272
+        appliedOptions.topBar.rightButtonColor = new Colour(10);
273
+        appliedOptions.topBar.leftButtonColor = new Colour(100);
274 274
 
275 275
         Options options2 = new Options();
276 276
         Button rightButton1 = new Button();
@@ -301,8 +301,8 @@ public class StackOptionsPresenterTest extends BaseTest {
301 301
     @Test
302 302
     public void mergeChildOptions_buttonColorIsResolvedFromMergedOptions() {
303 303
         Options resolvedOptions = new Options();
304
-        resolvedOptions.topBar.rightButtonColor = new Color(10);
305
-        resolvedOptions.topBar.leftButtonColor = new Color(100);
304
+        resolvedOptions.topBar.rightButtonColor = new Colour(10);
305
+        resolvedOptions.topBar.leftButtonColor = new Colour(100);
306 306
 
307 307
         Options options2 = new Options();
308 308
         Button rightButton1 = new Button();

+ 11
- 10
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarButtonControllerTest.java Vedi File

@@ -1,6 +1,7 @@
1 1
 package com.reactnativenavigation.viewcontrollers;
2 2
 
3 3
 import android.app.Activity;
4
+import android.graphics.Color;
4 5
 import android.graphics.Typeface;
5 6
 import android.support.v7.widget.Toolbar;
6 7
 import android.view.MenuItem;
@@ -11,7 +12,7 @@ import com.reactnativenavigation.mocks.ImageLoaderMock;
11 12
 import com.reactnativenavigation.mocks.TopBarButtonCreatorMock;
12 13
 import com.reactnativenavigation.parse.params.Bool;
13 14
 import com.reactnativenavigation.parse.params.Button;
14
-import com.reactnativenavigation.parse.params.Color;
15
+import com.reactnativenavigation.parse.params.Colour;
15 16
 import com.reactnativenavigation.parse.params.NullText;
16 17
 import com.reactnativenavigation.parse.params.Number;
17 18
 import com.reactnativenavigation.parse.params.Text;
@@ -71,7 +72,7 @@ public class TopBarButtonControllerTest extends BaseTest {
71 72
         uut.addToMenu(getTitleBar(), 0);
72 73
 
73 74
         assertThat(getTitleBar().getMenu().size()).isOne();
74
-        verify(optionsPresenter, times(1)).tint(any(), eq(android.graphics.Color.RED));
75
+        verify(optionsPresenter, times(1)).tint(any(), eq(Color.RED));
75 76
     }
76 77
 
77 78
     @Test
@@ -79,16 +80,16 @@ public class TopBarButtonControllerTest extends BaseTest {
79 80
         setIconButton(false);
80 81
         uut.addToMenu(getTitleBar(), 0);
81 82
 
82
-        verify(optionsPresenter, times(1)).tint(any(), eq(android.graphics.Color.LTGRAY));
83
+        verify(optionsPresenter, times(1)).tint(any(), eq(Color.LTGRAY));
83 84
     }
84 85
 
85 86
     @Test
86 87
     public void setIconColor_disabledColor() {
87 88
         setIconButton(false);
88
-        button.disabledColor = new Color(android.graphics.Color.BLACK);
89
+        button.disabledColor = new Colour(Color.BLACK);
89 90
         uut.addToMenu(getTitleBar(), 0);
90 91
 
91
-        verify(optionsPresenter, times(1)).tint(any(), eq(android.graphics.Color.BLACK));
92
+        verify(optionsPresenter, times(1)).tint(any(), eq(Color.BLACK));
92 93
     }
93 94
 
94 95
     @Test
@@ -128,7 +129,7 @@ public class TopBarButtonControllerTest extends BaseTest {
128 129
 
129 130
         clearMenu();
130 131
         button.enabled = new Bool(true);
131
-        button.color = new Color(android.graphics.Color.RED);
132
+        button.color = new Colour(android.graphics.Color.RED);
132 133
         uut.addToMenu(getTitleBar(), 0);
133 134
         dispatchPreDraw(getTitleBar());
134 135
         verify(optionsPresenter, times(1)).setEnabledColor(any());
@@ -144,13 +145,13 @@ public class TopBarButtonControllerTest extends BaseTest {
144 145
         button.enabled = new Bool(false);
145 146
         uut.addToMenu(getTitleBar(), 0);
146 147
         dispatchPreDraw(getTitleBar());
147
-        verify(optionsPresenter, times(1)).setDisabledColor(any(), eq(android.graphics.Color.LTGRAY));
148
+        verify(optionsPresenter, times(1)).setDisabledColor(any(), eq(Color.LTGRAY));
148 149
 
149 150
         clearMenu();
150
-        button.disabledColor = new Color(android.graphics.Color.BLACK);
151
+        button.disabledColor = new Colour(android.graphics.Color.BLACK);
151 152
         uut.addToMenu(getTitleBar(), 0);
152 153
         dispatchPreDraw(getTitleBar());
153
-        verify(optionsPresenter, times(1)).setDisabledColor(any(), eq(android.graphics.Color.BLACK));
154
+        verify(optionsPresenter, times(1)).setDisabledColor(any(), eq(Color.BLACK));
154 155
     }
155 156
 
156 157
     private Toolbar getTitleBar() {
@@ -167,7 +168,7 @@ public class TopBarButtonControllerTest extends BaseTest {
167 168
     private void setIconButton(boolean enabled) {
168 169
         button.id = "btn1";
169 170
         button.icon = new Text("someIcon");
170
-        button.color = new Color(android.graphics.Color.RED);
171
+        button.color = new Colour(Color.RED);
171 172
         button.component.name = new NullText();
172 173
         button.component.componentId = new NullText();
173 174
         button.enabled = new Bool(enabled);

+ 3
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/button/NavigationIconResolverTest.java Vedi File

@@ -1,12 +1,13 @@
1 1
 package com.reactnativenavigation.viewcontrollers.button;
2 2
 
3 3
 import android.content.Context;
4
+import android.graphics.Color;
4 5
 import android.graphics.drawable.Drawable;
5 6
 
6 7
 import com.reactnativenavigation.BaseTest;
7 8
 import com.reactnativenavigation.mocks.ImageLoaderMock;
8 9
 import com.reactnativenavigation.parse.params.Button;
9
-import com.reactnativenavigation.parse.params.Color;
10
+import com.reactnativenavigation.parse.params.Colour;
10 11
 import com.reactnativenavigation.parse.params.Text;
11 12
 import com.reactnativenavigation.react.Constants;
12 13
 import com.reactnativenavigation.utils.ImageLoader;
@@ -63,7 +64,7 @@ public class NavigationIconResolverTest extends BaseTest {
63 64
         Button button = new Button();
64 65
         button.id = "iconBtnId";
65 66
         button.icon = new Text(ICON_URI);
66
-        button.color = new Color(android.graphics.Color.RED);
67
+        button.color = new Colour(Color.RED);
67 68
         return button;
68 69
     }
69 70