Skip to content

Commit 87d23e4

Browse files
K2GO-443 fix(forgejo): show percent + current repo in the refresh status line
The refresh showed only the current repo and a bar with no number, so an all-up-to-date refresh (git has nothing to fetch, so it is near-instant) read as no progress. The status line now shows "<pct>% <repo>" (percent from onProgress, repo from onLog, both via render()). The percent is coarse by nature (repo count: 0/33/66 for 3 repos), but it is the visible progress the user expected.
1 parent c0cfc4d commit 87d23e4

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎controller/app/src/main/java/org/appdevforall/k2go/forgejo/presentation/ForgejoRepoRefresh.java‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,21 @@ private static void run(@NonNull View trigger) {
134134
terminal(settled, trigger, parent, progress, R.string.k2go_forgejo_update_cancelled);
135135
});
136136

137+
// The status line shows the percent and the current repo together (git progress is repo-count, so
138+
// the percent is coarse: 0/33/66 for 3 repos). Percent arrives via onProgress, the repo via onLog;
139+
// both feed render() so the line stays "<pct>% <repo>".
140+
final int[] pct = { -1 };
141+
final String[] repo = { "" };
142+
final Runnable render = () -> {
143+
if (!liveLine.isAttachedToWindow()) return;
144+
liveLine.setText(pct[0] >= 0 ? pct[0] + "% " + repo[0] : repo[0]);
145+
};
146+
137147
client.start(sentinelBody(), new RestContentClient.Listener() {
138148
@Override public void onProgress(int percent, String speed) {
139149
if (!liveLine.isAttachedToWindow()) return;
140150
bar.setIndeterminate(percent < 0);
141-
if (percent >= 0) bar.setProgressCompat(percent, true);
151+
if (percent >= 0) { bar.setProgressCompat(percent, true); pct[0] = percent; render.run(); }
142152
}
143153
@Override public void onIndexing() {
144154
if (liveLine.isAttachedToWindow()) bar.setIndeterminate(true);
@@ -157,8 +167,8 @@ private static void run(@NonNull View trigger) {
157167
return;
158168
}
159169
// Otherwise the job detail is the current repo ("owner/name"); drop the org prefix.
160-
final String shown = t.replace("AppDevForAll/", "");
161-
if (liveLine.isAttachedToWindow()) liveLine.setText(shown);
170+
repo[0] = t.replace("AppDevForAll/", "");
171+
render.run();
162172
}
163173
@Override public void onDone() {
164174
terminal(settled, trigger, parent, progress, messageFor(summary[0], summary[1], summary[2]));

0 commit comments

Comments
 (0)