- all user interface unrelated data is now kept in baresip service

allowing proper recovery in case Android kills other activities
- many other improvements and bug fixes
This commit is contained in:
Juha Heinanen
2018-11-23 10:35:48 +02:00
parent 0a9108f846
commit 18478c3436
23 changed files with 872 additions and 679 deletions
@@ -6,6 +6,8 @@ import android.support.v7.app.AlertDialog
import android.util.Log
import android.os.PowerManager
import android.app.KeyguardManager
import android.text.Editable
import android.text.TextWatcher
import java.io.*
@@ -95,9 +97,13 @@ object Utils {
}
fun friendlyUri(uri: String, domain: String): String {
val user = uriUserPart(uri)
val host = uriHostPart(uri)
if (host == domain) return user else return "$user@$host"
if (uri.contains("@")) {
val user = uriUserPart(uri)
val host = uriHostPart(uri)
if (host == domain) return user else return "$user@$host"
} else {
return uri
}
}
fun aorDomain(aor: String): String {
@@ -233,4 +239,23 @@ object Utils {
return isLocked
}
fun dtmfWatcher(callp: String): TextWatcher {
return object : TextWatcher {
override fun beforeTextChanged(sequence: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(sequence: CharSequence, start: Int, before: Int, count: Int) {
val text = sequence.subSequence(start, start + count).toString()
if (text.length > 0) {
val digit = text[0]
Log.d("Baresip", "Got DTMF digit '$digit'")
if (((digit >= '0') && (digit <= '9')) || (digit == '*') || (digit == '#'))
Api.call_send_digit(callp, digit)
}
}
override fun afterTextChanged(sequence: Editable) {
// KEYCODE_REL
// call_send_digit(callp, 4.toChar())
}
}
}
}