@@ -54,16 +54,14 @@ public class DashboardDetailFragment extends Fragment {
5454 // ADFA-5339 / K2GO-374: expandable Details — the live rebuild log via the shared LiveLogPanel. The
5555 // toggle stays hidden until there are lines (an older box without /rebuild/log shows no Details).
5656 private org .appdevforall .k2go .widget .LiveLogPanel logPanel ;
57- private static final long LOG_POLL_MS = 1500L ;
58- private final Runnable logPoll = this ::pollLog ;
5957 // K2GO-95 / K2GO-383: the determinate in-progress bar + its "NN% ~N min left" caption. The values
6058 // come from DashboardRebuildService (the persistent owner, which outlives this card's recreation) via
6159 // its ACTION_PROGRESS broadcast, so the bar resumes where the rebuild actually is after minimize /
6260 // restore instead of restarting from 0.
6361 private LinearProgressIndicator progressBar ;
64- // K2GO-383: the status line under the label is two fixed columns: the percent anchored left, the ETA
65- // anchored right (space-between). Each has its own anchor , so a width change in one never shifts the
66- // other. Style matches the content updaters' status line (BodySmall, muted, single line).
62+ // K2GO-383: the status line under the label is two equal-weight columns, the percent and the ETA each
63+ // centered in its own half. Separate columns , so a width change in one never reaches the other. Style
64+ // matches the content updaters' status line (BodySmall, muted, single line).
6765 private TextView updatingPercent ;
6866 private TextView updatingEta ;
6967
@@ -77,6 +75,10 @@ public class DashboardDetailFragment extends Fragment {
7775 if (DashboardRebuildService .ACTION_PROGRESS .equals (i .getAction ())) {
7876 onProgress (i .getIntExtra (DashboardRebuildService .EXTRA_PERCENT , -1 ),
7977 i .getLongExtra (DashboardRebuildService .EXTRA_ETA_SECONDS , -1L ));
78+ // K2GO-383: the same tick carries the log tail; feed the Details panel from it instead of
79+ // a second /rebuild/log poll. reveal + auto-scroll are handled inside setContent.
80+ String log = i .getStringExtra (DashboardRebuildService .EXTRA_LOG );
81+ if (updating && logPanel != null && log != null ) logPanel .setContent (log );
8082 return ;
8183 }
8284 String state = i .getStringExtra (DashboardRebuildService .EXTRA_STATE );
@@ -388,39 +390,17 @@ private void setUpdating(boolean on) {
388390 if (updatingCancel != null ) updatingCancel .setEnabled (on ); // re-enable when a new update shows
389391 if (rebuild != null ) { rebuild .setEnabled (!on ); rebuild .setAlpha (on ? 0.5f : 1f ); }
390392 if (on && rebuildHint != null ) rebuildHint .setVisibility (View .GONE );
391- // ADFA-5339: the Details log only exists while a rebuild runs. Poll it on, tear it down on off.
392- main .removeCallbacks (logPoll );
393393 if (on ) {
394394 // K2GO-383: start indeterminate with the plain label; the service's ACTION_PROGRESS then
395- // drives the bar + the "NN% ~N min left" caption. pollLog only feeds the Details panel now .
395+ // drives the bar, the "NN% ~N min left" caption, and (same tick) the Details panel.
396396 if (progressBar != null ) progressBar .setIndeterminate (true );
397397 if (updatingPercent != null ) updatingPercent .setText ("" ); // filled by the first progress tick
398398 if (updatingEta != null ) updatingEta .setText ("" );
399399 if (logPanel != null ) logPanel .reset (); // K2GO-374: start clean; toggle hidden until lines
400- main .post (logPoll );
401400 }
402401 // On "off" the whole updatingRow is hidden above, which takes the panel with it.
403402 }
404403
405- /** ADFA-5339: poll the rebuild log tail while updating. Fork B — the toggle appears only once there
406- * are lines, so an older box without the endpoint (empty) shows no Details affordance. Reschedules
407- * itself while {@code updating}; setUpdating(false) and onDestroyView remove the callback. */
408- private void pollLog () {
409- if (!isAdded () || !updating ) return ;
410- DashboardClient .rebuildLog (new DashboardClient .RebuildLogCb () {
411- @ Override public void onLines (java .util .List <String > lines ) {
412- if (!isAdded () || !updating ) return ;
413- String log = android .text .TextUtils .join ("\n " , lines );
414- if (logPanel != null ) logPanel .setContent (log ); // K2GO-374: reveal + auto-scroll handled here
415- main .postDelayed (logPoll , LOG_POLL_MS );
416- }
417- @ Override public void onErr (String message ) {
418- // No endpoint / transient: keep the panel as-is (toggle hidden if never populated) and retry.
419- if (isAdded () && updating ) main .postDelayed (logPoll , LOG_POLL_MS );
420- }
421- });
422- }
423-
424404 /** K2GO-383: apply a progress tick from DashboardRebuildService (the persistent owner, so the value
425405 * survives this card's recreation). A negative percent means "no phase marker yet" -> indeterminate;
426406 * otherwise set the determinate bar and the two status columns: "NN%" left, the ETA right (eta via
@@ -440,7 +420,7 @@ private void onProgress(int percent, long etaSeconds) {
440420 }
441421
442422 @ Override public void onDestroyView () {
443- main .removeCallbacks ( logPoll ); // ADFA-5339: never poll past the view's life
423+ main .removeCallbacksAndMessages ( null ); // ADFA-5339: drop any pending posts past the view's life
444424 super .onDestroyView ();
445425 }
446426
0 commit comments