Sam
05/27/2021, 2:32 AM*Modular Android* App *Architecture*
, so I would like to discuss these two solutions:
• Problems:
◦ Target : Module A
send Event to show Dialog
on the screens and exclude a some screens.
◦ Features divided into separate modules.
◦ Example Requirement: Class SocketService in Module A
get events from server in Application class , we use ActivityLifecycleCallbacks to get Current Activity
, We do not display dialog on Search Screens, Map Screen, … etc ( 2 cases : several screens or large screens should not show dialog)
• Solution 1:
◦ Create an Interface DoNotShowDialog
in Common Module
◦ You will implement this interface to prevent to display Dialog
in each modules/Activity class
• Solution 2:
▪︎ Module A
use activity.javaClass.simpleName to compare with array of strings
▪︎ Example :
arrayListOf("SearchActivity", "MapActivity").contains(this.javaClass.simpleName)
Which solution will you choose?
Thanks.pepos
05/28/2021, 5:04 AMSam
05/28/2021, 8:32 AMPros
Example:
1. Easy to write UnitTest -> compare class name
2. Some features do not include common module code
3. It is not impact to any feature modules code -> No more write code in each modules.pepos
05/28/2021, 8:46 AMpepos
05/28/2021, 8:48 AMSam
05/28/2021, 8:49 AMSam
05/28/2021, 8:50 AM*Modular Android* App *Architecture*
Concept?Sam
05/28/2021, 8:53 AMpepos
05/28/2021, 6:00 PM