Flipboard/bottomsheet

Add option to keep state between sheet displays

开放

#92 创建于 2015年12月2日

 (2 条评论) (0 个反应) (0 位负责人)Java (609 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (4,540 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Due to the asynchronous handling when dismissing/showing the view it is impossible to have listeners set after re-showing.

First time:

  • add state change listener
  • show view -> listener gets called

Second time:

  • add listener
  • show view (it is already showing) -> calls dismiss and returns
  • gets dismissed -> removes all listeners (including new ones)
  • runnable shows view again -> no listeners

Adding the listeners after calling show also doesn't work (because the runnable to show again is asynchronously called from the dismiss animation callback)

My idea would be to store a local copy of the listeners in the dismiss method and clean the global fields. Then from the animation listener:

  • When it wasn't cancelled call the local listeners.
  • If it was cancelled put the local listeners back into the global fields. (To remain the state before the dismiss)

贡献者指南