Skip to content

Commit

Permalink
fix(settings): disable ignoreDisplayCutout when necessary
Browse files Browse the repository at this point in the history
`Ignore display cutout` is only useful if `Hide system bars` is set to something other than `None`
  • Loading branch information
BrayanDSO authored and lukstbit committed Feb 9, 2025
1 parent 9599a1d commit 168cad0
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
package com.ichi2.anki.preferences

import android.os.Bundle
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import com.ichi2.anki.R
import com.ichi2.anki.SingleFragmentActivity
import com.ichi2.anki.preferences.reviewer.ReviewerMenuSettingsFragment
import com.ichi2.anki.settings.Prefs
import com.ichi2.anki.settings.enums.HideSystemBars

/**
* Developer options to test some of the new reviewer settings and features
Expand Down Expand Up @@ -51,5 +55,14 @@ class ReviewerOptionsFragment :
startActivity(intent)
true
}

val ignoreDisplayCutout =
requirePreference<SwitchPreferenceCompat>(R.string.ignore_display_cutout_key).apply {
isEnabled = Prefs.hideSystemBars != HideSystemBars.NONE
}

requirePreference<ListPreference>(R.string.hide_system_bars_key).setOnPreferenceChangeListener { value ->
ignoreDisplayCutout.isEnabled = value != HideSystemBars.NONE.entryValue
}
}
}

0 comments on commit 168cad0

Please sign in to comment.