User alert dialog instead of toast for no network/aec info
This commit is contained in:
@ -498,13 +498,23 @@ class BaresipService: Service() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
var message = ""
|
val message = if (linkAddresses.isEmpty()) {
|
||||||
if (linkAddresses.isEmpty())
|
if (!aecAvailable)
|
||||||
message = '\u2022' + " " + getString(R.string.no_network) + '\n'
|
'\u2022' + " " + getString(R.string.no_network) + '\n' +
|
||||||
if (!aecAvailable)
|
'\u2022' + " " + getString(R.string.no_aec)
|
||||||
message = message + '\u2022' + " " + getString(R.string.no_aec) + '\n'
|
else
|
||||||
if (message != "")
|
getString(R.string.no_network)
|
||||||
toast(message.dropLast(1), Toast.LENGTH_LONG)
|
}
|
||||||
|
else
|
||||||
|
if (!aecAvailable) getString(R.string.no_aec) else ""
|
||||||
|
if (message != "") {
|
||||||
|
val newIntent = Intent(this, MainActivity::class.java)
|
||||||
|
newIntent.flags =
|
||||||
|
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or
|
||||||
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
newIntent.putExtra("action", "no,$message")
|
||||||
|
startActivity(newIntent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"Start Content Observer" -> {
|
"Start Content Observer" -> {
|
||||||
|
|||||||
@ -2187,6 +2187,12 @@ class MainActivity : ComponentActivity() {
|
|||||||
Log.d(TAG, "Handling intent '$action'")
|
Log.d(TAG, "Handling intent '$action'")
|
||||||
val ev = action.split(",")
|
val ev = action.split(",")
|
||||||
when (ev[0]) {
|
when (ev[0]) {
|
||||||
|
"no" -> {
|
||||||
|
alertTitle.value = getString(R.string.notice)
|
||||||
|
alertMessage.value = ev[1]
|
||||||
|
showAlert.value = true
|
||||||
|
return
|
||||||
|
}
|
||||||
"call", "dial" -> {
|
"call", "dial" -> {
|
||||||
if (Call.inCall()) {
|
if (Call.inCall()) {
|
||||||
Toast.makeText(applicationContext, getString(R.string.call_already_active),
|
Toast.makeText(applicationContext, getString(R.string.call_already_active),
|
||||||
|
|||||||
Reference in New Issue
Block a user