|
@@ -5,6 +5,7 @@ import android.view.Gravity;
|
5
|
5
|
import android.view.View;
|
6
|
6
|
|
7
|
7
|
import com.reactnativenavigation.parse.Options;
|
|
8
|
+import com.reactnativenavigation.parse.SideMenuRootOptions;
|
8
|
9
|
import com.reactnativenavigation.parse.params.Bool;
|
9
|
10
|
import com.reactnativenavigation.presentation.Presenter;
|
10
|
11
|
import com.reactnativenavigation.presentation.SideMenuPresenter;
|
|
@@ -24,6 +25,8 @@ import androidx.annotation.RestrictTo;
|
24
|
25
|
import androidx.drawerlayout.widget.DrawerLayout;
|
25
|
26
|
import androidx.drawerlayout.widget.DrawerLayout.LayoutParams;
|
26
|
27
|
|
|
28
|
+import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
29
|
+
|
27
|
30
|
public class SideMenuController extends ParentController<SideMenuRoot> implements DrawerLayout.DrawerListener {
|
28
|
31
|
|
29
|
32
|
private ViewController center;
|
|
@@ -94,6 +97,7 @@ public class SideMenuController extends ParentController<SideMenuRoot> implement
|
94
|
97
|
public void mergeChildOptions(Options options, ViewController child) {
|
95
|
98
|
super.mergeChildOptions(options, child);
|
96
|
99
|
presenter.mergeOptions(options.sideMenuRootOptions);
|
|
100
|
+ mergeLockMode(this.initialOptions, options.sideMenuRootOptions);
|
97
|
101
|
performOnParentController(parent -> parent.mergeChildOptions(options, child));
|
98
|
102
|
}
|
99
|
103
|
|
|
@@ -126,13 +130,13 @@ public class SideMenuController extends ParentController<SideMenuRoot> implement
|
126
|
130
|
@Override
|
127
|
131
|
public void onDrawerOpened(@NonNull View drawerView) {
|
128
|
132
|
ViewController view = this.getMatchingView(drawerView);
|
129
|
|
- view.mergeOptions(this.getOptionsWithVisibility(this.viewIsLeft(drawerView), true));
|
|
133
|
+ view.mergeOptions(this.getOptionsWithVisibility(isLeftMenu(drawerView), true));
|
130
|
134
|
}
|
131
|
135
|
|
132
|
136
|
@Override
|
133
|
137
|
public void onDrawerClosed(@NonNull View drawerView) {
|
134
|
138
|
ViewController view = this.getMatchingView(drawerView);
|
135
|
|
- view.mergeOptions(this.getOptionsWithVisibility(this.viewIsLeft(drawerView), false));
|
|
139
|
+ view.mergeOptions(this.getOptionsWithVisibility(isLeftMenu(drawerView), false));
|
136
|
140
|
}
|
137
|
141
|
|
138
|
142
|
@Override
|
|
@@ -179,10 +183,10 @@ public class SideMenuController extends ParentController<SideMenuRoot> implement
|
179
|
183
|
}
|
180
|
184
|
|
181
|
185
|
private ViewController getMatchingView (View drawerView) {
|
182
|
|
- return this.viewIsLeft(drawerView) ? left : right;
|
|
186
|
+ return this.isLeftMenu(drawerView) ? left : right;
|
183
|
187
|
}
|
184
|
188
|
|
185
|
|
- private boolean viewIsLeft (View drawerView) {
|
|
189
|
+ private boolean isLeftMenu(View drawerView) {
|
186
|
190
|
return (left != null && drawerView.equals(left.getView()));
|
187
|
191
|
}
|
188
|
192
|
|
|
@@ -208,6 +212,11 @@ public class SideMenuController extends ParentController<SideMenuRoot> implement
|
208
|
212
|
}
|
209
|
213
|
}
|
210
|
214
|
|
|
215
|
+ private void mergeLockMode(Options out, SideMenuRootOptions sideMenu) {
|
|
216
|
+ perform(sideMenu.left.enabled.get(null), enabled -> out.sideMenuRootOptions.left.enabled = new Bool(enabled));
|
|
217
|
+ perform(sideMenu.right.enabled.get(null), enabled -> out.sideMenuRootOptions.right.enabled = new Bool(enabled));
|
|
218
|
+ }
|
|
219
|
+
|
211
|
220
|
@RestrictTo(RestrictTo.Scope.TESTS)
|
212
|
221
|
SideMenu getSideMenu() {
|
213
|
222
|
return presenter.getSideMenu();
|