Browse Source

Fix SideMenu e2e

Guy Carmeli 6 years ago
parent
commit
93967d19de

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

@@ -3,6 +3,7 @@ package com.reactnativenavigation.viewcontrollers;
3 3
 import android.app.Activity;
4 4
 import android.support.annotation.NonNull;
5 5
 import android.support.v4.widget.DrawerLayout;
6
+import android.support.v4.widget.DrawerLayout.LayoutParams;
6 7
 import android.view.Gravity;
7 8
 import android.view.View;
8 9
 
@@ -15,7 +16,6 @@ import java.util.ArrayList;
15 16
 import java.util.Collection;
16 17
 
17 18
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
18
-import static android.widget.ListPopupWindow.WRAP_CONTENT;
19 19
 
20 20
 public class SideMenuController extends ParentController<DrawerLayout> implements NavigationOptionsListener {
21 21
 
@@ -69,21 +69,13 @@ public class SideMenuController extends ParentController<DrawerLayout> implement
69 69
 		getView().addView(childView);
70 70
 	}
71 71
 
72
-	public void setLeftController(ViewController leftController) {
73
-		this.leftController = leftController;
74
-		View childView = leftController.getView();
75
-		DrawerLayout.LayoutParams lp = new DrawerLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
76
-		lp.gravity = Gravity.LEFT;
77
-		childView.setLayoutParams(lp);
78
-		getView().addView(childView);
72
+	public void setLeftController(ViewController controller) {
73
+		this.leftController = controller;
74
+        getView().addView(controller.getView(), new LayoutParams(MATCH_PARENT, MATCH_PARENT, Gravity.LEFT));
79 75
 	}
80 76
 
81
-	public void setRightController(ViewController rightController) {
82
-		this.rightController = rightController;
83
-		View childView = rightController.getView();
84
-		DrawerLayout.LayoutParams lp = new DrawerLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
85
-		lp.gravity = Gravity.RIGHT;
86
-		childView.setLayoutParams(lp);
87
-		getView().addView(childView);
77
+	public void setRightController(ViewController controller) {
78
+		this.rightController = controller;
79
+        getView().addView(controller.getView(), new LayoutParams(MATCH_PARENT, MATCH_PARENT, Gravity.RIGHT));
88 80
 	}
89 81
 }