MVP template

0. The layout will look like this:

Layout will have 2 EditTexts and 1 Button:
- Project tree will look like this:

- First create All Interfaces:
1.1. IUser.java
The Model will have a methods that will provide Email and Password, and check for a Valid data entering:
1.2. ILoginPresenter.java
The Presenter will receive data (email and password) from View and will handle it.
1.3. ILoginView.java
ILoginView method in View will received already handled message and will display it, for example in Toast.
2. Let’s create User.java
This class will have a constructor that receives 2 Strings.
We need to implement IUser interface and Override methods.
3. Create LoginPresenter.java
Implement earlier created interface ILoginPresenter, that is we will override onLogin() method.
In onLogin() method we receive 2 Strings, we create User object and check if the entered data is Valid.
If the Data would be Valid, we would like to inform View (the user of App) that everything is OK.
In order to inform the View, we must get the reference to it, so we will create constructor with the parameter ILoginView.
Through this interface we can access to available Public methods, in our case onLoginResult().
So through this object ILoginView we send to View’s method (onLoginResult()) a String.
4. MainActivity.java
We findViewByIds of all views.
Create Button onClick listener.
As we click on Button we must send data from EditTexts to Presenter, which will handle it.
Presenter will check, if the entered data is Valid or not and send back to View the information.
In order send information to Presenter we need to create Presenter Object.
Then in the Button is clicked, we will send data through the Presenter’s method onLogin(String email, String Password).
Presenter handles it, and sends back.
In order to handle the data from Presenter we need to implement interface ILoginView.
As we implement this interface, we need to override the method onLoginResult(String message).
We can show the received message in Toast.
5. Can find this project in GitHub.
