Skip to content

Commit

Permalink
Read dark mode state
Browse files Browse the repository at this point in the history
  • Loading branch information
uholeschak committed Jan 12, 2025
1 parent 372f275 commit 7ee261e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion BmwDeepObd/BaseActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public bool ActionBarVisible
private static List<Android.App.Activity> ActivityStack = new List<Android.App.Activity>();
public const ConfigChanges ActivityConfigChanges =
ConfigChanges.KeyboardHidden | ConfigChanges.Orientation | ConfigChanges.ScreenLayout |
ConfigChanges.ScreenSize | ConfigChanges.SmallestScreenSize;
ConfigChanges.ScreenSize | ConfigChanges.SmallestScreenSize | ConfigChanges.UiMode;
private const int AutoFullScreenTimeout = 3000;
private const int LongPressTimeout = 2000;
public const string InstanceDataKeyDefault = "InstanceData";
Expand Down Expand Up @@ -663,6 +663,13 @@ public virtual void OnBackPressedEvent()
Finish();
}

public bool IsDarkModeOn()
{
UiMode nightModeFlags = Resources.Configuration.UiMode & UiMode.NightMask;
bool isDarkModeOn = nightModeFlags == UiMode.NightYes;
return isDarkModeOn;
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416: Validate platform compatibility")]
public void EnableFullScreenMode(bool enable)
{
Expand Down

0 comments on commit 7ee261e

Please sign in to comment.