YoKeyword / Fragmentation

[DEPRECATED] A powerful library that manage Fragment for Android
Apache License 2.0
9.72k stars 2.11k forks source link

让Fragmentation 继续走下去 #1237

Open JantHsueh opened 4 years ago

JantHsueh commented 4 years ago

我使用这个库,也有一年多了,当时还没有适配Androidx,我拉下代码后,进行了整改,也算是折腾了一番,后来作者也更新了Androidx。在使用中,发现一些很难处理的问题,在遇到这些问题后,我首先会去issue看看,很多人和我有同样的问题,但都没解决。在空闲的时候,看完了这个库,又把Fragment 源码基本打通了,才解决了之前很棘手的问题。

之前想着有作者这样的大神,我遇到的这些问题,对他来说肯定是小事,应该迟早会修复。所以也没想pull request。

直到一天,同事跟我说,作者不维护这个库了,我拉下代码,去看了看那些问题,并没有解决。想着还有不少人,被这些问题困扰着,所以我打算继续维护这个库,既然打算维护,后期如果有问题,我会尽快处理。

demo中的示例,和我项目的实际情况不太一样,如果不太懂原理,可能会出现一些错误。所以demo_wechat 我也更新了一些

为了表示对原作者的尊重,能保留原作者名称的我都保留了。我对引用方式进行了修改,因为可能这个域名,作者不再付费,或者有其他用途。避免使用上的冲突,我改为了自己的域名。(特意买了xuexuan.me 这个域名,后缀me 再次致敬作者)

implementation 'me.yokeyword:fragmentationx:1.0.2' 更改为 implementation 'me.xuexuan:fragmentationx:1.0.4'

implementation 'me.yokeyword:fragmentationx-core:1.0.2' 更改为 implementation 'me.xuexuan:fragmentationx-core:1.0.4'

implementation 'me.yokeyword:fragmentationx-swipeback:1.0.2' 更改为 implementation 'me.xuexuan:fragmentationx-swipeback:1.0.4'

这个库implementation 'me.yokeyword:eventbus-activity-scope:1.1.0' 在issue中没看到有相关的bug,所以我目前没有修改它,还是使用原作者的。现在使用eventbus 的人应该不多了吧

在下一个版本,我会先把这几个问题给解决了: #1139 #1183 #1194 #1185 #1159

这些问题的原理分析,我写了几篇文章: 1、Android 在动画结束回调onAnimationEnd()中remove view的崩溃解决方法及源码分析 2、Fragment.setNextAnim(int) on a null object 解决方法及源码详解 3、Fragment has not been attached yet 解决方法及源码详解

其中关于swipeback问题的原因,看一下代码的修改,相信小伙伴们会明白的

使用不规范造成的 #1177 (具体原因,可参考上面2、3 文章),可参考更新后的demo_wechat

很多问题描述,和这几个问题很像,我不确定是否是其他问题,还是没有描述清楚,所以没有提及。

山外有山,人外有人。比我水平高的人,肯定很多,所以我希望大家能一起参与进来,把这个库维护的更好,造福更多的Android同胞。

最后奉上代码:https://github.com/JantHsueh/Fragmentation 为了方便维护, 后续有新版本,就不再在这里说明了,建议大家start一下我fork的版本。欢迎 issues

star-andy commented 4 years ago

支持下

ray-yuruisoft commented 4 years ago

implementation 'me.xuexuan:fragmentationx:1.0.3' 你的库怎么 引不进来,缺少依赖

erosiners commented 4 years ago

老哥,你的库依赖有问题 ERROR: Failed to resolve: Fragmentation:fragmentation_core:unspecified

star-andy commented 4 years ago

@ray-yuruisoft @erosiners 是有问题 我是直接引用了implementation 'me.xuexuan:fragmentationx-core:1.0.3' 然后自己添加了 SupportActivity/Fragment

JantHsueh commented 4 years ago

@ray-yuruisoft @erosiners @qinyang1018 已经解决这个问题,版本改为1.0.4,例如: implementation 'me.xuexuan:fragmentationx:1.0.4'

erosiners commented 4 years ago

@JantHsueh 谢谢,已经可以了

NewBrandSTONE commented 4 years ago

大佬您好,我想咨询一下,之前在 issue 里看到很多反馈白屏的问题,您这有什么解决或者排查方法吗,十分感谢~

JantHsueh commented 4 years ago

@NewBrandSTONE 你好

关于白屏的问题,我认为是使用的问题吧,如果最上级FragmentManager (通过Activity获得的,不是在fragment通过getChildFragmentManager 获得的)管理的fragment只剩一个了,再调用有pop的操作,就会出现白屏。

项目中open的issue中,目前有6个是关于白屏的

1190 ,#1050, #1011 , #1151 和 #1150( 这两个是同一人提出的,应该算一种情况)

上面的这四种情况,和使用的版本、代码逻辑有关,所以我不好重现。我认为应该都是使用上的问题。

1083 这个好像特殊一点,但是我按照评论里的步骤,也是没有重现

我在长期使用中,并未出现白屏的问题。也可能确实有问题,但我现在没有发现,如果有同学遇到了,可详细描述一下复现步骤或提供简单的demo,我会尽快处理。

最后想多唠叨一下: 关于白屏的描述,有的同学看到屏幕有大块白,就说是白屏,其实是有底部的导航bottom(我公司的测试和产品,就是这样描述),这种情况,其实就是 #1139 的问题。

OneTake1998 commented 4 years ago

使用androidx包出这个问题,v7包没问题

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mall/com.example.mall.MainActivity}: java.lang.ClassCastException: com.example.mall.MainActivity cannot be cast to me.yokeyword.fragmentation.SupportActivity

JantHsueh commented 4 years ago

@OneTake1998 详见 https://github.com/JantHsueh/Fragmentation/issues/1

xiaosalanqiao commented 4 years ago

支持一下

hothotsavage commented 4 years ago

顶起来

LGYG commented 4 years ago

支持大佬!

koala0x commented 4 years ago

star

JantHsueh commented 4 years ago

1.0.6 已发布 1、去除了对mStopped 和 mStateSaved的依赖、删除FragmentationMagician (更加贴近Android 源码的思想)

2、优化 VisibleDelegate TransactionDelegate

解决 #1234 #1222

tyzero commented 3 years ago

废弃可能是作者太忙了吧,支持你继续维护!

wickqin commented 3 years ago

支持

djf123 commented 3 years ago

顶一下,不然不维护太可惜了

CAnonymous8 commented 3 years ago

大佬您好,我想咨询一下,之前在 issue 里看到很多反馈白屏的问题,您这有什么解决或者排查方法吗,十分感谢~

https://github.com/YoKeyword/Fragmentation/issues/1130#issuecomment-886559697 解决了小问题, 这里看看

HolmesJJ commented 2 years ago

mark一下,感谢大佬继续维护

aa86799 commented 2 years ago

用了四五年了,在想,是不是俺也来接个力

esirong commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

957699zjs commented 2 weeks ago

你好,现在是不维护了吗,为什么我安装不下来 implementation("me.xuexuan:fragmentationx:1.0.6") implementation("me.xuexuan:fragmentationx-swipeback:1.0.6")