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
91a4261a
Commit
91a4261a
authored
Aug 01, 2022
by
王佳洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,音频播放功能查漏补缺
2,音视频悬浮窗代码优化
parent
69bc9942
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
111 deletions
+113
-111
CourseMediaBean.kt
m-course/src/main/java/com/yidianling/course/bean/CourseMediaBean.kt
+4
-0
AudioPlayActivity.kt
m-course/src/main/java/com/yidianling/course/coursePlay/AudioPlayActivity.kt
+3
-1
CourseServiceImp.kt
m-course/src/main/java/com/yidianling/course/modular_service/CourseServiceImp.kt
+7
-2
PlayerFloatHelper.kt
ydl-media/src/main/java/com/ydl/media/view/PlayerFloatHelper.kt
+22
-10
PlayerFloatView.kt
ydl-media/src/main/java/com/ydl/media/view/PlayerFloatView.kt
+0
-0
item_playing_float_btn.xml
ydl-media/src/main/res/layout/item_playing_float_btn.xml
+77
-98
No files found.
m-course/src/main/java/com/yidianling/course/bean/CourseMediaBean.kt
View file @
91a4261a
...
...
@@ -7,6 +7,8 @@ package com.yidianling.course.bean
* @Company 壹点灵
* @date 2019/7/11
*/
const
val
COURSE_AUDIO
=
1
const
val
COURSE_VIDEO
=
2
data class
CourseMediaBean
(
/**
...
...
@@ -19,6 +21,8 @@ data class CourseMediaBean(
var
doctorName
:
String
,
/**
* 资料类型 1.音频 2.视频 ,
* @see COURSE_AUDIO
* @see COURSE_VIDEO
*/
var
mediaType
:
Int
,
/**
...
...
m-course/src/main/java/com/yidianling/course/coursePlay/AudioPlayActivity.kt
View file @
91a4261a
...
...
@@ -34,6 +34,7 @@ import com.yidianling.common.tools.ToastUtil
import
com.yidianling.course.BuildConfig
import
com.yidianling.course.CourseConstants
import
com.yidianling.course.R
import
com.yidianling.course.bean.COURSE_AUDIO
import
com.yidianling.course.bean.CourseExtraBean
import
com.yidianling.course.bean.CourseMediaBean
import
com.yidianling.course.bean.CourseMediaDetailBean
...
...
@@ -195,7 +196,7 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon
if
(!
it
.
isDemo
&&
!
isBuy
)
{
if
(
AudioPlayer
.
get
().
isPlaying
)
AudioPlayer
.
get
().
pausePlayer
()
buyCourseTipDialog
()
}
else
if
(
it
.
mediaType
==
1
)
{
}
else
if
(
it
.
mediaType
==
COURSE_AUDIO
)
{
return
true
}
}
...
...
@@ -228,6 +229,7 @@ class AudioPlayActivity : BaseMvpActivity<IAudioPlayContract.View, IAudioPlayCon
val
hashMap
=
HashMap
<
String
,
String
>()
hashMap
[
"course_id"
]
=
mCourseId
.
toString
()
hashMap
[
"media_type"
]
=
COURSE_AUDIO
.
toString
()
PlayerFloatHelper
.
playTempData
.
putAll
(
hashMap
)
}
return
true
...
...
m-course/src/main/java/com/yidianling/course/modular_service/CourseServiceImp.kt
View file @
91a4261a
...
...
@@ -8,10 +8,12 @@ import com.alibaba.android.arouter.facade.annotation.Route
import
com.ydl.course.api.ICourseService
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.view.PlayerFloatHelper
import
com.yidianling.course.bean.COURSE_AUDIO
import
com.yidianling.course.courseNew.CourseTopicActivity
import
com.yidianling.course.courseNew.mine.MyCourseActivity
import
com.yidianling.course.coursePlay.AudioPlayActivity
import
com.yidianling.course.coursePlay.CourseCommentActivity
import
com.yidianling.course.coursePlay.CoursePlayActivity
import
com.yidianling.course.coursePlay.CourseReplyListActivity
import
com.yidianling.course.flutterPlugin.CourseSendPlugin
import
com.yidianling.course.lifeCallback.CoursePlayLifecycle
...
...
@@ -60,8 +62,11 @@ class CourseServiceImp : ICourseService {
}
override
fun
startCoursePlayActivity
(
activity
:
Activity
,
courseId
:
Int
,
coursePlayUrl
:
String
?,
from
:
Int
,
mediaType
:
String
?)
{
// val intent = Intent(activity, CoursePlayActivity::class.java)
val
intent
=
Intent
(
activity
,
AudioPlayActivity
::
class
.
java
)
val
intent
=
if
(
COURSE_AUDIO
.
toString
()
==
mediaType
)
{
Intent
(
activity
,
AudioPlayActivity
::
class
.
java
)
}
else
{
Intent
(
activity
,
CoursePlayActivity
::
class
.
java
)
}
intent
.
putExtra
(
"course_id"
,
courseId
)
intent
.
putExtra
(
"coursePlayUrl"
,
coursePlayUrl
)
intent
.
putExtra
(
"from"
,
from
)
...
...
ydl-media/src/main/java/com/ydl/media/view/PlayerFloatHelper.kt
View file @
91a4261a
...
...
@@ -188,16 +188,28 @@ class PlayerFloatHelper {
}
fun
startCoursePlayActivity
(
context
:
Context
?,
from
:
Int
,
fullScreen
:
Int
=
0
,
coursePlayUrl
:
String
?
=
""
,
isFromFloatView
:
Boolean
=
false
)
{
ARouter
.
getInstance
()
.
build
(
"/course/play"
)
.
withInt
(
"course_id"
,
playTempData
[
"course_id"
]
?.
toInt
()
?:
0
)
.
withInt
(
"course_type"
,
0
)
.
withString
(
"coursePlayUrl"
,
coursePlayUrl
)
.
withInt
(
"from"
,
from
)
.
withBoolean
(
"isFromFloatView"
,
isFromFloatView
)
.
withInt
(
"fullScreen"
,
fullScreen
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
navigation
()
val
courseId
=
playTempData
[
"course_id"
]
?.
toInt
()
?:
0
if
(
"1"
==
playTempData
[
"media_type"
])
{
// 音频
ARouter
.
getInstance
()
.
build
(
"/course/audioPlay"
)
.
withInt
(
"course_id"
,
courseId
)
.
withString
(
"coursePlayUrl"
,
coursePlayUrl
)
.
withInt
(
"from"
,
from
)
.
withBoolean
(
"isFromFloatView"
,
isFromFloatView
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
navigation
()
}
else
{
ARouter
.
getInstance
()
.
build
(
"/course/play"
)
.
withInt
(
"course_id"
,
courseId
)
.
withInt
(
"course_type"
,
0
)
.
withString
(
"coursePlayUrl"
,
coursePlayUrl
)
.
withInt
(
"from"
,
from
)
.
withBoolean
(
"isFromFloatView"
,
isFromFloatView
)
.
withInt
(
"fullScreen"
,
fullScreen
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
navigation
()
}
}
fun
startFMPlayActivity
(
context
:
Context
?)
{
...
...
ydl-media/src/main/java/com/ydl/media/view/PlayerFloatView.kt
View file @
91a4261a
This diff is collapsed.
Click to expand it.
ydl-media/src/main/res/layout/item_playing_float_btn.xml
View file @
91a4261a
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"56dp"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
android:background=
"@drawable/play_float_background"
>
<
LinearLayout
android:id=
"@+id/
ll_audio_layout
"
android:layout_width=
"
match_parent
"
android:layout_height=
"5
6
dp"
android:
layout_marginLeft
=
"15dp"
android:
layout_marginRight=
"15dp
"
a
ndroid:background=
"@drawable/play_float_background
"
a
ndroid:gravity=
"center_vertical
"
a
ndroid:orientation=
"horizontal"
>
<
ImageView
android:id=
"@+id/
play_close
"
android:layout_width=
"
50dp
"
android:layout_height=
"5
0
dp"
android:
padding
=
"15dp"
android:
src=
"@drawable/ico_play_float_pause
"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
a
pp:layout_constraintStart_toStartOf=
"parent
"
a
pp:layout_constraintTop_toTopOf=
"parent"
/
>
<ImageView
android:id=
"@+id/play_close"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_gravity=
"center"
android:layout_marginEnd=
"10dp"
android:padding=
"15dp"
android:src=
"@drawable/ico_play_float_pause"
android:visibility=
"visible"
/>
<ImageView
android:id=
"@+id/play_head"
android:layout_width=
"36dp"
android:layout_height=
"36dp"
android:layout_marginStart=
"12dp"
android:layout_marginEnd=
"12dp"
android:src=
"@drawable/ico_play_float_pic"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tv_title"
app:layout_constraintStart_toEndOf=
"@id/play_close"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/play_head"
android:layout_width=
"36dp"
android:layout_height=
"36dp"
android:layout_marginLeft=
"12.5dp"
android:src=
"@drawable/ico_play_float_pic"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"#FFFFFF"
android:textSize=
"14sp"
app:layout_constraintBottom_toTopOf=
"@id/tv_name"
app:layout_constraintEnd_toStartOf=
"@id/play_state"
app:layout_constraintStart_toEndOf=
"@id/play_head"
tools:text=
"丁sir说抑郁丁sir说抑郁:像心理学"
/>
<RelativeLayout
android:id=
"@+id/rl_info"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/platform_dp_18"
android:layout_marginRight=
"@dimen/platform_dp_18"
android:layout_weight=
"1"
>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"#BFBFBF"
android:textSize=
"10sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"@id/tv_title"
app:layout_constraintStart_toStartOf=
"@id/tv_title"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"丁sir"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"#FFFFFF"
android:textSize=
"14sp"
tools:text=
"丁sir说抑郁丁sir说抑郁:像心理学"
/>
<TextView
android:id=
"@+id/tv_now_playing_time"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
app:layout_constraintEnd_toEndOf=
"@id/tv_title"
app:layout_constraintStart_toStartOf=
"@id/tv_title"
android:ellipsize=
"end"
android:maxLines=
"1"
app:layout_constraintTop_toBottomOf=
"@id/tv_name"
android:textColor=
"#BFBFBF"
android:textSize=
"10sp"
tools:text=
"00:06"
/>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_title"
android:maxLines=
"1"
android:ellipsize=
"end"
android:textColor=
"#BFBFBF"
android:textSize=
"10sp"
tools:text=
"丁sir"
/>
<ImageView
android:id=
"@+id/play_state"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/ico_yyfc_play"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@id/tv_title"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_now_playing_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_name"
android:textColor=
"#BFBFBF"
android:textSize=
"10sp"
tools:text=
"00:06"
/>
<TextView
android:id=
"@+id/tv_line_two"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignBaseline=
"@id/tv_now_playing_time"
android:layout_toRightOf=
"@+id/tv_now_playing_time"
android:text=
" / "
android:textColor=
"#BFBFBF"
android:textSize=
"10sp"
/>
<TextView
android:layout_alignBaseline=
"@id/tv_now_playing_time"
android:id=
"@+id/tv_duration"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_title"
android:layout_toRightOf=
"@+id/tv_line_two"
android:textColor=
"#BFBFBF"
android:textSize=
"10sp"
tools:text=
"30:28"
/>
</RelativeLayout>
<ImageView
android:id=
"@+id/play_state"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"15dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/ico_yyfc_play"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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