Skip to content

Commit e43ead1

Browse files
committed
fix #949 #942 extraTransaction().setCustomAnimations() exitAnimation is not working
1 parent b66a4eb commit e43ead1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

fragmentation_core/src/main/java/me/yokeyword/fragmentation/TransactionDelegate.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,23 @@ void pop(final FragmentManager fm) {
247247
@Override
248248
public void run() {
249249
handleAfterSaveInStateTransactionException(fm, "pop()");
250-
removeTopFragment(fm);
251250
FragmentationMagician.popBackStackAllowingStateLoss(fm);
251+
removeTopFragment(fm);
252252
}
253253
});
254254
}
255255

256256
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+
263267
}
264268
}
265269

0 commit comments

Comments
 (0)