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
76274a58
Commit
76274a58
authored
Nov 13, 2019
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
课程、支付
parent
1d422b3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
19 deletions
+30
-19
CoursePlugin.kt
m-course/src/main/java/com/yidianling/course/flutterPlugin/CoursePlugin.kt
+1
-0
PlayerFloatView.kt
ydl-media/src/main/java/com/ydl/media/view/PlayerFloatView.kt
+29
-19
No files found.
m-course/src/main/java/com/yidianling/course/flutterPlugin/CoursePlugin.kt
View file @
76274a58
...
...
@@ -141,6 +141,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
PlayerFloatHelper
.
playingType
=
PlayTypeEnum
.
PLAY_TYPE_COURSE
music
.
path
=
url
PlayerFloatHelper
.
show
(
mFragment
!!
.
activity
)
AudioPlayer
.
get
().
singlePlay
(
music
)
}
if
(
demoType
==
2
)
{
...
...
ydl-media/src/main/java/com/ydl/media/view/PlayerFloatView.kt
View file @
76274a58
...
...
@@ -54,7 +54,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
private
var
listeners
:
CopyOnWriteArraySet
<
FloatViewPlayListener
>
=
CopyOnWriteArraySet
()
private
var
mStateChangeListener
:
OnPlayerEventListener
?
=
null
private
var
playData
:
HashMap
<
String
,
String
>
=
hashMapOf
<
String
,
String
>()
private
var
playData
:
HashMap
<
String
,
String
>
=
hashMapOf
<
String
,
String
>()
init
{
init
(
context
)
...
...
@@ -72,7 +72,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
@SuppressLint
(
"ClickableViewAccessibility"
)
private
fun
init
(
context
:
Context
)
{
wm
=
getContext
().
getSystemService
(
Context
.
WINDOW_SERVICE
)
as
WindowManager
mTouchSlop
=
ViewConfiguration
.
get
(
getContext
()).
scaledTouchSlop
+
8
mTouchSlop
=
(
ViewConfiguration
.
get
(
getContext
()).
scaledTouchSlop
+
8
)
*
3
val
view
=
View
.
inflate
(
context
,
R
.
layout
.
item_playing_float_btn
,
this
)
mAudioLayout
=
view
.
findViewById
(
R
.
id
.
ll_audio_layout
)
mInfoLayout
=
view
.
findViewById
(
R
.
id
.
rl_info
)
...
...
@@ -88,10 +88,10 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
if
(!
TextUtils
.
isEmpty
(
AudioPlayer
.
get
().
playMusic
?.
coverPath
))
{
GlideApp
.
with
(
context
.
applicationContext
)
.
load
(
AudioPlayer
.
get
().
playMusic
?.
coverPath
)
.
transform
(
GlideRoundTransform
(
context
,
4
))
.
error
(
R
.
drawable
.
ico_play_float_pic
)
.
into
(
playHead
!!
)
.
load
(
AudioPlayer
.
get
().
playMusic
?.
coverPath
)
.
transform
(
GlideRoundTransform
(
context
,
4
))
.
error
(
R
.
drawable
.
ico_play_float_pic
)
.
into
(
playHead
!!
)
}
myHandler
=
MyHandler
()
...
...
@@ -113,11 +113,12 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent
.
ACTION_UP
->
{
if
(
Math
.
abs
(
event
.
x
-
mTouchStartX
)
>
mTouchSlop
||
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
updateViewPosition
()
}
else
{
if
(!
isMove
)
{
if
(
PlayerFloatHelper
.
isCanClick
){
if
(
PlayerFloatHelper
.
isCanClick
)
{
PlayerFloatHelper
.
startPlayingActivity
(
context
)
}
}
...
...
@@ -147,11 +148,12 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent
.
ACTION_UP
->
{
if
(
Math
.
abs
(
event
.
x
-
mTouchStartX
)
>
mTouchSlop
||
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
updateViewPosition
()
}
else
{
if
(!
isMove
)
{
if
(
PlayerFloatHelper
.
isCanClick
){
if
(
PlayerFloatHelper
.
isCanClick
)
{
PlayerFloatHelper
.
startPlayingActivity
(
context
)
}
}
...
...
@@ -181,11 +183,12 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent
.
ACTION_UP
->
{
if
(
Math
.
abs
(
event
.
x
-
mTouchStartX
)
>
mTouchSlop
||
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
updateViewPosition
()
}
else
{
if
(!
isMove
)
{
if
(
PlayerFloatHelper
.
isCanClick
){
if
(
PlayerFloatHelper
.
isCanClick
)
{
PlayerFloatHelper
.
startPlayingActivity
(
context
)
}
}
...
...
@@ -215,10 +218,16 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent
.
ACTION_UP
->
{
if
(
Math
.
abs
(
event
.
x
-
mTouchStartX
)
>
mTouchSlop
||
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
updateViewPosition
()
}
else
{
if
(!
isMove
)
{
for
(
listener
in
listeners
)
{
//数据重新设置回调
listener
.
onPauseClick
()
}
this
@PlayerFloatView
.
visibility
=
View
.
GONE
PlayerFloatHelper
.
removeView
(
mContext
)
PlayerFloatHelper
.
playTempData
.
clear
()
...
...
@@ -250,7 +259,8 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent
.
ACTION_UP
->
{
if
(
Math
.
abs
(
event
.
x
-
mTouchStartX
)
>
mTouchSlop
||
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
Math
.
abs
(
event
.
y
-
mTouchStartY
)
>
mTouchSlop
||
isMove
)
{
updateViewPosition
()
}
else
{
if
(!
isMove
)
{
...
...
@@ -280,7 +290,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
if
(
mStateChangeListener
==
null
)
{
mStateChangeListener
=
object
:
OnPlayerEventListener
{
mStateChangeListener
=
object
:
OnPlayerEventListener
{
override
fun
onComplete
()
{
myHandler
?.
sendEmptyMessage
(
UPDATE_VIEW_COMPLETE
)
}
...
...
@@ -316,10 +326,10 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
private
fun
resetAudioView
()
{
if
(!
TextUtils
.
isEmpty
(
AudioPlayer
.
get
().
playMusic
?.
coverPath
))
{
GlideApp
.
with
(
context
.
applicationContext
)
.
load
(
AudioPlayer
.
get
().
playMusic
?.
coverPath
)
.
transform
(
GlideRoundTransform
(
context
,
4
))
.
error
(
R
.
drawable
.
ico_play_float_pic
)
.
into
(
playHead
!!
)
.
load
(
AudioPlayer
.
get
().
playMusic
?.
coverPath
)
.
transform
(
GlideRoundTransform
(
context
,
4
))
.
error
(
R
.
drawable
.
ico_play_float_pic
)
.
into
(
playHead
!!
)
}
if
(
TextUtils
.
isEmpty
(
AudioPlayer
.
get
().
playMusic
?.
title
))
{
...
...
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