Hello, good morning everybody.
I have implement
*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.