Simple example login page with 1 Button, 2 EditText and internet request. We take the data from the input fields and when you click on the button, send a request to the server and wait for an answer
- MVP(Moxy)
- REST(Retrofit2)
- ButterKnife
Description of the application code
Open
In the Manifest
add permission on the Internet and initialize MyApp.class. Read the comments in the code
In the gradle
add only dependencies on the Internet, ButterKnife , Moxy(MVP). Read the comments in the code
Aplication code
- is the code with the mechanics of the application.
Carefully read the code comments.
To make our code more flexible we apply the MVP architectural pattern. Divide application into parts:
model
- here we will work with the business logic of the applicationui
- here we will work with the UI "View-Presenter"utils
- here we will store our utilitiesMyApp.class
- root class in the application. Used for various flexible solutions and getting the context and any place of application
Package model
. Divide package into parts:
interactors
- Here we will work with entities.repositories
- here we work only with data. We take and place them in the database, internal storage or work with Internet requests
Package ui
. Divide package into parts:
login
- This package is called in accordance with the activation and in it are all the components necessary for the operation of this activitutils
- our utilities that only work with UI elementsBaseActivity.java
- Activity from which we extends all our Activity. It is good to keep the methods involved in different Activity
Package login
. Divide package into parts:
LoginActivity.java
- page with 1 Button, 2 EditText, progress and internet request.LoginActivityPresenter.java
- Element of the architectural pattern MVP. Binds business logic and viewLoginActivityView.java
- Element of the architectural pattern MVP. Binds Presenter and UI
Res
Change only Application Name