(misc) fix pb visibility

also work on fixing the update issues

Signed-off-by: androidacy-user <opensource@androidacy.com>
master
androidacy-user 1 year ago
parent 9cf494ac13
commit ec6bfd36e3

@ -257,6 +257,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
moduleViewListBuilder.addNotification(NotificationType.INSTALL_FROM_STORAGE); moduleViewListBuilder.addNotification(NotificationType.INSTALL_FROM_STORAGE);
ModuleManager.getINSTANCE().scan(); ModuleManager.getINSTANCE().scan();
ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilder::appendInstalledModules); ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilder::appendInstalledModules);
ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilderOnline::appendRemoteModules);
this.commonNext(); this.commonNext();
} }
@ -276,6 +277,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
NotificationType.NO_INTERNET.autoAdd(moduleViewListBuilderOnline); NotificationType.NO_INTERNET.autoAdd(moduleViewListBuilderOnline);
// hide progress bar is repo-manager says we have no internet // hide progress bar is repo-manager says we have no internet
if (!RepoManager.getINSTANCE().hasConnectivity()) { if (!RepoManager.getINSTANCE().hasConnectivity()) {
Timber.i("No connection, hiding progress");
runOnUiThread(() -> { runOnUiThread(() -> {
progressIndicator.setVisibility(View.GONE); progressIndicator.setVisibility(View.GONE);
progressIndicator.setIndeterminate(false); progressIndicator.setIndeterminate(false);
@ -300,12 +302,6 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
}); });
} }
moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter); 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!"); Timber.i("Scanning for modules!");
if (BuildConfig.DEBUG) Timber.i("Initialize Update"); 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"); if (BuildConfig.DEBUG) Timber.i("Apply");
RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilderOnline::appendRemoteModules); RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilderOnline::appendRemoteModules);
// logic to handle updateable modules
moduleViewListBuilder.applyTo(moduleListOnline, moduleViewAdapterOnline);
moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline); moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline);
// if moduleViewListBuilderOnline has the upgradeable notification, show a badge on the online repo nav item // if moduleViewListBuilderOnline has the upgradeable notification, show a badge on the online repo nav item
if (MainApplication.getINSTANCE().modulesHaveUpdates) { if (MainApplication.getINSTANCE().modulesHaveUpdates) {
@ -389,6 +377,12 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
Timber.i("Badge applied"); 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!"); Timber.i("Finished app opening state!");
} }
}, true); }, true);

@ -134,6 +134,7 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
} }
public Type getType() { public Type getType() {
Timber.d("Getting type for %s", this.moduleId);
if (this.footerPx != -1) { if (this.footerPx != -1) {
return Type.FOOTER; return Type.FOOTER;
} else if (this.separator != null) { } else if (this.separator != null) {
@ -141,6 +142,7 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
} else if (this.notificationType != null) { } else if (this.notificationType != null) {
return Type.NOTIFICATION; return Type.NOTIFICATION;
} else if (this.moduleInfo == null) { } else if (this.moduleInfo == null) {
Timber.d("Module %s is not installed", this.moduleId);
return Type.INSTALLABLE; return Type.INSTALLABLE;
} else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode || } else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode ||
(this.repoModule != null && this.moduleInfo.versionCode < (this.repoModule != null && this.moduleInfo.versionCode <
@ -152,8 +154,10 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
MainApplication.getINSTANCE().updateModuleCount++; MainApplication.getINSTANCE().updateModuleCount++;
} }
Timber.d("modulesHaveUpdates = %s, updateModuleCount = %s", MainApplication.getINSTANCE().modulesHaveUpdates, 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; return Type.UPDATABLE;
} else { } else {
Timber.d("Module %s is installed", this.moduleId);
return Type.INSTALLED; return Type.INSTALLED;
} }
} }

@ -42,11 +42,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminate="true"
android:scaleY="2" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent" app:layout_constraintTop_toBottomOf="parent"
app:layout_constraintTop_toTopOf="@+id/swipe_refresh" app:layout_constraintTop_toTopOf="@+id/root_container"
app:showAnimationBehavior="outward" /> app:showAnimationBehavior="outward" />
<LinearLayout <LinearLayout

Loading…
Cancel
Save