mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-29 00:03:19 -05:00
Fix window undimming when reader custom filter settings are open
This commit is contained in:
parent
e0733c1a4c
commit
5467104b95
3 changed files with 19 additions and 20 deletions
|
@ -23,9 +23,6 @@ fun ReaderSettingsDialog(
|
|||
onHideMenus: () -> Unit,
|
||||
screenModel: ReaderSettingsScreenModel,
|
||||
) {
|
||||
// TODO: undimming doesn't seem to work
|
||||
val window = (LocalView.current.parent as? DialogWindowProvider)?.window
|
||||
|
||||
val tabTitles = listOf(
|
||||
stringResource(R.string.pref_category_reading_mode),
|
||||
stringResource(R.string.pref_category_general),
|
||||
|
@ -33,16 +30,6 @@ fun ReaderSettingsDialog(
|
|||
)
|
||||
val pagerState = rememberPagerState { tabTitles.size }
|
||||
|
||||
LaunchedEffect(pagerState.currentPage) {
|
||||
if (pagerState.currentPage == 2) {
|
||||
window?.setDimAmount(0f)
|
||||
onHideMenus()
|
||||
} else {
|
||||
window?.setDimAmount(0.75f)
|
||||
onShowMenus()
|
||||
}
|
||||
}
|
||||
|
||||
TabbedDialog(
|
||||
onDismissRequest = {
|
||||
onDismissRequest()
|
||||
|
@ -51,6 +38,18 @@ fun ReaderSettingsDialog(
|
|||
tabTitles = tabTitles,
|
||||
pagerState = pagerState,
|
||||
) { page ->
|
||||
val window = (LocalView.current.parent as? DialogWindowProvider)?.window
|
||||
|
||||
LaunchedEffect(pagerState.currentPage) {
|
||||
if (pagerState.currentPage == 2) {
|
||||
window?.setDimAmount(0f)
|
||||
onHideMenus()
|
||||
} else {
|
||||
window?.setDimAmount(0.5f)
|
||||
onShowMenus()
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(vertical = TabbedDialogPaddings.Vertical)
|
||||
|
|
|
@ -113,6 +113,10 @@ class MainActivity : BaseActivity() {
|
|||
|
||||
private var navigator: Navigator? = null
|
||||
|
||||
init {
|
||||
registerSecureActivity(this)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val isLaunch = savedInstanceState == null
|
||||
|
||||
|
@ -429,10 +433,6 @@ class MainActivity : BaseActivity() {
|
|||
return true
|
||||
}
|
||||
|
||||
init {
|
||||
registerSecureActivity(this)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Splash screen
|
||||
private const val SPLASH_MIN_DURATION = 500 // ms
|
||||
|
|
|
@ -15,9 +15,9 @@ class NetworkHelper(
|
|||
private val preferences: NetworkPreferences,
|
||||
) {
|
||||
|
||||
val cookieJar by lazy { AndroidCookieJar() }
|
||||
val cookieJar = AndroidCookieJar()
|
||||
|
||||
val client by lazy {
|
||||
val client: OkHttpClient = run {
|
||||
val builder = OkHttpClient.Builder()
|
||||
.cookieJar(cookieJar)
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
|
@ -64,7 +64,7 @@ class NetworkHelper(
|
|||
*/
|
||||
@Deprecated("The regular client handles Cloudflare by default")
|
||||
@Suppress("UNUSED")
|
||||
val cloudflareClient by lazy { client }
|
||||
val cloudflareClient: OkHttpClient = client
|
||||
|
||||
fun defaultUserAgentProvider() = preferences.defaultUserAgent().get().trim()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue