All Projects → ahmedeltaher → Android Mvp Architecture

ahmedeltaher / Android Mvp Architecture

Licence: apache-2.0
MVP + Kotlin + Retrofit2 + Dagger2 + Coroutines + Anko + Kotlin-Android-Extensions + RX-java + Mockk + Espresso + Junit5

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Android Mvp Architecture

Kotlinrxmvparchitecture
Clean MVP Architecture with RxJava + Dagger2 + Retrofit2 + Mockito + Fresco + EasiestGenericRecyclerAdapter using Kotlin. Includes Unit Tests(Kotlin Tests)!
Stars: ✭ 94 (+14.63%)
Mutual labels:  dagger2, mvp, clean-architecture, mvp-architecture, unit-testing, retrofit2
Kotlinmvparchitecture
Clean MVP Architecture with Dagger2 + Retrofit2 + Mockito + Fresco + EasiestGenericRecyclerAdapter using Kotlin. Added Unit Tests(Kotlin Tests)!
Stars: ✭ 143 (+74.39%)
Mutual labels:  dagger2, mvp, clean-architecture, mvp-architecture, unit-testing, retrofit2
Android Architecture Components Kotlin
Clean code App with Kotlin and Android Architecture Components
Stars: ✭ 23 (-71.95%)
Mutual labels:  dagger2, clean-architecture, android-architecture, clean-code, retrofit2
AndroidMVPArchitecture
Android MVP architecture sample project with or without RxJava and Dagger2 and Kotlin
Stars: ✭ 78 (-4.88%)
Mutual labels:  clean-code, mvp, dagger2, mvp-architecture, retrofit2
Android tmdb clean architecture
Showcase of clean architecture concepts along with Continuous Integration and Development for modular Android applications. Includes test suits (functional and unit tests) along with code coverage.
Stars: ✭ 63 (-23.17%)
Mutual labels:  dagger2, mvp, clean-architecture, android-architecture, retrofit2
Fineract-CN-mobile
DEPRECATED project - Check the Apache fineract-cn-mobile project instead
Stars: ✭ 17 (-79.27%)
Mutual labels:  unit-testing, mvp, dagger2, mvp-architecture, retrofit2
Mvparms
⚔️ A common architecture for Android applications developing based on MVP, integrates many open source projects, to make your developing quicker and easier (一个整合了大量主流开源项目高度可配置化的 Android MVP 快速集成框架).
Stars: ✭ 10,146 (+12273.17%)
Mutual labels:  dagger2, mvp, android-architecture, mvp-architecture, retrofit2
Armscomponent
📦 A complete android componentization solution, powered by MVPArms (MVPArms 官方快速组件化方案).
Stars: ✭ 1,664 (+1929.27%)
Mutual labels:  dagger2, mvp, android-architecture, mvp-architecture, retrofit2
GithubApp-android-architecture
Let's learn a deep look at the Android architecture
Stars: ✭ 16 (-80.49%)
Mutual labels:  mvp, clean-architecture, android-architecture, dagger2, retrofit2
mvp-android-template
MVP Android Template to give you a Quick Head Start for your next Android Project. It implements MVP Architecture using Dagger2, Room, RxJava2 , Retrofit2
Stars: ✭ 20 (-75.61%)
Mutual labels:  mvp, dagger2, mvp-architecture, retrofit2
MVPArchitecture
Android MVP architecture in Kotlin using Dagger2, RxJava2, Retrofit2 and so on
Stars: ✭ 27 (-67.07%)
Mutual labels:  clean-architecture, dagger2, mvp-architecture, retrofit2
Clean Marvel Kotlin
This repository contains a detailed sample app that implements Clean architecture and MVP in Kotlin using RxJava2, Retrofit
Stars: ✭ 27 (-67.07%)
Mutual labels:  mvp, clean-architecture, dagger2, retrofit2
Android Mvp Mvvm Flytour
🔥🔥🔥 FlyTour是Android MVVM+MVP+Dagger2+Retrofit+RxJava+组件化+插件组成的双编码架构+双工程架构+双语言Android应用开发框架,通过不断的升级迭代该框架已经有了十个不同的版本,5.0之前工程架构采用gradle配置实现组件化,5.0之后的工程架构采用VirtualAPK实现了插件化,5.0之前采用Java编码实现,5.0之后采用Kotlin编码实现,编码架构由MVVM和MVP组成,工程架构和编码架构及编码语言开发者可根据自己具体的项目实际需求去决定选择使用,该框架是Android组件化、Android插件化、Android MVP架构、Android MVVM架构的集大成者,帮助你快速的搭建自己的App项目开发框架,以便把主要的精…
Stars: ✭ 2,948 (+3495.12%)
Mutual labels:  dagger2, android-architecture, mvp-architecture, retrofit2
Weather-Guru-MVP
Sample Material-design Android weather application build with MVP architectural approach using Dagger2, RxJava2, Retrofit2, Event-Bus, GreenDao, Butterknife, Lottie etc.
Stars: ✭ 15 (-81.71%)
Mutual labels:  mvp, dagger2, mvp-architecture, retrofit2
KotlinMvpTemplateGenerator
Android Studio template for Kotlin with MVP + Dagger2 + Retrofit2
Stars: ✭ 65 (-20.73%)
Mutual labels:  mvp, clean-architecture, dagger2, mvp-architecture
Stocker
Stocker is a currency monitoring app. It offers instant currency rates of banks.
Stars: ✭ 38 (-53.66%)
Mutual labels:  dagger2, clean-architecture, unit-testing, retrofit2
UTair-MVP-Sample
Android Clean Architecture + MVP Sample written in Kotlin
Stars: ✭ 27 (-67.07%)
Mutual labels:  mvp, clean-architecture, android-architecture, dagger2
Business Search App Java
Showcases object oriented programming in Java, Java Swing, Kotlin, and Android
Stars: ✭ 53 (-35.37%)
Mutual labels:  dagger2, mvp, clean-architecture, retrofit2
Tvflix
TvFlix android app using Dagger Hilt, Coroutines, Flow, KTX, Jetpack(Room, ViewModel, Paging3, Lifecycle) based on MVVM architecture purely written in Kotlin
Stars: ✭ 286 (+248.78%)
Mutual labels:  dagger2, clean-code, unit-testing, retrofit2
Crazydaily
[开源项目] 一款程序员日常放松的App,基于Material Design + MVP-Clean + Weex + Flutter + RxJava2 + Retrofit + Dagger2 + Glide + Okhttp + MTRVA + BRVAH + 炫酷控件 + 炫酷动画
Stars: ✭ 294 (+258.54%)
Mutual labels:  dagger2, mvp, clean-architecture, retrofit2

