Square通过“屏幕外片段重现生机”和“无法直接控制动画”意味着什么?

时间:2014-08-20 19:03:13

标签: android square mortar square-flow

在发现Android库和框架时,我遇到了Square's blog post on Flow and Mortar。作者指出,开发流动和砂浆的一些动机是因为

  

......屏幕碎片神秘地在奇怪的时刻恢复生机   ......没有直接控制动画

我无法理解作者的意思。谁能详细阐述作者所说的这两个痛点?

1 个答案:

答案 0 :(得分:6)

我建议你阅读Square's new blog post。它清楚地描述了碎片'由于它的问题复杂的生命周期,依赖于实现的错误,交易和创造魔法。关键的想法是There is no need for new APIs; everything we needed was there from the very beginning: activities, views, and layout inflaters

考虑您的问题:

  

屏幕碎片神秘地在奇怪的时刻恢复生机

从帖子引用:If you ever found yourself with a stale unattached fragment recreated on rotation, you know what I'm talking about. ...when restoring the activity instance state, the fragment manager may try to recreate an instance of that fragment class using reflection.

  

无法直接控制动画

关于片段交易:...committing a transaction is async and posted at the end of the main thread handler queue. This can leave your app in an unknown state when receiving multiple click events or during configuration changes.