0

Let's say I want to have text only be visible once the screen colors are inverted in a native Android application. To do this:

  • Set the text color to the background color, white for example.
  • Listen for the invert colors being enabled.
  • Once it's enabled, disable that text's color from being inverted but let the background be inverted.
  • The background should now be black, but the text will remain white.

Now, my question is, is it possible to override the effect for a specific view? According to this you can listen for inverted color changes.

However, to implement this I'll need to disable the inversion of the color of the text. I don't think this is possible, however, if it IS possible for me to do it, I'm thinking:

  • The user might need to be rooted
  • This might violate any terms of the device.

I'd like to try to do this by overriding the service instead of changing the text colors once the service is turned on, just for fun.

Ali Bdeir
  • 4,151
  • 10
  • 57
  • 117
  • I'm not an Android programmer, but one thought... couldn't you listen for the inverted color change event, and then use that to manually change your font such that its inverted color is the one you want? – yshavit Apr 15 '18 at 16:14
  • @yshavit D'oh... – Ali Bdeir Apr 15 '18 at 16:16
  • @yshavit To fix things I'm going to try to see if this is possible WITHOUT that but instead overriding it. – Ali Bdeir Apr 15 '18 at 16:22

1 Answers1

0

This is theoretically possible, HOWEVER, the approach you'd have to take is such a terrible hack as for it to be impossible. You see, you don't get access to any raw views in Accessibility Services. Just a textual representation. So the only way to make this happen would be to re-render the entire view hierarchy in an Overlay on top of the application.

An approach the way you outline is not possible. Even on a rooted device. If you were really determined to follow through on such thoughts, you'd need your own OS distribution.

MobA11y
  • 18,425
  • 3
  • 49
  • 76