From d91dffcffa3d282f8197ee4746aade19399d08e4 Mon Sep 17 00:00:00 2001 From: YoKey Date: Sun, 25 Feb 2018 17:05:00 +0800 Subject: [PATCH 1/4] Fix #778, fix `afterTransactionRunnable` is called before `popTo()` --- .../me/yokeyword/fragmentation/TransactionDelegate.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fragmentation_core/src/main/java/me/yokeyword/fragmentation/TransactionDelegate.java b/fragmentation_core/src/main/java/me/yokeyword/fragmentation/TransactionDelegate.java index f820c2a4..38d5c8b9 100755 --- a/fragmentation_core/src/main/java/me/yokeyword/fragmentation/TransactionDelegate.java +++ b/fragmentation_core/src/main/java/me/yokeyword/fragmentation/TransactionDelegate.java @@ -238,12 +238,12 @@ void popTo(final String targetFragmentTag, final boolean includeTargetFragment, @Override public void run() { doPopTo(targetFragmentTag, includeTargetFragment, afterPopTransactionRunnable, fm, popAnim); + + if (afterPopTransactionRunnable != null) { + afterPopTransactionRunnable.run(); + } } }); - - if (afterPopTransactionRunnable != null) { - afterPopTransactionRunnable.run(); - } } /** From 31587d42092af0ad2eacda74ccbb020a26507e3e Mon Sep 17 00:00:00 2001 From: YoKey Date: Sun, 25 Feb 2018 17:13:09 +0800 Subject: [PATCH 2/4] Fix #695, fix black background when closing SwipebackActivity with Animations or Transitions --- .../fragmentation_swipeback/core/SwipeBackActivityDelegate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fragmentation_swipeback/src/main/java/me/yokeyword/fragmentation_swipeback/core/SwipeBackActivityDelegate.java b/fragmentation_swipeback/src/main/java/me/yokeyword/fragmentation_swipeback/core/SwipeBackActivityDelegate.java index 689f4c34..b7f60861 100644 --- a/fragmentation_swipeback/src/main/java/me/yokeyword/fragmentation_swipeback/core/SwipeBackActivityDelegate.java +++ b/fragmentation_swipeback/src/main/java/me/yokeyword/fragmentation_swipeback/core/SwipeBackActivityDelegate.java @@ -58,7 +58,7 @@ public boolean swipeBackPriority() { private void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - mActivity.getWindow().getDecorView().setBackgroundDrawable(null); + mActivity.getWindow().getDecorView().setBackgroundColor(Color.TRANSPARENT); mSwipeBackLayout = new SwipeBackLayout(mActivity); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); mSwipeBackLayout.setLayoutParams(params); From 8af4dc540b210d3c28b66c87d0f6b75b8c7f0d02 Mon Sep 17 00:00:00 2001 From: YoKey Date: Sun, 25 Feb 2018 20:36:23 +0800 Subject: [PATCH 3/4] Fix #653, fix `startWithPop()` may cause unexpected issues --- .../yokeyword/fragmentation/queue/Action.java | 3 --- .../fragmentation/queue/ActionQueue.java | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/Action.java b/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/Action.java index 1d3a9054..b9f8e90a 100644 --- a/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/Action.java +++ b/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/Action.java @@ -24,9 +24,6 @@ public Action() { public Action(int action) { this.action = action; - if (action == ACTION_POP_MOCK) { - duration = BUFFER_TIME; - } } public Action(int action, FragmentManager fragmentManager) { diff --git a/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/ActionQueue.java b/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/ActionQueue.java index 8da23b4c..765b3838 100644 --- a/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/ActionQueue.java +++ b/fragmentation_core/src/main/java/me/yokeyword/fragmentation/queue/ActionQueue.java @@ -59,15 +59,26 @@ private void executeNextAction(Action action) { if (action.action == Action.ACTION_POP) { ISupportFragment top = SupportHelper.getTopFragment(action.fragmentManager); if (top == null) return; - long duration = top.getSupportDelegate().getExitAnimDuration(); - action.duration = duration + Action.BUFFER_TIME; + action.duration = top.getSupportDelegate().getExitAnimDuration() + Action.BUFFER_TIME; } + final int currentAction = action.action; mMainHandler.postDelayed(new Runnable() { @Override public void run() { - mQueue.poll(); - handleAction(); + if (currentAction == Action.ACTION_POP || currentAction == Action.ACTION_POP_MOCK) { + // For compatibility with v4-27+, see #653 + mMainHandler.post(new Runnable() { + @Override + public void run() { + mQueue.poll(); + handleAction(); + } + }); + } else { + mQueue.poll(); + handleAction(); + } } }, action.duration); } From d1d8f2c904fb9d7678c86a0d30eab152bed6609b Mon Sep 17 00:00:00 2001 From: YoKey Date: Sun, 25 Feb 2018 21:28:39 +0800 Subject: [PATCH 4/4] Update to 1.2.7 --- README.md | 8 ++++---- README_CN.md | 8 ++++---- fragmentation_swipeback/README.md | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 012cba88..2fd44175 100755 --- a/README.md +++ b/README.md @@ -46,15 +46,15 @@ The first demo shows the basic usage of the library. The second one shows the wa **1、build.gradle** ````gradle // appcompat-v7 is required -compile 'me.yokeyword:fragmentation:1.2.6' +compile 'me.yokeyword:fragmentation:1.2.7' // If you don't want to extends SupportActivity/Fragment and would like to customize your own support, just rely on fragmentation-core -// compile 'me.yokeyword:fragmentation-core:1.2.6' +// compile 'me.yokeyword:fragmentation-core:1.2.7' // To get SwipeBack feature, rely on both fragmentation & fragmentation-swipeback -compile 'me.yokeyword:fragmentation:1.2.6' +compile 'me.yokeyword:fragmentation:1.2.7' // Swipeback is based on fragmentation. Refer to SwipeBackActivity/Fragment for your Customized SupportActivity/Fragment -compile 'me.yokeyword:fragmentation-swipeback:1.2.6' +compile 'me.yokeyword:fragmentation-swipeback:1.2.7' // To simplify the communication between Fragments. compile 'me.yokeyword:eventbus-activity-scope:1.1.0' diff --git a/README_CN.md b/README_CN.md index f5817f00..19371fbb 100644 --- a/README_CN.md +++ b/README_CN.md @@ -52,15 +52,15 @@ A powerful library that manage Fragment for Android! **1. 项目下app的build.gradle中依赖:** ````gradle // appcompat-v7包是必须的 -compile 'me.yokeyword:fragmentation:1.2.5' +compile 'me.yokeyword:fragmentation:1.2.7' // 如果不想继承SupportActivity/Fragment,自己定制Support,可仅依赖: -// compile 'me.yokeyword:fragmentation-core:1.2.5' +// compile 'me.yokeyword:fragmentation-core:1.2.7' // 如果想使用SwipeBack 滑动边缘退出Fragment/Activity功能,完整的添加规则如下: -compile 'me.yokeyword:fragmentation:1.2.6' +compile 'me.yokeyword:fragmentation:1.2.7' // swipeback基于fragmentation, 如果是自定制SupportActivity/Fragment,则参照SwipeBackActivity/Fragment实现即可 -compile 'me.yokeyword:fragmentation-swipeback:1.2.6' +compile 'me.yokeyword:fragmentation-swipeback:1.2.7' // Activity作用域的EventBus,更安全,可有效避免after onSavenInstanceState()异常 compile 'me.yokeyword:eventbus-activity-scope:1.1.0' diff --git a/fragmentation_swipeback/README.md b/fragmentation_swipeback/README.md index 5293661f..fd7621c0 100644 --- a/fragmentation_swipeback/README.md +++ b/fragmentation_swipeback/README.md @@ -10,8 +10,8 @@ Activity内Fragment数大于1时,滑动返回的是Fragment,否则滑动返 1、项目下app的build.gradle中依赖: ````gradle // appcompat v7包是必须的 -compile 'me.yokeyword:fragmentation:1.2.6' -compile 'me.yokeyword:fragmentation-swipeback:1.2.6' +compile 'me.yokeyword:fragmentation:1.2.7' +compile 'me.yokeyword:fragmentation-swipeback:1.2.7' ```` 2、如果Activity也需要支持SwipeBack,则继承SwipeBackActivity: ````java