Skip to content

Commit 54ff12f

Browse files
authored
Merge pull request #782 from YoKeyword/dev
Dev
2 parents 327de61 + d1d8f2c commit 54ff12f

File tree

7 files changed

+30
-22
lines changed

7 files changed

+30
-22
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ The first demo shows the basic usage of the library. The second one shows the wa
4646
**1、build.gradle**
4747
````gradle
4848
// appcompat-v7 is required
49-
compile 'me.yokeyword:fragmentation:1.2.6'
49+
compile 'me.yokeyword:fragmentation:1.2.7'
5050
5151
// If you don't want to extends SupportActivity/Fragment and would like to customize your own support, just rely on fragmentation-core
52-
// compile 'me.yokeyword:fragmentation-core:1.2.6'
52+
// compile 'me.yokeyword:fragmentation-core:1.2.7'
5353
5454
// To get SwipeBack feature, rely on both fragmentation & fragmentation-swipeback
55-
compile 'me.yokeyword:fragmentation:1.2.6'
55+
compile 'me.yokeyword:fragmentation:1.2.7'
5656
// Swipeback is based on fragmentation. Refer to SwipeBackActivity/Fragment for your Customized SupportActivity/Fragment
57-
compile 'me.yokeyword:fragmentation-swipeback:1.2.6'
57+
compile 'me.yokeyword:fragmentation-swipeback:1.2.7'
5858
5959
// To simplify the communication between Fragments.
6060
compile 'me.yokeyword:eventbus-activity-scope:1.1.0'

README_CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ A powerful library that manage Fragment for Android!
5252
**1. 项目下app的build.gradle中依赖:**
5353
````gradle
5454
// appcompat-v7包是必须的
55-
compile 'me.yokeyword:fragmentation:1.2.5'
55+
compile 'me.yokeyword:fragmentation:1.2.7'
5656
5757
// 如果不想继承SupportActivity/Fragment,自己定制Support,可仅依赖:
58-
// compile 'me.yokeyword:fragmentation-core:1.2.5'
58+
// compile 'me.yokeyword:fragmentation-core:1.2.7'
5959
6060
// 如果想使用SwipeBack 滑动边缘退出Fragment/Activity功能,完整的添加规则如下:
61-
compile 'me.yokeyword:fragmentation:1.2.6'
61+
compile 'me.yokeyword:fragmentation:1.2.7'
6262
// swipeback基于fragmentation, 如果是自定制SupportActivity/Fragment,则参照SwipeBackActivity/Fragment实现即可
63-
compile 'me.yokeyword:fragmentation-swipeback:1.2.6'
63+
compile 'me.yokeyword:fragmentation-swipeback:1.2.7'
6464
6565
// Activity作用域的EventBus,更安全,可有效避免after onSavenInstanceState()异常
6666
compile 'me.yokeyword:eventbus-activity-scope:1.1.0'

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,12 @@ void popTo(final String targetFragmentTag, final boolean includeTargetFragment,
238238
@Override
239239
public void run() {
240240
doPopTo(targetFragmentTag, includeTargetFragment, afterPopTransactionRunnable, fm, popAnim);
241+
242+
if (afterPopTransactionRunnable != null) {
243+
afterPopTransactionRunnable.run();
244+
}
241245
}
242246
});
243-
244-
if (afterPopTransactionRunnable != null) {
245-
afterPopTransactionRunnable.run();
246-
}
247247
}
248248

249249
/**

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
}

fragmentation_swipeback/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Activity内Fragment数大于1时,滑动返回的是Fragment,否则滑动返
1010
1、项目下app的build.gradle中依赖:
1111
````gradle
1212
// appcompat v7包是必须的
13-
compile 'me.yokeyword:fragmentation:1.2.6'
14-
compile 'me.yokeyword:fragmentation-swipeback:1.2.6'
13+
compile 'me.yokeyword:fragmentation:1.2.7'
14+
compile 'me.yokeyword:fragmentation-swipeback:1.2.7'
1515
````
1616
2、如果Activity也需要支持SwipeBack,则继承SwipeBackActivity:
1717
````java

fragmentation_swipeback/src/main/java/me/yokeyword/fragmentation_swipeback/core/SwipeBackActivityDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public boolean swipeBackPriority() {
5858

5959
private void onActivityCreate() {
6060
mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
61-
mActivity.getWindow().getDecorView().setBackgroundDrawable(null);
61+
mActivity.getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT);
6262
mSwipeBackLayout = new SwipeBackLayout(mActivity);
6363
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
6464
mSwipeBackLayout.setLayoutParams(params);

0 commit comments

Comments
 (0)