Skip to content

Commit

Permalink
Merge pull request #961 from YoKeyword/dev
Browse files Browse the repository at this point in the history
v1.3.6
  • Loading branch information
YoKeyword authored Aug 14, 2018
2 parents 018bd92 + e43ead1 commit c0fed6f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,23 @@ void pop(final FragmentManager fm) {
@Override
public void run() {
handleAfterSaveInStateTransactionException(fm, "pop()");
removeTopFragment(fm);
FragmentationMagician.popBackStackAllowingStateLoss(fm);
removeTopFragment(fm);
}
});
}

private void removeTopFragment(FragmentManager fm) {
ISupportFragment top = SupportHelper.getBackStackTopFragment(fm);
if (top != null) {
fm.beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
.remove((Fragment) top)
.commitAllowingStateLoss();
try { // Safe popBackStack()
ISupportFragment top = SupportHelper.getBackStackTopFragment(fm);
if (top != null) {
fm.beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
.remove((Fragment) top)
.commitAllowingStateLoss();
}
} catch (Exception ignored) {

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

public abstract class Action {
public static final int BUFFER_TIME = 60;
public static final long DEFAULT_POP_TIME = 300L;

public static final int ACTION_NORMAL = 0;
public static final int ACTION_POP = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ private void handleAction() {
private void executeNextAction(Action action) {
if (action.action == Action.ACTION_POP) {
ISupportFragment top = SupportHelper.getBackStackTopFragment(action.fragmentManager);
if (top == null) return;
action.duration = top.getSupportDelegate().getExitAnimDuration();
action.duration = top == null ? Action.DEFAULT_POP_TIME : top.getSupportDelegate().getExitAnimDuration();
}

mMainHandler.postDelayed(new Runnable() {
Expand Down

0 comments on commit c0fed6f

Please sign in to comment.