This folder contains the internal parts of the Account Selection component. Files, classes and methods defined in here are not meant to be used outside of this package.
This document provides a brief overview of the architecture.
This component follows the typical MVC structure that is widely used in Chrome on Android. The MVC structures separates logic from representation:
//src/ui/android/java/src/org/chromium/ui/modelutil/
A typical request to the Account Selection component API that intends to change the visible appearance involves all component parts. For example if the API caller requests to show new accounts:
accounts
.accounts
for display.SHEET_ITEMS
property was changed.The model holds state and event listeners connected to the view. An MCP automatically notifies listener about any change made to a property. To automate this Observer structure, the model is a ListModel
as defined in //src/ui/android/java/src/org/chromium/ui/modelutil/
. The items in this model are themselves of type PropertyModel
. The properties for these are located in the static AccountSelectionProperties
class.
The items in the list can be of three types:
The controller of this model implements the AccountSelectionComponent interface as defined in public/
and contains all logic. The controller consists of two parts:
We use a simple LinearLayout
as the top-level view for this component which contains the list view for sheet items. This view is them displayed inside the bottom sheet via AccountSelectionBottomSheetContent
. The rest of the logic is split in two parts:
SimpleRecyclerViewAdapter
and is responsible to bind changes to the items in the model list to the RecyclerView inside the bottom sheet.BottomSheetContent
interface and facilitates display of our view inside the BottomSheetController
. The bottom sheet controller instance itself is controlled by the mediator to create and modify the bottom sheet where accounts are displayed.