0

I'm developing a game for Android using Supernova Engine (https://github.com/supernovaengine/supernova) but I'm having trouble getting rid of the "Low contrast" alert by Google Play Console.

Element path: "android:id/content/FrameLayout[1]/m[1]"

Recomendation: "The item's text contrast ratio is 1.21. This ratio is based on an estimated foreground color of #000000 and an estimated background color of #1A1A1A. Consider increasing this item's text contrast ratio to 3.00 or greater."

enter image description here

Supernova Engine uses this Activity class for Android: https://github.com/supernovaengine/supernova/blob/master/workspaces/androidstudio/app/src/main/java/org/supernovaengine/supernova/MainActivity.java

But I cannot find where is this element: "FrameLayout[1]/m[1]".

1 Answers1

0

TL;DR: I suspect if you set the text and hint color of this component to a color contrasting to black (e.g. white) you will probably get rid of this error.

getText().insert(this.getSelectionStart(), " "); 

Having white space in here might also be throwing the Play Store check off

Some other things to try:

Loading this screen up with an un-proguarded debug version and using Google's Accessibility Scanner? This should help you diagnose these types of issues in the future

Alternatively you can do an adb shell uiautomator dump and try and find the offending child in the XML there. This requires more sifting though, you'd need to know what you were looking for.

I tried checking out the code and running, but got too many errors. From what I can see in MainActivity, you are doing the following to create the view:

layout = new FrameLayout(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
setContentView(layout);

setFullScreen();

edittext = new TextInput(this);

layout.addView(edittext);
layout.addView(glSurfaceView);

Where TextInput is some sort of Hybrid view - inflated from code without styles being set. Your problem is probably there somewhere.

Quintin Balsdon
  • 5,484
  • 10
  • 54
  • 95
  • Thank you for these tips, I will try those on next release. This TextInput is hidden, it is necessary to manage keyboard and text input to engine. I have already removed accessibility checks in it with setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS) – Eduardo Dória Jun 10 '23 at 19:32
  • Have you tried to run the code using Mac? I fixed the errors that were happening with Mac. – Eduardo Dória Jun 10 '23 at 19:36
  • Yes it was a mac! I hope some of the suggestions help! – Quintin Balsdon Jun 10 '23 at 22:15