Use accent color transfer button to execute attended transfer
This commit is contained in:
@ -46,8 +46,10 @@ class Call(val callp: Long, val ua: UserAgent, val peerUri: String, val dir: Str
|
||||
|
||||
fun executeTransfer(): Boolean {
|
||||
return if (this.onHoldCall != null) {
|
||||
call_hold(callp, true)
|
||||
call_replace_transfer(this.onHoldCall!!.callp, callp)
|
||||
if (call_hold(callp, true) == 0)
|
||||
call_replace_transfer(this.onHoldCall!!.callp, callp)
|
||||
else
|
||||
false
|
||||
} else
|
||||
false
|
||||
}
|
||||
|
||||
@ -76,7 +76,6 @@ class MainActivity : AppCompatActivity() {
|
||||
private var speakerIcon: MenuItem? = null
|
||||
private lateinit var swipeRefresh: SwipeRefreshLayout
|
||||
private lateinit var requestPermissionLauncher: ActivityResultLauncher<String>
|
||||
private var executeTransferDialog: androidx.appcompat.app.AlertDialog? = null
|
||||
|
||||
private lateinit var accountsRequest: ActivityResultLauncher<Intent>
|
||||
private lateinit var chatRequests: ActivityResultLauncher<Intent>
|
||||
@ -389,7 +388,17 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
transferButton.setOnClickListener {
|
||||
makeTransfer(UserAgent.uas()[aorSpinner.selectedItemPosition])
|
||||
val ua = UserAgent.uas()[aorSpinner.selectedItemPosition]
|
||||
val call = ua.currentCall()
|
||||
if (call != null ) {
|
||||
if (call.onHoldCall != null) {
|
||||
if (!call.executeTransfer())
|
||||
Utils.alertView(this@MainActivity, getString(R.string.notice),
|
||||
String.format(getString(R.string.transfer_failed)))
|
||||
} else {
|
||||
makeTransfer(ua)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
infoButton.setOnClickListener {
|
||||
@ -1863,25 +1872,10 @@ class MainActivity : AppCompatActivity() {
|
||||
Utils.aorDomain(ua.account.aor)))
|
||||
transferButton.isEnabled = true
|
||||
}
|
||||
if (call.onHoldCall != null) {
|
||||
val builder = MaterialAlertDialogBuilder(this, R.style.AlertDialogTheme)
|
||||
with(builder) {
|
||||
setTitle(getString(R.string.execute_transfer))
|
||||
setPositiveButton(getText(R.string.yes)) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
call.executeTransfer()
|
||||
}
|
||||
setNeutralButton(getText(R.string.no)) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
Api.ua_hangup(ua.uap, call.callp, 0, "")
|
||||
}
|
||||
}
|
||||
executeTransferDialog = builder.create()
|
||||
executeTransferDialog!!.show()
|
||||
} else {
|
||||
executeTransferDialog?.dismiss()
|
||||
executeTransferDialog = null
|
||||
}
|
||||
if (call.onHoldCall == null)
|
||||
transferButton.setImageResource(R.drawable.call_transfer)
|
||||
else
|
||||
transferButton.setImageResource(R.drawable.call_transfer_execute)
|
||||
startCallTimer(call)
|
||||
callTimer.visibility = View.VISIBLE
|
||||
if (ua.account.mediaEnc == "") {
|
||||
|
||||
5
app/src/main/res/drawable/call_transfer_execute.xml
Normal file
5
app/src/main/res/drawable/call_transfer_execute.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="48dp" android:viewportHeight="1024"
|
||||
android:viewportWidth="1024" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@color/colorAccent" android:pathData="M65.2,510.67c0,247.04 200.26,447.3 447.24,447.3C759.55,957.97 959.71,757.71 959.71,510.67c0,-246.98 -200.16,-447.24 -447.27,-447.24C265.46,63.43 65.2,263.68 65.2,510.67zM139.94,510.67c0,-205.69 166.82,-372.5 372.5,-372.5 205.75,0 372.57,166.81 372.57,372.5 0,205.82 -166.81,372.57 -372.57,372.57C306.75,883.23 139.94,716.48 139.94,510.67z"/>
|
||||
<path android:fillColor="@color/colorAccent" android:pathData="M721.86,508.24 L560.34,374.74c0,0 -19.11,-20.22 -19.11,1.64 0,22.12 0,75.26 0,75.26s-12.96,0 -32.72,0c-56.84,0 -160.21,0 -202.25,0 0,0 -11.35,-3.07 -11.35,14.33 0,17.41 0,93.65 0,105.95 0,12.5 9.49,12.17 9.49,12.17 40.9,0 147.77,0 202.61,0 17.87,0 34.39,0 34.39,0s0,42.67 0,69.44c0,26.83 19.01,3.6 19.01,3.6s146.95,-110.53 162.79,-126.37C734.68,519.17 721.86,508.24 721.86,508.24z"/>
|
||||
</vector>
|
||||
Reference in New Issue
Block a user