Add infinite progressbar before the first time apps are displayed
This commit is contained in:
parent
a10cc837df
commit
93a8e57b09
|
@ -87,10 +87,6 @@ public class AppListFragment extends Fragment implements ComputeAppListTask.List
|
|||
|
||||
applistBinding.appList.setLayoutManager(new LinearLayoutManager(context));
|
||||
if (packageManager != null) {
|
||||
if(startupRefresh) {
|
||||
startRefresh();
|
||||
startupRefresh = false;
|
||||
}
|
||||
applistBinding.noPackageManager.setVisibility(View.GONE);
|
||||
adapter = new ApplicationListAdapter(context, onAppClickListener);
|
||||
applistBinding.appList.setAdapter(adapter);
|
||||
|
@ -182,6 +178,10 @@ public class AppListFragment extends Fragment implements ComputeAppListTask.List
|
|||
|
||||
private void displayAppListAsync() {
|
||||
applistBinding.noAppFound.setVisibility(View.GONE);
|
||||
if (applications.isEmpty()) {
|
||||
applistBinding.retrieveApp.setVisibility(View.VISIBLE);
|
||||
applistBinding.logo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
new ComputeAppListTask(
|
||||
new WeakReference<>(packageManager),
|
||||
|
@ -193,9 +193,17 @@ public class AppListFragment extends Fragment implements ComputeAppListTask.List
|
|||
@Override
|
||||
public void onAppsComputed(List<ApplicationViewModel> apps) {
|
||||
this.applications = apps;
|
||||
applistBinding.retrieveApp.setVisibility(View.GONE);
|
||||
applistBinding.logo.setVisibility(View.GONE);
|
||||
applistBinding.noAppFound.setVisibility(apps.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
if(adapter != null) {
|
||||
adapter.displayAppList(apps);
|
||||
}
|
||||
if(!apps.isEmpty()) {
|
||||
if(startupRefresh) {
|
||||
startRefresh();
|
||||
startupRefresh = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,24 @@
|
|||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp" />
|
||||
<ProgressBar
|
||||
android:id="@+id/retrieve_app"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/logo" />
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
|
|
Loading…
Reference in New Issue