From 93a8e57b09cd8fcb934d8c1ae2dbdf38bda30033 Mon Sep 17 00:00:00 2001 From: Schoumi Date: Tue, 30 Jul 2019 17:26:39 +0200 Subject: [PATCH] Add infinite progressbar before the first time apps are displayed --- .../fragments/AppListFragment.java | 16 ++++++++++++---- app/src/main/res/layout/applist.xml | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/AppListFragment.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/AppListFragment.java index cca45bf..6219ef9 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/AppListFragment.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/AppListFragment.java @@ -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 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; + } + } } } diff --git a/app/src/main/res/layout/applist.xml b/app/src/main/res/layout/applist.xml index 9eff7d3..7af3678 100644 --- a/app/src/main/res/layout/applist.xml +++ b/app/src/main/res/layout/applist.xml @@ -57,6 +57,24 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> + +