3. New Activity Guide - addam01/android-rx-retro-kickstart GitHub Wiki
This tutorial is to set up new activities and new packages.
If you are not planning to have multiple services or multiple API calling, I would recommend creating just one package to place your classes and activities in it.
-
Create a package of your own, if you haven't done it yet.
-
Create 5 sub packages,
- Activities
- Models
- Views
- Presenter
- retroRest
-
Create an activity in the Activities package.
-
Create a presenter class in the Presenter package.
-
Create a view interface, extend the view on Core package like so
import com.example.addam.skeleton_app.core.View; public interface SampleView extends View {}
-
Your presenter class implements Presenters from Core with the type of your view above like so
public class SamplePresenter implements Presenters<SampleView> {}
-
All of your API request and respond Objects goes to Model (Google up MVC style). Use JSONSchema2Pojo to convert your JSON to GSON annotation.
-
All your REST threadings goes into the retroRest, we'll cover that in the next tutorial.
Basically your classes should related like this
Activity -> Binds -> View -> Into -> Presenters
Presenter -> Handles logic for -> Acvtivity -> By handling events through -> View
Models -> Holds object for API request and response for -> Presenters -> In API threading from -> retroRest