diff --git a/app/src/main/java/com/javiersantos/mlmanager/activities/MainActivity.java b/app/src/main/java/com/javiersantos/mlmanager/activities/MainActivity.java index 391f38d..55b0829 100644 --- a/app/src/main/java/com/javiersantos/mlmanager/activities/MainActivity.java +++ b/app/src/main/java/com/javiersantos/mlmanager/activities/MainActivity.java @@ -125,13 +125,19 @@ private void setNavigationDrawer(AppAdapter appAdapter, AppAdapter appSystemAdap drawer = UtilsUI.setNavigationDrawer(this, getApplicationContext(), toolbar, appAdapter, appSystemAdapter, recyclerView); } - class getInstalledApps extends AsyncTask { - public getInstalledApps() {} + class getInstalledApps extends AsyncTask { + private Integer totalApps; + private Integer actualApps; + + public getInstalledApps() { + actualApps = 0; + } @Override protected Void doInBackground(Void... params) { final PackageManager packageManager = getPackageManager(); List packages = packageManager.getInstalledPackages(PackageManager.GET_META_DATA); + totalApps = packages.size(); // Get Sort Mode switch (appPreferences.getSortMode()) { default: @@ -207,13 +213,17 @@ public int compare(PackageInfo p1, PackageInfo p2) { } } } + + actualApps++; + publishProgress(Double.toString((actualApps * 100) / totalApps)); } return null; } @Override - protected void onProgressUpdate(PackageInfo... values) { - super.onProgressUpdate(values); + protected void onProgressUpdate(String... progress) { + super.onProgressUpdate(progress); + progressWheel.setProgress(Float.parseFloat(progress[0])); } @Override