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
ba88c84f
Commit
ba88c84f
authored
Sep 24, 2021
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:升级ydl-media、m-course、m-confide、m-home\m-fm\m-muse组件
parent
dab3800b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
71 deletions
+74
-71
PlayFragment.java
app/src/main/java/com/ydl/component/music/PlayFragment.java
+2
-3
config.gradle
config.gradle
+15
-15
MyCourseActivity.java
m-course/src/main/java/com/yidianling/course/courseNew/mine/MyCourseActivity.java
+21
-20
activity_my_course.xml
m-course/src/main/res/layout/activity_my_course.xml
+28
-26
AudioPlayer.kt
ydl-media/src/main/java/com/ydl/media/audio/AudioPlayer.kt
+8
-7
No files found.
app/src/main/java/com/ydl/component/music/PlayFragment.java
View file @
ba88c84f
...
...
@@ -215,12 +215,11 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
tvArtist
.
setText
(
music
.
getArtist
());
sbProgress
.
setProgress
((
int
)
AudioPlayer
.
Companion
.
get
().
getAudioPosition
());
sbProgress
.
setSecondaryProgress
(
0
);
sbProgress
.
setMax
((
int
)
AudioPlayer
.
Companion
.
get
().
getDuration
());
//
sbProgress.setMax((int) AudioPlayer.Companion.get().getDuration());
mLastProgress
=
0
;
tvCurrentTime
.
setText
(
R
.
string
.
play_time_start
);
tvTotalTime
.
setText
(
formatTime
(
AudioPlayer
.
Companion
.
get
().
getDuration
()));
// tvTotalTime.setText(formatTime(AudioPlayer.Companion.get().getDuration()));
setCoverAndBg
(
music
);
if
(
AudioPlayer
.
Companion
.
get
().
isPlaying
()
||
AudioPlayer
.
Companion
.
get
().
isPreparing
())
{
ivPlay
.
setSelected
(
true
);
...
...
config.gradle
View file @
ba88c84f
...
...
@@ -5,18 +5,18 @@ ext {
ydlPublishVersion
=
[
// -------------- 业务模块 --------------
//第三步 若干
"m-confide"
:
"0.0.49.1
3
"
,
"m-confide"
:
"0.0.49.1
7
"
,
"m-consultant"
:
"0.0.59.93"
,
"m-fm"
:
"0.0.30.0
4
"
,
"m-fm"
:
"0.0.30.0
6
"
,
"m-user"
:
"0.0.61.71"
,
"m-home"
:
"0.0.22.7
3
"
,
"m-home"
:
"0.0.22.7
4
"
,
"m-im"
:
"0.0.19.80"
,
"m-dynamic"
:
"0.0.7.29"
,
"m-article"
:
"0.0.0.10"
,
"m-muse"
:
"0.0.28.2
4
"
,
"m-muse"
:
"0.0.28.2
5
"
,
"m-tests"
:
"0.0.24.15"
,
"m-course"
:
"0.0.42.6
6
"
,
"m-course"
:
"0.0.42.6
8
"
,
//-------------- 业务模块 API 层 --------------
"m-audioim-api"
:
"0.0.6"
,
...
...
@@ -37,10 +37,10 @@ ext {
//第二步 若干
"ydl-webview"
:
"0.0.38.47"
,
"ydl-media"
:
"0.0.21.1
2
"
,
"ydl-media"
:
"0.0.21.1
5
"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.41"
,
"ydl-flutter-base"
:
"0.0.14.3
1
"
,
"ydl-flutter-base"
:
"0.0.14.3
2
"
,
//以下 几乎不会动
"router"
:
"0.0.1"
,
...
...
@@ -90,16 +90,16 @@ ext {
"m-confide"
:
"0.0.49.13"
,
"m-consultant"
:
"0.0.59.93"
,
"m-fm"
:
"0.0.30.0
4
"
,
"m-fm"
:
"0.0.30.0
6
"
,
"m-user"
:
"0.0.61.71"
,
"m-home"
:
"0.0.22.7
3
"
,
"m-home"
:
"0.0.22.7
4
"
,
"m-im"
:
"0.0.19.80"
,
"m-dynamic"
:
"0.0.7.29"
,
"m-article"
:
"0.0.0.8"
,
"m-muse"
:
"0.0.28.2
4
"
,
"m-muse"
:
"0.0.28.2
5
"
,
"m-tests"
:
"0.0.24.15"
,
"m-course"
:
"0.0.42.6
6
"
,
"m-course"
:
"0.0.42.6
8
"
,
//-------------- 业务模块 API 层 --------------
"m-audioim-api"
:
"0.0.6"
,
"m-confide-api"
:
"0.0.2.11"
,
...
...
@@ -119,10 +119,10 @@ ext {
//第二步 若干
"ydl-webview"
:
"0.0.38.47"
,
"ydl-media"
:
"0.0.21.1
2
"
,
"ydl-media"
:
"0.0.21.1
5
"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.41"
,
"ydl-flutter-base"
:
"0.0.14.3
1
"
,
"ydl-flutter-base"
:
"0.0.14.3
2
"
,
//以下 几乎不会动
"router"
:
"0.0.1"
,
...
...
@@ -220,7 +220,7 @@ ext {
"systembartint"
:
"com.readystatesoftware.systembartint:systembartint:1.0.3"
,
"cube"
:
"in.srain.cube:cube-sdk:1.0.44@aar"
,
"support-multidex"
:
'androidx.multidex:multidex:2.0.0'
,
"ydl-ijkplayer-jjdxm"
:
"com.ydl:jjdxm-ijkplayer:0.0.
7
"
,
"ydl-ijkplayer-jjdxm"
:
"com.ydl:jjdxm-ijkplayer:0.0.
9
"
,
"robust"
:
"com.meituan.robust:robust:0.4.87"
,
"walle"
:
"com.meituan.android.walle:library:1.1.5"
,
"jpush"
:
"cn.jiguang.sdk:jpush:3.3.6"
,
...
...
@@ -271,7 +271,7 @@ ext {
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base"
:
"com.ydl:ydl-flutter-base:${ydlCompileVersion["
ydl
-
flutter
-
base
"]}"
,
//组件化项目中的flutter base模块
"ydl-flutter"
:
"com.ydl:ydl-flutter:0.0.3
7
@aar"
,
//flutter aar
"ydl-flutter"
:
"com.ydl:ydl-flutter:0.0.3
8
@aar"
,
//flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号
...
...
m-course/src/main/java/com/yidianling/course/courseNew/mine/MyCourseActivity.java
View file @
ba88c84f
...
...
@@ -101,31 +101,32 @@ public class MyCourseActivity extends BaseActivity {
Class
<?>
tabLayout
=
tabs
.
getClass
();
Field
tabStrip
=
null
;
try
{
tabStrip
=
tabLayout
.
getDeclaredField
(
"mTabStrip"
);
tabStrip
=
tabLayout
.
getClass
().
getDeclaredField
(
"mTabStrip"
);
tabStrip
.
setAccessible
(
true
);
LinearLayout
llTab
=
null
;
try
{
llTab
=
(
LinearLayout
)
tabStrip
.
get
(
tabs
);
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
int
left
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
leftDip
,
Resources
.
getSystem
().
getDisplayMetrics
());
int
right
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
rightDip
,
Resources
.
getSystem
().
getDisplayMetrics
());
for
(
int
i
=
0
;
i
<
llTab
.
getChildCount
();
i
++)
{
View
child
=
llTab
.
getChildAt
(
i
);
child
.
setPadding
(
0
,
0
,
0
,
0
);
LinearLayout
.
LayoutParams
params
=
new
LinearLayout
.
LayoutParams
(
0
,
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
1
);
params
.
leftMargin
=
DisplayUtils
.
dip2px
(
this
,
left
);
params
.
rightMargin
=
DisplayUtils
.
dip2px
(
this
,
right
);
child
.
setLayoutParams
(
params
);
child
.
invalidate
();
}
}
catch
(
NoSuchFieldException
e
)
{
e
.
printStackTrace
();
}
tabStrip
.
setAccessible
(
true
);
LinearLayout
llTab
=
null
;
try
{
llTab
=
(
LinearLayout
)
tabStrip
.
get
(
tabs
);
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
int
left
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
leftDip
,
Resources
.
getSystem
().
getDisplayMetrics
());
int
right
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
rightDip
,
Resources
.
getSystem
().
getDisplayMetrics
());
for
(
int
i
=
0
;
i
<
llTab
.
getChildCount
();
i
++)
{
View
child
=
llTab
.
getChildAt
(
i
);
child
.
setPadding
(
0
,
0
,
0
,
0
);
LinearLayout
.
LayoutParams
params
=
new
LinearLayout
.
LayoutParams
(
0
,
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
1
);
params
.
leftMargin
=
DisplayUtils
.
dip2px
(
this
,
left
);
params
.
rightMargin
=
DisplayUtils
.
dip2px
(
this
,
right
);
child
.
setLayoutParams
(
params
);
child
.
invalidate
();
}
}
static
class
MyCourseFragmentAdapter
extends
FragmentPagerAdapter
{
...
...
m-course/src/main/res/layout/activity_my_course.xml
View file @
ba88c84f
<?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=
"match_parent"
android:background=
"@color/white"
android:orientation=
"vertical"
>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:orientation=
"vertical"
>
<include
layout=
"@layout/course_layout_title_bar"
/>
<include
layout=
"@layout/course_layout_title_bar"
/>
<com.yidianling.course.widget.CourseRedPacketView
android:id=
"@+id/courseRedPacketView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
/>
android:id=
"@+id/courseRedPacketView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
/>
<com.yidianling.course.widget.SearchBarView
android:id=
"@+id/search_bar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:id=
"@+id/search_bar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<com.google.android.material.tabs.TabLayout
android:id=
"@+id/my_courses_tabs"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:background=
"@color/white"
app:tabGravity=
"fill"
app:tabIndicatorColor=
"@color/platform_main_theme"
app:tabMode=
"fixed"
app:tabSelectedTextColor=
"@color/platform_main_theme"
app:tabTextColor=
"#333"
/>
android:id=
"@+id/my_courses_tabs"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:background=
"@color/white"
app:tabGravity=
"fill"
app:tabIndicatorColor=
"@color/platform_main_theme"
app:tabIndicatorFullWidth=
"false"
app:tabMode=
"fixed"
app:tabSelectedTextColor=
"@color/platform_main_theme"
app:tabTextColor=
"#333"
/>
<androidx.viewpager.widget.ViewPager
android:id=
"@+id/my_course_vp"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
/>
android:id=
"@+id/my_course_vp"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
/>
</LinearLayout>
\ No newline at end of file
ydl-media/src/main/java/com/ydl/media/audio/AudioPlayer.kt
View file @
ba88c84f
...
...
@@ -3,6 +3,7 @@ package com.ydl.media.audio
import
android.content.Context
import
android.content.IntentFilter
import
android.media.AudioManager
import
android.media.MediaPlayer
import
android.os.Handler
import
android.os.Looper
import
com.tencent.bugly.Bugly.applicationContext
...
...
@@ -30,7 +31,7 @@ class AudioPlayer private constructor() {
private
var
context
:
Context
?
=
null
private
var
audioFocusManager
:
AudioFocusManager
?
=
null
var
mediaPlayer
:
I
MediaPlayer
?
=
null
var
mediaPlayer
:
MediaPlayer
?
=
null
private
var
handler
:
Handler
?
=
null
private
var
noisyReceiver
:
NoisyAudioStreamReceiver
?
=
null
private
var
noisyFilter
:
IntentFilter
?
=
null
...
...
@@ -119,7 +120,7 @@ class AudioPlayer private constructor() {
fun
init
(
context
:
Context
)
{
this
.
context
=
context
.
applicationContext
audioFocusManager
=
AudioFocusManager
(
context
)
mediaPlayer
=
Ijk
MediaPlayer
()
mediaPlayer
=
MediaPlayer
()
try
{
(
mediaPlayer
as
IjkMediaPlayer
).
setOption
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
...
...
@@ -146,7 +147,7 @@ class AudioPlayer private constructor() {
}
}
for
(
listener
in
listeners
)
{
listener
.
onPrepared
(
mediaPlayer
!!
.
duration
)
listener
.
onPrepared
(
mediaPlayer
!!
.
duration
.
toLong
()
)
}
}
mediaPlayer
!!
.
setOnBufferingUpdateListener
{
mp
,
percent
->
...
...
@@ -268,7 +269,7 @@ class AudioPlayer private constructor() {
try
{
mediaPlayer
!!
.
reset
()
mediaPlayer
!!
.
dataSource
=
music
!!
.
path
mediaPlayer
!!
.
setDataSource
(
music
!!
.
path
)
mediaPlayer
!!
.
prepareAsync
()
state
=
STATE_PREPARING
for
(
listener
in
listeners
)
{
...
...
@@ -434,10 +435,10 @@ class AudioPlayer private constructor() {
currentPosition
=
position
}
else
{
currentPosition
=
percent
*
mediaPlayer
!!
.
duration
/
100
currentPosition
=
(
percent
*
mediaPlayer
!!
.
duration
/
100
).
toLong
()
}
mediaPlayer
!!
.
seekTo
(
currentPosition
)
mediaPlayer
!!
.
seekTo
(
currentPosition
.
toInt
())
//////
MediaSessionManager
.
get
().
updatePlaybackState
()
if
(
autoSaveProgress
)
{
PlayProgressUtil
.
saveProgress
(
...
...
@@ -463,7 +464,7 @@ class AudioPlayer private constructor() {
* 获取音乐时长
*/
fun
getDuration
():
Long
{
return
mediaPlayer
?.
duration
?:
0
return
mediaPlayer
?.
duration
?.
toLong
()
?:
0
}
companion
object
{
...
...
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