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,9 +26,9 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
26 26
 
27 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 32
     private SideMenuOptionsPresenter presenter;
33 33
 
34 34
     public SideMenuController(Activity activity, ChildControllersRegistry childRegistry, String id, Options initialOptions, SideMenuOptionsPresenter sideMenuOptionsPresenter, OptionsPresenter presenter) {
@@ -39,11 +39,11 @@ public class SideMenuController extends ParentController<DrawerLayout> {
39 39
     @Override
40 40
     protected ViewController getCurrentChild() {
41 41
 	    if (getView().isDrawerOpen(Gravity.LEFT)) {
42
-            return leftController;
42
+            return left;
43 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 49
     @NonNull
@@ -56,16 +56,16 @@ public class SideMenuController extends ParentController<DrawerLayout> {
56 56
 
57 57
     @Override
58 58
     public void sendOnNavigationButtonPressed(String buttonId) {
59
-        centerController.sendOnNavigationButtonPressed(buttonId);
59
+        center.sendOnNavigationButtonPressed(buttonId);
60 60
     }
61 61
 
62 62
     @NonNull
63 63
 	@Override
64 64
 	public Collection<ViewController> getChildControllers() {
65 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 69
 		return children;
70 70
 	}
71 71
 
@@ -94,24 +94,24 @@ public class SideMenuController extends ParentController<DrawerLayout> {
94 94
 
95 95
     @Override
96 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 100
     public void setCenterController(ViewController centerController) {
101
-		this.centerController = centerController;
101
+		this.center = centerController;
102 102
 		View childView = centerController.getView();
103 103
 		getView().addView(childView);
104 104
 	}
105 105
 
106 106
     public void setLeftController(ViewController controller) {
107
-        this.leftController = controller;
107
+        this.left = controller;
108 108
         int height = this.getHeight(options.sideMenuRootOptions.left);
109 109
         int width = this.getWidth(options.sideMenuRootOptions.left);
110 110
         getView().addView(controller.getView(), new LayoutParams(width, height, Gravity.LEFT));
111 111
     }
112 112
 
113 113
     public void setRightController(ViewController controller) {
114
-        this.rightController = controller;
114
+        this.right = controller;
115 115
         int height = this.getHeight(options.sideMenuRootOptions.right);
116 116
         int width = this.getWidth(options.sideMenuRootOptions.right);
117 117
         getView().addView(controller.getView(), new LayoutParams(width, height, Gravity.RIGHT));