|
@@ -28,25 +28,23 @@ public class RnnModal extends Dialog implements DialogInterface.OnDismissListene
|
28
|
28
|
|
29
|
29
|
private ScreenStack mScreenStack;
|
30
|
30
|
private View mContentView;
|
31
|
|
- private Screen mScreen;
|
32
|
31
|
private RnnToolBar mToolBar;
|
33
|
32
|
|
34
|
33
|
public RnnModal(BaseReactActivity context, Screen screen) {
|
35
|
34
|
super(context, R.style.Modal);
|
36
|
|
- mScreen = screen;
|
37
|
35
|
ModalController.getInstance().add(this);
|
38
|
|
- init(context);
|
|
36
|
+ init(context, screen);
|
39
|
37
|
}
|
40
|
38
|
|
41
|
39
|
@SuppressLint("InflateParams")
|
42
|
|
- private void init(final Context context) {
|
|
40
|
+ private void init(final Context context, Screen screen) {
|
43
|
41
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
44
|
42
|
mContentView = LayoutInflater.from(context).inflate(R.layout.modal_layout, null, false);
|
45
|
43
|
mToolBar = (RnnToolBar) mContentView.findViewById(R.id.toolbar);
|
46
|
44
|
mScreenStack = (ScreenStack) mContentView.findViewById(R.id.screenStack);
|
47
|
45
|
setContentView(mContentView);
|
48
|
|
- mToolBar.updateToolbar(mScreen);
|
49
|
|
- mScreenStack.push(mScreen, new RctView.OnDisplayedListener() {
|
|
46
|
+ mToolBar.update(screen);
|
|
47
|
+ mScreenStack.push(screen, new RctView.OnDisplayedListener() {
|
50
|
48
|
@Override
|
51
|
49
|
public void onDisplayed() {
|
52
|
50
|
Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_up);
|
|
@@ -59,32 +57,32 @@ public class RnnModal extends Dialog implements DialogInterface.OnDismissListene
|
59
|
57
|
if (SdkSupports.lollipop()) {
|
60
|
58
|
Window window = getWindow();
|
61
|
59
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
62
|
|
- StyleHelper.setWindowStyle(window, context.getApplicationContext(), mScreen);
|
|
60
|
+ StyleHelper.setWindowStyle(window, context.getApplicationContext(), screen);
|
63
|
61
|
}
|
64
|
62
|
}
|
65
|
63
|
|
66
|
64
|
public void push(Screen screen) {
|
67
|
65
|
mScreenStack.push(screen);
|
68
|
|
- mToolBar.updateToolbar(mScreen);
|
|
66
|
+ mToolBar.update(screen);
|
69
|
67
|
}
|
70
|
68
|
|
71
|
69
|
public Screen pop() {
|
72
|
|
- if (mScreenStack.getStackSize() > 1) {
|
73
|
|
- return mScreenStack.pop();
|
74
|
|
- } else {
|
|
70
|
+ if (mScreenStack.isEmpty()) {
|
75
|
71
|
ModalController.getInstance().remove();
|
76
|
72
|
super.onBackPressed();
|
77
|
73
|
return null;
|
|
74
|
+ } else {
|
|
75
|
+ return mScreenStack.pop();
|
78
|
76
|
}
|
79
|
77
|
}
|
80
|
78
|
|
81
|
79
|
@Override
|
82
|
80
|
public void onBackPressed() {
|
83
|
|
- if (mScreenStack.getStackSize() > 1) {
|
84
|
|
- mScreenStack.pop();
|
85
|
|
- } else {
|
|
81
|
+ if (mScreenStack.isEmpty()) {
|
86
|
82
|
ModalController.getInstance().remove();
|
87
|
83
|
super.onBackPressed();
|
|
84
|
+ } else {
|
|
85
|
+ mScreenStack.pop();
|
88
|
86
|
}
|
89
|
87
|
}
|
90
|
88
|
|