Skip to content

Commit 8c9718d

Browse files
CopilotYBTopaz8
andcommitted
Improve code readability by extracting condition to helper method
Co-authored-by: YBTopaz8 <41630728+YBTopaz8@users.noreply.github.com>
1 parent ba0ab70 commit 8c9718d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Dimmer/Dimmer.Droid/ViewsAndPages/NativeViews/LyricsViewFragment.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,16 @@ public override void OnPause()
138138
ClearScreenKeepOn();
139139
}
140140

141+
private bool ShouldSetScreenKeepOn()
142+
{
143+
return viewModel?.KeepScreenOnDuringLyrics == true
144+
&& Activity?.Window != null
145+
&& !_isScreenKeepOnSetByThisFragment;
146+
}
147+
141148
private void UpdateScreenKeepOn()
142149
{
143-
if (viewModel?.KeepScreenOnDuringLyrics == true && Activity?.Window != null && !_isScreenKeepOnSetByThisFragment)
150+
if (ShouldSetScreenKeepOn())
144151
{
145152
Activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
146153
_isScreenKeepOnSetByThisFragment = true;

0 commit comments

Comments
 (0)