Where to handle CAB actions of a list item that are common with detail?

隐身守侯 提交于 2019-12-25 07:24:17

问题


lets say I have master/detail pattern using fragments, so as usual, the detail fragment would be inside new activity on a phone and on a tablet it would be inside the previous activity that list fragment is in also. Old stuff.

I have some actions to perform on the detail, like share, it would be actionbar item. Old stuff.

But now, I want to implement Contextual ActionBar, or a dialog, it doesnt really matter in my opinion, that would allow sharing right from the list.

My question is, where should I have that sharing code? I want to avoid duplicates. In my head, it cant really be a callback because the detail can be inside the dual activity or inside its single activity. Its just really confusing to me how should I do this.

Hope you get it. Thanks!


回答1:


where should I have that sharing code? I want to avoid duplicates

Taking a guess that "that sharing code" is your ACTION_SEND invocation, since that is only a half-dozen lines of code or so, tuck that in a static method somewhere that can be accessed by your detail fragment and by the activity that is hosting the list on smaller screens.



来源:https://stackoverflow.com/questions/14990269/where-to-handle-cab-actions-of-a-list-item-that-are-common-with-detail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!