Skip to content

JDSCaram/Android_Kotlin_MVP_Repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kotlin_mvp_dagger_repository

This Android Kotlin project using an classic architecture MVP with repository pattern, DI (Dagger2), Retrofit and Room.

I am providing the Repository with all necessary dependencies

@Singleton
@Component(modules = [
    ApplicationModule::class,
    RepositoryModule::class,
    RetrofitModule::class,
    SharedPrefsModule::class,
    RoomModule::class])
interface ApplicationComponent : AndroidInjector<SampleApplication> {
    fun inject(applicationContext: Context)
    fun provideRepository(): Repository
}

Repository.

Alt text

Samples:

//Acesso Local (Database):
mRepository.local()?.getDatabase()?.breedDao()?.insertBreeds(entities)
                
//Acesso Local (Prefs):
repository.local()?
                .getPrefs();
                
//Acesso Remote (WebService)
mRepository.remote()?.getRetrofit()?.create(API::class.java)

Project Contains.

Room Persistence Library: https://developer.android.com/topic/libraries/architecture/room.html
Retrofit: http://square.github.io/retrofit/
MVP: https://medium.com/android-dev-br/desmistificando-o-mvc-e-mvp-no-android-abe927d01df7
RxAndroid : https://github.com/ReactiveX/RxAndroid
Butter Knife : http://jakewharton.github.io/butterknife/
Dagger 2 : https://google.github.io/dagger/

About

A simple project Android using Kotlin with classic architecture MVP, Repository pattern and DI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors