bk138 / multivnc

MultiVNC is a cross-platform Multicast-enabled VNC viewer based on LibVNCClient. The desktop client runs on Unix, Mac OS X and Windows. There also is an Android client.
GNU General Public License v3.0
460 stars 66 forks source link

Android: Add support for night mode (dark theme) #165

Closed gujjwal00 closed 2 years ago

gujjwal00 commented 2 years ago

This adds basic night mode support. If system is in night mode, we will automatically use dark theme.

Fixes #142

bk138 commented 2 years ago

@gujjwal00 There's a small issue with this: with bright mode, AlertDialog buttons now have white text on white background. What do you think would be the best solution - adding a specific AlertDialog theme (I tried that for a few minutes, but did not succeed quickly) or adding specific day/night button text colours (did not try that yet...)

gujjwal00 commented 2 years ago

IMO instead of the modifying the global android:buttonStyle we should apply the style directly on the required buttons. I think there are only 5-6 buttons which we want to modify (2 in main activity + 2 in editor activity + 1 in meta-key dialog ...).

Adding specific day/night button text colors will probably run into the same issue as we want some of the buttons to have white color and other to have primary green color. (I fixed the text color to white because black text on our primary color has poor contrast).

About the issue: Dialog buttons seems to apply the style from android:buttonBarButtonStyle attribute, which is initialized with android:buttonStyle attribute. That's why it is inheriting the white text, and probably why setting a AlertDialog theme didn't work. It also seems to affect API 23+ only.

bk138 commented 2 years ago

Got it in 89f648e5d4440e03471c7c11c14a47527e96e55d. Not really fun dealing with all those prefixed vs non-prefixed style names though ;-)

gujjwal00 commented 2 years ago

Yeah, it's like shooting in the dark, except you also have to find the gun first.