fix mods update check
This commit is contained in:
parent
ed8b524ba3
commit
e4a51d4e9a
|
@ -183,20 +183,22 @@ public final class TaskListPane extends FCLAdapter {
|
|||
@Override
|
||||
public void onPropertiesUpdate(Task<?> task) {
|
||||
if (task instanceof Task.CountTask) {
|
||||
stageNodes.stream()
|
||||
Schedulers.androidUIThread().execute(() -> stageNodes.stream()
|
||||
.filter(x -> x.stage.equals(((Task<?>.CountTask) task).getCountStage()))
|
||||
.findAny()
|
||||
.ifPresent(StageNode::count);
|
||||
.ifPresent(StageNode::count));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (task.getStage() != null) {
|
||||
int total = tryCast(task.getProperties().get("total"), Integer.class).orElse(0);
|
||||
stageNodes.stream()
|
||||
.filter(x -> x.stage.equals(task.getStage()))
|
||||
.findAny()
|
||||
.ifPresent(stageNode -> stageNode.setTotal(total));
|
||||
Schedulers.androidUIThread().execute(() -> {
|
||||
int total = tryCast(task.getProperties().get("total"), Integer.class).orElse(0);
|
||||
stageNodes.stream()
|
||||
.filter(x -> x.stage.equals(task.getStage()))
|
||||
.findAny()
|
||||
.ifPresent(stageNode -> stageNode.setTotal(total));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -26,13 +26,13 @@ public class ModCheckUpdatesTask extends Task<List<LocalModFile.ModUpdate>> {
|
|||
.map(type ->
|
||||
Task.supplyAsync(() -> mod.checkUpdates(gameVersion, type.getRemoteModRepository()))
|
||||
.setSignificance(TaskSignificance.MAJOR)
|
||||
.setName(String.format("%s (%s)", mod.getFileName(), type.name())).withCounter("mods_check_updates")
|
||||
.setName(String.format("%s (%s)", mod.getFileName(), type.name())).withCounter("mods.check_updates")
|
||||
)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
setStage("mods_check_updates");
|
||||
setStage("mods.check_updates");
|
||||
getProperties().put("total", dependents.size() * RemoteMod.Type.values().length);
|
||||
}
|
||||
|
||||
|
|
|
@ -347,6 +347,13 @@ public class ModListPage extends FCLCommonPage implements ManageUI.VersionLoadab
|
|||
builder.setMessage("Failed to check updates");
|
||||
builder.setNegativeButton(getContext().getString(com.tungsten.fcllibrary.R.string.dialog_positive), null);
|
||||
builder.create().show();
|
||||
} else if (result.isEmpty()) {
|
||||
FCLAlertDialog.Builder builder = new FCLAlertDialog.Builder(getContext());
|
||||
builder.setCancelable(false);
|
||||
builder.setAlertLevel(FCLAlertDialog.AlertLevel.INFO);
|
||||
builder.setMessage(getContext().getString(R.string.mods_check_updates_empty));
|
||||
builder.setNegativeButton(getContext().getString(com.tungsten.fcllibrary.R.string.dialog_positive), null);
|
||||
builder.create().show();
|
||||
} else {
|
||||
ModUpdatesPage page = new ModUpdatesPage(getContext(), PageManager.PAGE_ID_TEMP, getParent(), R.layout.page_mod_update, modManager, result);
|
||||
ManagePageManager.getInstance().showTempPage(page);
|
||||
|
|
|
@ -522,6 +522,7 @@
|
|||
<string name="mods_category">类别</string>
|
||||
<string name="mods_check_updates">检查更新</string>
|
||||
<string name="mods_check_updates_current_version">当前版本</string>
|
||||
<string name="mods_check_updates_empty">没有需要更新的模组</string>
|
||||
<string name="mods_check_updates_failed">无法下载部分文件。</string>
|
||||
<string name="mods_check_updates_file">文件</string>
|
||||
<string name="mods_check_updates_source">下载源</string>
|
||||
|
|
|
@ -541,6 +541,7 @@
|
|||
<string name="mods_category">Category</string>
|
||||
<string name="mods_check_updates">Check for Updates</string>
|
||||
<string name="mods_check_updates_current_version">Current Version</string>
|
||||
<string name="mods_check_updates_empty">No mods need to be updated</string>
|
||||
<string name="mods_check_updates_failed">Unable to download some of the files.</string>
|
||||
<string name="mods_check_updates_file">File</string>
|
||||
<string name="mods_check_updates_source">Source</string>
|
||||
|
|
Loading…
Reference in New Issue