Kore/doc/diagrams/sequence/org.xbmc.kore.ui.abstractinfo.puml

113 lines
2.3 KiB
Plaintext
Raw Normal View History

Refactored AbstractDetailsFragment This introduces the MVC model to details fragments. It moves as much view and control code out of the concrete fragments into the abstract classes. * Added UML class and sequence diagrams under doc/diagrams to clarify the new setup * Introduces new abstract classes * AbstractFragment class to hold the DataHolder * AbstractInfoFragment class to display media information * AbstractAddtionalInfoFragment class to allow *InfoFragments to add additional UI elements and propagate refresh requests. See for an example TVShowInfoFragment which adds TVShowProgressFragment to display next episodes and season progression. * Introduces new RefreshItem class to encapsulate all refresh functionality from AbstractDetailsFragment * Introduces new SharedElementTransition utility class to encapsulate all shared element transition code * Introduces new CastFragment class to encapsulate all code for displaying casts reducing code duplication * Introduces DataHolder class to replace passing the ViewHolder from the *ListFragment to the *DetailsFragment or *InfoFragment * Refactored AbstractDetailsFragment into two classes: o AbstractDetailsFragment: for fragments requiring a tab bar o AbstractInfoFragment: for fragments showing media information We used to use <NAME>DetailsFragments for both fragments that show generic info about some media item and fragments that hold all details for some media item. For example, artist details showed artist info and used tabs to show artist albums and songs as well. Now Details fragments are used to show all details, Info fragments only show media item information like description, title, rating, etc. * Moved swiperefreshlayout code from AbstractCursorListFragment to AbstractListFragment
2016-12-30 09:27:24 +01:00
@startuml
Actor Activity
participant "AbstractFragment" as A
participant "AbstractInfoFragment" as B
participant "ConcreteInfoFragment" as C
participant "AbstractAdditionalInfoFragment" as D
participant "ConcreteAdditionalInfoFragment" as E
participant "RefreshItem" as F
Activity -> A: onCreate
activate A
A -> A: setup DataHolder
activate A
deactivate A
deactivate A
Activity -> B: onCreateView
activate B
B -> B: set poster size to square or rectangular
B -> B: connect this class as swipe refresh listener
B -> C: getAdditionalInfoFragment()
activate C
C -> B: return AbstractAdditionalInfoFragment or null if none
deactivate C
B -> C: setupMediaActionBar()
activate C
C -> B: setOn...Listener(View.OnClickListener)
activate B
C -> B: setOn...Listener(View.OnClickListener)
C -> B: ...
note over C: setting a listener for each\naction button required, will\nmake it visible in the UI
note over B: Make button(s) visible\nin action bar and\nattach listener
B --> C
deactivate B
deactivate C
B -> C: setupFAB(ImageButton FAB)
activate C
note over C: add a listener for the FAB if needed
C -> B: return true to enable the FAB, false to disable it
B -> B: updateView(dataholder)
deactivate C
note left : updateView uses dataholder to fill views
activate B
deactivate B
B --> Activity: return view
deactivate B
Activity -> B: onStart
Activate B
B -> B: bind to library sync service
activate B
deactivate B
deactivate B
Activity -> B: onResume
Activate B
B -> B: register refresh item if it exists
activate B
deactivate B
deactivate B
== UI active ==
...
note over B: user requests a refresh
Activity -> B: onRefresh
activate B
B -> B: getRefreshItem()
B -> C: if no refreshItem then call createRefreshItem()
activate B
activate C
C -> B: return refresh item
deactivate C
deactivate B
B ->> F: startSync()
activate F
F -> F: start LibrarySyncService
B -> D: refresh()
activate D
D -> E: refresh()
activate E
E --> D
deactivate E
D --> B
deactivate D
deactivate B
...
F -> C: onSyncProcessEnded(MediaSyncEvent)
deactivate F
activate C
note over C: update dataholder
C -> B: updateView(dataholder)
deactivate C
...
== UI inactive ==
Activity -> B: onPause
activate B
B -> B: unregister refresh item if it exists
activate B
deactivate B
deactivate B
Activity -> B: onStop
activate B
B -> B: unbind from library sync service
activate B
deactivate B
deactivate B
@enduml