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
b958799d
Commit
b958799d
authored
May 18, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:bottomSheet设置圆角
parent
1502ff1e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
207 additions
and
10 deletions
+207
-10
config.gradle
config.gradle
+1
-1
ConfideHomeEventImpl.kt
m-confide/src/main/java/com/ydl/confide/home/event/ConfideHomeEventImpl.kt
+63
-7
confide_close_icon.webp
m-confide/src/main/res/drawable-xhdpi/confide_close_icon.webp
+0
-0
confide_bottom_line.xml
m-confide/src/main/res/drawable/confide_bottom_line.xml
+12
-0
confide_line_bg_change.xml
m-confide/src/main/res/drawable/confide_line_bg_change.xml
+8
-0
confide_bottom_two.xml
m-confide/src/main/res/layout/confide_bottom_two.xml
+69
-0
confide_webview.xml
m-confide/src/main/res/layout/confide_webview.xml
+43
-2
styles.xml
m-confide/src/main/res/values/styles.xml
+11
-0
No files found.
config.gradle
View file @
b958799d
ext
{
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydlPublishVersion
=
[
// -------------- 业务模块 --------------
...
...
m-confide/src/main/java/com/ydl/confide/home/event/ConfideHomeEventImpl.kt
View file @
b958799d
...
...
@@ -5,15 +5,17 @@ import android.app.Activity
import
android.content.Context
import
android.content.Intent
import
android.net.Uri
import
android.opengl.Visibility
import
android.text.TextUtils
import
android.view.
MotionEvent
import
android.
view.View
import
android.view.
*
import
android.
widget.FrameLayout
import
androidx.appcompat.app.AppCompatActivity
import
com.alibaba.android.arouter.launcher.ARouter
import
com.alibaba.fastjson.JSON
import
com.google.android.material.bottomsheet.BottomSheetBehavior
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.tencent.smtt.sdk.WebSettings
import
com.ydl.confide.R
import
com.alibaba.android.arouter.launcher.ARouter
import
com.alibaba.fastjson.JSON
import
com.ydl.confide.api.ConfideRoute
import
com.ydl.confide.home.ConfideHomeActivity
import
com.ydl.confide.home.adapter.ConfideHomeAdapter
...
...
@@ -44,6 +46,7 @@ import com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.bean.IMRequestCallback
/**
* @author yuanwai
* @描述:倾诉首页事件处理类
...
...
@@ -139,10 +142,15 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
*/
@SuppressLint
(
"JavascriptInterface"
,
"ClickableViewAccessibility"
)
override
fun
consultantClick
(
linkUrl
:
String
?)
{
val
bottomSheetDialog
=
mContext
?.
let
{
BottomSheetDialog
(
it
)
}
bottomSheetDialog
?.
setContentView
(
R
.
layout
.
confide_webview
)
val
bottomSheetDialog
=
mContext
?.
let
{
BottomSheetDialog
(
it
,
R
.
style
.
CustomShapeAppearanceBottomSheetDialog
)
}
val
bottomView
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
confide_webview
,
FrameLayout
(
mContext
),
false
)
bottomSheetDialog
?.
setContentView
(
bottomView
)
bottomSheetDialog
?.
show
()
var
wv_content
=
bottomSheetDialog
?.
findViewById
<
ProgressWebView
>(
com
.
ydl
.
webview
.
R
.
id
.
wv_content
)
var
close_webview_Icon
=
bottomSheetDialog
?.
findViewById
<
View
>(
R
.
id
.
close_webview_Icon
)
var
text_title
=
bottomSheetDialog
?.
findViewById
<
View
>(
R
.
id
.
text_title
)
var
line
=
bottomSheetDialog
?.
findViewById
<
View
>(
R
.
id
.
line
)
var
rl_title
=
bottomSheetDialog
?.
findViewById
<
View
>(
R
.
id
.
rl_title
)
val
setting
:
WebSettings
=
wv_content
?.
settings
!!
//支持js
//支持js
...
...
@@ -165,6 +173,43 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
wv_content
!!
.
addJavascriptInterface
(
jtoJHandle
,
"javascriptHandler"
)
bottomSheetDialog
?.
behavior
?.
peekHeight
=
1500
bottomSheetDialog
?.
behavior
?.
addBottomSheetCallback
(
object
:
BottomSheetBehavior
.
BottomSheetCallback
(){
override
fun
onStateChanged
(
p0
:
View
,
p1
:
Int
)
{
LogUtil
.
e
(
"aaaa"
+
p1
)
if
(
p1
==
3
){
rl_title
?.
visibility
=
View
.
VISIBLE
close_webview_Icon
?.
visibility
=
View
.
VISIBLE
text_title
?.
visibility
=
View
.
VISIBLE
line
?.
visibility
=
View
.
GONE
}
else
if
(
p1
==
1
){
rl_title
?.
visibility
=
View
.
VISIBLE
close_webview_Icon
?.
visibility
=
View
.
GONE
text_title
?.
visibility
=
View
.
GONE
line
?.
visibility
=
View
.
VISIBLE
}
else
if
(
p1
==
4
){
rl_title
?.
visibility
=
View
.
VISIBLE
line
?.
visibility
=
View
.
VISIBLE
}
}
override
fun
onSlide
(
p0
:
View
,
p1
:
Float
)
{
}
})
val
itemView
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
confide_bottom_two
,
null
,
false
)
val
layoutCall
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layoutCall
)
val
layoutChange
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layoutChange
)
layoutCall
.
setOnClickListener
{
callJsFun
(
wv_content
,
"layoutCall()"
)
}
layoutChange
.
setOnClickListener
{
callJsFun
(
wv_content
,
"layoutCall()"
)
}
val
layoutParams
=
FrameLayout
.
LayoutParams
(
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
).
apply
{
gravity
=
Gravity
.
BOTTOM
or
Gravity
.
CENTER_HORIZONTAL
}
bottomSheetDialog
?.
window
?.
addContentView
(
itemView
,
layoutParams
)
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
// bottomSheetDialog?.behavior?.skipCollapsed=true
wv_content
.
loadUrl
(
"https://m.ydl.com/jy/experts/23035?v=4.0.99&uid=9404770&ts=1652787528&toConfide=1&"
+
...
...
@@ -182,11 +227,22 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
}
return
false
;
}
})
// link(linkUrl)
}
private
fun
callJsFun
(
wv_content
:
ProgressWebView
,
funcName
:
String
)
{
val
sb
=
StringBuffer
(
"javascript:"
)
sb
.
append
(
funcName
)
wv_content
.
post
{
try
{
wv_content
.
loadUrl
(
sb
.
toString
())
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
}
override
fun
videoShowClick
(
index
:
Int
,
data
:
List
<
ConfideHomeBodyBean
>?)
{
val
dataJson
=
if
(
data
!=
null
)
JSON
.
toJSONString
(
data
)
else
null
ARouter
.
getInstance
().
build
(
ConfideRoute
.
R_VIDEO_SHOW
).
withInt
(
"initPos"
,
index
)
...
...
m-confide/src/main/res/drawable-xhdpi/confide_close_icon.webp
0 → 100644
View file @
b958799d
File added
m-confide/src/main/res/drawable/confide_bottom_line.xml
0 → 100644
View file @
b958799d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"@dimen/confide_dp_4"
/>
<solid
android:color=
"#d1d1d1"
/>
</shape>
\ No newline at end of file
m-confide/src/main/res/drawable/confide_line_bg_change.xml
0 → 100644
View file @
b958799d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<corners
android:radius=
"26dp"
/>
<gradient
android:endColor=
"#4BAFEC"
android:startColor=
"#65C4FF"
/>
</shape>
\ No newline at end of file
m-confide/src/main/res/layout/confide_bottom_two.xml
0 → 100644
View file @
b958799d
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/platform_dp_15"
android:layout_marginEnd=
"@dimen/platform_dp_15"
android:background=
"@color/transparent"
android:gravity=
"center_horizontal"
android:orientation=
"horizontal"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/layoutCall"
android:layout_width=
"150dp"
android:layout_height=
"42dp"
android:layout_marginBottom=
"32dp"
android:background=
"@drawable/confide_line_bg_1"
android:paddingLeft=
"28dp"
android:paddingRight=
"28dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
>
<ImageView
android:id=
"@+id/ivCall"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_marginRight=
"4dp"
android:src=
"@drawable/ic_confide_call"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/tvCall"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tvCall"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"通话中"
android:textColor=
"@color/white"
android:textSize=
"17sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@+id/ivCall"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id=
"@+id/layoutChange"
android:layout_width=
"150dp"
android:layout_height=
"42dp"
android:layout_marginStart=
"@dimen/platform_dp_23"
android:layout_marginBottom=
"32dp"
android:background=
"@drawable/confide_line_bg_change"
android:gravity=
"center"
android:paddingLeft=
"28dp"
android:paddingRight=
"28dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"再换一位"
android:textColor=
"@color/white"
android:textSize=
"17sp"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
m-confide/src/main/res/layout/confide_webview.xml
View file @
b958799d
...
...
@@ -3,12 +3,52 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:id=
"@+id/rl_title"
android:layout_marginLeft=
"@dimen/platform_dp_20"
android:layout_marginRight=
"@dimen/platform_dp_20"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/confide_close_icon"
android:id=
"@+id/close_webview_Icon"
android:visibility=
"gone"
android:layout_marginTop=
"@dimen/platform_dp_28"
android:layout_centerVertical=
"true"
>
</ImageView>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"我是标题"
android:layout_centerInParent=
"true"
android:id=
"@+id/text_title"
android:visibility=
"gone"
>
</TextView>
<View
android:layout_width=
"@dimen/platform_dp_36"
android:layout_height=
"@dimen/platform_dp_6"
android:background=
"@drawable/confide_bottom_line"
android:id=
"@+id/line"
android:layout_marginTop=
"@dimen/platform_dp_12"
android:layout_centerInParent=
"true"
>
</View>
</RelativeLayout>
<com.ydl.webview.ProgressWebView
android:id=
"@+id/wv_content"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/platform_transparent"
/>
android:layout_below=
"@id/rl_title"
/>
</RelativeLayout>
\ No newline at end of file
m-confide/src/main/res/values/styles.xml
View file @
b958799d
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"confide_NoTitleTheme"
parent=
"Theme.AppCompat.Light.DarkActionBar"
>
<!-- Customize your theme here. -->
<item
name=
"android:windowActionBar"
>
false
</item>
...
...
@@ -10,4 +11,13 @@
<item
name=
"colorAccent"
>
@color/platform_main_theme
</item>
</style>
<style
name=
"CustomShapeAppearanceBottomSheetDialog"
parent=
"Theme.MaterialComponents.Light.BottomSheetDialog"
>
<item
name=
"cornerFamily"
>
rounded
</item>
<item
name=
"cornerSizeTopRight"
>
16dp
</item>
<item
name=
"cornerSizeTopLeft"
>
16dp
</item>
<item
name=
"cornerSizeBottomRight"
>
0dp
</item>
<item
name=
"cornerSizeBottomLeft"
>
0dp
</item>
<item
name=
"background"
>
@color/transparent
</item>
</style>
</resources>
\ 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