I'm implementing Android Java application in which there are two types of User. Each of them have permission to use some of the application features but not all of them.
My current implementation includes setting of all components visibility inside one activity every time user is redirected to that same activity. Example:
protected void onCreate(Bundle savedInstanceState) {
if(!userLoggedIn()) {
// Set all visibilities
} else if (loggedUserType() == UserType.USER1) {
// Set all visibilities
} else {
// Set all visibilities
}
}
Is there standard approach in android java applications that state how to deal with this issue? If not, is there any better approach than the one shown in example above?