mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-07-22 11:11:02 +00:00
Do not show extended proxy details in App Settings if proxy type is system or none (#661)
Fixes: #660
This commit is contained in:
parent
5921fb2bb6
commit
014c94a031
|
@ -284,45 +284,47 @@ class AppSettingsActivity: AppCompatActivity() {
|
|||
onDismiss = { showProxyTypeInputDialog = false }
|
||||
)
|
||||
|
||||
var showProxyHostNameInputDialog by remember { mutableStateOf(false) }
|
||||
Setting(
|
||||
name = stringResource(R.string.app_settings_proxy_host),
|
||||
summary = proxyHostName
|
||||
) {
|
||||
showProxyHostNameInputDialog = true
|
||||
}
|
||||
if (showProxyHostNameInputDialog)
|
||||
EditTextInputDialog(
|
||||
title = stringResource(R.string.app_settings_proxy_host),
|
||||
initialValue = proxyHostName,
|
||||
keyboardType = KeyboardType.Uri,
|
||||
onValueEntered = onProxyHostNameUpdated,
|
||||
onDismiss = { showProxyHostNameInputDialog = false }
|
||||
)
|
||||
if (proxyType !in listOf(Settings.PROXY_TYPE_SYSTEM, Settings.PROXY_TYPE_NONE)) {
|
||||
var showProxyHostNameInputDialog by remember { mutableStateOf(false) }
|
||||
Setting(
|
||||
name = stringResource(R.string.app_settings_proxy_host),
|
||||
summary = proxyHostName
|
||||
) {
|
||||
showProxyHostNameInputDialog = true
|
||||
}
|
||||
if (showProxyHostNameInputDialog)
|
||||
EditTextInputDialog(
|
||||
title = stringResource(R.string.app_settings_proxy_host),
|
||||
initialValue = proxyHostName,
|
||||
keyboardType = KeyboardType.Uri,
|
||||
onValueEntered = onProxyHostNameUpdated,
|
||||
onDismiss = { showProxyHostNameInputDialog = false }
|
||||
)
|
||||
|
||||
var showProxyPortInputDialog by remember { mutableStateOf(false) }
|
||||
Setting(
|
||||
name = stringResource(R.string.app_settings_proxy_port),
|
||||
summary = proxyPort?.toString()
|
||||
) {
|
||||
showProxyPortInputDialog = true
|
||||
var showProxyPortInputDialog by remember { mutableStateOf(false) }
|
||||
Setting(
|
||||
name = stringResource(R.string.app_settings_proxy_port),
|
||||
summary = proxyPort?.toString()
|
||||
) {
|
||||
showProxyPortInputDialog = true
|
||||
}
|
||||
if (showProxyPortInputDialog)
|
||||
EditTextInputDialog(
|
||||
title = stringResource(R.string.app_settings_proxy_port),
|
||||
initialValue = proxyPort?.toString(),
|
||||
keyboardType = KeyboardType.Number,
|
||||
onValueEntered = {
|
||||
try {
|
||||
val newPort = it.toInt()
|
||||
if (newPort in 1..65535)
|
||||
onProxyPortUpdated(newPort)
|
||||
} catch (_: NumberFormatException) {
|
||||
// user entered invalid port number
|
||||
}
|
||||
},
|
||||
onDismiss = { showProxyPortInputDialog = false }
|
||||
)
|
||||
}
|
||||
if (showProxyPortInputDialog)
|
||||
EditTextInputDialog(
|
||||
title = stringResource(R.string.app_settings_proxy_port),
|
||||
initialValue = proxyPort?.toString(),
|
||||
keyboardType = KeyboardType.Number,
|
||||
onValueEntered = {
|
||||
try {
|
||||
val newPort = it.toInt()
|
||||
if (newPort in 1..65535)
|
||||
onProxyPortUpdated(newPort)
|
||||
} catch(_: NumberFormatException) {
|
||||
// user entered invalid port number
|
||||
}
|
||||
},
|
||||
onDismiss = { showProxyPortInputDialog = false }
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
Loading…
Reference in a new issue