GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - WaveTechStudio/AndroidMVP: It is a simple MVP android project to understand the basic concept on MVP architecture.

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
screens
screens
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

AndroidMVP

It is a simple MVP android project to understand the basic concept on MVP architecture.

Prerequisites

Android SDK v28 Latest Android Build Tools Android Support Repository

Features

Simple login screen.

  • Fake API call for delay
  • View interaction with presenter
  • Presenter interaction with View/Model

Description

  • MainActivity implements MainActivityPresenter.View and overrides these methods.

      public interface View {
        void updateLoginResponse(String response);
        void clearInputFeilds();
        void showProgressBar();
        void hideProgressBar();
      }
    
  • You can add any dummy credentials on login screen to proceed View communicates to presenter.

      private MainActivityPresenter presenter = new MainActivityPresenter(this);
      presenter.loginAPICall("email", "password");  
    

    after calling this there would be a dummy loader for fake API call (see MainActivityPresenter class) and return response to View.

     mainActivityView.updateLoginResponse("Successfully logged in with these credentials: \n\n" + user.toString());
     mainActivityView.clearInputFeilds();
     mainActivityView.hideProgressBar();
    

Architecture used

Dependencies used

//App's dependencies
implementation 'com.android.support:appcompat-v7:28.0.0'

Presenter class for communication

public class MainActivityPresenter {
private User user;
private View mainActivityView;

public MainActivityPresenter(View mainActivityView) {
    this.user = new User();
    this.mainActivityView = mainActivityView;
} 

public void loginAPICall(String email, String password) {
    user.setEmail(email);
    user.setPassword(password);

    //Do API call here, I am adding dummy loader/for delay
    mainActivityView.showProgressBar();

    new CountDownTimer(3000, 1000) {

        public void onTick(long millisUntilFinished) {
        }

        public void onFinish() {

            mainActivityView.updateLoginResponse("Successfully logged in with these credentials: \n\n" + user.toString());

            mainActivityView.clearInputFeilds();
            mainActivityView.hideProgressBar();
        }
    }.start();
}
  public interface View {

     void updateLoginResponse(String response);

      void clearInputFeilds();

     void showProgressBar();

     void hideProgressBar();
  }
}

How to run a sample

  • Clone or download the project open it with Android Studio compile and run it will work.

Images


Author

Waheed Nazir

License

It is totally free to use. :)

About

It is a simple MVP android project to understand the basic concept on MVP architecture.

Topics

androidandroidstudiocommunicationhello-world-mvpmvpmvp-androidmvp-architecturesimple-mvp

Resources

Readme
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.