Browse Source

rename to component

Daniel Zlotin 7 years ago
parent
commit
c18dcbf2c3

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

5
 import com.reactnativenavigation.parse.TopBarOptions;
5
 import com.reactnativenavigation.parse.TopBarOptions;
6
 import com.reactnativenavigation.parse.TopTabOptions;
6
 import com.reactnativenavigation.parse.TopTabOptions;
7
 import com.reactnativenavigation.parse.TopTabsOptions;
7
 import com.reactnativenavigation.parse.TopTabsOptions;
8
-import com.reactnativenavigation.views.Container;
8
+import com.reactnativenavigation.views.Component;
9
 import com.reactnativenavigation.views.TopBar;
9
 import com.reactnativenavigation.views.TopBar;
10
 
10
 
11
 import java.util.ArrayList;
11
 import java.util.ArrayList;
15
 
15
 
16
 public class OptionsPresenter {
16
 public class OptionsPresenter {
17
 
17
 
18
-    private Container reactContainer;
18
+    private Component reactComponent;
19
     private TopBar topBar;
19
     private TopBar topBar;
20
 
20
 
21
-    public OptionsPresenter(Container reactContainer) {
22
-        this.reactContainer = reactContainer;
23
-        this.topBar = reactContainer.getTopBar();
21
+    public OptionsPresenter(Component reactComponent) {
22
+        this.reactComponent = reactComponent;
23
+        this.topBar = reactComponent.getTopBar();
24
     }
24
     }
25
 
25
 
26
     public void applyOptions(NavigationOptions options) {
26
     public void applyOptions(NavigationOptions options) {
44
             topBar.show(options.animateHide);
44
             topBar.show(options.animateHide);
45
         }
45
         }
46
         if (options.drawBehind == True) {
46
         if (options.drawBehind == True) {
47
-            reactContainer.drawBehindTopBar();
47
+            reactComponent.drawBehindTopBar();
48
         } else if (options.drawBehind == False) {
48
         } else if (options.drawBehind == False) {
49
-            reactContainer.drawBelowTopBar();
49
+            reactComponent.drawBelowTopBar();
50
         }
50
         }
51
 
51
 
52
         if (options.hideOnScroll == True) {
52
         if (options.hideOnScroll == True) {

+ 9
- 12
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java View File

1
 package com.reactnativenavigation.viewcontrollers;
1
 package com.reactnativenavigation.viewcontrollers;
2
 
2
 
3
-import android.app.Activity;
4
-import android.support.annotation.NonNull;
5
-import android.support.annotation.RestrictTo;
6
-import android.util.Log;
7
-import android.view.View;
8
-
9
-import com.reactnativenavigation.parse.NavigationOptions;
10
-import com.reactnativenavigation.presentation.NavigationOptionsListener;
11
-import com.reactnativenavigation.views.ReactComponent;
12
-import com.reactnativenavigation.views.TopBar;
13
-
14
-public class ContainerViewController extends ViewController implements NavigationOptionsListener {
3
+import android.app.*;
4
+import android.support.annotation.*;
5
+import android.view.*;
6
+
7
+import com.reactnativenavigation.parse.*;
8
+import com.reactnativenavigation.presentation.*;
9
+import com.reactnativenavigation.views.*;
10
+
11
+public class ComponentViewController extends ViewController implements NavigationOptionsListener {
15
 
12
 
16
     public interface ReactViewCreator {
13
     public interface ReactViewCreator {
17
 
14
 

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

4
 import android.view.View;
4
 import android.view.View;
5
 
5
 
6
 import com.reactnativenavigation.parse.NavigationOptions;
6
 import com.reactnativenavigation.parse.NavigationOptions;
7
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
7
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
8
 
8
 
9
 public interface Component {
9
 public interface Component {
10
     void applyOptions(NavigationOptions options);
10
     void applyOptions(NavigationOptions options);

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java View File

7
 
7
 
8
 import com.reactnativenavigation.parse.NavigationOptions;
8
 import com.reactnativenavigation.parse.NavigationOptions;
9
 import com.reactnativenavigation.presentation.OptionsPresenter;
9
 import com.reactnativenavigation.presentation.OptionsPresenter;
10
-import com.reactnativenavigation.views.ReactContainer;
10
+import com.reactnativenavigation.views.ReactComponent;
11
 import com.reactnativenavigation.views.TopBar;
11
 import com.reactnativenavigation.views.TopBar;
12
 
12
 
13
 public class TestComponentLayout extends RelativeLayout implements ReactComponent {
13
 public class TestComponentLayout extends RelativeLayout implements ReactComponent {

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentView.java View File

4
 import android.view.View;
4
 import android.view.View;
5
 
5
 
6
 import com.reactnativenavigation.parse.NavigationOptions;
6
 import com.reactnativenavigation.parse.NavigationOptions;
7
-import com.reactnativenavigation.views.ReactContainer;
7
+import com.reactnativenavigation.views.ReactComponent;
8
 import com.reactnativenavigation.views.TopBar;
8
 import com.reactnativenavigation.views.TopBar;
9
 
9
 
10
 public class TestComponentView extends View implements ReactComponent {
10
 public class TestComponentView extends View implements ReactComponent {

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

144
         initialNavigationOptions.topBarOptions.title = "the title";
144
         initialNavigationOptions.topBarOptions.title = "the title";
145
         initialNavigationOptions.topBarOptions.drawBehind = NavigationOptions.BooleanOptions.False;
145
         initialNavigationOptions.topBarOptions.drawBehind = NavigationOptions.BooleanOptions.False;
146
         uut.onViewAppeared();
146
         uut.onViewAppeared();
147
-        RelativeLayout.LayoutParams uutLayoutParams = (RelativeLayout.LayoutParams) ((ViewGroup) uut.getContainer().asView()).getChildAt(1).getLayoutParams();
147
+        RelativeLayout.LayoutParams uutLayoutParams = (RelativeLayout.LayoutParams) ((ViewGroup) uut.getComponent().asView()).getChildAt(1).getLayoutParams();
148
         assertThat(uutLayoutParams.getRule(BELOW)).isNotEqualTo(0);
148
         assertThat(uutLayoutParams.getRule(BELOW)).isNotEqualTo(0);
149
 
149
 
150
         NavigationOptions opts = new NavigationOptions();
150
         NavigationOptions opts = new NavigationOptions();
151
         opts.topBarOptions.drawBehind = NavigationOptions.BooleanOptions.True;
151
         opts.topBarOptions.drawBehind = NavigationOptions.BooleanOptions.True;
152
         uut.mergeNavigationOptions(opts);
152
         uut.mergeNavigationOptions(opts);
153
 
153
 
154
-        uutLayoutParams = (RelativeLayout.LayoutParams) ((ViewGroup) uut.getContainer().asView()).getChildAt(1).getLayoutParams();
154
+        uutLayoutParams = (RelativeLayout.LayoutParams) ((ViewGroup) uut.getComponent().asView()).getChildAt(1).getLayoutParams();
155
         assertThat(uutLayoutParams.getRule(BELOW)).isEqualTo(0);
155
         assertThat(uutLayoutParams.getRule(BELOW)).isEqualTo(0);
156
     }
156
     }
157
 }
157
 }