added baresip icon (letter B) to notification bar
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package com.tutpro.baresip
|
package com.tutpro.baresip
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
|
import android.app.Notification
|
||||||
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
@@ -41,6 +43,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
internal lateinit var aorSpinner: Spinner
|
internal lateinit var aorSpinner: Spinner
|
||||||
internal lateinit var am: AudioManager
|
internal lateinit var am: AudioManager
|
||||||
internal lateinit var imm: InputMethodManager
|
internal lateinit var imm: InputMethodManager
|
||||||
|
internal lateinit var nm: NotificationManager
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|
||||||
@@ -259,6 +262,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (!running) {
|
if (!running) {
|
||||||
Log.i("Baresip", "Starting Baresip with path $path")
|
Log.i("Baresip", "Starting Baresip with path $path")
|
||||||
Thread(Runnable { baresipStart(path) }).start()
|
Thread(Runnable { baresipStart(path) }).start()
|
||||||
|
addStatusBarIcon(10)
|
||||||
running = true
|
running = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,6 +339,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
baresipStop()
|
baresipStop()
|
||||||
|
nm.cancel(10)
|
||||||
running = false
|
running = false
|
||||||
}
|
}
|
||||||
finish()
|
finish()
|
||||||
@@ -571,6 +576,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
layout.addView(reject_button)
|
layout.addView(reject_button)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addStatusBarIcon(id: Int) {
|
||||||
|
nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||||
|
val notification = Notification.Builder(this)
|
||||||
|
.setSmallIcon(R.drawable.ic_stat)
|
||||||
|
.setContentTitle("Baresip is running")
|
||||||
|
.setOngoing(true).build()
|
||||||
|
nm.notify(id, notification)
|
||||||
|
}
|
||||||
|
|
||||||
private fun callIndex(calls: ArrayList<Call>, ua: String, call: String): Int {
|
private fun callIndex(calls: ArrayList<Call>, ua: String, call: String): Int {
|
||||||
for (i in calls.indices) {
|
for (i in calls.indices) {
|
||||||
if (calls[i].ua.equals(ua) && calls[i].call == call)
|
if (calls[i].ua.equals(ua) && calls[i].call == call)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 298 B |
Binary file not shown.
|
After Width: | Height: | Size: 231 B |
Binary file not shown.
|
After Width: | Height: | Size: 365 B |
Binary file not shown.
|
After Width: | Height: | Size: 539 B |
Reference in New Issue
Block a user