Simplified string access
This commit is contained in:
@@ -69,7 +69,7 @@ class AboutActivity : ComponentActivity() {
|
|||||||
|
|
||||||
Utils.addActivity("about")
|
Utils.addActivity("about")
|
||||||
|
|
||||||
val aboutTitle = String.format(getString(R.string.about_title))
|
val aboutTitle = getString(R.string.about_title)
|
||||||
val aboutText = String.format(getString(R.string.about_text),
|
val aboutText = String.format(getString(R.string.about_text),
|
||||||
BuildConfig.VERSION_NAME)
|
BuildConfig.VERSION_NAME)
|
||||||
|
|
||||||
|
|||||||
@@ -1248,7 +1248,7 @@ class AccountActivity : ComponentActivity() {
|
|||||||
showPasswordDialog = showPasswordDialog,
|
showPasswordDialog = showPasswordDialog,
|
||||||
password = password,
|
password = password,
|
||||||
keyboardController = keyboardController,
|
keyboardController = keyboardController,
|
||||||
title = getString(R.string.authentication_password),
|
title = stringResource(R.string.authentication_password),
|
||||||
okAction = {
|
okAction = {
|
||||||
if (password.value != "") {
|
if (password.value != "") {
|
||||||
BaresipService.aorPasswords[acc.aor] = password.value
|
BaresipService.aorPasswords[acc.aor] = password.value
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class AccountsActivity : ComponentActivity() {
|
|||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
val title = String.format(getString(R.string.accounts))
|
val title = getString(R.string.accounts)
|
||||||
|
|
||||||
aor = intent.getStringExtra("aor")!!
|
aor = intent.getStringExtra("aor")!!
|
||||||
Utils.addActivity("accounts,$aor")
|
Utils.addActivity("accounts,$aor")
|
||||||
@@ -183,11 +183,11 @@ class AccountsActivity : ComponentActivity() {
|
|||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = message.value,
|
message = message.value,
|
||||||
positiveButtonText = getString(R.string.delete),
|
positiveButtonText = stringResource(R.string.delete),
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
negativeButtonText = getString(R.string.cancel),
|
negativeButtonText = stringResource(R.string.cancel),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (showAlert.value) {
|
if (showAlert.value) {
|
||||||
@@ -281,7 +281,7 @@ class AccountsActivity : ComponentActivity() {
|
|||||||
) {
|
) {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = newAor,
|
value = newAor,
|
||||||
placeholder = { Text(text = getString(R.string.new_account)) },
|
placeholder = { Text(text = stringResource(R.string.new_account)) },
|
||||||
onValueChange = { newAor = it },
|
onValueChange = { newAor = it },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -115,7 +116,7 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
color = LocalCustomColors.current.background
|
color = LocalCustomColors.current.background
|
||||||
) {
|
) {
|
||||||
CallDetailsScreen(this, getString(R.string.call_details)) { goBack() }
|
CallDetailsScreen(this, stringResource(R.string.call_details)) { goBack() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +176,7 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Peer(ctx: Context, peer: String, account: Account) {
|
fun Peer(ctx: Context, peer: String, account: Account) {
|
||||||
val headerText = getString(R.string.peer) + " " +
|
val headerText = stringResource(R.string.peer) + " " +
|
||||||
Utils.friendlyUri(ctx, peer, account)
|
Utils.friendlyUri(ctx, peer, account)
|
||||||
Text(
|
Text(
|
||||||
text = headerText,
|
text = headerText,
|
||||||
@@ -190,20 +191,20 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
@Composable
|
@Composable
|
||||||
fun Calls(ctx: Context) {
|
fun Calls(ctx: Context) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Text(text = getString(R.string.direction),
|
Text(text = stringResource(R.string.direction),
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.SemiBold,
|
fontWeight = FontWeight.SemiBold,
|
||||||
modifier = Modifier.width(96.dp)
|
modifier = Modifier.width(96.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(6.dp))
|
Spacer(modifier = Modifier.width(6.dp))
|
||||||
Text(text = getString(R.string.time),
|
Text(text = stringResource(R.string.time),
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.SemiBold
|
fontWeight = FontWeight.SemiBold
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Text(text = getString(R.string.calls_duration),
|
Text(text = stringResource(R.string.calls_duration),
|
||||||
modifier = Modifier.padding(end = 12.dp),
|
modifier = Modifier.padding(end = 12.dp),
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
@@ -232,7 +233,7 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
modifier = Modifier.width(64.dp)
|
modifier = Modifier.width(64.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(38.dp))
|
Spacer(modifier = Modifier.width(38.dp))
|
||||||
val durationText = startTime(ctx, detail)
|
val durationText = startTime(detail)
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Duration(ctx, detail, durationText)
|
Duration(ctx, detail, durationText)
|
||||||
}
|
}
|
||||||
@@ -241,14 +242,14 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun startTime(ctx: Context, detail: CallRow.Details): String {
|
fun startTime(detail: CallRow.Details): String {
|
||||||
val startTime = detail.startTime
|
val startTime = detail.startTime
|
||||||
val stopTime = detail.stopTime
|
val stopTime = detail.stopTime
|
||||||
val startTimeText: String
|
val startTimeText: String
|
||||||
val durationText: String
|
val durationText: String
|
||||||
val stopText = if (DateUtils.isToday(stopTime.timeInMillis)) {
|
val stopText = if (DateUtils.isToday(stopTime.timeInMillis)) {
|
||||||
val fmt = DateFormat.getTimeInstance(DateFormat.MEDIUM)
|
val fmt = DateFormat.getTimeInstance(DateFormat.MEDIUM)
|
||||||
ctx.getString(R.string.today) + " " + fmt.format(stopTime.time)
|
stringResource(R.string.today) + " " + fmt.format(stopTime.time)
|
||||||
} else {
|
} else {
|
||||||
val fmt = DateFormat.getDateTimeInstance()
|
val fmt = DateFormat.getDateTimeInstance()
|
||||||
fmt.format(stopTime.time)
|
fmt.format(stopTime.time)
|
||||||
@@ -263,7 +264,7 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
} else {
|
} else {
|
||||||
val startText = if (DateUtils.isToday(startTime.timeInMillis)) {
|
val startText = if (DateUtils.isToday(startTime.timeInMillis)) {
|
||||||
val fmt = DateFormat.getTimeInstance(DateFormat.MEDIUM)
|
val fmt = DateFormat.getTimeInstance(DateFormat.MEDIUM)
|
||||||
ctx.getString(R.string.today) + " " + fmt.format(startTime.time)
|
stringResource(R.string.today) + " " + fmt.format(startTime.time)
|
||||||
} else {
|
} else {
|
||||||
val fmt = DateFormat.getDateTimeInstance()
|
val fmt = DateFormat.getDateTimeInstance()
|
||||||
fmt.format(startTime.time)
|
fmt.format(startTime.time)
|
||||||
@@ -285,7 +286,7 @@ class CallDetailsActivity : ComponentActivity() {
|
|||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.playing_recording),
|
title = stringResource(R.string.playing_recording),
|
||||||
message = "",
|
message = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
@@ -103,7 +104,7 @@ class CallsActivity : ComponentActivity() {
|
|||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
val title = String.format(getString(R.string.call_history))
|
val title = getString(R.string.call_history)
|
||||||
|
|
||||||
aor = intent.getStringExtra("aor")!!
|
aor = intent.getStringExtra("aor")!!
|
||||||
Utils.addActivity("calls,$aor")
|
Utils.addActivity("calls,$aor")
|
||||||
@@ -147,19 +148,19 @@ class CallsActivity : ComponentActivity() {
|
|||||||
|
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val delete = String.format(getString(R.string.delete))
|
val delete = stringResource(R.string.delete)
|
||||||
val disable = String.format(getString(R.string.disable_history))
|
val disable = stringResource(R.string.disable_history)
|
||||||
val enable = String.format(getString(R.string.enable_history))
|
val enable = stringResource(R.string.enable_history)
|
||||||
|
|
||||||
val showDialog = remember { mutableStateOf(false) }
|
val showDialog = remember { mutableStateOf(false) }
|
||||||
val positiveAction = remember { mutableStateOf({}) }
|
val positiveAction = remember { mutableStateOf({}) }
|
||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = String.format(getString(R.string.delete_history_alert), aor.substringAfter(":")),
|
message = String.format(stringResource(R.string.delete_history_alert), aor.substringAfter(":")),
|
||||||
positiveButtonText = getString(R.string.delete),
|
positiveButtonText = stringResource(R.string.delete),
|
||||||
negativeButtonText = getString(R.string.cancel),
|
negativeButtonText = stringResource(R.string.cancel),
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -234,7 +235,7 @@ class CallsActivity : ComponentActivity() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Account(account: Account) {
|
fun Account(account: Account) {
|
||||||
val headerText = getString(R.string.account) + " " +
|
val headerText = stringResource(R.string.account) + " " +
|
||||||
if (account.nickName.value != "")
|
if (account.nickName.value != "")
|
||||||
account.nickName.value
|
account.nickName.value
|
||||||
else
|
else
|
||||||
@@ -264,13 +265,13 @@ class CallsActivity : ComponentActivity() {
|
|||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = message.value,
|
message = message.value,
|
||||||
positiveButtonText = positiveButtonText.value,
|
positiveButtonText = positiveButtonText.value,
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
neutralButtonText = neutralButtonText.value,
|
neutralButtonText = neutralButtonText.value,
|
||||||
onNeutralClicked = neutralAction.value,
|
onNeutralClicked = neutralAction.value,
|
||||||
negativeButtonText = getString(R.string.cancel)
|
negativeButtonText = stringResource(R.string.cancel)
|
||||||
)
|
)
|
||||||
|
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
@@ -301,8 +302,8 @@ class CallsActivity : ComponentActivity() {
|
|||||||
onClick = {
|
onClick = {
|
||||||
val peerUri = callRow.peerUri
|
val peerUri = callRow.peerUri
|
||||||
val peerName = Utils.friendlyUri(ctx, peerUri, account)
|
val peerName = Utils.friendlyUri(ctx, peerUri, account)
|
||||||
message.value = String.format(ctx.getString(R.string.contact_action_question), peerName)
|
message.value = String.format(getString(R.string.contact_action_question), peerName)
|
||||||
positiveButtonText.value = ctx.getString(R.string.call)
|
positiveButtonText.value = getString(R.string.call)
|
||||||
positiveAction.value = {
|
positiveAction.value = {
|
||||||
BaresipService.activities.remove("calls,$aor")
|
BaresipService.activities.remove("calls,$aor")
|
||||||
MainActivity.activityAor = aor
|
MainActivity.activityAor = aor
|
||||||
@@ -314,7 +315,7 @@ class CallsActivity : ComponentActivity() {
|
|||||||
i.putExtra("peer", peerUri)
|
i.putExtra("peer", peerUri)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
}
|
}
|
||||||
neutralButtonText.value = ctx.getString(R.string.send_message)
|
neutralButtonText.value = getString(R.string.send_message)
|
||||||
neutralAction.value = {
|
neutralAction.value = {
|
||||||
BaresipService.activities.remove("calls,$aor")
|
BaresipService.activities.remove("calls,$aor")
|
||||||
MainActivity.activityAor = aor
|
MainActivity.activityAor = aor
|
||||||
|
|||||||
@@ -287,13 +287,13 @@ class ChatActivity : ComponentActivity() {
|
|||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = dialogMessage.value,
|
message = dialogMessage.value,
|
||||||
positiveButtonText = positiveButtonText.value,
|
positiveButtonText = positiveButtonText.value,
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
neutralButtonText = neutralButtonText.value,
|
neutralButtonText = neutralButtonText.value,
|
||||||
onNeutralClicked = neutralAction.value,
|
onNeutralClicked = neutralAction.value,
|
||||||
negativeButtonText = getString(R.string.cancel)
|
negativeButtonText = stringResource(R.string.cancel)
|
||||||
)
|
)
|
||||||
|
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
@@ -336,7 +336,7 @@ class ChatActivity : ComponentActivity() {
|
|||||||
chatPeer
|
chatPeer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ctx.getString(R.string.you)
|
stringResource(R.string.you)
|
||||||
var info: String
|
var info: String
|
||||||
val cal = GregorianCalendar()
|
val cal = GregorianCalendar()
|
||||||
cal.timeInMillis = message.timeStamp
|
cal.timeInMillis = message.timeStamp
|
||||||
@@ -345,12 +345,12 @@ class ChatActivity : ComponentActivity() {
|
|||||||
else
|
else
|
||||||
DateFormat.getDateInstance(DateFormat.SHORT)
|
DateFormat.getDateInstance(DateFormat.SHORT)
|
||||||
info = fmt.format(cal.time)
|
info = fmt.format(cal.time)
|
||||||
if (info.length < 6) info = "${ctx.getString(R.string.today)} $info"
|
if (info.length < 6) info = "${stringResource(R.string.today)} $info"
|
||||||
if (message.direction == MESSAGE_UP_FAIL) {
|
if (message.direction == MESSAGE_UP_FAIL) {
|
||||||
info = if (message.responseCode != 0)
|
info = if (message.responseCode != 0)
|
||||||
"$info - ${ctx.getString(R.string.message_failed)}: " + "${message.responseCode} ${message.responseReason}"
|
"$info - ${stringResource(R.string.message_failed)}: " + "${message.responseCode} ${message.responseReason}"
|
||||||
else
|
else
|
||||||
"$info - ${ctx.getString(R.string.sending_failed)}"
|
"$info - ${stringResource(R.string.sending_failed)}"
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
@@ -359,10 +359,10 @@ class ChatActivity : ComponentActivity() {
|
|||||||
Button(
|
Button(
|
||||||
onClick = {
|
onClick = {
|
||||||
if (chatPeer == peerUri) {
|
if (chatPeer == peerUri) {
|
||||||
dialogMessage.value = String.format(ctx.getString(R.string.long_message_question),
|
dialogMessage.value = String.format(getString(R.string.long_message_question),
|
||||||
peerUri
|
peerUri
|
||||||
)
|
)
|
||||||
positiveButtonText.value = ctx.getString(R.string.add_contact)
|
positiveButtonText.value = getString(R.string.add_contact)
|
||||||
positiveAction.value = {
|
positiveAction.value = {
|
||||||
val i = Intent(ctx, BaresipContactActivity::class.java)
|
val i = Intent(ctx, BaresipContactActivity::class.java)
|
||||||
val b = Bundle()
|
val b = Bundle()
|
||||||
@@ -371,15 +371,15 @@ class ChatActivity : ComponentActivity() {
|
|||||||
i.putExtras(b)
|
i.putExtras(b)
|
||||||
ctx.startActivity(i)
|
ctx.startActivity(i)
|
||||||
}
|
}
|
||||||
neutralButtonText.value = ctx.getString(R.string.delete)
|
neutralButtonText.value = getString(R.string.delete)
|
||||||
neutralAction.value = {
|
neutralAction.value = {
|
||||||
message.delete()
|
message.delete()
|
||||||
_chatMessages.value = uaPeerMessages(aor, peerUri)
|
_chatMessages.value = uaPeerMessages(aor, peerUri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dialogMessage.value = ctx.getString(R.string.short_message_question)
|
dialogMessage.value = getString(R.string.short_message_question)
|
||||||
positiveButtonText.value = ctx.getString(R.string.delete)
|
positiveButtonText.value = getString(R.string.delete)
|
||||||
positiveAction.value = {
|
positiveAction.value = {
|
||||||
message.delete()
|
message.delete()
|
||||||
_chatMessages.value = uaPeerMessages(aor, peerUri)
|
_chatMessages.value = uaPeerMessages(aor, peerUri)
|
||||||
@@ -455,9 +455,9 @@ class ChatActivity : ComponentActivity() {
|
|||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.notice),
|
title = stringResource(R.string.notice),
|
||||||
message = dialogMessage.value,
|
message = dialogMessage.value,
|
||||||
positiveButtonText = getString(R.string.ok),
|
positiveButtonText = stringResource(R.string.ok),
|
||||||
)
|
)
|
||||||
|
|
||||||
var newMessage by remember { mutableStateOf("") }
|
var newMessage by remember { mutableStateOf("") }
|
||||||
@@ -470,7 +470,7 @@ class ChatActivity : ComponentActivity() {
|
|||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = newMessage,
|
value = newMessage,
|
||||||
placeholder = { Text(text = getString(R.string.new_message)) },
|
placeholder = { Text(text = stringResource(R.string.new_message)) },
|
||||||
onValueChange = { newMessage = it },
|
onValueChange = { newMessage = it },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
|
|||||||
@@ -179,21 +179,21 @@ class ChatsActivity: ComponentActivity() {
|
|||||||
|
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val delete = String.format(getString(R.string.delete))
|
val delete = stringResource(R.string.delete)
|
||||||
|
|
||||||
val showDialog = remember { mutableStateOf(false) }
|
val showDialog = remember { mutableStateOf(false) }
|
||||||
val positiveAction = remember { mutableStateOf({}) }
|
val positiveAction = remember { mutableStateOf({}) }
|
||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = String.format(
|
message = String.format(
|
||||||
getString(R.string.delete_chats_alert),
|
stringResource(R.string.delete_chats_alert),
|
||||||
aor.substringAfter(":")
|
aor.substringAfter(":")
|
||||||
),
|
),
|
||||||
positiveButtonText = getString(R.string.delete),
|
positiveButtonText = stringResource(R.string.delete),
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
negativeButtonText = getString(R.string.cancel),
|
negativeButtonText = stringResource(R.string.cancel),
|
||||||
)
|
)
|
||||||
|
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
@@ -275,7 +275,7 @@ class ChatsActivity: ComponentActivity() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Account(account: Account) {
|
fun Account(account: Account) {
|
||||||
val headerText = getString(R.string.account) + " " +
|
val headerText = stringResource(R.string.account) + " " +
|
||||||
if (account.nickName.value != "")
|
if (account.nickName.value != "")
|
||||||
account.nickName.value
|
account.nickName.value
|
||||||
else
|
else
|
||||||
@@ -303,13 +303,13 @@ class ChatsActivity: ComponentActivity() {
|
|||||||
if (showDialog.value)
|
if (showDialog.value)
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = dialogMessage.value,
|
message = dialogMessage.value,
|
||||||
positiveButtonText = positiveButtonText.value,
|
positiveButtonText = positiveButtonText.value,
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
neutralButtonText = neutralButtonText.value,
|
neutralButtonText = neutralButtonText.value,
|
||||||
onNeutralClicked = neutralAction.value,
|
onNeutralClicked = neutralAction.value,
|
||||||
negativeButtonText = getString(R.string.cancel)
|
negativeButtonText = stringResource(R.string.cancel)
|
||||||
)
|
)
|
||||||
|
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
@@ -483,10 +483,10 @@ class ChatsActivity: ComponentActivity() {
|
|||||||
|
|
||||||
SelectableAlertDialog(
|
SelectableAlertDialog(
|
||||||
openDialog = showDialog,
|
openDialog = showDialog,
|
||||||
title = getString(R.string.choose_destination_uri),
|
title = stringResource(R.string.choose_destination_uri),
|
||||||
items = items.value,
|
items = items.value,
|
||||||
onItemClicked = itemAction.value,
|
onItemClicked = itemAction.value,
|
||||||
neutralButtonText = getString(R.string.cancel),
|
neutralButtonText = stringResource(R.string.cancel),
|
||||||
onNeutralClicked = {}
|
onNeutralClicked = {}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -558,7 +558,7 @@ class ChatsActivity: ComponentActivity() {
|
|||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = newPeer,
|
value = newPeer,
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(text = getString(R.string.new_chat_peer))
|
Text(text = stringResource(R.string.new_chat_peer))
|
||||||
},
|
},
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
newPeer = it
|
newPeer = it
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class CodecsActivity : ComponentActivity() {
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = getString(R.string.codecs),
|
text = stringResource(R.string.codecs),
|
||||||
color = LocalCustomColors.current.light,
|
color = LocalCustomColors.current.light,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class ConfigActivity : ComponentActivity() {
|
|||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
val title = String.format(getString(R.string.configuration))
|
val title = getString(R.string.configuration)
|
||||||
|
|
||||||
Utils.addActivity("config")
|
Utils.addActivity("config")
|
||||||
|
|
||||||
@@ -672,9 +672,9 @@ class ConfigActivity : ComponentActivity() {
|
|||||||
if (showAlertDialog.value)
|
if (showAlertDialog.value)
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showAlertDialog,
|
showDialog = showAlertDialog,
|
||||||
title = getString(R.string.notice),
|
title = stringResource(R.string.notice),
|
||||||
message = getString(R.string.no_read_permission),
|
message = stringResource(R.string.no_read_permission),
|
||||||
positiveButtonText = getString(R.string.ok),
|
positiveButtonText = stringResource(R.string.ok),
|
||||||
onPositiveClicked = { requestPermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE) },
|
onPositiveClicked = { requestPermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE) },
|
||||||
negativeButtonText = "",
|
negativeButtonText = "",
|
||||||
onNegativeClicked = {},
|
onNegativeClicked = {},
|
||||||
@@ -1019,9 +1019,9 @@ class ConfigActivity : ComponentActivity() {
|
|||||||
if (showAlertDialog.value)
|
if (showAlertDialog.value)
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showAlertDialog,
|
showDialog = showAlertDialog,
|
||||||
title = getString(R.string.notice),
|
title = stringResource(R.string.notice),
|
||||||
message = getString(R.string.no_android_contacts),
|
message = stringResource(R.string.no_android_contacts),
|
||||||
positiveButtonText = getString(R.string.ok),
|
positiveButtonText = stringResource(R.string.ok),
|
||||||
onPositiveClicked = { requestPermissionsLauncher.launch(
|
onPositiveClicked = { requestPermissionsLauncher.launch(
|
||||||
arrayOf(
|
arrayOf(
|
||||||
Manifest.permission.READ_CONTACTS,
|
Manifest.permission.READ_CONTACTS,
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class ContactsActivity : ComponentActivity() {
|
|||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
val title = String.format(getString(R.string.contacts))
|
val title = getString(R.string.contacts)
|
||||||
|
|
||||||
aor = intent.getStringExtra("aor")!!
|
aor = intent.getStringExtra("aor")!!
|
||||||
Utils.addActivity("contacts,$aor")
|
Utils.addActivity("contacts,$aor")
|
||||||
@@ -221,13 +221,13 @@ class ContactsActivity : ComponentActivity() {
|
|||||||
if (showDialog.value)
|
if (showDialog.value)
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = dialogMessage.value,
|
message = dialogMessage.value,
|
||||||
positiveButtonText = positiveText.value,
|
positiveButtonText = positiveText.value,
|
||||||
onPositiveClicked = positiveAction.value,
|
onPositiveClicked = positiveAction.value,
|
||||||
neutralButtonText = neutralText.value,
|
neutralButtonText = neutralText.value,
|
||||||
onNeutralClicked = neutralAction.value,
|
onNeutralClicked = neutralAction.value,
|
||||||
negativeButtonText = getString(R.string.cancel)
|
negativeButtonText = stringResource(R.string.cancel)
|
||||||
)
|
)
|
||||||
|
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
@@ -299,10 +299,10 @@ class ContactsActivity : ComponentActivity() {
|
|||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
dialogMessage.value = String.format(
|
dialogMessage.value = String.format(
|
||||||
ctx.getString(R.string.contact_action_question),
|
getString(R.string.contact_action_question),
|
||||||
name
|
name
|
||||||
)
|
)
|
||||||
positiveText.value = ctx.getString(R.string.call)
|
positiveText.value = getString(R.string.call)
|
||||||
positiveAction.value = {
|
positiveAction.value = {
|
||||||
val i = Intent(ctx, MainActivity::class.java)
|
val i = Intent(ctx, MainActivity::class.java)
|
||||||
i.flags =
|
i.flags =
|
||||||
@@ -319,7 +319,7 @@ class ContactsActivity : ComponentActivity() {
|
|||||||
(ctx as Activity).startActivity(i)
|
(ctx as Activity).startActivity(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
neutralText.value = ctx.getString(R.string.send_message)
|
neutralText.value = getString(R.string.send_message)
|
||||||
neutralAction.value = {
|
neutralAction.value = {
|
||||||
val i = Intent(
|
val i = Intent(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -343,10 +343,10 @@ class ContactsActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
dialogMessage.value = String.format(
|
dialogMessage.value = String.format(
|
||||||
ctx.getString(R.string.contact_delete_question),
|
getString(R.string.contact_delete_question),
|
||||||
name
|
name
|
||||||
)
|
)
|
||||||
positiveText.value = ctx.getString(R.string.delete)
|
positiveText.value = getString(R.string.delete)
|
||||||
positiveAction.value = {
|
positiveAction.value = {
|
||||||
val id = contact.id
|
val id = contact.id
|
||||||
val avatarFile = File(
|
val avatarFile = File(
|
||||||
@@ -416,10 +416,10 @@ class ContactsActivity : ComponentActivity() {
|
|||||||
},
|
},
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
dialogMessage.value = String.format(
|
dialogMessage.value = String.format(
|
||||||
ctx.getString(R.string.contact_delete_question),
|
getString(R.string.contact_delete_question),
|
||||||
name
|
name
|
||||||
)
|
)
|
||||||
positiveText.value = ctx.getString(R.string.delete)
|
positiveText.value = getString(R.string.delete)
|
||||||
positiveAction.value = {
|
positiveAction.value = {
|
||||||
ctx.contentResolver.delete(
|
ctx.contentResolver.delete(
|
||||||
ContactsContract.RawContacts.CONTENT_URI,
|
ContactsContract.RawContacts.CONTENT_URI,
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = Modifier.safeDrawingPadding(),
|
modifier = Modifier.safeDrawingPadding(),
|
||||||
containerColor = LocalCustomColors.current.background,
|
containerColor = LocalCustomColors.current.background,
|
||||||
topBar = { TopAppBar(ctx, String.format(getString(R.string.baresip))) },
|
topBar = { TopAppBar(ctx, getString(R.string.baresip)) },
|
||||||
bottomBar = { BottomBar(ctx) },
|
bottomBar = { BottomBar(ctx) },
|
||||||
content = { contentPadding ->
|
content = { contentPadding ->
|
||||||
MainContent(ctx, contentPadding)
|
MainContent(ctx, contentPadding)
|
||||||
@@ -551,20 +551,20 @@ class MainActivity : ComponentActivity() {
|
|||||||
if (showDialog.value)
|
if (showDialog.value)
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
showDialog = showDialog,
|
showDialog = showDialog,
|
||||||
title = getString(R.string.confirmation),
|
title = stringResource(R.string.confirmation),
|
||||||
message = dialogMessage.value,
|
message = dialogMessage.value,
|
||||||
positiveButtonText = positiveText.value,
|
positiveButtonText = positiveText.value,
|
||||||
onPositiveClicked = onPositiveClicked.value,
|
onPositiveClicked = onPositiveClicked.value,
|
||||||
negativeButtonText = getString(R.string.cancel),
|
negativeButtonText = stringResource(R.string.cancel),
|
||||||
onNegativeClicked = onNegativeClicked.value
|
onNegativeClicked = onNegativeClicked.value
|
||||||
)
|
)
|
||||||
|
|
||||||
SelectableAlertDialog(
|
SelectableAlertDialog(
|
||||||
openDialog = showSelectItemDialog,
|
openDialog = showSelectItemDialog,
|
||||||
title = getString(R.string.choose_destination_uri),
|
title = stringResource(R.string.choose_destination_uri),
|
||||||
items = items.value,
|
items = items.value,
|
||||||
onItemClicked = itemAction.value,
|
onItemClicked = itemAction.value,
|
||||||
neutralButtonText = getString(R.string.cancel),
|
neutralButtonText = stringResource(R.string.cancel),
|
||||||
onNeutralClicked = {}
|
onNeutralClicked = {}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -656,14 +656,14 @@ class MainActivity : ComponentActivity() {
|
|||||||
var recImage by remember { mutableStateOf(recOffImage) }
|
var recImage by remember { mutableStateOf(recOffImage) }
|
||||||
var menuExpanded by remember { mutableStateOf(false) }
|
var menuExpanded by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val about = String.format(getString(R.string.about))
|
val about = stringResource(R.string.about)
|
||||||
val settings = String.format(getString(R.string.configuration))
|
val settings = stringResource(R.string.configuration)
|
||||||
val accounts = String.format(getString(R.string.accounts))
|
val accounts = stringResource(R.string.accounts)
|
||||||
val backup = String.format(getString(R.string.backup))
|
val backup = stringResource(R.string.backup)
|
||||||
val restore = String.format(getString(R.string.restore))
|
val restore = stringResource(R.string.restore)
|
||||||
val logcat = String.format(getString(R.string.logcat))
|
val logcat = stringResource(R.string.logcat)
|
||||||
val restart = String.format(getString(R.string.restart))
|
val restart = stringResource(R.string.restart)
|
||||||
val quit = String.format(getString(R.string.quit))
|
val quit = stringResource(R.string.quit)
|
||||||
|
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
@@ -1441,7 +1441,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
horizontalArrangement = Arrangement.Center,
|
horizontalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = ContextCompat.getString(ctx, R.string.blind),
|
text = stringResource(R.string.blind),
|
||||||
color = LocalCustomColors.current.alert,
|
color = LocalCustomColors.current.alert,
|
||||||
modifier = Modifier.padding(16.dp),
|
modifier = Modifier.padding(16.dp),
|
||||||
)
|
)
|
||||||
@@ -1451,7 +1451,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
blindChecked.value = true
|
blindChecked.value = true
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = ContextCompat.getString(ctx, R.string.attended),
|
text = stringResource(R.string.attended),
|
||||||
color = LocalCustomColors.current.alert,
|
color = LocalCustomColors.current.alert,
|
||||||
modifier = Modifier.padding(16.dp),
|
modifier = Modifier.padding(16.dp),
|
||||||
)
|
)
|
||||||
@@ -1897,7 +1897,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
shape = RoundedCornerShape(20)
|
shape = RoundedCornerShape(20)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = getString(R.string.call_is_on_hold),
|
text = stringResource(R.string.call_is_on_hold),
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
color = LocalCustomColors.current.itemText,
|
color = LocalCustomColors.current.itemText,
|
||||||
)
|
)
|
||||||
@@ -1917,8 +1917,8 @@ class MainActivity : ComponentActivity() {
|
|||||||
showPasswordDialog = showPasswordsDialog,
|
showPasswordDialog = showPasswordsDialog,
|
||||||
password = password,
|
password = password,
|
||||||
keyboardController = keyboardController,
|
keyboardController = keyboardController,
|
||||||
title = getString(R.string.authentication_password),
|
title = stringResource(R.string.authentication_password),
|
||||||
message = getString(R.string.account) + " " + Utils.plainAor(aor),
|
message = stringResource(R.string.account) + " " + Utils.plainAor(aor),
|
||||||
okAction = {
|
okAction = {
|
||||||
if (password.value != "")
|
if (password.value != "")
|
||||||
BaresipService.aorPasswords[aor] = password.value
|
BaresipService.aorPasswords[aor] = password.value
|
||||||
|
|||||||
Reference in New Issue
Block a user