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