|
@@ -13,7 +13,32 @@ public class SideMenuPresenter {
|
13
|
13
|
this.sideMenu = sideMenu;
|
14
|
14
|
}
|
15
|
15
|
|
|
16
|
+ /**
|
|
17
|
+ * Called when initializing the sideMenu DrawerLayout.
|
|
18
|
+ *
|
|
19
|
+ * @param options Side menu options
|
|
20
|
+ */
|
|
21
|
+ public void applyInitialOptions(SideMenuRootOptions options) {
|
|
22
|
+ if (options.left.enabled.isFalse()) {
|
|
23
|
+ sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.LEFT);
|
|
24
|
+ }
|
|
25
|
+ else if (options.left.enabled.isTrue()) {
|
|
26
|
+ sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.LEFT);
|
|
27
|
+ }
|
|
28
|
+
|
|
29
|
+ if (options.right.enabled.isFalse()) {
|
|
30
|
+ sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT);
|
|
31
|
+ }
|
|
32
|
+ else if (options.right.enabled.isTrue()) {
|
|
33
|
+ sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
|
|
34
|
+ }
|
|
35
|
+ }
|
|
36
|
+
|
16
|
37
|
public void present(SideMenuRootOptions options) {
|
|
38
|
+ // TODO: Not sure why we call these options when we show the DrawerLayout rather than when initializing it.
|
|
39
|
+ // TODO: (i.e. `setDrawerLockMode()` is supposed to be called when the DrawerLayout is initialized.
|
|
40
|
+ applyInitialOptions(options);
|
|
41
|
+
|
17
|
42
|
if (options.left.visible.isTrue()) {
|
18
|
43
|
sideMenu.openDrawer(Gravity.LEFT);
|
19
|
44
|
|
|
@@ -27,20 +52,6 @@ public class SideMenuPresenter {
|
27
|
52
|
} else if (options.right.visible.isFalse() && sideMenu.isDrawerOpen(Gravity.RIGHT)){
|
28
|
53
|
sideMenu.closeDrawer(Gravity.RIGHT);
|
29
|
54
|
}
|
30
|
|
-
|
31
|
|
- if (options.left.enabled.isFalse()) {
|
32
|
|
- sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.LEFT);
|
33
|
|
- }
|
34
|
|
- else if (options.left.enabled.isTrue()) {
|
35
|
|
- sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.LEFT);
|
36
|
|
- }
|
37
|
|
-
|
38
|
|
- if (options.right.enabled.isFalse()) {
|
39
|
|
- sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT);
|
40
|
|
- }
|
41
|
|
- else if (options.right.enabled.isTrue()) {
|
42
|
|
- sideMenu.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
|
43
|
|
- }
|
44
|
55
|
}
|
45
|
56
|
|
46
|
57
|
public boolean handleBack() {
|