Commit 5928bf0b by 万齐军

倾诉权限获取修改

parent 20551e40
......@@ -7,13 +7,13 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.app.ActivityCompat
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.DialogFragment
import com.blankj.utilcode.constant.PermissionConstants
import com.blankj.utilcode.util.PermissionUtils
import com.ydl.confide.R
import com.ydl.confide.databinding.DialogConfidePermissionBinding
import com.ydl.ydlcommon.view.dialog.CommonDialog
class ConfidePermissionDialog : DialogFragment() {
......@@ -37,8 +37,7 @@ class ConfidePermissionDialog : DialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding.ivClose.setOnClickListener {
callback?.invoke(false)
dismiss()
reject()
}
binding.tvBtn.setOnClickListener {
......@@ -51,19 +50,21 @@ class ConfidePermissionDialog : DialogFragment() {
}
override fun onDenied(permissionsDeniedForever: MutableList<String>?, permissionsDenied: MutableList<String>?) {
callback?.invoke(false)
dismissAllowingStateLoss()
reject()
}
}).request()
}
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
if (!ActivityCompat.shouldShowRequestPermissionRationale(requireActivity(), Manifest.permission.RECORD_AUDIO)) {
callback?.invoke(false)
private fun reject() {
dismissAllowingStateLoss()
CommonDialog(context)
.setMessage("由于您尚未同意获取麦克风权限,本次通话将使用传统电话方式拨打")
.setRightClick("确定") {
callback?.invoke(false)
}
.setCancelAble(false)
.show()
}
override fun onStart() {
......
......@@ -49,7 +49,6 @@ public class DeviceTool {
} else {
activity.startActivity(getAppDetailSettingIntent());
}
gotoMiuiPermission(activity);
}
/**
......@@ -57,7 +56,7 @@ public class DeviceTool {
*/
private static void gotoMiuiPermission(Activity activity) {
Intent i = new Intent("miui.intent.action.APP_PERM_EDITOR");
ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");
ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity");
i.setComponent(componentName);
i.putExtra("extra_pkgname", getPackageName());
try {
......
......@@ -38,8 +38,8 @@
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:layout_marginRight">30dp</item>
<item name="android:layout_marginLeft">30dp</item>
<item name="android:layout_marginRight">0dp</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:windowBackground">@drawable/platform_normaldialog_bg</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
......
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