From 3d50ab1b653e57f5478810ac3a9097e8b9809b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sch=C3=A4ttgen?= Date: Wed, 22 Jan 2025 22:06:57 +0100 Subject: [PATCH] Improve color contrast on hidden codes --- .../java/com/beemdevelopment/aegis/ui/views/EntryHolder.java | 5 ++++- app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/themes.xml | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/views/EntryHolder.java b/app/src/main/java/com/beemdevelopment/aegis/ui/views/EntryHolder.java index ba86e9cd50..cca83dfdda 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/views/EntryHolder.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/views/EntryHolder.java @@ -369,9 +369,11 @@ public void revealCode() { public void hideCode() { String code = getOtp(); String hiddenText = code.replaceAll("\\S", Character.toString(HIDDEN_CHAR)); + stopExpirationAnimation(); + updateTextViewWithDots(_profileCode, hiddenText, code); updateTextViewWithDots(_nextProfileCode, hiddenText, code); - stopExpirationAnimation(); + _hidden = true; } @@ -384,6 +386,7 @@ private void updateTextViewWithDots(TextView textView, String hiddenCode, String float dotsWidth = paint.measureText(hiddenCode); float scaleFactor = codeWidth / dotsWidth; scaleFactor = (float)(Math.round(scaleFactor * 10.0) / 10.0); + textView.setTextColor(MaterialColors.getColor(textView, R.attr.colorCodeHidden)); // If scale is higher or equal to 0.8, do nothing and proceed with the normal text rendering if (scaleFactor >= 0.8) { diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 0c24c596bb..8baea4f494 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -8,6 +8,7 @@ + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 7ae582e99e..d135ec24c8 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -62,6 +62,7 @@ @color/aegis_theme_light_success @color/aegis_theme_light_onSurfaceDim ?attr/colorPrimary + ?attr/colorOutlineVariant ?attr/colorSurfaceVariant ?attr/colorOnSurfaceVariant @@ -132,6 +133,7 @@ @color/aegis_theme_dark_success @color/aegis_theme_dark_onSurfaceDim ?attr/colorPrimary + ?attr/colorOutlineVariant ?attr/colorSurfaceVariant ?attr/colorOnSurfaceVariant @@ -159,6 +161,7 @@ #000000 #000000 @android:color/white + #2F2F2F @android:color/white @@ -179,6 +182,7 @@ #000000 #000000 @android:color/white + #2F2F2F @android:color/white