简体   繁体   English

我们是否需要用于Android MVP模式的登录以及Signup Activity的其他Presenter?

[英]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.

相关问题 我们应该检查Presenter或MVP模式的Activity中的视图可见性吗? - Should we check for view visibility in Presenter or Activity in MVP pattern? Android MVP 从 Presenter 打开 Activity,反模式? - Android MVP open Activity from Presenter, anti-pattern? 为什么我们对MVP模式使用Base View和Base Presenter? - Why do we use Base View and Base Presenter for MVP pattern? 演示者在 Android MVP 模式中具有处理程序 - Presenter having Handler in Android MVP pattern Android MVP-活动应该是视图还是演示者? - Android MVP - should an Activity be a View or Presenter? Android MVP - 从活动展示器到片段展示器的数据 - Android MVP - Data from activity presenter to fragment presenter Android MVP - 如何在活动演示者和片段演示者之间进行通信 - Android MVP - How to communicate between activity presenter and fragment presenter 在MVP模式下,Presenter应该是Android应用程序的活动性还是功能性 - In MVP pattern, should Presenter be activity-wise or functionality-wise of Android app 我们是否需要在MVP结构中的Model和Presenter之间注入(例如Dagger2)? - Do we need injection (Dagger2 for example) between Model and Presenter in MVP structure? 在适用于Android的MVP设计模式中,我们将企业登录名放在哪里? - In MVP Design Pattern for android, where we put Business login in?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM