- avoided a few compiler warnings about null values
This commit is contained in:
@@ -34,7 +34,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_account)
|
setContentView(R.layout.activity_account)
|
||||||
|
|
||||||
acc = Account.find(intent.extras.getString("accp"))!!
|
acc = Account.find(intent.getStringExtra("accp"))!!
|
||||||
aor = acc.aor
|
aor = acc.aor
|
||||||
uaIndex = UserAgent.findAorIndex(aor)!!
|
uaIndex = UserAgent.findAorIndex(aor)!!
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class AccountsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val accp = intent.extras.getString("accp")
|
val accp = intent.getStringExtra("accp")
|
||||||
if (accp != "") {
|
if (accp != "") {
|
||||||
val i = Intent(this, AccountActivity::class.java)
|
val i = Intent(this, AccountActivity::class.java)
|
||||||
val b = Bundle()
|
val b = Bundle()
|
||||||
|
|||||||
@@ -667,7 +667,6 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun requestAudioFocus(streamType: Int) {
|
private fun requestAudioFocus(streamType: Int) {
|
||||||
val res: Int
|
|
||||||
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) && (audioFocusRequest == null)) {
|
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) && (audioFocusRequest == null)) {
|
||||||
@TargetApi(26)
|
@TargetApi(26)
|
||||||
audioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN).run {
|
audioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN).run {
|
||||||
@@ -678,16 +677,15 @@ class BaresipService: Service() {
|
|||||||
build()
|
build()
|
||||||
}
|
}
|
||||||
@TargetApi(26)
|
@TargetApi(26)
|
||||||
res = am.requestAudioFocus(audioFocusRequest)
|
if (am.requestAudioFocus(audioFocusRequest!!) == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||||
if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
|
||||||
Log.d(LOG_TAG, "Audio focus granted")
|
Log.d(LOG_TAG, "Audio focus granted")
|
||||||
} else {
|
} else {
|
||||||
Log.d(LOG_TAG, "Audio focus denied")
|
Log.d(LOG_TAG, "Audio focus denied")
|
||||||
audioFocusRequest = null
|
audioFocusRequest = null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = am.requestAudioFocus(null, streamType, AudioManager.AUDIOFOCUS_GAIN)
|
if (am.requestAudioFocus(null, streamType, AudioManager.AUDIOFOCUS_GAIN) ==
|
||||||
if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||||
Log.d(LOG_TAG, "Audio focus granted")
|
Log.d(LOG_TAG, "Audio focus granted")
|
||||||
audioFocused = true
|
audioFocused = true
|
||||||
} else {
|
} else {
|
||||||
@@ -700,7 +698,7 @@ class BaresipService: Service() {
|
|||||||
private fun abandonAudioFocus() {
|
private fun abandonAudioFocus() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
if (audioFocusRequest != null) {
|
if (audioFocusRequest != null) {
|
||||||
am.abandonAudioFocusRequest(audioFocusRequest)
|
am.abandonAudioFocusRequest(audioFocusRequest!!)
|
||||||
audioFocusRequest = null
|
audioFocusRequest = null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class CallsActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
setContentView(R.layout.activity_calls)
|
setContentView(R.layout.activity_calls)
|
||||||
|
|
||||||
val aor = intent.extras.getString("aor")
|
val aor = intent.getStringExtra("aor")!!
|
||||||
val ua = Account.findUa(aor)!!
|
val ua = Account.findUa(aor)!!
|
||||||
|
|
||||||
val headerView = findViewById(R.id.account) as TextView
|
val headerView = findViewById(R.id.account) as TextView
|
||||||
@@ -71,7 +71,7 @@ class CallsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
listView.onItemLongClickListener = AdapterView.OnItemLongClickListener { _, _, pos, _ ->
|
listView.onItemLongClickListener = AdapterView.OnItemLongClickListener { _, _, pos, _ ->
|
||||||
val peerUri = uaHistory[pos].peerURI
|
val peerUri = uaHistory[pos].peerURI
|
||||||
var peerName = ContactsActivity.contactName(peerUri)
|
val peerName = ContactsActivity.contactName(peerUri)
|
||||||
val dialogClickListener = DialogInterface.OnClickListener { _, which ->
|
val dialogClickListener = DialogInterface.OnClickListener { _, which ->
|
||||||
when (which) {
|
when (which) {
|
||||||
DialogInterface.BUTTON_NEUTRAL -> {
|
DialogInterface.BUTTON_NEUTRAL -> {
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ class ChatActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
setContentView(R.layout.activity_chat)
|
setContentView(R.layout.activity_chat)
|
||||||
|
|
||||||
aor = intent.extras.getString("aor")
|
aor = intent.getStringExtra("aor")!!
|
||||||
peerUri = intent.extras.getString("peer")
|
peerUri = intent.getStringExtra("peer")!!
|
||||||
val focus = intent.extras.getBoolean("focus")
|
val focus = intent.getBooleanExtra("focus", false)
|
||||||
|
|
||||||
val userAgent = Account.findUa(aor)
|
val userAgent = Account.findUa(aor)
|
||||||
if (userAgent == null) {
|
if (userAgent == null) {
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ class ChatsActivity: AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val peer = intent.extras.getString("peer")
|
val peer = intent.getStringExtra("peer")
|
||||||
if (peer != "") {
|
if (peer != "") {
|
||||||
val i = Intent(this, ChatActivity::class.java)
|
val i = Intent(this, ChatActivity::class.java)
|
||||||
val b = Bundle()
|
val b = Bundle()
|
||||||
b.putString("aor", aor)
|
b.putString("aor", aor)
|
||||||
b.putString("peer", peer)
|
b.putString("peer", peer)
|
||||||
b.putBoolean("focus", intent.extras.getBoolean("focus"))
|
b.putBoolean("focus", intent.getBooleanExtra("focus", false))
|
||||||
i.putExtras(b)
|
i.putExtras(b)
|
||||||
startActivityForResult(i, MainActivity.MESSAGE_CODE)
|
startActivityForResult(i, MainActivity.MESSAGE_CODE)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ class ContactActivity : AppCompatActivity() {
|
|||||||
nameView = findViewById(R.id.Name) as EditText
|
nameView = findViewById(R.id.Name) as EditText
|
||||||
uriView = findViewById(R.id.Uri) as EditText
|
uriView = findViewById(R.id.Uri) as EditText
|
||||||
|
|
||||||
val uri = intent.extras.getString("uri")
|
val uri = intent.getStringExtra("uri")
|
||||||
new = intent.extras.getBoolean("new")
|
new = intent.getBooleanExtra("new", false)
|
||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
setTitle("New Contact")
|
setTitle("New Contact")
|
||||||
@@ -36,7 +36,7 @@ class ContactActivity : AppCompatActivity() {
|
|||||||
uriView.setText(uri)
|
uriView.setText(uri)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
index = intent.extras.getInt("index")
|
index = intent.getIntExtra("index", 0)
|
||||||
val name = Contact.contacts()[index].name
|
val name = Contact.contacts()[index].name
|
||||||
setTitle(name)
|
setTitle(name)
|
||||||
nameView.setText(name)
|
nameView.setText(name)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class ContactsActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
val listView = findViewById(R.id.contacts) as ListView
|
val listView = findViewById(R.id.contacts) as ListView
|
||||||
|
|
||||||
val aor = intent.extras.getString("aor")
|
val aor = intent.getStringExtra("aor")!!
|
||||||
clAdapter = ContactListAdapter(this, Contact.contacts(), aor)
|
clAdapter = ContactListAdapter(this, Contact.contacts(), aor)
|
||||||
listView.adapter = clAdapter
|
listView.adapter = clAdapter
|
||||||
listView.isLongClickable = true
|
listView.isLongClickable = true
|
||||||
|
|||||||
Reference in New Issue
Block a user