|
@@ -121,23 +121,26 @@ public class ScreenStack {
|
121
|
121
|
return;
|
122
|
122
|
}
|
123
|
123
|
|
124
|
|
- final Screen toRemove = stack.pop();
|
125
|
|
- final Screen previous = stack.peek();
|
126
|
|
-
|
127
|
124
|
if (keyboardVisibilityDetector.isKeyboardVisible()) {
|
128
|
125
|
keyboardVisibilityDetector.setKeyboardCloseListener(new Runnable() {
|
129
|
126
|
@Override
|
130
|
127
|
public void run() {
|
131
|
128
|
keyboardVisibilityDetector.setKeyboardCloseListener(null);
|
132
|
|
- swapScreens(animated, toRemove, previous, onScreenPop);
|
|
129
|
+ popInternal(animated, onScreenPop);
|
133
|
130
|
}
|
134
|
131
|
});
|
135
|
132
|
keyboardVisibilityDetector.closeKeyboard();
|
136
|
133
|
} else {
|
137
|
|
- swapScreens(animated, toRemove, previous, onScreenPop);
|
|
134
|
+ popInternal(animated, onScreenPop);
|
138
|
135
|
}
|
139
|
136
|
}
|
140
|
137
|
|
|
138
|
+ private void popInternal(final boolean animated, @Nullable final OnScreenPop onScreenPop) {
|
|
139
|
+ final Screen toRemove = stack.pop();
|
|
140
|
+ final Screen previous = stack.peek();
|
|
141
|
+ swapScreens(animated, toRemove, previous, onScreenPop);
|
|
142
|
+ }
|
|
143
|
+
|
141
|
144
|
private void swapScreens(boolean animated, final Screen toRemove, Screen previous, OnScreenPop onScreenPop) {
|
142
|
145
|
readdPrevious(previous);
|
143
|
146
|
previous.setStyle();
|
|
@@ -163,9 +166,28 @@ public class ScreenStack {
|
163
|
166
|
parent.addView(previous, 0);
|
164
|
167
|
}
|
165
|
168
|
|
166
|
|
- public void popToRoot(boolean animated) {
|
|
169
|
+ public void popToRoot(final boolean animated, @Nullable final OnScreenPop onScreenPop) {
|
|
170
|
+ if (keyboardVisibilityDetector.isKeyboardVisible()) {
|
|
171
|
+ keyboardVisibilityDetector.setKeyboardCloseListener(new Runnable() {
|
|
172
|
+ @Override
|
|
173
|
+ public void run() {
|
|
174
|
+ keyboardVisibilityDetector.setKeyboardCloseListener(null);
|
|
175
|
+ popToRootInternal(animated, onScreenPop);
|
|
176
|
+ }
|
|
177
|
+ });
|
|
178
|
+ keyboardVisibilityDetector.closeKeyboard();
|
|
179
|
+ } else {
|
|
180
|
+ popToRootInternal(animated, onScreenPop);
|
|
181
|
+ }
|
|
182
|
+ }
|
|
183
|
+
|
|
184
|
+ private void popToRootInternal(final boolean animated, @Nullable final OnScreenPop onScreenPop) {
|
167
|
185
|
while (canPop()) {
|
168
|
|
- pop(animated);
|
|
186
|
+ if (stack.size() == 2) {
|
|
187
|
+ popInternal(animated, onScreenPop);
|
|
188
|
+ } else {
|
|
189
|
+ popInternal(animated, null);
|
|
190
|
+ }
|
169
|
191
|
}
|
170
|
192
|
}
|
171
|
193
|
|