From ec6bfd36e39ffe7fa8fc9a7a25f49d87c26526df Mon Sep 17 00:00:00 2001 From: androidacy-user Date: Sat, 29 Apr 2023 21:41:22 -0400 Subject: [PATCH] (misc) fix pb visibility also work on fixing the update issues Signed-off-by: androidacy-user --- .../java/com/fox2code/mmm/MainActivity.java | 22 +++++++------------ .../com/fox2code/mmm/module/ModuleHolder.java | 4 ++++ app/src/main/res/layout/activity_main.xml | 4 ++-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/fox2code/mmm/MainActivity.java b/app/src/main/java/com/fox2code/mmm/MainActivity.java index 8e16b08..1221889 100644 --- a/app/src/main/java/com/fox2code/mmm/MainActivity.java +++ b/app/src/main/java/com/fox2code/mmm/MainActivity.java @@ -257,6 +257,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe moduleViewListBuilder.addNotification(NotificationType.INSTALL_FROM_STORAGE); ModuleManager.getINSTANCE().scan(); ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilder::appendInstalledModules); + ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilderOnline::appendRemoteModules); this.commonNext(); } @@ -276,6 +277,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe NotificationType.NO_INTERNET.autoAdd(moduleViewListBuilderOnline); // hide progress bar is repo-manager says we have no internet if (!RepoManager.getINSTANCE().hasConnectivity()) { + Timber.i("No connection, hiding progress"); runOnUiThread(() -> { progressIndicator.setVisibility(View.GONE); progressIndicator.setIndeterminate(false); @@ -300,12 +302,6 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe }); } moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter); - runOnUiThread(() -> { - progressIndicator.setIndeterminate(false); - progressIndicator.setMax(PRECISION); - // Fix insets not being accounted for correctly - updateScreenInsets(getResources().getConfiguration()); - }); Timber.i("Scanning for modules!"); if (BuildConfig.DEBUG) Timber.i("Initialize Update"); @@ -367,16 +363,8 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe } } } - runOnUiThread(() -> { - progressIndicator.setProgressCompat(PRECISION, true); - progressIndicator.setVisibility(View.GONE); - searchView.setEnabled(true); - updateScreenInsets(getResources().getConfiguration()); - }); if (BuildConfig.DEBUG) Timber.i("Apply"); RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilderOnline::appendRemoteModules); - // logic to handle updateable modules - moduleViewListBuilder.applyTo(moduleListOnline, moduleViewAdapterOnline); moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline); // if moduleViewListBuilderOnline has the upgradeable notification, show a badge on the online repo nav item if (MainApplication.getINSTANCE().modulesHaveUpdates) { @@ -389,6 +377,12 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe Timber.i("Badge applied"); }); } + runOnUiThread(() -> { + progressIndicator.setProgressCompat(PRECISION, true); + progressIndicator.setVisibility(View.GONE); + searchView.setEnabled(true); + updateScreenInsets(getResources().getConfiguration()); + }); Timber.i("Finished app opening state!"); } }, true); diff --git a/app/src/main/java/com/fox2code/mmm/module/ModuleHolder.java b/app/src/main/java/com/fox2code/mmm/module/ModuleHolder.java index 0226d5f..da9541d 100644 --- a/app/src/main/java/com/fox2code/mmm/module/ModuleHolder.java +++ b/app/src/main/java/com/fox2code/mmm/module/ModuleHolder.java @@ -134,6 +134,7 @@ public final class ModuleHolder implements Comparable { } public Type getType() { + Timber.d("Getting type for %s", this.moduleId); if (this.footerPx != -1) { return Type.FOOTER; } else if (this.separator != null) { @@ -141,6 +142,7 @@ public final class ModuleHolder implements Comparable { } else if (this.notificationType != null) { return Type.NOTIFICATION; } else if (this.moduleInfo == null) { + Timber.d("Module %s is not installed", this.moduleId); return Type.INSTALLABLE; } else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode || (this.repoModule != null && this.moduleInfo.versionCode < @@ -152,8 +154,10 @@ public final class ModuleHolder implements Comparable { MainApplication.getINSTANCE().updateModuleCount++; } Timber.d("modulesHaveUpdates = %s, updateModuleCount = %s", MainApplication.getINSTANCE().modulesHaveUpdates, MainApplication.getINSTANCE().updateModuleCount); + Timber.d("Module %s has update", this.moduleId); return Type.UPDATABLE; } else { + Timber.d("Module %s is installed", this.moduleId); return Type.INSTALLED; } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 8667cd9..7237318 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -42,11 +42,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:indeterminate="true" - android:scaleY="2" + android:visibility="visible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="parent" - app:layout_constraintTop_toTopOf="@+id/swipe_refresh" + app:layout_constraintTop_toTopOf="@+id/root_container" app:showAnimationBehavior="outward" />