|
33 | 33 | import androidx.core.content.ContextCompat; |
34 | 34 | import androidx.fragment.app.Fragment; |
35 | 35 |
|
| 36 | +import com.google.android.material.button.MaterialButton; |
| 37 | + |
36 | 38 | import org.appdevforall.k2go.R; |
37 | 39 | import org.appdevforall.k2go.config.BoxEndpoints; |
38 | 40 | import org.appdevforall.k2go.util.AppExecutors; |
@@ -98,24 +100,6 @@ public class ModuleHubFragment extends Fragment { |
98 | 100 | private LinearLayout host; |
99 | 101 | private Button proceed; |
100 | 102 |
|
101 | | - /** ADFA-4958 §5.2: outlined state pill (transparent fill, state-colored 1.4dp stroke, full radius). */ |
102 | | - private TextView statePill(String text, int colorRes) { |
103 | | - int color = ContextCompat.getColor(requireContext(), colorRes); |
104 | | - TextView pill = new TextView(requireContext()); |
105 | | - pill.setText(text); |
106 | | - pill.setTextColor(color); |
107 | | - pill.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_LabelMedium); |
108 | | - pill.setPadding(px(10), px(3), px(10), px(3)); |
109 | | - android.graphics.drawable.GradientDrawable bg = new android.graphics.drawable.GradientDrawable(); |
110 | | - bg.setShape(android.graphics.drawable.GradientDrawable.RECTANGLE); |
111 | | - bg.setColor(android.graphics.Color.TRANSPARENT); |
112 | | - bg.setCornerRadius(px(20)); |
113 | | - int strokeW = Math.max(1, Math.round(1.4f * getResources().getDisplayMetrics().density)); |
114 | | - bg.setStroke(strokeW, color); |
115 | | - pill.setBackground(bg); |
116 | | - return pill; |
117 | | - } |
118 | | - |
119 | 103 | private int px(int dp) { return Math.round(dp * getResources().getDisplayMetrics().density); } |
120 | 104 |
|
121 | 105 | private static boolean is64Bit() { |
@@ -393,8 +377,11 @@ private void addHiddenSection() { |
393 | 377 | col.addView(sub); |
394 | 378 | row.addView(col, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f)); |
395 | 379 |
|
396 | | - TextView restore = statePill(getString(R.string.k2go_mod_restore), R.color.k2go_teal); // ADFA-4958 §5.7: outlined teal pill |
397 | | - restore.setPadding(px(14), px(6), px(14), px(6)); |
| 380 | + // K2GO-385 (PR3): an action is a real M3 button (filled primary stadium), not an outlined |
| 381 | + // pill — its shape signals "tappable" (the pill-roles design decision, board §"THE FOUR ROLES"). |
| 382 | + MaterialButton restore = new MaterialButton( |
| 383 | + new android.view.ContextThemeWrapper(requireContext(), R.style.ThemeOverlay_K2Go_Button_Filled), null); |
| 384 | + restore.setText(R.string.k2go_mod_restore); |
398 | 385 | restore.setOnClickListener(v -> { HiddenModules.remove(requireContext(), key); buildCards(); }); |
399 | 386 | row.addView(restore); |
400 | 387 | host.addView(row); |
@@ -486,7 +473,9 @@ private View cardRow(final ModuleCards.Card c, final boolean isInstalled, |
486 | 473 | // already there cannot meaningfully be waiting to be installed, and if a stale wishlist |
487 | 474 | // entry survived an install, saying "Scheduled" over it would be the older lie again. |
488 | 475 | boolean scheduled = !isInstalled && !unknown && ModuleWishlist.contains(requireContext(), c.key()); |
489 | | - TextView pill = statePill( |
| 476 | + // K2GO-385 (PR3): a lifecycle state is a read-only STATUS -- dot + text, semantic colour, no |
| 477 | + // ripple (the shared K2GoStatusBadge) -- not an outlined pill that reads like a button. |
| 478 | + LinearLayout pill = K2GoStatusBadge.create(requireContext(), |
490 | 479 | isInstalled ? getString(R.string.k2go_mod_phase_done) |
491 | 480 | : failed ? getString(R.string.k2go_mod_phase_failed) |
492 | 481 | : unknown ? getString(R.string.k2go_state_no_answer) |
@@ -544,8 +533,11 @@ private void addSystemDashboardCard() { |
544 | 533 | } |
545 | 534 | }); |
546 | 535 |
|
547 | | - TextView rebuild = statePill(getString(R.string.k2go_dash_rebuild), R.color.k2go_teal); |
548 | | - rebuild.setPadding(px(14), px(6), px(14), px(6)); |
| 536 | + // K2GO-385 (PR3): the Rebuild/Update action is a real M3 button (filled primary stadium), not |
| 537 | + // an outlined pill. Its label still toggles Rebuild<->Update via DashboardCardStatus below. |
| 538 | + MaterialButton rebuild = new MaterialButton( |
| 539 | + new android.view.ContextThemeWrapper(requireContext(), R.style.ThemeOverlay_K2Go_Button_Filled), null); |
| 540 | + rebuild.setText(R.string.k2go_dash_rebuild); |
549 | 541 | // ADFA-5339: the confirm dialog matches the pill — pass the last-known "update available". |
550 | 542 | final boolean[] up = {false}; |
551 | 543 | rebuild.setOnClickListener(v -> DashboardRebuild.confirmAndStart(this, host, up[0])); |
|
0 commit comments