简体   繁体   English

MVP到MVVM Android

[英]MVP to MVVM Android

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. 来自这里的一个人告诉我,MVVM比MVP更好,他告诉我许多专业人士和许多人,但我想知道我的MVP是否做得好还是你知道其他任何方式可能转换为MVVM。 It's a Sign in with Google MVP. 这是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) 用户(简单用户pojo类)

-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 我有一个IGoogleLoginView的对象,我调用这些方法,但这里我有逻辑createGoogleClient()signIn()onActivityResult()onStop()onStart()onDestroy()所有这些方法都来自我的interface在同一个包IGoogleSignIn
  • IGoogleSignIn - All of the methods from the Presenter class IGoogleSignIn - Presenter类中的所有方法

-View -视图

  • googleSignIn() googleSignIn()
  • goToMainActivity() goToMainActivity()

And then I have my MainActivity where I call the methods... 然后我有我的MainActivity,我称之为方法...

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? 我想知道在MVVM上做到这一点会有多么不同,做什么会有什么变化,还有什么不在好的地方?

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 Android架构蓝图

Android架构蓝图

Reactive Apps with MODEL-VIEW-INTENT - PART1 - Model 使用MODEL-VIEW-INTENT的反应性应用程序 - 第1部分 - 模型

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM