From 7464ad59924bad1fff3621a32115489191cb6f68 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sun, 26 May 2019 09:51:56 +0300 Subject: [PATCH] - Small edits and code improvements. --- .../kotlin/com/tutpro/baresip/AccountActivity.kt | 1 - .../kotlin/com/tutpro/baresip/BaresipService.kt | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt index 98f016ca..56c7ae54 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountActivity.kt @@ -72,7 +72,6 @@ class AccountActivity : AppCompatActivity() { spinner.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT) spinner.setPopupBackgroundResource(R.drawable.spinner_background) layout.addView(spinner) - if (acc.audioCodec.size > i) { val codec = acc.audioCodec[i] spinnerList[i].add(codec) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 0fac813f..48e8fccd 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -71,7 +71,7 @@ class BaresipService: Service() { object : ConnectivityManager.NetworkCallback() { override fun onAvailable(network: Network) { super.onAvailable(network) - Log.d(LOG_TAG, "Network $network is available") + Log.d(LOG_TAG, "Network '$network' is available") if (disconnected) { UserAgent.register() disconnected = false @@ -79,12 +79,12 @@ class BaresipService: Service() { if (dynDns) { val dnsServers = cm.getLinkProperties(network).getDnsServers() if (Config.updateDnsServers(dnsServers) != 0) - Log.w(LOG_TAG, "Failed to update DNS servers '$dnsServers") + Log.w(LOG_TAG, "Failed to update DNS servers '$dnsServers'") } } override fun onLost(network: Network) { super.onLost(network) - Log.d(LOG_TAG, "Network $network is lost") + Log.d(LOG_TAG, "Network '$network' is lost") disconnected = true } override fun onLinkPropertiesChanged(network: Network, linkProperties: LinkProperties) { @@ -93,7 +93,7 @@ class BaresipService: Service() { if (dynDns) { val dnsServers = linkProperties.getDnsServers() if (Config.updateDnsServers(dnsServers) != 0) - Log.w(LOG_TAG, "Failed to update DNS servers '$dnsServers") + Log.w(LOG_TAG, "Failed to update DNS servers '$dnsServers'") } } } @@ -141,10 +141,10 @@ class BaresipService: Service() { for (a in assets) { file = File("${filesPath}/$a") if (!file.exists()) { - Log.d(LOG_TAG, "Copying asset $a") + Log.d(LOG_TAG, "Copying asset '$a'") Utils.copyAssetToFile(applicationContext, a, "$filesPath/$a") } else { - Log.d(LOG_TAG, "Asset $a already copied") + Log.d(LOG_TAG, "Asset '$a' already copied") if (a == "config") { var dnsServers = listOf() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { @@ -384,7 +384,9 @@ class BaresipService: Service() { .setColor(ContextCompat.getColor(this, R.color.colorBaresip)) .setContentIntent(pi) + .setCategory(Notification.CATEGORY_CALL) .setAutoCancel(true) + .setOngoing(true) .setContentTitle(getString(R.string.incoming_call_from)) .setContentText(caller) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {