From 799e3ba368dcc1f990f777332f9be075eed1e42c Mon Sep 17 00:00:00 2001 From: "Luis Guzman (AppDevForAll)" Date: Mon, 24 Aug 2026 12:07:40 -0600 Subject: [PATCH 1/2] ADFA-5248 fix(books): legible selected chip and state band on covers The Books "Get more" screen had two low-contrast spots: - The selected filter chip used hardcoded white on the teal fill. The fill flips to light aqua in dark mode, so white washed out. Use k2go_on_teal (the existing on-accent token), which flips with the same DayNight mechanism as the fill: light text on the dark-teal light-mode fill, dark text on the light-aqua dark-mode fill. - The "In your books" / "Selected" band used a colored fill that matched the same-hue covers (green band on a green cover) and vanished. Make the band a light cream pill and move the semantic hue to the text, so it reads on any of the six covers. Band tokens have no -night twin: the band sits on a fixed cover color, so it is mode-independent. --- .../redesign/BooksLandingFragment.java | 22 +++++++++++++------ .../app/src/main/res/values/colors_k2go.xml | 9 ++++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java b/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java index e64cbaed1..8fe2188fd 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java @@ -200,9 +200,12 @@ private TextView chip(String text, boolean on, Runnable onClick) { t.setText(text); t.setPadding(px(14), px(8), px(14), px(8)); t.setBackgroundResource(on ? R.drawable.k2go_chip_bg : R.drawable.k2go_pill_bg); - // ADFA-4910: white on the selected (teal) chip — same as MapsChooseFragment. The theme-split - // k2go_on_teal could resolve to its dark night value in light mode, killing the contrast. - t.setTextColor(ContextCompat.getColor(requireContext(), on ? android.R.color.white : R.color.k2go_ink)); + // ADFA-5248: use k2go_on_teal for the selected (teal) chip. It flips with the same DayNight + // mechanism as k2go_teal (the chip's own fill), so it resolves per the current mode just like + // the fill does: light text on the dark-teal light-mode fill, dark text on the light-aqua + // dark-mode fill. The old hardcoded white was legible only in light mode; in dark mode it + // washed out on the light-aqua fill (this ticket). + t.setTextColor(ContextCompat.getColor(requireContext(), on ? R.color.k2go_on_teal : R.color.k2go_ink)); t.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_BodySmall); t.setClickable(true); t.setOnClickListener(v -> onClick.run()); @@ -366,18 +369,23 @@ private View cell(JSONObject b, int coverColorRes) { return box; } - /** A pill band under the title. A faint white stroke keeps it legible on any cover color. */ + /** + * A state pill under the title. ADFA-5248: the pill is a light (cream) surface so it separates + * from ANY of the 6 covers (all medium/dark) — the old colored fill matched the same-hue covers + * (green band on a green cover) and vanished. The semantic hue now lives in the TEXT ({@code + * colorRes}), which reads darkly on the cream pill. + */ private TextView band(int colorRes, String text) { TextView t = new TextView(requireContext()); t.setText(text); t.setGravity(Gravity.CENTER); t.setPadding(px(12), px(4), px(12), px(4)); t.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_BodySmall); - t.setTextColor(0xFFFFFFFF); + t.setTextColor(ContextCompat.getColor(requireContext(), colorRes)); GradientDrawable d = new GradientDrawable(); - d.setColor(ContextCompat.getColor(requireContext(), colorRes)); + d.setColor(ContextCompat.getColor(requireContext(), R.color.k2go_band_surface)); d.setCornerRadius(px(8)); - d.setStroke(px(1), 0x4DFFFFFF); + d.setStroke(px(1), 0x1A000000); // subtle dark hairline to define the pill edge on any cover t.setBackground(d); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); diff --git a/controller/app/src/main/res/values/colors_k2go.xml b/controller/app/src/main/res/values/colors_k2go.xml index e021e2d98..3b2904990 100644 --- a/controller/app/src/main/res/values/colors_k2go.xml +++ b/controller/app/src/main/res/values/colors_k2go.xml @@ -49,8 +49,13 @@ #B5432E #2E7D4F #4A5568 - #2E9E5B - #4A504E + + #FBF8F3 + #12633C + #3A403E From 5f056adf06a3970294fade7cba3166100c3af235 Mon Sep 17 00:00:00 2001 From: "Luis Guzman (AppDevForAll)" Date: Mon, 24 Aug 2026 13:06:36 -0600 Subject: [PATCH 2/2] ADFA-5248 fix(books): legible selected chip and state band on covers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two low-contrast spots on the Books "Get more" screen. Selected filter chip: chip() called setTextColor BEFORE setTextAppearance, so the Material3 appearance's own colorOnSurface silently overwrote the chip color. onSurface flips with the theme, so the selected chip rendered dark-on-dark-teal in light mode and light-on-aqua in dark mode — exactly the "dark gray on dark green / light gray on light aqua" the ticket reported; neither the old white nor k2go_on_teal ever took effect. Apply the appearance first, then the color, so k2go_on_teal sticks and flips against the teal fill. State band ("In your books" / "Selected"): the colored fill matched the same-hue covers (green band on a green cover) and vanished. Make the band a light cream pill and move the semantic hue to the text, so it reads on any of the six covers. Band tokens have no -night twin: the band sits on a fixed cover color, so it is mode-independent. --- .../controller/redesign/BooksLandingFragment.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java b/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java index 8fe2188fd..da6a48e25 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/BooksLandingFragment.java @@ -200,13 +200,14 @@ private TextView chip(String text, boolean on, Runnable onClick) { t.setText(text); t.setPadding(px(14), px(8), px(14), px(8)); t.setBackgroundResource(on ? R.drawable.k2go_chip_bg : R.drawable.k2go_pill_bg); - // ADFA-5248: use k2go_on_teal for the selected (teal) chip. It flips with the same DayNight - // mechanism as k2go_teal (the chip's own fill), so it resolves per the current mode just like - // the fill does: light text on the dark-teal light-mode fill, dark text on the light-aqua - // dark-mode fill. The old hardcoded white was legible only in light mode; in dark mode it - // washed out on the light-aqua fill (this ticket). - t.setTextColor(ContextCompat.getColor(requireContext(), on ? R.color.k2go_on_teal : R.color.k2go_ink)); + // ADFA-5248: apply the text appearance FIRST, then the color. TextAppearance_Material3_* + // carries its own colorOnSurface, so setting the color before it silently overwrote the chip + // color (the real bug the ticket reported: onSurface flips with the theme, giving dark-on- + // dark-teal in light mode and light-on-aqua in dark mode — never legible on the teal fill). + // With the order fixed, k2go_on_teal sticks: it flips against the fill (light text on the + // dark-teal light-mode fill, dark text on the light-aqua dark-mode fill). t.setTextAppearance(com.google.android.material.R.style.TextAppearance_Material3_BodySmall); + t.setTextColor(ContextCompat.getColor(requireContext(), on ? R.color.k2go_on_teal : R.color.k2go_ink)); t.setClickable(true); t.setOnClickListener(v -> onClick.run()); return t;