meypod/al-azan

Notifications widget

Closed this issue · 15 comments

The widget appears in the notifications in a white color without texts.

Version, image، context? What did you try that resulted in what

I noticed that the problem appears from version 1.17.0.rc6

Screenshot_20230726-220348_Al-Azan

I suggest to try 1.17.0-rc7, just to make sure it was not a build issue
I haven't done anything to the widget in the last updates for sth like this to happen

However if if it did happen again, try enabling adaptive theme option (if you have android 12+) i provided to see if its a theming issue or sth else

My phone is running Android 9, I have now discovered that the problem occurs with the system dark theme only, in all versions of the app.

٢٠٢٣٠٧٢٧-٠٧٣٠٥٩

thanks for narrowing down the issue
I had suspected that this is may be what happening, thats why I suggested to try adaptive theme mode

but still, it doesn't make any sense why the background of it is white
I'm on dark theme as well but on android 13

I'll investigate android 9 on emulator to see what's happening

As far as I can tell, it seems that android 9 did not have a proper dark mode yet at the time of it's release
I could reproduce it very hard, and even then I don't know how I reproduced it

because the dark mode is not system wide, at least in emulator. you can see all notifications are colored/white, and also system settings are still in light mode. other places are dark mode. so It's a mix of light and dark instead of complete dark mode.

image
image

so overall, I don't think a fix is easy to implement
unless I give my widget a solid background, which won't look good on other versions

for me setting the dark mode from display settings of emulator has no effect
using the following command enables the issue after updating the widget(hide then show again or via app restart):

adb shell "cmd uimode night yes"

to disable:

adb shell "cmd uimode night no"

it seems this is somehow different from system's dark mode settings

anyway the issue is that the notifications background must also turn black, but they don't
I don't know how consistent is this behavior across android versions

hmmm

So I guess dark theme (and probably subsequently the notification background color change) starts with android 10

It may be actually easy
I'll apply the night colors only on android 10+, and fallback to original values of light theme on older android

Hmm,, As for me, I do not use the widget feature inside the notifications, I use the widget on the home screen, I just wanted to report the existence of this problem, you can ignore and close the issue if you want :)

Thank you for reporting it, for sure it's important to know such issues exist

even if you don't use it, someone else may be using it
so again, thank you

feel free to open an issue whenever you find one, I appreciate it :)

I'll close the issue once I apply the fix

the info I may comment on an issue in details is usually for the record and maybe future revisits if some similar problem arises somewhere, and sometimes the issue opener, like you, may have more info than me, so they may correct me, so don't mind me if I look like I'm talking to myself

a few questions:
are your other notifications also white background, or only al-azan ?
do you have any other notification that also has some kind of structure (not text only), that has white background ? or they all work correctly ?

I did not receive any notifications with a white background devoid of text, except in Al-azan app

It's not as simple as I thought

home screen widget is using the same values as well
notification's background color is tricky across versions

some notes from android docs:

Beware that the background color for the notification can vary across different devices and versions. So you should always apply support library styles such as TextAppearance_Compat_Notification for the text and TextAppearance_Compat_Notification_Title for the title in your custom layout. These styles adapt to the color variations so you don't end up with black-on-black or white-on-white text.

Applied the fix
separated notification widget base style from homescreen widget and only applied dark theme related values on android 10+
will be available on rc11 or the stable release once it's ready

thank you