Cleaned up some code and resources
This commit is contained in:
@ -24,7 +24,7 @@ class AboutActivity : AppCompatActivity() {
|
||||
val text = String.format(getString(R.string.about_text),
|
||||
BuildConfig.VERSION_NAME)
|
||||
binding.aboutText.text = HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
binding.aboutText.setMovementMethod(LinkMovementMethod.getInstance())
|
||||
binding.aboutText.movementMethod = LinkMovementMethod.getInstance()
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -253,7 +253,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
if (dn != acc.displayName) {
|
||||
if (Account.checkDisplayName(dn)) {
|
||||
if (Api.account_set_display_name(acc.accp, dn) == 0) {
|
||||
acc.displayName = Api.account_display_name(acc.accp);
|
||||
acc.displayName = Api.account_display_name(acc.accp)
|
||||
Log.d(TAG, "New display name is ${acc.displayName}")
|
||||
save = true
|
||||
} else {
|
||||
@ -272,7 +272,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
if (au != acc.authUser) {
|
||||
if (Account.checkAuthUser(au)) {
|
||||
if (Api.account_set_auth_user(acc.accp, au) == 0) {
|
||||
acc.authUser = Api.account_auth_user(acc.accp);
|
||||
acc.authUser = Api.account_auth_user(acc.accp)
|
||||
Log.d(TAG, "New auth user is ${acc.authUser}")
|
||||
save = true
|
||||
} else {
|
||||
@ -344,7 +344,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "New outbound proxies are ${outbound}")
|
||||
Log.d(TAG, "New outbound proxies are $outbound")
|
||||
acc.outbound = outbound
|
||||
if (outbound.isEmpty())
|
||||
Api.account_set_sipnat(acc.accp, "")
|
||||
@ -411,7 +411,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
if (acc.stunUser != newStunUser) {
|
||||
if (Account.checkAuthUser(newStunUser)) {
|
||||
if (Api.account_set_stun_user(acc.accp, newStunUser) == 0) {
|
||||
acc.stunUser = Api.account_stun_user(acc.accp);
|
||||
acc.stunUser = Api.account_stun_user(acc.accp)
|
||||
Log.d(TAG, "New STUN/TURN user is ${acc.stunUser}")
|
||||
save = true
|
||||
} else {
|
||||
@ -428,7 +428,7 @@ class AccountActivity : AppCompatActivity() {
|
||||
if (acc.stunPass != newStunPass) {
|
||||
if (newStunPass.isEmpty() || Account.checkAuthPass(newStunPass)) {
|
||||
if (Api.account_set_stun_pass(acc.accp, newStunPass) == 0) {
|
||||
acc.stunPass = Api.account_stun_pass(acc.accp);
|
||||
acc.stunPass = Api.account_stun_pass(acc.accp)
|
||||
save = true
|
||||
} else {
|
||||
Log.e(TAG, "Setting of stun pass failed")
|
||||
|
||||
@ -261,7 +261,7 @@ class BaresipService: Service() {
|
||||
val dnsServers = Utils.findDnsServers(BaresipService.dnsServers)
|
||||
if ((ipV4Addr == "") && (ipV6Addr == ""))
|
||||
Log.w(LOG_TAG, "Starting baresip without IP addresses")
|
||||
Thread(Runnable {
|
||||
Thread({
|
||||
baresipStart(filesPath, ipV4Addr, ipV6Addr, "",
|
||||
dnsServers, Api.AF_UNSPEC, logLevel)
|
||||
}).start()
|
||||
@ -466,7 +466,7 @@ class BaresipService: Service() {
|
||||
newEvent = "registering failed,DNS lookup failed"
|
||||
Api.net_dns_debug()
|
||||
if (dynDns)
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (VERSION.SDK_INT >= 23) {
|
||||
val activeNetwork = cm.activeNetwork
|
||||
if (activeNetwork != null) {
|
||||
val props = cm.getLinkProperties(activeNetwork)
|
||||
@ -531,7 +531,7 @@ class BaresipService: Service() {
|
||||
Call(callp, ua, peerUri, "in", "incoming",
|
||||
Utils.dtmfWatcher(callp)).add()
|
||||
if (ua.account.answerMode == Api.ANSWERMODE_MANUAL) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (VERSION.SDK_INT >= 23) {
|
||||
Log.d(LOG_TAG, "CurrentInterruptionFilter ${nm.currentInterruptionFilter}")
|
||||
if (nm.currentInterruptionFilter <= NotificationManager.INTERRUPTION_FILTER_ALL)
|
||||
startRinging()
|
||||
@ -568,7 +568,7 @@ class BaresipService: Service() {
|
||||
.setContentText(caller)
|
||||
.setShowWhen(true)
|
||||
.setFullScreenIntent(pi, true)
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
if (VERSION.SDK_INT < 26) {
|
||||
nb.setVibrate(LongArray(0))
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.priority = Notification.PRIORITY_HIGH
|
||||
@ -659,10 +659,9 @@ class BaresipService: Service() {
|
||||
.setAutoCancel(true)
|
||||
.setContentTitle(getString(R.string.transfer_request_to))
|
||||
.setContentText(target)
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
if (VERSION.SDK_INT < 26) {
|
||||
nb.setVibrate(LongArray(0))
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE).priority = Notification.PRIORITY_HIGH
|
||||
}
|
||||
val acceptIntent = Intent(this, BaresipService::class.java)
|
||||
acceptIntent.action = "Transfer Accept"
|
||||
@ -729,7 +728,7 @@ class BaresipService: Service() {
|
||||
.setAutoCancel(true)
|
||||
.setContentTitle(getString(R.string.missed_call_from))
|
||||
.setContentText(caller)
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
if (VERSION.SDK_INT < 26) {
|
||||
nb.setVibrate(LongArray(0))
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.priority = Notification.PRIORITY_HIGH
|
||||
@ -796,7 +795,7 @@ class BaresipService: Service() {
|
||||
.setAutoCancel(true)
|
||||
.setContentTitle(getString(R.string.message_from) + " " + sender)
|
||||
.setContentText(text)
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
if (VERSION.SDK_INT < 26) {
|
||||
nb.setVibrate(LongArray(0))
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.priority = Notification.PRIORITY_HIGH
|
||||
@ -877,7 +876,7 @@ class BaresipService: Service() {
|
||||
}
|
||||
|
||||
private fun createNotificationChannels() {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
if (VERSION.SDK_INT >= 26) {
|
||||
val defaultChannel = NotificationChannel(DEFAULT_CHANNEL_ID, "Default",
|
||||
NotificationManager.IMPORTANCE_LOW)
|
||||
defaultChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
|
||||
@ -904,7 +903,7 @@ class BaresipService: Service() {
|
||||
}
|
||||
|
||||
private fun updateStatusNotification() {
|
||||
val contentView = RemoteViews(getPackageName(), R.layout.status_notification)
|
||||
val contentView = RemoteViews(packageName, R.layout.status_notification)
|
||||
for (i: Int in 0..5) {
|
||||
val resID = resources.getIdentifier("status$i", "id", packageName)
|
||||
if (i < status.size) {
|
||||
@ -922,7 +921,7 @@ class BaresipService: Service() {
|
||||
nm.notify(STATUS_NOTIFICATION_ID, snb.build())
|
||||
}
|
||||
|
||||
private fun getActionText(@StringRes stringRes: Int, @ColorRes colorRes: Int): Spannable? {
|
||||
private fun getActionText(@StringRes stringRes: Int, @ColorRes colorRes: Int): Spannable {
|
||||
val spannable: Spannable = SpannableString(applicationContext.getText(stringRes))
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.N_MR1) {
|
||||
spannable.setSpan(
|
||||
@ -939,7 +938,7 @@ class BaresipService: Service() {
|
||||
else
|
||||
abandonAudioFocus()
|
||||
}
|
||||
if ((Build.VERSION.SDK_INT >= 26) && (audioFocusRequest == null)) {
|
||||
if ((VERSION.SDK_INT >= 26) && (audioFocusRequest == null)) {
|
||||
@TargetApi(26)
|
||||
audioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE)
|
||||
.run {
|
||||
@ -987,7 +986,7 @@ class BaresipService: Service() {
|
||||
}
|
||||
|
||||
private fun abandonAudioFocus() {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
if (VERSION.SDK_INT >= 26) {
|
||||
if (audioFocusRequest != null) {
|
||||
if (am.abandonAudioFocusRequest(audioFocusRequest!!) ==
|
||||
AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||
@ -1013,7 +1012,7 @@ class BaresipService: Service() {
|
||||
private fun startRinging() {
|
||||
am.mode = AudioManager.MODE_RINGTONE
|
||||
requestAudioFocus(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
if (VERSION.SDK_INT >= 28) {
|
||||
rt.isLooping = true
|
||||
rt.play()
|
||||
} else {
|
||||
@ -1021,7 +1020,7 @@ class BaresipService: Service() {
|
||||
rtTimer = Timer()
|
||||
rtTimer!!.scheduleAtFixedRate(object : TimerTask() {
|
||||
override fun run() {
|
||||
if (!rt.isPlaying()) {
|
||||
if (!rt.isPlaying) {
|
||||
rt.play()
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1030,7 @@ class BaresipService: Service() {
|
||||
|
||||
private fun stopRinging() {
|
||||
if (am.mode == AudioManager.MODE_RINGTONE) {
|
||||
if ((Build.VERSION.SDK_INT < 28) && (rtTimer != null)) {
|
||||
if ((VERSION.SDK_INT < 28) && (rtTimer != null)) {
|
||||
rtTimer!!.cancel()
|
||||
rtTimer = null
|
||||
}
|
||||
@ -1065,14 +1064,14 @@ class BaresipService: Service() {
|
||||
|
||||
private fun proximitySensing(enable: Boolean) {
|
||||
if (enable) {
|
||||
if (!proximityWakeLock.isHeld()) {
|
||||
if (!proximityWakeLock.isHeld) {
|
||||
Log.d(LOG_TAG, "Acquiring proximity wake lock")
|
||||
proximityWakeLock.acquire()
|
||||
} else {
|
||||
Log.d(LOG_TAG, "Proximity wake lock already acquired")
|
||||
}
|
||||
} else {
|
||||
if (proximityWakeLock.isHeld()) {
|
||||
if (proximityWakeLock.isHeld) {
|
||||
proximityWakeLock.release()
|
||||
Log.d(LOG_TAG, "Released proximity wake lock")
|
||||
} else {
|
||||
@ -1138,7 +1137,7 @@ class BaresipService: Service() {
|
||||
}
|
||||
|
||||
private fun isNetworkActive(network: Network): Boolean {
|
||||
if (Build.VERSION.SDK_INT >= 23)
|
||||
if (VERSION.SDK_INT >= 23)
|
||||
return network == cm.activeNetwork
|
||||
if ((cm.activeNetworkInfo != null) && (cm.getNetworkInfo(network) != null))
|
||||
return cm.activeNetworkInfo!!.toString() == cm.getNetworkInfo(network)!!.toString()
|
||||
@ -1207,7 +1206,7 @@ class BaresipService: Service() {
|
||||
var callHistory = ArrayList<CallHistory>()
|
||||
var messages = ArrayList<Message>()
|
||||
val contacts = ArrayList<Contact>()
|
||||
val chatTexts: MutableMap<String, String> = mutableMapOf<String, String>()
|
||||
val chatTexts: MutableMap<String, String> = mutableMapOf()
|
||||
val activities = mutableListOf<String>()
|
||||
var linkAddresses = listOf<LinkAddress>()
|
||||
var dnsServers = listOf<InetAddress>()
|
||||
|
||||
@ -9,7 +9,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings.Global.getString
|
||||
import androidx.core.app.NotificationCompat
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
@ -28,10 +28,6 @@ class Call(val callp: String, val ua: UserAgent, val peerUri: String, val dir: S
|
||||
call_start_audio(callp)
|
||||
}
|
||||
|
||||
fun stopAudio() {
|
||||
call_stop_audio(callp)
|
||||
}
|
||||
|
||||
fun hold(): Int {
|
||||
return call_hold(callp)
|
||||
}
|
||||
@ -53,10 +49,6 @@ class Call(val callp: String, val ua: UserAgent, val peerUri: String, val dir: S
|
||||
call_notify_sipfrag(callp, code, reason)
|
||||
}
|
||||
|
||||
fun hasVideo(): Boolean {
|
||||
return call_has_video(callp)
|
||||
}
|
||||
|
||||
fun status(): String {
|
||||
return call_status(callp)
|
||||
}
|
||||
|
||||
@ -128,11 +128,11 @@ class ChatActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
newMessage = binding.text
|
||||
newMessage.setOnFocusChangeListener(View.OnFocusChangeListener { _, hasFocus ->
|
||||
newMessage.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
|
||||
if (hasFocus) {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (focus) newMessage.requestFocus()
|
||||
|
||||
@ -147,7 +147,7 @@ class ChatActivity : AppCompatActivity() {
|
||||
msg.add()
|
||||
chatMessages.add(msg)
|
||||
if (Api.message_send(ua.uap, peerUri, msgText, time.toString()) != 0) {
|
||||
Toast.makeText(getApplicationContext(), "${getString(R.string.message_failed)}!",
|
||||
Toast.makeText(applicationContext, "${getString(R.string.message_failed)}!",
|
||||
Toast.LENGTH_SHORT).show()
|
||||
msg.direction = R.drawable.arrow_up_red
|
||||
msg.responseReason = getString(R.string.message_failed)
|
||||
@ -216,8 +216,8 @@ class ChatActivity : AppCompatActivity() {
|
||||
if (SystemClock.elapsedRealtime() - lastCall > 1000) {
|
||||
lastCall = SystemClock.elapsedRealtime()
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
intent.putExtra("action", "call")
|
||||
intent.putExtra("uap", ua.uap)
|
||||
intent.putExtra("peer", peerUri)
|
||||
|
||||
@ -73,7 +73,7 @@ class ChatListAdapter(private val ctx: Context, private var rows: ArrayList<Mess
|
||||
else
|
||||
viewHolder.layoutView.setBackgroundResource(R.drawable.message_out_bg)
|
||||
|
||||
viewHolder.peerView.setText(peer)
|
||||
viewHolder.peerView.text = peer
|
||||
|
||||
val cal = GregorianCalendar()
|
||||
cal.timeInMillis = message.timeStamp
|
||||
|
||||
@ -55,7 +55,7 @@ class CodecsActivity : AppCompatActivity() {
|
||||
while (newCodecs.size < codecs.size) newCodecs.add("-")
|
||||
|
||||
val layout = binding.SpinnerTable
|
||||
val spinnerList = Array(codecs.size, {_ -> ArrayList<String>()})
|
||||
val spinnerList = Array(codecs.size) { ArrayList<String>() }
|
||||
for (i in codecs.indices) {
|
||||
val spinner = Spinner(applicationContext)
|
||||
spinner.id = i + 100
|
||||
@ -72,7 +72,7 @@ class CodecsActivity : AppCompatActivity() {
|
||||
spinnerList[i].addAll(codecs)
|
||||
spinnerList[i].add(0, "-")
|
||||
}
|
||||
val codecSpinner = findViewById(spinner.id) as Spinner
|
||||
val codecSpinner = findViewById<Spinner>(spinner.id)
|
||||
val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item,
|
||||
spinnerList[i])
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
|
||||
@ -96,7 +96,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
volVals.removeAt(curVal)
|
||||
volKeys.add(0, curKey)
|
||||
volVals.add(0, curVal)
|
||||
val callVolAdapter = ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,
|
||||
val callVolAdapter = ArrayAdapter(this, android.R.layout.simple_spinner_item,
|
||||
volKeys)
|
||||
callVolAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
callVolSpinner.adapter = callVolAdapter
|
||||
|
||||
@ -102,7 +102,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
|
||||
oldAndroid = androidCheck.isChecked
|
||||
|
||||
textAvatarView.setOnClickListener { _ ->
|
||||
textAvatarView.setOnClickListener {
|
||||
|
||||
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
@ -112,7 +112,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
textAvatarView.setOnLongClickListener { _ ->
|
||||
textAvatarView.setOnLongClickListener {
|
||||
|
||||
color = Utils.randomColor()
|
||||
showTextAvatar(textAvatarView.text.toString(), color)
|
||||
@ -121,7 +121,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
cardAvatarView.setOnClickListener { _ ->
|
||||
cardAvatarView.setOnClickListener {
|
||||
|
||||
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
@ -131,7 +131,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
cardAvatarView.setOnLongClickListener { _ ->
|
||||
cardAvatarView.setOnLongClickListener {
|
||||
|
||||
color = Utils.randomColor()
|
||||
showTextAvatar(nameView.text.toString(), color)
|
||||
@ -533,7 +533,7 @@ class ContactActivity : AppCompatActivity() {
|
||||
val cur: Cursor? = ctx.contentResolver.query(ContactsContract.Data.CONTENT_URI, projection,
|
||||
selection, null, null)
|
||||
while (cur != null && cur.moveToNext()) {
|
||||
val id = cur.getLong(0);
|
||||
val id = cur.getLong(0)
|
||||
val name = cur.getString(1) // display name
|
||||
val mime = cur.getString(2) // type of data
|
||||
val data = cur.getString(3) // info
|
||||
|
||||
@ -75,13 +75,13 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
|
||||
viewHolder.nameView.setPadding(6, 6, 0, 6)
|
||||
|
||||
if (aor != "") {
|
||||
viewHolder.nameView.setOnClickListener { _ ->
|
||||
viewHolder.nameView.setOnClickListener {
|
||||
val dialogClickListener = DialogInterface.OnClickListener { _, which ->
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_NEGATIVE -> {
|
||||
val i = Intent(ctx, MainActivity::class.java)
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
if (which == DialogInterface.BUTTON_NEGATIVE)
|
||||
i.putExtra("action", "call")
|
||||
else
|
||||
@ -114,7 +114,7 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
|
||||
}
|
||||
}
|
||||
|
||||
viewHolder.nameView.setOnLongClickListener { _ ->
|
||||
viewHolder.nameView.setOnLongClickListener {
|
||||
val dialogClickListener = DialogInterface.OnClickListener { _, which ->
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> {
|
||||
@ -151,7 +151,7 @@ class ContactListAdapter(private val ctx: Context, private val rows: ArrayList<C
|
||||
true
|
||||
}
|
||||
|
||||
viewHolder.actionView.setOnClickListener { _ ->
|
||||
viewHolder.actionView.setOnClickListener {
|
||||
if (SystemClock.elapsedRealtime() - lastClick > 1000) {
|
||||
lastClick = SystemClock.elapsedRealtime()
|
||||
val i = Intent(ctx, ContactActivity::class.java)
|
||||
|
||||
@ -136,13 +136,13 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onFinish() {
|
||||
when (stopState) {
|
||||
"initial" -> {
|
||||
baresipService.setAction("Stop Force");
|
||||
baresipService.action = "Stop Force"
|
||||
startService(baresipService)
|
||||
stopState = "force"
|
||||
quitTimer.start()
|
||||
}
|
||||
"force" -> {
|
||||
baresipService.setAction("Kill");
|
||||
baresipService.action = "Kill"
|
||||
startService(baresipService)
|
||||
finishAndRemoveTask()
|
||||
System.exit(0)
|
||||
@ -386,8 +386,8 @@ class MainActivity : AppCompatActivity() {
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> {
|
||||
val callIntent = Intent(this, MainActivity::class.java)
|
||||
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
callIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
callIntent.putExtra("action", "call")
|
||||
callIntent.putExtra("uap", ua.uap)
|
||||
callIntent.putExtra("peer", acc.vmUri)
|
||||
@ -729,7 +729,7 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
when (keyCode) {
|
||||
KeyEvent.KEYCODE_VOLUME_DOWN, KeyEvent.KEYCODE_VOLUME_UP -> {
|
||||
Log.d(TAG, "Adjusting volume $keyCode of stream ${volumeControlStream}")
|
||||
Log.d(TAG, "Adjusting volume $keyCode of stream $volumeControlStream")
|
||||
am.adjustStreamVolume(volumeControlStream,
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
||||
AudioManager.ADJUST_LOWER else
|
||||
@ -989,7 +989,7 @@ class MainActivity : AppCompatActivity() {
|
||||
"message", "message show", "message reply" -> {
|
||||
val peer = params[1]
|
||||
val i = Intent(applicationContext, ChatActivity::class.java)
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
i.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
val b = Bundle()
|
||||
b.putString("aor", aor)
|
||||
b.putString("peer", peer)
|
||||
@ -1024,7 +1024,7 @@ class MainActivity : AppCompatActivity() {
|
||||
private fun reStart() {
|
||||
Log.d(TAG, "Trigger restart")
|
||||
val pm = applicationContext.packageManager
|
||||
val intent = pm.getLaunchIntentForPackage(this.getPackageName())
|
||||
val intent = pm.getLaunchIntentForPackage(this.packageName)
|
||||
this.finishAffinity()
|
||||
this.startActivity(intent)
|
||||
System.exit(0)
|
||||
@ -1116,7 +1116,7 @@ class MainActivity : AppCompatActivity() {
|
||||
if (aorSpinner.tag != "")
|
||||
updateIcons(Account.ofAor(aorSpinner.tag.toString())!!)
|
||||
if (BaresipService.isServiceRunning) {
|
||||
baresipService.setAction("UpdateNotification")
|
||||
baresipService.action = "UpdateNotification"
|
||||
startService(baresipService)
|
||||
}
|
||||
}
|
||||
@ -1205,7 +1205,7 @@ class MainActivity : AppCompatActivity() {
|
||||
Log.d(TAG, "quitRestart Restart = $reStart")
|
||||
if (BaresipService.isServiceRunning) {
|
||||
restart = reStart
|
||||
baresipService.setAction("Stop");
|
||||
baresipService.action = "Stop"
|
||||
startService(baresipService)
|
||||
quitTimer.start()
|
||||
} else {
|
||||
@ -1379,7 +1379,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun startBaresip() {
|
||||
baresipService.setAction("Start")
|
||||
baresipService.action = "Start"
|
||||
startService(baresipService)
|
||||
if (atStartup)
|
||||
moveTaskToBack(true)
|
||||
|
||||
@ -5,7 +5,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.ImageButton
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
|
||||
|
||||
@ -270,7 +270,7 @@ object Utils {
|
||||
var servers = ""
|
||||
for (dnsServer in list) {
|
||||
var address = dnsServer.hostAddress.removePrefix("/")
|
||||
if (Utils.checkIpV4(address))
|
||||
if (checkIpV4(address))
|
||||
address = "${address}:53"
|
||||
else
|
||||
address = "[${address}]:53"
|
||||
@ -518,7 +518,7 @@ object Utils {
|
||||
fun decryptFromFile(filePath: String, password: String): ByteArray? {
|
||||
var plainData: ByteArray? = null
|
||||
try {
|
||||
ObjectInputStream(FileInputStream(File(filePath))).use { it ->
|
||||
ObjectInputStream(FileInputStream(File(filePath))).use {
|
||||
val obj = it.readObject() as Crypto
|
||||
plainData = decrypt(obj, password.toCharArray())
|
||||
}
|
||||
@ -577,7 +577,7 @@ object Utils {
|
||||
return false
|
||||
}
|
||||
(allFiles - zipFiles).iterator().forEach {
|
||||
deleteFile(File(BaresipService.filesPath, "$it"))
|
||||
deleteFile(File(BaresipService.filesPath, it))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@ -589,7 +589,7 @@ object Utils {
|
||||
Log.d("Baresip", "Dumping intent start")
|
||||
while (it.hasNext()) {
|
||||
val key = it.next()
|
||||
Log.d("Baresip","[" + key + "=" + bundle.get(key)+"]");
|
||||
Log.d("Baresip", "[" + key + "=" + bundle.get(key) + "]")
|
||||
}
|
||||
Log.d("Baresip", "Dumping intent finish")
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/notificationLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mainRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView android:id="@+id/image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:src="@drawable/baresip"
|
||||
android:contentDescription="@string/app_name" />
|
||||
|
||||
<TextView android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="15sp"
|
||||
android:textColor="#000000"
|
||||
android:text="@string/app_name"
|
||||
style = "@android:style/TextAppearance.Medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/callFrom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/mainRow"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textSize="15sp"
|
||||
style = "@android:style/TextAppearance.Medium" />
|
||||
|
||||
<Button android:id="@+id/answerButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/callFrom"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/answer" />
|
||||
|
||||
<Button android:id="@+id/rejectButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/callFrom"
|
||||
android:layout_toEndOf="@id/answerButton"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/reject" />
|
||||
|
||||
</RelativeLayout>
|
||||
@ -1,7 +1,4 @@
|
||||
<resources>
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="textsize">12sp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="button_width">96dp</dimen>
|
||||
</resources>
|
||||
|
||||
@ -91,9 +91,6 @@
|
||||
</ul>
|
||||
]]>
|
||||
</string>
|
||||
<string name="baresip_link" translatable="false">
|
||||
<a href="https://github.com/juha-h/baresip-studio">GitHub</a>
|
||||
</string>
|
||||
<!-- Account Activity -->
|
||||
<string name="account">Account</string>
|
||||
<string name="display_name">Display Name</string>
|
||||
|
||||
Reference in New Issue
Block a user