Browse Source

Rename centre left right controllers

Guy Carmeli 6 years ago
parent
commit
24610cc8eb

+ 14
- 14
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java View File

26
 
26
 
27
 public class SideMenuController extends ParentController<DrawerLayout> {
27
 public class SideMenuController extends ParentController<DrawerLayout> {
28
 
28
 
29
-	private ViewController centerController;
30
-	private ViewController leftController;
31
-	private ViewController rightController;
29
+	private ViewController center;
30
+	private ViewController left;
31
+	private ViewController right;
32
     private SideMenuOptionsPresenter presenter;
32
     private SideMenuOptionsPresenter presenter;
33
 
33
 
34
     public SideMenuController(Activity activity, ChildControllersRegistry childRegistry, String id, Options initialOptions, SideMenuOptionsPresenter sideMenuOptionsPresenter, OptionsPresenter presenter) {
34
     public SideMenuController(Activity activity, ChildControllersRegistry childRegistry, String id, Options initialOptions, SideMenuOptionsPresenter sideMenuOptionsPresenter, OptionsPresenter presenter) {
39
     @Override
39
     @Override
40
     protected ViewController getCurrentChild() {
40
     protected ViewController getCurrentChild() {
41
 	    if (getView().isDrawerOpen(Gravity.LEFT)) {
41
 	    if (getView().isDrawerOpen(Gravity.LEFT)) {
42
-            return leftController;
42
+            return left;
43
         } else if (getView().isDrawerOpen(Gravity.RIGHT)) {
43
         } else if (getView().isDrawerOpen(Gravity.RIGHT)) {
44
-            return rightController;
44
+            return right;
45
         }
45
         }
46
-        return centerController;
46
+        return center;
47
     }
47
     }
48
 
48
 
49
     @NonNull
49
     @NonNull
56
 
56
 
57
     @Override
57
     @Override
58
     public void sendOnNavigationButtonPressed(String buttonId) {
58
     public void sendOnNavigationButtonPressed(String buttonId) {
59
-        centerController.sendOnNavigationButtonPressed(buttonId);
59
+        center.sendOnNavigationButtonPressed(buttonId);
60
     }
60
     }
61
 
61
 
62
     @NonNull
62
     @NonNull
63
 	@Override
63
 	@Override
64
 	public Collection<ViewController> getChildControllers() {
64
 	public Collection<ViewController> getChildControllers() {
65
 		ArrayList<ViewController> children = new ArrayList<>();
65
 		ArrayList<ViewController> children = new ArrayList<>();
66
-		if (centerController != null) children.add(centerController);
67
-		if (leftController != null) children.add(leftController);
68
-		if (rightController != null) children.add(rightController);
66
+		if (center != null) children.add(center);
67
+		if (left != null) children.add(left);
68
+		if (right != null) children.add(right);
69
 		return children;
69
 		return children;
70
 	}
70
 	}
71
 
71
 
94
 
94
 
95
     @Override
95
     @Override
96
     public boolean handleBack(CommandListener listener) {
96
     public boolean handleBack(CommandListener listener) {
97
-        return presenter.handleBack() || super.handleBack(listener);
97
+        return presenter.handleBack() || center.handleBack(listener) || super.handleBack(listener);
98
     }
98
     }
99
 
99
 
100
     public void setCenterController(ViewController centerController) {
100
     public void setCenterController(ViewController centerController) {
101
-		this.centerController = centerController;
101
+		this.center = centerController;
102
 		View childView = centerController.getView();
102
 		View childView = centerController.getView();
103
 		getView().addView(childView);
103
 		getView().addView(childView);
104
 	}
104
 	}
105
 
105
 
106
     public void setLeftController(ViewController controller) {
106
     public void setLeftController(ViewController controller) {
107
-        this.leftController = controller;
107
+        this.left = controller;
108
         int height = this.getHeight(options.sideMenuRootOptions.left);
108
         int height = this.getHeight(options.sideMenuRootOptions.left);
109
         int width = this.getWidth(options.sideMenuRootOptions.left);
109
         int width = this.getWidth(options.sideMenuRootOptions.left);
110
         getView().addView(controller.getView(), new LayoutParams(width, height, Gravity.LEFT));
110
         getView().addView(controller.getView(), new LayoutParams(width, height, Gravity.LEFT));
111
     }
111
     }
112
 
112
 
113
     public void setRightController(ViewController controller) {
113
     public void setRightController(ViewController controller) {
114
-        this.rightController = controller;
114
+        this.right = controller;
115
         int height = this.getHeight(options.sideMenuRootOptions.right);
115
         int height = this.getHeight(options.sideMenuRootOptions.right);
116
         int width = this.getWidth(options.sideMenuRootOptions.right);
116
         int width = this.getWidth(options.sideMenuRootOptions.right);
117
         getView().addView(controller.getView(), new LayoutParams(width, height, Gravity.RIGHT));
117
         getView().addView(controller.getView(), new LayoutParams(width, height, Gravity.RIGHT));