~/talk

MVP: The Life-Changing Magic of Tidying Up Your Android Presentation Layer

Talkat 360|AnDev 2018 · 2018-07-19..07-20· [android]
name:Yun Cheng
links:none on file
slides:none on file

Claim: converting a messy Android activity to MVP makes presentation logic testable and smaller. Steps: split into Model View Presenter and a lifecycle class, inject dependencies via a factory, keep the presenter a POJO with no Android classes, mock collaborators and run JUnit + Mockito unit tests on the JVM. Real result at RunKeeper: a trip list activity shrinks 747 to 132 lines and methods drop 27 to 12. Examples include a delete-trip flow and pull-to-refresh where presenter commands the view and mocked web client avoids real network calls.

AI-written summary · about

  1. 0:00Start
  2. 5:07Overview
  3. 8:23Normal Java Code
  4. 8:48Normal Unit Testing
  5. 9:02Android Unit Testing
  6. 10:56Trip List Activity (BEFORE)
  7. 11:19Separation of Concerns
  8. 12:17Model View Presenter
  9. 19:35Runkeeper Architecture
  10. 20:45Split up the Activity
  11. 21:47Activity-Presenter Relationship
  12. 22:09Presenter-View Relationship
  13. 22:41Trip List Activity (AFTER)
  14. 23:36Key Takeaway
  15. 24:27Lifecycle to Presenter
  16. 24:52View to Presenter
  17. 27:09Dependency Injection
  18. 28:34Presenter Factory
  19. 30:00Unit Testing Tools
  20. 30:15Mock Dependencies
  21. 30:39Inject Dependencies
  22. 31:14Example: Delete a Trip
  23. 32:52Example: Swipe to Refresh
  24. 34:23Write Tests
  25. 35:10How to Refactor to MVP
  26. 36:17Pros and cons
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.