Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

StageText.color is automatically inverted (Android dark theme, forceDarkAllowed style flag)

Open Mintonist opened this issue 4 years ago • 12 comments

Hi!

Seems Android try to set dark theme inside AIR app and change StageText.color StageText.color is inverted. 0x000000 -> 0xFFFFFF 0x404040 -> 0xBFBFBF 0xFFFFFF -> 0x000000

But it happens time to time (not always on same device). Seems depend of actions order (change theme, run app)

I use AIR+Starling+Feather. Concretely Feather's TextInput. It uses StageText inside. So seems the problem relates to AIR.

For example I see this on Redme Note 7: image

instead of: image

There is a video demonstrating the problem after entering 2 symbols - https://user-images.githubusercontent.com/9267850/113772215-15343e80-972d-11eb-9934-bc2e0fcd0997.mp4


Starling forum topic: https://forum.starling-framework.org/d/22992-stagetext-color-changes-with-theme-changing-on-android

Mintonist avatar Apr 06 '21 20:04 Mintonist

Can you try adding <item name="android:forceDarkAllowed">false</item> to the styles.xml in your AIR SDK

AIRSDK/lib/android/lib/resources/app_entry/res/values/styles.xml

<resources>
    <style name="Theme.NoShadow" parent="android:style/Theme.NoTitleBar">
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:forceDarkAllowed">false</item>
    </style>
</resources>

marchbold avatar Apr 07 '21 01:04 marchbold

Thx to @marchbold ! It works!

Mintonist avatar Apr 12 '21 09:04 Mintonist

Probably should leave this open to get harman to address it :)

marchbold avatar Apr 13 '21 04:04 marchbold

@ajwfrost Can you give a solution for this? Can we configure this behavior without modification IRSDK/lib/android/lib/resources/app_entry/res/values/styles.xml after each AIR update? Thx!

Mintonist avatar Oct 22 '21 12:10 Mintonist

Sorry @Mintonist we had missed this one! So was this just a request to have that setting in the AIR default styles.xml, or would you prefer this to be configurable via the application descriptor?

ajwfrost avatar Oct 22 '21 12:10 ajwfrost

No idea) If only I have this request, may be it does not matter. You can discuss this inside your team.

Mintonist avatar Oct 26 '21 14:10 Mintonist

Now with AIR51.2 we can add own res/values/styles.xml

In my case this is:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.NoShadow" parent="android:style/Theme.NoTitleBar">
        <item name="android:windowContentOverlay">@null</item>
		<item name="android:forceDarkAllowed">false</item>
    </style>
</resources>

@ajwfrost It works for .aab build but failed with .apk build:

Unable to run java: com.adobe.air.ADTException: gradle tool failed: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processReleaseResources'. > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction > Android resource linking failed ERROR: ...\AppData\Local\Temp\fc746b90-86ce-4db7-97e0-0f7bf5fb336d\app\src\main\AndroidManifest.xml:376:1-382:12: AAPT: error: resource style/Theme.PlayCore.Transparent (aka air.mycompany.com:style/Theme.PlayCore.Transparent) not found.

Mintonist avatar Nov 15 '25 14:11 Mintonist

@ajwfrost can you give advice about my problem with .apk build?

Mintonist avatar Nov 26 '25 14:11 Mintonist

@Mintonist Not sure this will work via the res folder as the original resource will still be in the AIR SDK, though the error seems to indicate something different than I would have expected. To do it that way you might have to change the name of the style and then apply a different style to the application activity, though I haven't tried this.

marchbold avatar Nov 27 '25 23:11 marchbold

@marchbold It works with res folder for .aab build. But fail for .apk build

Mintonist avatar Dec 03 '25 10:12 Mintonist

Interesting, can you double check that you are using the new build process (i.e. have set build legacy in your manifest and have set an android sdk in your config via air sdk manager or other)?

marchbold avatar Dec 04 '25 23:12 marchbold

about adding own res/values/styles.xml @ajwfrost tell me somewhere in other ticket early

I use new build process via gradle and Android SDK

Mintonist avatar Dec 05 '25 16:12 Mintonist