Android MVP with EventBus and Started Service

357
June 21, 2017, at 07:49 AM

Context

I've written an Android App to play single media file with its lyrics being displayed in the activity. The Activity screen also has a Play-Pause toggle button and a seek-bar to forward/rewind using drag. And the Activity launches the Started Service in its onCreate() method.

I'm attempting to layer the app confirming to MVP design pattern. I'm looking for sample code as guidance that fits this kind of a situation. Your help is much appreciated.

Things I'm keen to learn

  1. In case like mine where the Activity and the Started Service have two-way communications using EventBus, where does the code for EventBus listener lie in? Is Presenter not having any role in this?
  2. How is the code tested for EventBus related code - both unit and integrating testing?
  3. What code comes in Activity? What comes in Service? And What does the Presenter contract with Activity and Service look like? Lastly, how does the implementation of this presenter look like?
  4. How do you manage code for MenuOptions click events in the case of MVP?

Any reference to existing code-repository in Github/Bitbucket is really appreciated, if a detailed explanation hurts for you. Thanks in advance.

Rent Charter Buses Company
READ ALSO
Horizontally center first item of RecyclerView

Horizontally center first item of RecyclerView

I want to use a RecyclerView to emulate the behavior of a MultiViewPager, in particular I'd like to have the selected item at the center of the screen, including the first and the last element

462
Android O NotificationChannels default category

Android O NotificationChannels default category

I recently added a category to my notification categories and I was able to set what I wanted into that categoryHowever, another category is showing in lists of these categories under "uncategorized" which I believe it's the default category, image below:

315
get location updates from a service sometimes displays 0.0

get location updates from a service sometimes displays 0.0

I have some issues trying to put the service location on work, basicly i want to have a service that runs on background capturing location updates as specified from me (for tests i have it listen for 0 distance and 0 time so i can watch it working :))

313
App crashes when granted user permission

App crashes when granted user permission

Hi I've an app that scan QR codes, so it requires camera permissionsI've a surfaceView in which I display the camera preview

299