avoid crash if caller hangs up during heads-up notification

This commit is contained in:
Juha Heinanen
2018-07-17 09:25:07 +03:00
parent 19ca0e7cfd
commit b42c027226
2 changed files with 9 additions and 13 deletions

View File

@ -8,7 +8,7 @@ android {
applicationId = 'com.tutpro.baresip'
minSdkVersion 21
targetSdkVersion 26
versionCode = 5
versionCode = 7
versionName = '1.0'
ndk {
abiFilters 'armeabi-v7a'

View File

@ -521,12 +521,14 @@ class MainActivity : AppCompatActivity() {
if (callButton.tag == "Call") {
callee.setOnKeyListener(null)
}
val caller_heading = layout.findViewById(view_id) as TextView
val view_index = layout.indexOfChild(caller_heading)
layout.removeViews(view_index, 3 * remove_count)
val callsIn = Call.uaCalls(calls, ua, "in")
for (i in inIndex until callsIn.size) {
addCallViews(ua, callsIn[i], (i + 1) * 10)
val caller_heading = layout.findViewById(view_id) as TextView?
if (caller_heading != null) {
val view_index = layout.indexOfChild(caller_heading)
layout.removeViews(view_index, 3 * remove_count)
val callsIn = Call.uaCalls(calls, ua, "in")
for (i in inIndex until callsIn.size) {
addCallViews(ua, callsIn[i], (i + 1) * 10)
}
}
historyButton.visibility = View.VISIBLE
}
@ -613,12 +615,6 @@ class MainActivity : AppCompatActivity() {
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
Log.d("Baresip", "View count at onAttachedToWindow is ${layout.childCount}")
Toast.makeText(this, "Hi UI is fully loaded", Toast.LENGTH_SHORT).show();
}
override fun onBackPressed() {
moveTaskToBack(true)
}