|
@@ -13,10 +13,12 @@ import com.reactnativenavigation.params.TitleBarLeftButtonParams;
|
13
|
13
|
import com.reactnativenavigation.screens.ScreenStack;
|
14
|
14
|
import com.reactnativenavigation.views.LeftButtonOnClickListener;
|
15
|
15
|
import com.reactnativenavigation.views.SideMenu;
|
|
16
|
+import com.reactnativenavigation.views.SnackbarContainer;
|
16
|
17
|
|
17
|
18
|
import java.util.List;
|
18
|
19
|
|
19
|
20
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
21
|
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
20
|
22
|
|
21
|
23
|
public class SingleScreenLayout extends RelativeLayout implements Layout {
|
22
|
24
|
|
|
@@ -24,6 +26,7 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
|
24
|
26
|
protected final ScreenParams screenParams;
|
25
|
27
|
private final SideMenuParams sideMenuParams;
|
26
|
28
|
protected ScreenStack stack;
|
|
29
|
+ private SnackbarContainer snackbarContainer;
|
27
|
30
|
protected LeftButtonOnClickListener leftButtonOnClickListener;
|
28
|
31
|
private @Nullable SideMenu sideMenu;
|
29
|
32
|
|
|
@@ -37,11 +40,16 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
|
37
|
40
|
|
38
|
41
|
private void createLayout() {
|
39
|
42
|
if (sideMenuParams == null) {
|
40
|
|
- createStack(this);
|
|
43
|
+ createStack(getScreenStackParent());
|
41
|
44
|
} else {
|
42
|
45
|
sideMenu = createSideMenu();
|
43
|
|
- createStack(sideMenu.getContentContainer());
|
|
46
|
+ createStack(getScreenStackParent());
|
44
|
47
|
}
|
|
48
|
+ createSnackbarContainer();
|
|
49
|
+ }
|
|
50
|
+
|
|
51
|
+ private RelativeLayout getScreenStackParent() {
|
|
52
|
+ return sideMenu == null ? this : sideMenu.getContentContainer();
|
45
|
53
|
}
|
46
|
54
|
|
47
|
55
|
private SideMenu createSideMenu() {
|
|
@@ -65,6 +73,14 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
|
65
|
73
|
stack.show();
|
66
|
74
|
}
|
67
|
75
|
|
|
76
|
+ private void createSnackbarContainer() {
|
|
77
|
+ snackbarContainer = new SnackbarContainer(getContext());
|
|
78
|
+ RelativeLayout.LayoutParams lp = new LayoutParams(MATCH_PARENT, WRAP_CONTENT);
|
|
79
|
+ lp.addRule(ALIGN_PARENT_BOTTOM);
|
|
80
|
+ snackbarContainer.setLayoutParams(lp);
|
|
81
|
+ getScreenStackParent().addView(snackbarContainer);
|
|
82
|
+ }
|
|
83
|
+
|
68
|
84
|
@Override
|
69
|
85
|
public boolean onBackPressed() {
|
70
|
86
|
if (stack.handleBackPressInJs()) {
|
|
@@ -151,7 +167,8 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
|
151
|
167
|
|
152
|
168
|
@Override
|
153
|
169
|
public void showSnackbar(SnackbarParams params) {
|
154
|
|
- // TODO: implement me
|
|
170
|
+ final String navigatorEventId = stack.peek().getNavigatorEventId();
|
|
171
|
+ snackbarContainer.showSnackbar(navigatorEventId, params);
|
155
|
172
|
}
|
156
|
173
|
|
157
|
174
|
@Override
|