Account activity UI improvements
This commit is contained in:
@@ -13,11 +13,13 @@ import androidx.compose.foundation.layout.Box
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.imePadding
|
import androidx.compose.foundation.layout.imePadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.safeDrawingPadding
|
import androidx.compose.foundation.layout.safeDrawingPadding
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
@@ -46,7 +48,6 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.platform.LocalFocusManager
|
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
import androidx.compose.ui.platform.SoftwareKeyboardController
|
import androidx.compose.ui.platform.SoftwareKeyboardController
|
||||||
import androidx.compose.ui.res.colorResource
|
import androidx.compose.ui.res.colorResource
|
||||||
@@ -130,6 +131,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
private val alertTitle = mutableStateOf("")
|
private val alertTitle = mutableStateOf("")
|
||||||
private val alertMessage = mutableStateOf("")
|
private val alertMessage = mutableStateOf("")
|
||||||
private val showAlert = mutableStateOf(false)
|
private val showAlert = mutableStateOf(false)
|
||||||
|
private val showStun = mutableStateOf(false)
|
||||||
|
|
||||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() {
|
||||||
@@ -165,6 +167,35 @@ class AccountActivity : ComponentActivity() {
|
|||||||
redirectModeMap = mapOf(false to getString(R.string.manual),
|
redirectModeMap = mapOf(false to getString(R.string.manual),
|
||||||
true to getString(R.string.auto))
|
true to getString(R.string.auto))
|
||||||
|
|
||||||
|
oldNickname = acc.nickName.value
|
||||||
|
oldDisplayname = acc.displayName
|
||||||
|
oldAuthUser = acc.authUser
|
||||||
|
if (BaresipService.aorPasswords[aor] == null && // check if OK
|
||||||
|
acc.authPass != NO_AUTH_PASS)
|
||||||
|
oldAuthPass = acc.authPass
|
||||||
|
if (acc.outbound.isNotEmpty()) {
|
||||||
|
oldOutbound1 = acc.outbound[0]
|
||||||
|
if (acc.outbound.size > 1)
|
||||||
|
oldOutbound2 = acc.outbound[1]
|
||||||
|
}
|
||||||
|
oldRegister = acc.regint > 0
|
||||||
|
oldRegInt = acc.configuredRegInt.toString()
|
||||||
|
oldMediaEnc = acc.mediaEnc
|
||||||
|
oldMediaNat = acc.mediaNat
|
||||||
|
showStun.value = oldMediaNat != ""
|
||||||
|
oldStunServer = acc.stunServer
|
||||||
|
oldStunUser = acc.stunUser
|
||||||
|
oldStunPass = acc.stunPass
|
||||||
|
oldRtcpMux = acc.rtcpMux
|
||||||
|
old100Rel = acc.rel100Mode == Api.REL100_ENABLED
|
||||||
|
oldDtmfMode = acc.dtmfMode
|
||||||
|
oldAnswerMode = acc.answerMode
|
||||||
|
oldAutoRedirect = acc.autoRedirect
|
||||||
|
oldVmUri = acc.vmUri
|
||||||
|
oldCountryCode = acc.countryCode
|
||||||
|
oldTelProvider = acc.telProvider
|
||||||
|
oldDefaultAccount = UserAgent.findAorIndex(aor)!! == 0
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
AppTheme {
|
AppTheme {
|
||||||
keyboardController = LocalSoftwareKeyboardController.current
|
keyboardController = LocalSoftwareKeyboardController.current
|
||||||
@@ -180,7 +211,6 @@ class AccountActivity : ComponentActivity() {
|
|||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
|
|
||||||
// Api.account_debug(acc.accp)
|
// Api.account_debug(acc.accp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@@ -252,8 +282,6 @@ class AccountActivity : ComponentActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val focusManager = LocalFocusManager.current
|
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.imePadding()
|
.imePadding()
|
||||||
@@ -261,37 +289,9 @@ class AccountActivity : ComponentActivity() {
|
|||||||
.padding(contentPadding)
|
.padding(contentPadding)
|
||||||
.padding(start = 16.dp, end = 4.dp, top = 8.dp, bottom = 8.dp)
|
.padding(start = 16.dp, end = 4.dp, top = 8.dp, bottom = 8.dp)
|
||||||
.verticalScrollbar(scrollState)
|
.verticalScrollbar(scrollState)
|
||||||
.verticalScroll(state = scrollState)
|
.verticalScroll(state = scrollState),
|
||||||
.clickable { focusManager.clearFocus() },
|
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
oldNickname = acc.nickName.value
|
|
||||||
oldDisplayname = acc.displayName
|
|
||||||
oldAuthUser = acc.authUser
|
|
||||||
if (BaresipService.aorPasswords[aor] == null && // check if OK
|
|
||||||
acc.authPass != NO_AUTH_PASS)
|
|
||||||
oldAuthPass = acc.authPass
|
|
||||||
if (acc.outbound.isNotEmpty()) {
|
|
||||||
oldOutbound1 = acc.outbound[0]
|
|
||||||
if (acc.outbound.size > 1)
|
|
||||||
oldOutbound2 = acc.outbound[1]
|
|
||||||
}
|
|
||||||
oldRegister = acc.regint > 0
|
|
||||||
oldRegInt = acc.configuredRegInt.toString()
|
|
||||||
oldMediaEnc = acc.mediaEnc
|
|
||||||
oldMediaNat = acc.mediaNat
|
|
||||||
oldStunServer = acc.stunServer
|
|
||||||
oldStunUser = acc.stunUser
|
|
||||||
oldStunPass = acc.stunPass
|
|
||||||
oldRtcpMux = acc.rtcpMux
|
|
||||||
old100Rel = acc.rel100Mode == Api.REL100_ENABLED
|
|
||||||
oldDtmfMode = acc.dtmfMode
|
|
||||||
oldAnswerMode = acc.answerMode
|
|
||||||
oldAutoRedirect = acc.autoRedirect
|
|
||||||
oldVmUri = acc.vmUri
|
|
||||||
oldCountryCode = acc.countryCode
|
|
||||||
oldTelProvider = acc.telProvider
|
|
||||||
oldDefaultAccount = UserAgent.findAorIndex(aor)!! == 0
|
|
||||||
AoR()
|
AoR()
|
||||||
Nickname()
|
Nickname()
|
||||||
DisplayName()
|
DisplayName()
|
||||||
@@ -488,6 +488,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
private fun Outbound() {
|
private fun Outbound() {
|
||||||
Text(text = stringResource(R.string.outbound_proxies),
|
Text(text = stringResource(R.string.outbound_proxies),
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
|
fontSize = 18.sp,
|
||||||
modifier = Modifier.padding(top=8.dp)
|
modifier = Modifier.padding(top=8.dp)
|
||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = getString(R.string.outbound_proxies)
|
alertTitle.value = getString(R.string.outbound_proxies)
|
||||||
@@ -555,6 +556,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
alertMessage.value = getString(R.string.register_help)
|
alertMessage.value = getString(R.string.register_help)
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
|
fontSize = 18.sp,
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var register by remember { mutableStateOf(oldRegister) }
|
var register by remember { mutableStateOf(oldRegister) }
|
||||||
newRegister = register
|
newRegister = register
|
||||||
@@ -565,6 +567,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
newRegister = register
|
newRegister = register
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,6 +682,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,10 +732,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
isDropDownExpanded.value = false
|
isDropDownExpanded.value = false
|
||||||
mediaNat.value = it.key
|
mediaNat.value = it.key
|
||||||
newMediaNat = mediaNat.value
|
newMediaNat = mediaNat.value
|
||||||
//if (newMediaNat == "")
|
showStun.value = newMediaNat != ""
|
||||||
// don't show stunserver
|
|
||||||
//else
|
|
||||||
// show stunserver
|
|
||||||
})
|
})
|
||||||
if (index < 3)
|
if (index < 3)
|
||||||
HorizontalDivider(
|
HorizontalDivider(
|
||||||
@@ -742,11 +743,13 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun StunServer() {
|
private fun StunServer() {
|
||||||
|
if (showStun.value)
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end=10.dp),
|
Modifier.fillMaxWidth().padding(end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -776,6 +779,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun StunUser() {
|
private fun StunUser() {
|
||||||
|
if (showStun.value)
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
Modifier.fillMaxWidth().padding(top=8.dp, end=10.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -805,6 +809,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun StunPass() {
|
private fun StunPass() {
|
||||||
|
if (showStun.value) {
|
||||||
val showPassword = remember { mutableStateOf(false) }
|
val showPassword = remember { mutableStateOf(false) }
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(end = 10.dp),
|
Modifier.fillMaxWidth().padding(end = 10.dp),
|
||||||
@@ -834,7 +839,8 @@ class AccountActivity : ComponentActivity() {
|
|||||||
} else {
|
} else {
|
||||||
Pair(
|
Pair(
|
||||||
ImageVector.vectorResource(R.drawable.visibility_off),
|
ImageVector.vectorResource(R.drawable.visibility_off),
|
||||||
colorResource(id = R.color.colorWhite))
|
colorResource(id = R.color.colorWhite)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
IconButton(onClick = { showPassword.value = !showPassword.value }) {
|
IconButton(onClick = { showPassword.value = !showPassword.value }) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -848,14 +854,17 @@ class AccountActivity : ComponentActivity() {
|
|||||||
.clickable {
|
.clickable {
|
||||||
alertTitle.value = getString(R.string.stun_password)
|
alertTitle.value = getString(R.string.stun_password)
|
||||||
alertMessage.value = getString(R.string.stun_password_help)
|
alertMessage.value = getString(R.string.stun_password_help)
|
||||||
showAlert.value = true },
|
showAlert.value = true
|
||||||
|
},
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
|
fontSize = 18.sp, color = LocalCustomColors.current.itemText
|
||||||
|
),
|
||||||
label = { LabelText(stringResource(R.string.stun_password)) },
|
label = { LabelText(stringResource(R.string.stun_password)) },
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun RtcpMux() {
|
fun RtcpMux() {
|
||||||
@@ -871,6 +880,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
alertMessage.value = getString(R.string.rtcp_mux_help)
|
alertMessage.value = getString(R.string.rtcp_mux_help)
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
|
fontSize = 18.sp,
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var rtcpMux by remember { mutableStateOf(oldRtcpMux) }
|
var rtcpMux by remember { mutableStateOf(oldRtcpMux) }
|
||||||
newRtcpMux = rtcpMux
|
newRtcpMux = rtcpMux
|
||||||
@@ -881,6 +891,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
newRtcpMux = rtcpMux
|
newRtcpMux = rtcpMux
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,6 +909,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
alertMessage.value = getString(R.string.rel_100_help)
|
alertMessage.value = getString(R.string.rel_100_help)
|
||||||
showAlert.value = true
|
showAlert.value = true
|
||||||
},
|
},
|
||||||
|
fontSize = 18.sp,
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var rel100 by remember { mutableStateOf(old100Rel) }
|
var rel100 by remember { mutableStateOf(old100Rel) }
|
||||||
new100Rel = rel100
|
new100Rel = rel100
|
||||||
@@ -908,13 +920,14 @@ class AccountActivity : ComponentActivity() {
|
|||||||
new100Rel = rel100
|
new100Rel = rel100
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Dtmf() {
|
private fun Dtmf() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=12.dp),
|
Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -969,13 +982,14 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Answer() {
|
private fun Answer() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=12.dp),
|
Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -1028,13 +1042,14 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Redirect() {
|
private fun Redirect() {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth().padding(top=12.dp),
|
Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
@@ -1089,6 +1104,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1192,6 +1208,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
alertTitle.value = getString(R.string.default_account)
|
alertTitle.value = getString(R.string.default_account)
|
||||||
alertMessage.value = getString(R.string.default_account_help)
|
alertMessage.value = getString(R.string.default_account_help)
|
||||||
showAlert.value = true },
|
showAlert.value = true },
|
||||||
|
fontSize = 18.sp,
|
||||||
color = LocalCustomColors.current.itemText)
|
color = LocalCustomColors.current.itemText)
|
||||||
var defaultAccount by remember { mutableStateOf(oldDefaultAccount) }
|
var defaultAccount by remember { mutableStateOf(oldDefaultAccount) }
|
||||||
newDefaultAccount = defaultAccount
|
newDefaultAccount = defaultAccount
|
||||||
@@ -1202,6 +1219,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
newDefaultAccount = defaultAccount
|
newDefaultAccount = defaultAccount
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user