File tree 3 files changed +13
-10
lines changed
fragmentation_core/src/main/java/me/yokeyword/fragmentation
3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -247,19 +247,23 @@ void pop(final FragmentManager fm) {
247
247
@ Override
248
248
public void run () {
249
249
handleAfterSaveInStateTransactionException (fm , "pop()" );
250
- removeTopFragment (fm );
251
250
FragmentationMagician .popBackStackAllowingStateLoss (fm );
251
+ removeTopFragment (fm );
252
252
}
253
253
});
254
254
}
255
255
256
256
private void removeTopFragment (FragmentManager fm ) {
257
- ISupportFragment top = SupportHelper .getBackStackTopFragment (fm );
258
- if (top != null ) {
259
- fm .beginTransaction ()
260
- .setTransition (FragmentTransaction .TRANSIT_FRAGMENT_CLOSE )
261
- .remove ((Fragment ) top )
262
- .commitAllowingStateLoss ();
257
+ try { // Safe popBackStack()
258
+ ISupportFragment top = SupportHelper .getBackStackTopFragment (fm );
259
+ if (top != null ) {
260
+ fm .beginTransaction ()
261
+ .setTransition (FragmentTransaction .TRANSIT_FRAGMENT_CLOSE )
262
+ .remove ((Fragment ) top )
263
+ .commitAllowingStateLoss ();
264
+ }
265
+ } catch (Exception ignored ) {
266
+
263
267
}
264
268
}
265
269
Original file line number Diff line number Diff line change 7
7
*/
8
8
9
9
public abstract class Action {
10
- public static final int BUFFER_TIME = 60 ;
10
+ public static final long DEFAULT_POP_TIME = 300L ;
11
11
12
12
public static final int ACTION_NORMAL = 0 ;
13
13
public static final int ACTION_POP = 1 ;
Original file line number Diff line number Diff line change @@ -58,8 +58,7 @@ private void handleAction() {
58
58
private void executeNextAction (Action action ) {
59
59
if (action .action == Action .ACTION_POP ) {
60
60
ISupportFragment top = SupportHelper .getBackStackTopFragment (action .fragmentManager );
61
- if (top == null ) return ;
62
- action .duration = top .getSupportDelegate ().getExitAnimDuration ();
61
+ action .duration = top == null ? Action .DEFAULT_POP_TIME : top .getSupportDelegate ().getExitAnimDuration ();
63
62
}
64
63
65
64
mMainHandler .postDelayed (new Runnable () {
You can’t perform that action at this time.
0 commit comments