[英]Do we need different Presenter for Login as well as Signup Activity in android MVP pattern?
I am implementing MVP design architecture in my android application. 我在我的android应用程序中实现MVP设计架构。 I am new to design patterns and haven't use any in my previous project. 我是设计模式的新手,在以前的项目中没有使用任何模式。 I want to know that whether we need different presenters for different activities such as let's say, Login and Sign up, or just one presenter handling both activities. 我想知道我们是否需要不同的主持人来进行不同的活动,例如“登录并注册”,还是仅需要一位主持人来处理这两项活动。 If yes, then please guide me through this process and a sample code with folder structure will be very helpful. 如果是,那么请引导我完成此过程,带有文件夹结构的示例代码将非常有帮助。 Thank You. 谢谢。
I've just implemented an MVP app with this two screens, one for login and one for sign up or register, both of they are activitys. 我刚刚用这两个屏幕实现了一个MVP应用程序,一个用于登录,一个用于注册或注册,它们都是活动。
Yes, you can use one single presenter for many diferents views but the poing of using MVP or another presentation layer is making the views independents from the logic and in my opinion independets to make it easier of using tests. 是的,您可以为多个不同的视图使用一个演示者,但是使用MVP或另一个演示层的目的是使视图与逻辑和我认为独立的视图无关,从而使测试的使用变得更加容易。
In my case I did one view and presenter diferents for each activity. 在我的情况下,我做了一个视图,并为每个活动演示了不同的内容。
Here you can find a basic explanation of the MVP: https://antonioleiva.com/mvp-android/ 在这里,您可以找到有关MVP的基本说明: https : //antonioleiva.com/mvp-android/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.