AccountObserver listeners were being triggered correctly, however, during every time
we open HomeFragment, home menu gets re-created, which causes us to re-run the initialization
block. Before this patch, the init block would never touch the account manager.
After this patch, it will query it if account manager has already been initialized.
`init` blocks are executed before `val` initialization which is declared afterwards
in the class. In this case, we had `quitItem` and `reconnectToSyncItem` as lazy,
but declared after the `init` block which may need them. And so, while this compiles
just fine, in practice we run into an NPE as the `init` block tries to get the lazy's value.
Simply re-ordering initialization fixes the problem.
In order to hide the time it takes for the account manager to be initialized
(which always involves disk IO, and often network IO), let's kick it off
after "visual completeness".
This makes sure that for most users, by the time they interact with the account
manager-related functionality (e.g. in Settings), it's ready to go.
Also, for signed-in users, this will establish background sync workers.
This refactor "reverses" relationship between these two classes, allowing
HomeMenu to inform its parent, HomeFragment, of any changes to the menu.
Once that's in place, we start observing account manager changes (once its ready)
for account problems.
This solves two problems:
- initialization of the account manager is no longer necessary to build a home menu
- home menu now starts observing changes to the account manager's state (before it was static)
Instead of always kicking off accountManager's init and telling it to sync right away in
'onResume', we move these tasks to some abstract point later on, whenever account manager
is available.
This replaces the StartupTaskManager we had with a more general class.
New implementation is a thread-safe "gated task executor", which either
runs the task right away if it's marked as 'ready', or queries it to be
executed later on.
This ability to either execute or queue a task will be useful later on in the
commit series.
AndroidAssetDispatcher class dispatcher was attempting to open a local asset with a query suffix from the request. If query suffix is found, remove it. Re-enable saveLoginFromPromptTest() and doNotSaveLoginFromPromptTest()
* let animation in top toolbar mode play nicely.
* remove duplicate methods, make code readable.
* migrate getToolbarNavOptions method to BrowserAnimator, one method to rule them all.
* Update linting
Co-authored-by: ahmedmamdouh13 <ahmedmamdouh13196@gmail.com>
- Increased atp switch size to be consistent with `dimen/tracking_protection_item_height`(48dp).
- Cut out redundant traversal of TextViews in SwitchWithTraversal as per https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md
- Reuse `QuickSettingsText.Icon` style on the switch component to be consistent with other items in the component_tracking_protection_panel.xml
- Added new string resources for textOff and textOn state to get appropriate screen reader description (unsure of the translation/localisation process here!)