Centre the first-run progress bar in the main screen.
Previously it was shown at the top, just below 'updating repositories', now it is
in the centre of the entire view. To make this simpler, the view was also changed
from a LinearLayout
to a ConstraintLayout
. Note that unlike the old RelativeLayout
,
when we ask the @id/app_list
to be below the @id/banner_updating_repos
, it works as
expected when the banner is not shown. That is to say, it will correctly anchor the
top of the app list to the top parent component if the banner is not shown, but will
sit it below the banner if the banner is shown.
This also has the added benefit of removing a small amount of view-related code from procedural Java code, keeping it in the declarative layout .xml
files.
Existing | New |
---|---|
![]() |
![]() |
Random other information unrelated to this MR
While testing this change, I noticed that both this and the existing master
both have a quirk with regards to when they decide to hide this initial-update-progress-bar. They wait for a onLoadFinished()
callback and then show something over the top (either the empty list state or the app list). However, the onLoadFinished()
callback is invoked multiple times even though the loader is only created once. The reason for this is because the CursorLoader
listens to notifyChange()
calls on the AppProvider.getContentUri()
. Because these providers URIs are hierarchical, this causes all cursors from the AppProvider
to re-query the database, resulting in a new refreshed list being displayed.
This is convenient because the view updates automatically whenever new data is inserted into the database or changed/removed. However in practice, this means that the onLoadComplete()
method in the WhatsNewViewBinder
gets called multiple times before the actual update is completed (e.g. when F-Droid scans for installed apps after it is first installed this triggers a notifyChagne()
, as do some other things.
A future MR will find a more appropriate time to hide this progress bar, probably by listening for when the UpdateService
completes it's initial update).