Skip to content

Commit 4f598c1

Browse files
K2GO-383 fix(ui): center the rebuild status columns (percent and ETA)
Give each value an equal-weight column and center it in its own half, so the two numbers sit over the bar and are easier to locate. They stay in separate columns, so centering never makes them collide.
1 parent ebaf171 commit 4f598c1

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎controller/app/src/main/java/org/appdevforall/k2go/redesign/DashboardDetailFragment.java‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,10 @@ private View buildUpdatingRow(Button rebuildBtn) {
284284
label.setTextColor(ContextCompat.getColor(requireContext(), R.color.k2go_muted));
285285
row.addView(label);
286286

287-
// K2GO-383: the status line is two fixed columns: percent left, ETA right (space-between). Each
288-
// column keeps its anchor, so a width change in one never nudges the other (no jitter). Same
289-
// BodySmall / muted / single-line style as the content updaters' status line.
287+
// K2GO-383: the status line is two equal columns (weight 1 each), the percent and the ETA each
288+
// centered in its own half. Separate columns, so a width change in one never reaches the other;
289+
// centering only reflows the value slightly around its own column center. Same BodySmall / muted /
290+
// single-line style as the content updaters' status line.
290291
LinearLayout statusRow = new LinearLayout(requireContext());
291292
statusRow.setOrientation(LinearLayout.HORIZONTAL);
292293
LinearLayout.LayoutParams statusLp = new LinearLayout.LayoutParams(
@@ -298,20 +299,18 @@ private View buildUpdatingRow(Button rebuildBtn) {
298299
updatingPercent.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_BodySmall);
299300
updatingPercent.setTextColor(ContextCompat.getColor(requireContext(), R.color.k2go_muted));
300301
updatingPercent.setMaxLines(1);
302+
updatingPercent.setGravity(android.view.Gravity.CENTER);
301303
statusRow.addView(updatingPercent, new LinearLayout.LayoutParams(
302-
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
304+
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
303305

304306
updatingEta = new TextView(requireContext());
305307
updatingEta.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_BodySmall);
306308
updatingEta.setTextColor(ContextCompat.getColor(requireContext(), R.color.k2go_muted));
307309
updatingEta.setMaxLines(1);
308310
updatingEta.setEllipsize(android.text.TextUtils.TruncateAt.END);
309-
updatingEta.setGravity(android.view.Gravity.END);
310-
// weight 1 so the ETA column takes the slack and hugs the right edge, opposite the percent.
311-
LinearLayout.LayoutParams etaLp = new LinearLayout.LayoutParams(
312-
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f);
313-
etaLp.leftMargin = Math.round(8 * d);
314-
statusRow.addView(updatingEta, etaLp);
311+
updatingEta.setGravity(android.view.Gravity.CENTER);
312+
statusRow.addView(updatingEta, new LinearLayout.LayoutParams(
313+
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
315314

316315
row.addView(statusRow);
317316

0 commit comments

Comments
 (0)