Commit ba88c84f by 霍志良

feat:升级ydl-media、m-course、m-confide、m-home\m-fm\m-muse组件

parent dab3800b
......@@ -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);
......
......@@ -5,18 +5,18 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.13",
"m-confide" : "0.0.49.17",
"m-consultant" : "0.0.59.93",
"m-fm" : "0.0.30.04",
"m-fm" : "0.0.30.06",
"m-user" : "0.0.61.71",
"m-home" : "0.0.22.73",
"m-home" : "0.0.22.74",
"m-im" : "0.0.19.80",
"m-dynamic" : "0.0.7.29",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.24",
"m-muse" : "0.0.28.25",
"m-tests" : "0.0.24.15",
"m-course" : "0.0.42.66",
"m-course" : "0.0.42.68",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
......@@ -37,10 +37,10 @@ ext {
//第二步 若干
"ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.12",
"ydl-media" : "0.0.21.15",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.41",
"ydl-flutter-base": "0.0.14.31",
"ydl-flutter-base": "0.0.14.32",
//以下 几乎不会动
"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.04",
"m-fm" : "0.0.30.06",
"m-user" : "0.0.61.71",
"m-home" : "0.0.22.73",
"m-home" : "0.0.22.74",
"m-im" : "0.0.19.80",
"m-dynamic" : "0.0.7.29",
"m-article" : "0.0.0.8",
"m-muse" : "0.0.28.24",
"m-muse" : "0.0.28.25",
"m-tests" : "0.0.24.15",
"m-course" : "0.0.42.66",
"m-course" : "0.0.42.68",
//-------------- 业务模块 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.12",
"ydl-media" : "0.0.21.15",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.41",
"ydl-flutter-base": "0.0.14.31",
"ydl-flutter-base": "0.0.14.32",
//以下 几乎不会动
"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.37@aar", //flutter aar
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.38@aar", //flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号
......
......@@ -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 {
......
<?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
......@@ -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: IMediaPlayer? = 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 = IjkMediaPlayer()
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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment