Skip to content

Commit ec6bfd3

Browse files
(misc) fix pb visibility
also work on fixing the update issues Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 9cf494a commit ec6bfd3

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

app/src/main/java/com/fox2code/mmm/MainActivity.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public void onPathReceived(String path) {
257257
moduleViewListBuilder.addNotification(NotificationType.INSTALL_FROM_STORAGE);
258258
ModuleManager.getINSTANCE().scan();
259259
ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilder::appendInstalledModules);
260+
ModuleManager.getINSTANCE().runAfterScan(moduleViewListBuilderOnline::appendRemoteModules);
260261
this.commonNext();
261262
}
262263

@@ -276,6 +277,7 @@ public void commonNext() {
276277
NotificationType.NO_INTERNET.autoAdd(moduleViewListBuilderOnline);
277278
// hide progress bar is repo-manager says we have no internet
278279
if (!RepoManager.getINSTANCE().hasConnectivity()) {
280+
Timber.i("No connection, hiding progress");
279281
runOnUiThread(() -> {
280282
progressIndicator.setVisibility(View.GONE);
281283
progressIndicator.setIndeterminate(false);
@@ -300,12 +302,6 @@ public void commonNext() {
300302
});
301303
}
302304
moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter);
303-
runOnUiThread(() -> {
304-
progressIndicator.setIndeterminate(false);
305-
progressIndicator.setMax(PRECISION);
306-
// Fix insets not being accounted for correctly
307-
updateScreenInsets(getResources().getConfiguration());
308-
});
309305

310306
Timber.i("Scanning for modules!");
311307
if (BuildConfig.DEBUG) Timber.i("Initialize Update");
@@ -367,16 +363,8 @@ public void commonNext() {
367363
}
368364
}
369365
}
370-
runOnUiThread(() -> {
371-
progressIndicator.setProgressCompat(PRECISION, true);
372-
progressIndicator.setVisibility(View.GONE);
373-
searchView.setEnabled(true);
374-
updateScreenInsets(getResources().getConfiguration());
375-
});
376366
if (BuildConfig.DEBUG) Timber.i("Apply");
377367
RepoManager.getINSTANCE().runAfterUpdate(moduleViewListBuilderOnline::appendRemoteModules);
378-
// logic to handle updateable modules
379-
moduleViewListBuilder.applyTo(moduleListOnline, moduleViewAdapterOnline);
380368
moduleViewListBuilderOnline.applyTo(moduleListOnline, moduleViewAdapterOnline);
381369
// if moduleViewListBuilderOnline has the upgradeable notification, show a badge on the online repo nav item
382370
if (MainApplication.getINSTANCE().modulesHaveUpdates) {
@@ -389,6 +377,12 @@ public void commonNext() {
389377
Timber.i("Badge applied");
390378
});
391379
}
380+
runOnUiThread(() -> {
381+
progressIndicator.setProgressCompat(PRECISION, true);
382+
progressIndicator.setVisibility(View.GONE);
383+
searchView.setEnabled(true);
384+
updateScreenInsets(getResources().getConfiguration());
385+
});
392386
Timber.i("Finished app opening state!");
393387
}
394388
}, true);

app/src/main/java/com/fox2code/mmm/module/ModuleHolder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,15 @@ public boolean hasFlag(int flag) {
134134
}
135135

136136
public Type getType() {
137+
Timber.d("Getting type for %s", this.moduleId);
137138
if (this.footerPx != -1) {
138139
return Type.FOOTER;
139140
} else if (this.separator != null) {
140141
return Type.SEPARATOR;
141142
} else if (this.notificationType != null) {
142143
return Type.NOTIFICATION;
143144
} else if (this.moduleInfo == null) {
145+
Timber.d("Module %s is not installed", this.moduleId);
144146
return Type.INSTALLABLE;
145147
} else if (this.moduleInfo.versionCode < this.moduleInfo.updateVersionCode ||
146148
(this.repoModule != null && this.moduleInfo.versionCode <
@@ -152,8 +154,10 @@ public Type getType() {
152154
MainApplication.getINSTANCE().updateModuleCount++;
153155
}
154156
Timber.d("modulesHaveUpdates = %s, updateModuleCount = %s", MainApplication.getINSTANCE().modulesHaveUpdates, MainApplication.getINSTANCE().updateModuleCount);
157+
Timber.d("Module %s has update", this.moduleId);
155158
return Type.UPDATABLE;
156159
} else {
160+
Timber.d("Module %s is installed", this.moduleId);
157161
return Type.INSTALLED;
158162
}
159163
}

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
android:layout_width="match_parent"
4343
android:layout_height="wrap_content"
4444
android:indeterminate="true"
45-
android:scaleY="2"
45+
android:visibility="visible"
4646
app:layout_constraintEnd_toEndOf="parent"
4747
app:layout_constraintStart_toStartOf="parent"
4848
app:layout_constraintTop_toBottomOf="parent"
49-
app:layout_constraintTop_toTopOf="@+id/swipe_refresh"
49+
app:layout_constraintTop_toTopOf="@+id/root_container"
5050
app:showAnimationBehavior="outward" />
5151

5252
<LinearLayout

0 commit comments

Comments
 (0)