|
@@ -4,9 +4,11 @@ import android.content.Context;
|
4
|
4
|
import android.support.v4.view.GravityCompat;
|
5
|
5
|
import android.support.v4.widget.DrawerLayout;
|
6
|
6
|
import android.view.Gravity;
|
|
7
|
+import android.view.ViewGroup;
|
7
|
8
|
import android.widget.RelativeLayout;
|
8
|
9
|
|
9
|
10
|
import com.reactnativenavigation.params.SideMenuParams;
|
|
11
|
+import com.reactnativenavigation.screens.Screen;
|
10
|
12
|
import com.reactnativenavigation.utils.ViewUtils;
|
11
|
13
|
|
12
|
14
|
public class SideMenu extends DrawerLayout {
|
|
@@ -71,9 +73,21 @@ public class SideMenu extends DrawerLayout {
|
71
|
73
|
sideMenuView = new ContentView(getContext(), sideMenuParams.screenId, sideMenuParams.navigationParams);
|
72
|
74
|
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
|
73
|
75
|
lp.gravity = Gravity.START;
|
|
76
|
+ setSideMenuWidth();
|
74
|
77
|
addView(sideMenuView, lp);
|
75
|
78
|
}
|
76
|
79
|
|
|
80
|
+ private void setSideMenuWidth() {
|
|
81
|
+ sideMenuView.setOnDisplayListener(new Screen.OnDisplayListener() {
|
|
82
|
+ @Override
|
|
83
|
+ public void onDisplay() {
|
|
84
|
+ ViewGroup.LayoutParams lp = sideMenuView.getLayoutParams();
|
|
85
|
+ lp.width = sideMenuView.getChildAt(0).getWidth();
|
|
86
|
+ sideMenuView.setLayoutParams(lp);
|
|
87
|
+ }
|
|
88
|
+ });
|
|
89
|
+ }
|
|
90
|
+
|
77
|
91
|
private void setStyle(SideMenuParams params) {
|
78
|
92
|
if (params.disableOpenGesture) {
|
79
|
93
|
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|