Skip to content

Commit d24d3ab

Browse files
K2GO-385 refactor(ui): status badge on its own line below the metadata tags (detail screens)
On-device review of PR3b: the dot+text status badge shared the metadata chip row with the boxed metadata tags (e.g. "v1.2.12 [] . Up to date . REST API []"), and the FlowLayout top-aligns its children, so the badge floated off the tags' centre axis -- the ragged mix the design decision warns against. Give the status its own zone, as the decision prescribes ("metadata + status cluster ... status on its own line so the roles don't share a shape row"). - New k2go_moddet_status FlowLayout in the shared detail layout, directly below the metadata chips, GONE until a status is added. - DashboardDetail: the live status badge moves out of the chip row into it (the chip row keeps version / REST API / System core). - ModuleDetail: the lifecycle state badges move there too (via addStatus, which reveals the row); the metadata + trait tags (size / version / Runs offline / Demo) stay in the chip row. Drops the now-unused chipRow alias. Fixes the "shared centre axis" finding from the PR3b review.
1 parent 386642f commit d24d3ab

3 files changed

Lines changed: 29 additions & 11 deletions

File tree

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
103103
((TextView) root.findViewById(R.id.k2go_moddet_desc)).setText(R.string.k2go_dash_detail_desc);
104104

105105
// Meta chips, in order: version (prepended live) | update status (live) | REST API | System core.
106-
// ADFA-5026: the status chip starts at index 0 so that when the version chip prepends at 0 it
107-
// lands right after the version. "Runs offline" is replaced by the update-status pill.
108106
chips = root.findViewById(R.id.k2go_moddet_chips);
109-
// K2GO-385 (PR3): the live lifecycle state is a status badge (dot+text, semantic); REST API /
110-
// System core are neutral metadata tags (colour there is noise -- the metadata colour rule).
107+
// K2GO-385 (PR3): the live lifecycle state is a status badge (dot+text, semantic) on its OWN line
108+
// below the metadata; version / REST API / System core are neutral metadata tags in the chip row
109+
// (colour there is noise -- the metadata colour rule). The version chip prepends to the chip row.
110+
ViewGroup statusRow = root.findViewById(R.id.k2go_moddet_status);
111+
statusRow.setVisibility(View.VISIBLE);
111112
statusChip = K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_dash_chip_checking), R.color.k2go_muted);
112-
chips.addView(statusChip);
113+
statusRow.addView(statusChip);
113114
chips.addView(K2GoChip.create(requireContext(), getString(R.string.k2go_dash_chip_rest)));
114115
chips.addView(K2GoChip.create(requireContext(), getString(R.string.k2go_dash_chip_core)));
115116
fetchVersionChip();

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
9999
// than start visible, because showing them and then taking them away is how a user ends
100100
// up tapping one in the gap.
101101
final Button installNowBtn = root.findViewById(R.id.k2go_moddet_install_now);
102-
final ViewGroup chipRow = chips;
102+
final ViewGroup statusRow = root.findViewById(R.id.k2go_moddet_status);
103103
installNowBtn.setVisibility(View.GONE);
104104

105105
Button schedule = root.findViewById(R.id.k2go_moddet_schedule);
@@ -125,7 +125,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
125125
if (!isAdded()) return;
126126
if (verdict == org.appdevforall.k2go.system.domain.SystemVerdict.State.NO_SYSTEM
127127
|| verdict == org.appdevforall.k2go.system.domain.SystemVerdict.State.DAMAGED) {
128-
chipRow.addView(K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_state_no_system), R.color.k2go_amber_text));
128+
addStatus(statusRow, K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_state_no_system), R.color.k2go_amber_text));
129129
installNowBtn.setText(R.string.k2go_home_recover);
130130
installNowBtn.setOnClickListener(v -> SetupLibraryActivity.recover(requireContext()));
131131
installNowBtn.setVisibility(View.VISIBLE);
@@ -136,11 +136,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
136136
|| verdict == org.appdevforall.k2go.system.domain.SystemVerdict.State.CLONE_SHARING) {
137137
// ADFA-5312: a system op is in progress — the system is present but mid-setup and the
138138
// server is down. Don't offer Install or Recover into it; just say it's busy.
139-
chipRow.addView(K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_home_installing), R.color.k2go_amber_text));
139+
addStatus(statusRow, K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_home_installing), R.color.k2go_amber_text));
140140
return;
141141
}
142142
if (isInstalled) {
143-
chipRow.addView(K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_mod_phase_done), R.color.k2go_leaf));
143+
addStatus(statusRow, K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_mod_phase_done), R.color.k2go_leaf));
144144
return; // nothing to offer: a module cannot be uninstalled or reinstalled here
145145
}
146146
// ADFA-4898: this module's runrole failed in the last finished batch — the SAME per-module
@@ -153,7 +153,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
153153
// Retry then bounces to the hub, which observes the queue live; this detail is a one-shot
154154
// snapshot (no observer) and would otherwise sit on a stale "Couldn't install".
155155
if (org.appdevforall.k2go.install.presentation.ModuleQueueRepository.get().current().didFail(c.key())) {
156-
chipRow.addView(K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_mod_phase_failed), R.color.k2go_clay));
156+
addStatus(statusRow, K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_mod_phase_failed), R.color.k2go_clay));
157157
schedule.setText(R.string.k2go_home_retry);
158158
// Shared, busy-gated retry (same action the live progress card fires). On a real start,
159159
// land on the install index — the same destination as a normal install (openModuleIndex)
@@ -172,7 +172,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
172172
return;
173173
}
174174
if (unknown) {
175-
chipRow.addView(K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_state_no_answer),
175+
addStatus(statusRow, K2GoStatusBadge.create(requireContext(), getString(R.string.k2go_state_no_answer),
176176
R.color.k2go_amber_text));
177177
return; // no grounds to offer work either way
178178
}
@@ -208,4 +208,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
208208
return root;
209209
}
210210

211+
/** K2GO-385 (PR3): a lifecycle status badge goes on its own row (k2go_moddet_status), which stays
212+
* GONE until one is added -- so a dot+text status never shares the boxed-metadata chip row. */
213+
private static void addStatus(ViewGroup row, View badge) {
214+
row.setVisibility(View.VISIBLE);
215+
row.addView(badge);
216+
}
217+
211218
}

‎controller/app/src/main/res/layout/fragment_k2go_module_detail.xml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@
6666
android:layout_height="wrap_content"
6767
android:layout_marginTop="12dp" />
6868

69+
<!-- K2GO-385 (PR3): the lifecycle status sits on its OWN line below the metadata tags, so a
70+
dot+text status badge never shares a row (and a centre axis) with the boxed metadata tags.
71+
GONE until a status is added (some module states show none). -->
72+
<org.appdevforall.k2go.redesign.FlowLayout
73+
android:id="@+id/k2go_moddet_status"
74+
android:layout_width="match_parent"
75+
android:layout_height="wrap_content"
76+
android:layout_marginTop="8dp"
77+
android:visibility="gone" />
78+
6979
<TextView
7080
android:id="@+id/k2go_moddet_desc"
7181
android:layout_width="match_parent"

0 commit comments

Comments
 (0)