Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
af4c062a
Commit
af4c062a
authored
Jun 28, 2022
by
万齐军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
倾诉权限请求提示Dialog
parent
a1fb0914
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
269 additions
and
34 deletions
+269
-34
build.gradle
api/confide/build.gradle
+1
-1
IConfideService.kt
api/confide/src/main/java/com/ydl/confide/api/IConfideService.kt
+3
-0
JsMethod.kt
app/src/main/java/com/ydl/component/service/web/JsMethod.kt
+24
-6
config.gradle
config.gradle
+1
-1
ConfidePermissionDialog.kt
m-confide/src/main/java/com/ydl/confide/home/ConfidePermissionDialog.kt
+77
-0
ConfdieServiceImpl.kt
m-confide/src/main/java/com/ydl/confide/home/modular/service/ConfdieServiceImpl.kt
+6
-0
ConfideWebServiceImpl.kt
m-confide/src/main/java/com/ydl/confide/home/modular/service/ConfideWebServiceImpl.kt
+14
-26
bg_confide_permission.png
m-confide/src/main/res/drawable-xxhdpi/bg_confide_permission.png
+0
-0
ic_confide_microphone.png
m-confide/src/main/res/drawable-xxhdpi/ic_confide_microphone.png
+0
-0
ic_confide_permission_close.png
m-confide/src/main/res/drawable-xxhdpi/ic_confide_permission_close.png
+0
-0
bg_confide_gradient_main_color.xml
m-confide/src/main/res/drawable/bg_confide_gradient_main_color.xml
+13
-0
dialog_confide_permission.xml
m-confide/src/main/res/layout/dialog_confide_permission.xml
+103
-0
XContext.kt
ydl-utils/src/main/java/com/yidianling/common/tools/XContext.kt
+27
-0
No files found.
api/confide/build.gradle
View file @
af4c062a
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android'
apply
from:
"../../maven_push_api.gradle"
apply
from:
"../../maven_push_api.gradle"
version
=
'1.0.
1
'
version
=
'1.0.
2
'
android
{
android
{
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
...
...
api/confide/src/main/java/com/ydl/confide/api/IConfideService.kt
View file @
af4c062a
...
@@ -37,4 +37,6 @@ interface IConfideService : IProvider {
...
@@ -37,4 +37,6 @@ interface IConfideService : IProvider {
doctorId
:
String
,
doctorId
:
String
,
uid
:
String
uid
:
String
)
)
fun
requestConfidePermission
(
activity
:
FragmentActivity
,
call
:
((
Boolean
)
->
Unit
)?)
}
}
\ No newline at end of file
app/src/main/java/com/ydl/component/service/web/JsMethod.kt
View file @
af4c062a
package
com.ydl.component.service.web
package
com.ydl.component.service.web
import
com.alibaba.android.arouter.launcher.ARouter
import
android.Manifest
import
com.blankj.utilcode.util.PermissionUtils
import
com.google.gson.JsonObject
import
com.google.gson.JsonObject
import
com.google.gson.JsonParser
import
com.google.gson.JsonParser
import
com.hjq.permissions.Permission
import
com.hjq.permissions.XXPermissions
import
com.tencent.smtt.sdk.WebView
import
com.tencent.smtt.sdk.WebView
import
com.ydl.audioim.YDLavManager
import
com.ydl.audioim.YDLavManager
import
com.ydl.confide.api.IConfideService
import
com.ydl.confide.api.IConfideService
...
@@ -15,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivityMgr
...
@@ -15,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivityMgr
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.ui.Loading
import
com.ydl.ydlcommon.ui.Loading
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.asFragmentActivity
import
com.yidianling.user.UserHelper
import
com.yidianling.user.UserHelper
import
de.greenrobot.event.EventBus
import
de.greenrobot.event.EventBus
...
@@ -68,9 +68,19 @@ class JsMethod(private val webView: WebView?) {
...
@@ -68,9 +68,19 @@ class JsMethod(private val webView: WebView?) {
"has_audio_permission"
->
{
"has_audio_permission"
->
{
val
callback
=
param
.
getAsJsonPrimitive
(
"callback"
).
asString
val
callback
=
param
.
getAsJsonPrimitive
(
"callback"
).
asString
if
(
callback
.
isNullOrBlank
())
return
true
if
(
callback
.
isNullOrBlank
())
return
true
val
topActivity
=
BaseActivityMgr
.
INST
.
getTopActivity
()
if
(
PermissionUtils
.
isGranted
(
Manifest
.
permission
.
RECORD_AUDIO
))
{
val
grantedPermission
=
XXPermissions
.
isGrantedPermission
(
topActivity
,
Permission
.
RECORD_AUDIO
)
webView
?.
post
{
webView
?.
loadUrl
(
"javascript:$callback(${if (grantedPermission) 1 else 0})"
)
webView
.
loadUrl
(
"javascript:$callback(1)"
)
}
return
true
}
(
webView
?.
context
?.
asFragmentActivity
())
?.
let
{
findRouteService
(
IConfideService
::
class
.
java
).
requestConfidePermission
(
it
)
{
granted
->
webView
.
post
{
webView
.
loadUrl
(
"javascript:$callback(${if (granted) 1 else 0})"
)
}
}
}
return
true
return
true
}
}
...
@@ -94,6 +104,14 @@ class JsMethod(private val webView: WebView?) {
...
@@ -94,6 +104,14 @@ class JsMethod(private val webView: WebView?) {
}
}
return
true
return
true
}
}
"support_check_audio_permission"
->
{
val
callback
=
param
.
getAsJsonPrimitive
(
"callback"
).
asString
if
(
callback
.
isNullOrBlank
())
return
true
webView
?.
post
{
webView
.
loadUrl
(
"javascript:$callback(1)"
)
}
return
true
}
else
->
{
else
->
{
return
false
return
false
}
}
...
...
config.gradle
View file @
af4c062a
...
@@ -234,7 +234,7 @@ ext {
...
@@ -234,7 +234,7 @@ ext {
"ydl-m-home-api"
:
"com.ydl:m-home-api:${ydlPublishVersion["
m
-
home
-
api
"]}"
,
"ydl-m-home-api"
:
"com.ydl:m-home-api:${ydlPublishVersion["
m
-
home
-
api
"]}"
,
"ydl-m-consultant-api"
:
"com.ydl:m-consultant-api:1.0.0"
,
"ydl-m-consultant-api"
:
"com.ydl:m-consultant-api:1.0.0"
,
"ydl-m-dynamic-api"
:
"com.ydl:m-dynamic-api:1.0.0"
,
"ydl-m-dynamic-api"
:
"com.ydl:m-dynamic-api:1.0.0"
,
"ydl-m-confide-api"
:
"com.ydl:m-confide-api:1.0.
1
"
,
"ydl-m-confide-api"
:
"com.ydl:m-confide-api:1.0.
2
"
,
"ydl-m-course-api"
:
"com.ydl:m-course-api:1.0.0"
,
"ydl-m-course-api"
:
"com.ydl:m-course-api:1.0.0"
,
]
]
...
...
m-confide/src/main/java/com/ydl/confide/home/ConfidePermissionDialog.kt
0 → 100644
View file @
af4c062a
package
com.ydl.confide.home
import
android.Manifest
import
android.graphics.Color
import
android.graphics.drawable.ColorDrawable
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
class
ConfidePermissionDialog
:
DialogFragment
()
{
var
callback
:
((
Boolean
)
->
Unit
)?
=
null
private
lateinit
var
binding
:
DialogConfidePermissionBinding
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
granted
=
PermissionUtils
.
isGranted
(
Manifest
.
permission
.
RECORD_AUDIO
)
if
(
granted
)
{
callback
?.
invoke
(
true
)
dismissAllowingStateLoss
()
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
binding
=
DataBindingUtil
.
inflate
(
inflater
,
R
.
layout
.
dialog_confide_permission
,
container
,
false
)
return
binding
.
root
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
binding
.
ivClose
.
setOnClickListener
{
callback
?.
invoke
(
false
)
dismiss
()
}
binding
.
tvBtn
.
setOnClickListener
{
PermissionUtils
.
permission
(
PermissionConstants
.
MICROPHONE
)
.
callback
(
object
:
PermissionUtils
.
FullCallback
{
override
fun
onGranted
(
permissionsGranted
:
MutableList
<
String
>?)
{
callback
?.
invoke
(
true
)
dismissAllowingStateLoss
()
}
override
fun
onDenied
(
permissionsDeniedForever
:
MutableList
<
String
>?,
permissionsDenied
:
MutableList
<
String
>?)
{
callback
?.
invoke
(
false
)
dismissAllowingStateLoss
()
}
}).
request
()
}
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
super
.
onActivityCreated
(
savedInstanceState
)
if
(!
ActivityCompat
.
shouldShowRequestPermissionRationale
(
requireActivity
(),
Manifest
.
permission
.
RECORD_AUDIO
))
{
callback
?.
invoke
(
false
)
dismissAllowingStateLoss
()
}
}
override
fun
onStart
()
{
super
.
onStart
()
isCancelable
=
false
val
width
=
(
resources
.
displayMetrics
.
widthPixels
*
0.8
).
toInt
()
dialog
?.
window
?.
setLayout
(
width
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
dialog
?.
window
?.
setBackgroundDrawable
(
ColorDrawable
(
Color
.
TRANSPARENT
))
}
}
\ No newline at end of file
m-confide/src/main/java/com/ydl/confide/home/modular/service/ConfdieServiceImpl.kt
View file @
af4c062a
...
@@ -15,6 +15,7 @@ import com.ydl.audioim.widget.AxbConfirmDialog
...
@@ -15,6 +15,7 @@ import com.ydl.audioim.widget.AxbConfirmDialog
import
com.ydl.confide.api.IConfideService
import
com.ydl.confide.api.IConfideService
import
com.ydl.confide.home.ConfideBottomSheetDialogFragment
import
com.ydl.confide.home.ConfideBottomSheetDialogFragment
import
com.ydl.confide.home.ConfideHomeActivity
import
com.ydl.confide.home.ConfideHomeActivity
import
com.ydl.confide.home.ConfidePermissionDialog
import
com.ydl.confide.home.bean.ConfideConnectResponse
import
com.ydl.confide.home.bean.ConfideConnectResponse
import
com.ydl.webview.TellData
import
com.ydl.webview.TellData
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.base.BaseApp
...
@@ -137,4 +138,8 @@ class ConfdieServiceImpl : IConfideService {
...
@@ -137,4 +138,8 @@ class ConfdieServiceImpl : IConfideService {
ConfideBottomSheetDialogFragment
().
showBottomSheetDialog
(
activity
,
jumpUrl
,
doctorId
,
false
,
uid
)
ConfideBottomSheetDialogFragment
().
showBottomSheetDialog
(
activity
,
jumpUrl
,
doctorId
,
false
,
uid
)
}
}
override
fun
requestConfidePermission
(
activity
:
FragmentActivity
,
call
:
((
Boolean
)
->
Unit
)?)
{
ConfidePermissionDialog
().
apply
{
callback
=
call
}.
show
(
activity
.
supportFragmentManager
,
"ConfidePermissionDialog"
)
}
}
}
\ No newline at end of file
m-confide/src/main/java/com/ydl/confide/home/modular/service/ConfideWebServiceImpl.kt
View file @
af4c062a
...
@@ -7,12 +7,13 @@ import android.content.Context
...
@@ -7,12 +7,13 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.text.TextUtils
import
android.text.TextUtils
import
androidx.fragment.app.FragmentActivity
import
com.alibaba.android.arouter.launcher.ARouter
import
com.alibaba.android.arouter.launcher.ARouter
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.ydl.audioim.IntentConstants
import
com.ydl.audioim.IntentConstants
import
com.ydl.audioim.YDLavManager
import
com.ydl.audioim.YDLavManager
import
com.ydl.audioim.bean.ExpertInfoBean
import
com.ydl.audioim.bean.ExpertInfoBean
import
com.ydl.audioim.widget.AxbConfirmDialog
import
com.ydl.audioim.widget.AxbConfirmDialog
import
com.ydl.confide.home.ConfidePermissionDialog
import
com.ydl.confide.home.bean.ConfideConnectResponse
import
com.ydl.confide.home.bean.ConfideConnectResponse
import
com.ydl.confide.home.bean.ConnectParamJava
import
com.ydl.confide.home.bean.ConnectParamJava
import
com.ydl.confide.home.constants.FinalString
import
com.ydl.confide.home.constants.FinalString
...
@@ -154,16 +155,16 @@ class ConfideWebServiceImpl {
...
@@ -154,16 +155,16 @@ class ConfideWebServiceImpl {
callType
:
String
?
callType
:
String
?
)
{
)
{
ConfideHomeDataManager
.
getHttp
()
ConfideHomeDataManager
.
getHttp
()
.
submitOrderAndPay
(
ConnectParamJava
(
""
+
id
,
""
+
type
,
callType
))
.
submitOrderAndPay
(
ConnectParamJava
(
""
+
id
,
""
,
""
))
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
.
subscribe
({
if
(
"200"
==
it
.
code
)
{
if
(
"200"
==
it
.
code
)
{
when
(
it
.
data
?.
dialDetail
?.
dialStatus
)
{
when
(
it
.
data
?.
dialDetail
?.
dialStatus
)
{
0
->
{
//连接成功
0
->
{
//连接成功
if
(
it
.
data
?.
dialDetail
?.
callConnectT
ype
==
3
)
{
if
(
t
ype
==
3
)
{
//checkpermission
//checkpermission
checkPermission
(
id
,
type
,
activity
,
callType
)
checkPermission
(
id
,
type
,
activity
,
callType
)
}
else
{
}
else
{
//axb
//axb
listenDial
(
id
,
type
,
activity
,
"1"
)
listenDial
(
id
,
type
,
activity
,
"1"
)
...
@@ -191,34 +192,21 @@ class ConfideWebServiceImpl {
...
@@ -191,34 +192,21 @@ class ConfideWebServiceImpl {
* */
* */
@SuppressLint
(
"CheckResult"
)
@SuppressLint
(
"CheckResult"
)
private
fun
checkPermission
(
id
:
Int
,
type
:
Int
,
activity
:
Activity
,
callType
:
String
?)
{
private
fun
checkPermission
(
id
:
Int
,
type
:
Int
,
activity
:
Activity
,
callType
:
String
?)
{
try
{
(
activity
as
?
FragmentActivity
)
?.
let
{
val
rxPermissions
=
RxPermissions
(
activity
)
ConfidePermissionDialog
().
apply
{
rxPermissions
.
requestEach
(
Manifest
.
permission
.
RECORD_AUDIO
).
subscribe
{
permission
->
callback
=
{
granted
->
when
{
if
(
granted
)
{
//权限已申请 进行通话
permission
.
granted
->
{
listenDial
(
id
,
type
,
activity
,
callType
)
listenDial
(
id
,
type
,
activity
,
callType
)
AliYunRichLogsHelper
.
getInstance
()
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"请求音频权限通过"
)
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"请求音频权限通过"
)
}
}
else
{
//权限未申请 重新申请
permission
.
shouldShowRequestPermissionRationale
->
{
checkPermission
(
id
,
type
,
activity
,
callType
)
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"权限未申请 重新申请"
)
}
//跳转设置界面
else
->
{
listenDial
(
id
,
type
,
activity
,
"1"
)
listenDial
(
id
,
type
,
activity
,
"1"
)
AliYunRichLogsHelper
.
getInstance
()
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"权限拒绝 转axb"
)
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"权限拒绝 转axb"
)
}
}
}
}
}
}.
show
(
it
.
supportFragmentManager
,
"ConfidePermissionDialog"
)
}
catch
(
e
:
Exception
)
{
listenDial
(
id
,
type
,
activity
,
"1"
);
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"请求音频权限异常${e.message}"
)
}
}
}
}
...
@@ -266,7 +254,7 @@ class ConfideWebServiceImpl {
...
@@ -266,7 +254,7 @@ class ConfideWebServiceImpl {
):
Disposable
{
):
Disposable
{
Loading
.
show
(
activity
)
Loading
.
show
(
activity
)
return
ConfideHomeDataManager
.
getHttp
()
return
ConfideHomeDataManager
.
getHttp
()
.
submitOrderAndPay
(
ConnectParamJava
(
""
+
id
,
""
+
type
,
callType
))
.
submitOrderAndPay
(
ConnectParamJava
(
""
+
id
,
""
,
""
))
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
.
subscribe
({
...
@@ -274,7 +262,7 @@ class ConfideWebServiceImpl {
...
@@ -274,7 +262,7 @@ class ConfideWebServiceImpl {
if
(
"200"
==
it
.
code
)
{
if
(
"200"
==
it
.
code
)
{
when
(
it
.
data
?.
dialDetail
?.
dialStatus
)
{
when
(
it
.
data
?.
dialDetail
?.
dialStatus
)
{
0
->
{
//连接成功
0
->
{
//连接成功
if
(
it
.
data
?.
dialDetail
?.
callConnectT
ype
==
3
)
{
if
(
t
ype
==
3
)
{
//检查音频权限
//检查音频权限
checkPermission
(
id
,
type
,
activity
as
Activity
,
callType
)
checkPermission
(
id
,
type
,
activity
as
Activity
,
callType
)
}
else
{
}
else
{
...
...
m-confide/src/main/res/drawable-xxhdpi/bg_confide_permission.png
0 → 100644
View file @
af4c062a
85.4 KB
m-confide/src/main/res/drawable-xxhdpi/ic_confide_microphone.png
0 → 100644
View file @
af4c062a
6.33 KB
m-confide/src/main/res/drawable-xxhdpi/ic_confide_permission_close.png
0 → 100644
View file @
af4c062a
1.41 KB
m-confide/src/main/res/drawable/bg_confide_gradient_main_color.xml
0 → 100644
View file @
af4c062a
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"30dp"
/>
<gradient
android:angle=
"180"
android:endColor=
"#42c1ff"
android:startColor=
"#ff1da1f2"
/>
</shape>
\ No newline at end of file
m-confide/src/main/res/layout/dialog_confide_permission.xml
0 → 100644
View file @
af4c062a
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/bg_confide_permission"
>
<TextView
android:id=
"@+id/tvTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"26dp"
android:text=
"温馨提示"
android:textColor=
"@color/white"
android:textSize=
"21sp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:text=
"为能正常倾诉通话,请务必开启以下权限"
android:textColor=
"@color/white"
android:textSize=
"12sp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvTitle"
/>
<ImageView
android:id=
"@+id/ivMicro"
android:layout_width=
"38dp"
android:layout_height=
"38dp"
android:layout_marginLeft=
"30dp"
android:layout_marginTop=
"144dp"
android:src=
"@drawable/ic_confide_microphone"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tvPermission"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"4dp"
android:text=
"麦克风权限"
android:textColor=
"#1c1f28"
android:textSize=
"17sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toTopOf=
"@+id/tvPermissionDesc"
app:layout_constraintLeft_toRightOf=
"@+id/ivMicro"
app:layout_constraintTop_toTopOf=
"@+id/ivMicro"
/>
<TextView
android:id=
"@+id/tvPermissionDesc"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"4dp"
android:layout_marginTop=
"4dp"
android:text=
"启用麦克风,以正常进行语音沟通"
android:textColor=
"#9d9ea7"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"@+id/ivMicro"
app:layout_constraintLeft_toRightOf=
"@+id/ivMicro"
app:layout_constraintTop_toBottomOf=
"@+id/tvPermission"
/>
<TextView
android:id=
"@+id/tvBtn"
android:layout_width=
"0dp"
android:layout_height=
"47dp"
android:layout_marginLeft=
"30dp"
android:layout_marginTop=
"38dp"
android:layout_marginRight=
"30dp"
android:layout_marginBottom=
"24dp"
android:background=
"@drawable/bg_confide_gradient_main_color"
android:gravity=
"center"
android:text=
"一键启用"
android:textColor=
"@color/white"
android:textSize=
"16sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/ivMicro"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id=
"@+id/ivClose"
android:layout_width=
"33dp"
android:layout_height=
"33dp"
android:layout_gravity=
"top|right"
android:padding=
"6dp"
android:src=
"@drawable/ic_confide_permission_close"
/>
</FrameLayout>
</layout>
\ No newline at end of file
ydl-utils/src/main/java/com/yidianling/common/tools/XContext.kt
0 → 100644
View file @
af4c062a
package
com.yidianling.common.tools
import
android.app.Activity
import
android.content.Context
import
android.view.ContextThemeWrapper
import
androidx.fragment.app.FragmentActivity
fun
Context
.
asActivity
():
Activity
?
{
if
(
this
is
Activity
)
{
return
this
}
if
(
this
is
ContextThemeWrapper
)
{
return
this
.
baseContext
.
asActivity
()
}
return
null
}
fun
Context
.
asFragmentActivity
():
FragmentActivity
?
{
if
(
this
is
FragmentActivity
)
{
return
this
}
if
(
this
is
ContextThemeWrapper
)
{
return
this
.
baseContext
.
asFragmentActivity
()
}
return
null
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment