Skip to content

Commit db30f69

Browse files
committed
Fix #653
1 parent 31587d4 commit db30f69

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/Action.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ public Action() {
2424

2525
public Action(int action) {
2626
this.action = action;
27-
if (action == ACTION_POP_MOCK) {
28-
duration = BUFFER_TIME;
29-
}
3027
}
3128

3229
public Action(int action, FragmentManager fragmentManager) {

fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/ActionQueue.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,26 @@ private void executeNextAction(Action action) {
5959
if (action.action == Action.ACTION_POP) {
6060
ISupportFragment top = SupportHelper.getTopFragment(action.fragmentManager);
6161
if (top == null) return;
62-
long duration = top.getSupportDelegate().getExitAnimDuration();
63-
action.duration = duration + Action.BUFFER_TIME;
62+
action.duration = top.getSupportDelegate().getExitAnimDuration() + Action.BUFFER_TIME;
6463
}
6564

65+
final int currentAction = action.action;
6666
mMainHandler.postDelayed(new Runnable() {
6767
@Override
6868
public void run() {
69-
mQueue.poll();
70-
handleAction();
69+
if (currentAction == Action.ACTION_POP || currentAction == Action.ACTION_POP_MOCK) {
70+
// For compatibility with v4-27+, see #653
71+
mMainHandler.post(new Runnable() {
72+
@Override
73+
public void run() {
74+
mQueue.poll();
75+
handleAction();
76+
}
77+
});
78+
} else {
79+
mQueue.poll();
80+
handleAction();
81+
}
7182
}
7283
}, action.duration);
7384
}

0 commit comments

Comments
 (0)