MVP to MVVM Android

99封情书 提交于 2019-12-30 10:27:50

问题


One guy from here told me that MVVM is better than MVP he told me many pros and many conts, but I'd like to know if my MVP is well done or if you know any other way maybe to convert to MVVM. It's a Sign in with Google MVP. I won't put all of the code but I'll put the folders and little explanation :

-Model

  • User (Simple user pojo class)

-Presenter

  • I have an object of my IGoogleLoginView where I call the methods, but here I have the logic createGoogleClient(),signIn(),onActivityResult(),onStop(), onStart(), onDestroy() all of those methods are from my interface inside the same package IGoogleSignIn
  • IGoogleSignIn - All of the methods from the Presenter class

-View

  • googleSignIn()
  • goToMainActivity()

And then I have my MainActivity where I call the methods...

I'm wondering how different could be to do that on MVVM and what would be the changes to do it, and also is something that it's not on the good place?


回答1:


Here is a knowledge base to get started, you should make your own project and implement these software architectures in order to adopt the one that works for you and your project:

Android Architecture Blueprints

Reactive Apps with MODEL-VIEW-INTENT - PART1 - Model



来源:https://stackoverflow.com/questions/52029984/mvp-to-mvvm-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!