|
@@ -11,6 +11,7 @@ import android.view.View;
|
11
|
11
|
|
12
|
12
|
import com.reactnativenavigation.parse.Options;
|
13
|
13
|
import com.reactnativenavigation.parse.SideMenuOptions;
|
|
14
|
+import com.reactnativenavigation.parse.params.Bool;
|
14
|
15
|
import com.reactnativenavigation.presentation.Presenter;
|
15
|
16
|
import com.reactnativenavigation.presentation.SideMenuPresenter;
|
16
|
17
|
import com.reactnativenavigation.utils.CommandListener;
|
|
@@ -103,14 +104,22 @@ public class SideMenuController extends ParentController<DrawerLayout> implement
|
103
|
104
|
return options;
|
104
|
105
|
}
|
105
|
106
|
|
|
107
|
+ //For onDrawerOpened and onDrawerClosed :
|
|
108
|
+ //Merge the options to the current state, if this happened due to a gesture we need to
|
|
109
|
+ //update the option state
|
|
110
|
+
|
106
|
111
|
@Override
|
107
|
112
|
public void onDrawerOpened(@NonNull View drawerView) {
|
108
|
|
- (left != null && drawerView.equals(left.getView()) ? left : right).onViewAppeared();
|
|
113
|
+ ViewController view = this.getMatchingView(drawerView);
|
|
114
|
+ view.mergeOptions(this.getOptionsWithVisability(this.viewIsLeft(drawerView), true));
|
|
115
|
+ view.onViewAppeared();
|
109
|
116
|
}
|
110
|
117
|
|
111
|
118
|
@Override
|
112
|
119
|
public void onDrawerClosed(@NonNull View drawerView) {
|
113
|
|
- (left != null && drawerView.equals(left.getView()) ? left : right).onViewDisappear();
|
|
120
|
+ ViewController view = this.getMatchingView(drawerView);
|
|
121
|
+ view.mergeOptions(this.getOptionsWithVisability(this.viewIsLeft(drawerView), false));
|
|
122
|
+ view.onViewDisappear();
|
114
|
123
|
}
|
115
|
124
|
|
116
|
125
|
@Override
|
|
@@ -154,6 +163,24 @@ public class SideMenuController extends ParentController<DrawerLayout> implement
|
154
|
163
|
return height;
|
155
|
164
|
}
|
156
|
165
|
|
|
166
|
+ private ViewController getMatchingView (View drawerView) {
|
|
167
|
+ return this.viewIsLeft(drawerView) ? left : right;
|
|
168
|
+ }
|
|
169
|
+
|
|
170
|
+ private boolean viewIsLeft (View drawerView) {
|
|
171
|
+ return (left != null && drawerView.equals(left.getView()));
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+ private Options getOptionsWithVisability ( boolean isLeft, boolean visible ) {
|
|
175
|
+ Options options = new Options();
|
|
176
|
+ if (isLeft) {
|
|
177
|
+ options.sideMenuRootOptions.left.visible = new Bool(visible);
|
|
178
|
+ } else {
|
|
179
|
+ options.sideMenuRootOptions.right.visible = new Bool(visible);
|
|
180
|
+ }
|
|
181
|
+ return options;
|
|
182
|
+ }
|
|
183
|
+
|
157
|
184
|
@Override
|
158
|
185
|
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
|
159
|
186
|
|