Commit 5e9cb2bd by 万齐军

权限拒绝弹窗修改

parent 735e336b
...@@ -35,6 +35,8 @@ interface IAudioImService : IProvider{ ...@@ -35,6 +35,8 @@ interface IAudioImService : IProvider{
*/ */
fun openAxbDialog(activity: Activity?, type: Int, phoneNumber: String?) fun openAxbDialog(activity: Activity?, type: Int, phoneNumber: String?)
fun openPermissionRejectDialog(activity: Activity?, callback: (() -> Unit))
/** /**
* 事件上报 * 事件上报
*/ */
......
...@@ -61,6 +61,19 @@ class AudioImServiceImp : IAudioImService { ...@@ -61,6 +61,19 @@ class AudioImServiceImp : IAudioImService {
dialog.show() dialog.show()
} }
override fun openPermissionRejectDialog(activity: Activity?, callback: () -> Unit) {
val dialog = AxbConfirmDialog(activity, 3, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
callback.invoke()
}
override fun onClose() {
callback.invoke()
}
})
dialog.show()
}
override fun callEventSave(status: String, res: String, session: String?, line: String) { override fun callEventSave(status: String, res: String, session: String?, line: String) {
YDLavManager.instances.callEventSave(status, res, session, line) YDLavManager.instances.callEventSave(status, res, session, line)
} }
......
...@@ -4,6 +4,7 @@ import android.app.Activity ...@@ -4,6 +4,7 @@ import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.os.Bundle import android.os.Bundle
import android.widget.TextView
import com.ydl.audioim.R import com.ydl.audioim.R
import kotlinx.android.synthetic.main.audioim_dialog_axb_confirm.* import kotlinx.android.synthetic.main.audioim_dialog_axb_confirm.*
...@@ -17,7 +18,7 @@ import kotlinx.android.synthetic.main.audioim_dialog_axb_confirm.* ...@@ -17,7 +18,7 @@ import kotlinx.android.synthetic.main.audioim_dialog_axb_confirm.*
class AxbConfirmDialog : Dialog { class AxbConfirmDialog : Dialog {
private var activity: Activity? = null private var activity: Activity? = null
private var listener: OnClickEnsureListener? = null private var listener: OnClickEnsureListener? = null
private var type :Int = 1 //弹窗类型,1为手动切换axb布局,2为自动切换axb布局 private var type :Int = 1 //弹窗类型,1为手动切换axb布局,2为自动切换axb布局,3权限拒绝
constructor(activity: Activity?,type:Int, listener: OnClickEnsureListener?) : super(activity) { constructor(activity: Activity?,type:Int, listener: OnClickEnsureListener?) : super(activity) {
this.activity = activity this.activity = activity
...@@ -29,7 +30,10 @@ class AxbConfirmDialog : Dialog { ...@@ -29,7 +30,10 @@ class AxbConfirmDialog : Dialog {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (this.type==2){ if (this.type==2){
setContentView(R.layout.audioim_dialog_autoaxb_confirm) setContentView(R.layout.audioim_dialog_autoaxb_confirm)
}else{ } else if (this.type == 3) {
setContentView(R.layout.audioim_dialog_autoaxb_confirm)
findViewById<TextView>(R.id.tvTip).text = "您未授权无法使用网络通话\n请点击呼叫使用传统电话"
} else {
setContentView(R.layout.audioim_dialog_axb_confirm) setContentView(R.layout.audioim_dialog_axb_confirm)
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="315dp" android:layout_width="315dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
...@@ -34,6 +33,7 @@ ...@@ -34,6 +33,7 @@
android:src="@drawable/audioim_switch_axb" /> android:src="@drawable/audioim_switch_axb" />
<TextView <TextView
android:id="@+id/tvTip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
......
...@@ -11,9 +11,10 @@ import androidx.databinding.DataBindingUtil ...@@ -11,9 +11,10 @@ import androidx.databinding.DataBindingUtil
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import com.blankj.utilcode.constant.PermissionConstants import com.blankj.utilcode.constant.PermissionConstants
import com.blankj.utilcode.util.PermissionUtils import com.blankj.utilcode.util.PermissionUtils
import com.ydl.audioim.api.IAudioImService
import com.ydl.confide.R import com.ydl.confide.R
import com.ydl.confide.databinding.DialogConfidePermissionBinding import com.ydl.confide.databinding.DialogConfidePermissionBinding
import com.ydl.ydlcommon.view.dialog.CommonDialog import com.ydl.ydlcommon.modular.findRouteService
class ConfidePermissionDialog : DialogFragment() { class ConfidePermissionDialog : DialogFragment() {
...@@ -58,13 +59,14 @@ class ConfidePermissionDialog : DialogFragment() { ...@@ -58,13 +59,14 @@ class ConfidePermissionDialog : DialogFragment() {
private fun reject() { private fun reject() {
dismissAllowingStateLoss() dismissAllowingStateLoss()
CommonDialog(context) // CommonDialog(context)
.setMessage("由于您尚未同意获取麦克风权限,本次通话将使用传统电话方式拨打") // .setMessage("由于您尚未同意获取麦克风权限,本次通话将使用传统电话方式拨打")
.setRightClick("确定") { // .setRightClick("确定") {
callback?.invoke(false) // callback?.invoke(false)
} // }
.setCancelAble(false) // .setCancelAble(false)
.show() // .show()
findRouteService(IAudioImService::class.java).openPermissionRejectDialog(activity) { callback?.invoke(false) }
} }
override fun onStart() { override fun onStart() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment