preface

This article is based on the Github project Ninja2005/AndroidMVVM.

Android MVVM is a rapid development framework based on MVVM framework, based on Jetpack component DataBinding+LiveData+ViewModel, integrating Retrofit+RxJava network module.

The framework processes

Characteristics of framework

  • Jetpack components

    1. DataBinding
    2. Lifecycles
    3. LiveData
    4. Navigation
    5. Paging
    6. Room
    7. ViewModel
  • Popular frameworks

    1. Retrofit + OKHTTP +rxJava is responsible for network requests
    2. Gson is responsible for parsing the JSON data
    3. Glide is responsible for loading images;
  • The base class encapsulates

    1. BaseActivity
    2. BaseFragment
    3. BaseViewModel
  • Global operations

    1. Global Activity stack management
    2. LoggingInterceptor intercepts network request logs globally
    3. Global exception capture, abnormal procedures will not crash, return to the last interface.
    4. Using androidx
    5. Do not use the kotlin
  • The Paging component

    1. Network only and Network & Database are realized

interface

1. Login interface (login with any account) 2. My warehouse list 3. 4. My following list 5. Warehouse Details 6. User detailsCopy the code

Pay attention to

1. The interface uses GitHub API V3 with a single-IP limit of 60 requests per hourCopy the code