Model–view–presenter (MVP)

Android Arsenal kotlin coroutines ANKO Mockk Junit5 Espresso Dagger 2 Kotlin-Android-Extensions MVVM MVP

androkotlinandroid-mvp-flow

Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern which mostly used for building user interfaces. In MVP, the presenter assumes the functionality of the “middle-man”. In MVP, all presentation logic is pushed to the presenter. Check here for MVVM

What is Coroutines ?

Coroutines :
Is light wight threads for asynchronous programming, Coroutines not only open the doors to
asynchronous programming, but also provide a wealth of other possibilities such as concurrency, actors, etc.

Coroutines VS RXJava

They're different tools with different strengths. Like a tank and a cannon, they have a lot of overlap but are more or less desirable under different circumstances.
- Coroutines Is light wight threads for asynchronous programming.
- RX-Kotlin/RX-Java is functional reactive programming, its core pattern relay on
observer design pattern, so you can use it to handle user interaction with UI while you
still using coroutines as main core for background work.

How does Coroutines concept work ?

  • Kotlin coroutine is a way of doing things asynchronously in a sequential manner. Creating a coroutine is a lot cheaper vs creating a thread.

When I can choose Coroutines or RX-Kotlin to do some behaviour ?

  • Coroutines : When we have concurrent tasks , like you would fetch data from Remote connections
    , database , any background processes , sure you can use RX in such cases too, but it looks like
    you use a tank to kill ant.
  • RX-Kotlin : When you would to handle stream of UI actions like : user scrolling , clicks ,
    update UI upon some events .....ect .

What is the Coroutines benefits?

  • Writing an asynchronous code is sequential manner.
  • Costing of create coroutines are much cheaper to crate threads.
  • Don't be over engineered to use observable pattern, when no need to use it.
  • parent coroutine can automatically manage the life cycle of its child coroutines for you.

Handle Retrofit with Coroutines

8399

  • Add Coroutines to your gradle file
// Add Coroutines  
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'  
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'  
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.2'  
// Add Retrofit2  
implementation 'com.squareup.retrofit2:retrofit:2.6.2'  
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'  
implementation 'com.squareup.okhttp3:okhttp:4.2.2'  
  • Make Retrofit Calls.
@GET("topstories/v2/home.json")  
fun fetchNews(): Call<NewsModel>  
  • With async we create new coroutine and returns its future result as an implementation of [Deferred].
  • The coroutine builder called launch allow us to start a coroutine in background and keep working in the meantime.
  • so async will run in background then return its promised result to parent coroutine which
    created by launch.
  • when we get a result, it is up to us to do handle the result.
launch {  
  try {  
        val serviceResponse: Data? = withContext(Dispatchers.IO) { dataRepository.requestNews()  
       }  
  if (serviceResponse?.code == Error.SUCCESS_CODE) {  
            val data = serviceResponse.data  
            callback.onSuccess(data as NewsModel)  
        } else {  
            callback.onFail(serviceResponse?.error)  
        }  
    } catch (e: Exception) {  
            callback.onFail(Error(e))  
    }  
}  

Keep your code clean according to MVP

  • yes , RXAndroid is easy , powerful , but you should know in which MVP
    layer you will put it .
  • for observables which will emit data stream , it has to be in your
    data layer , and don't inform those observables any thing else like
    in which thread those will consume , cause it is another
    responsibility , and according to Single responsibility principle
    in SOLID (object-oriented design) , so don't break this concept by
    mixing every thing due to RXAndroid ease .

MVP


LICENSE

Copyright [2016] [Ahmed Eltaher]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].