Commit a8390d2b by 霍志良

Merge remote-tracking branch 'origin/适配64位CPU' into APP埋点

# Conflicts:
#	config.gradle
parents 40ff720c e18b0ace
...@@ -37,7 +37,7 @@ android { ...@@ -37,7 +37,7 @@ android {
multiDexEnabled true multiDexEnabled true
ndk { ndk {
abiFilters "armeabi-v7a" // 指定要ndk需要兼容的架构(这样其他依赖包里mips,x86,armeabi,arm-v8之类的so会被过滤掉) abiFilters "arm64-v8a" // 指定要ndk需要兼容的架构(这样其他依赖包里mips,x86,armeabi,arm-v8之类的so会被过滤掉)
} }
} }
......
...@@ -78,7 +78,12 @@ class DemoAppLifecycles : IAppLifecycles { ...@@ -78,7 +78,12 @@ class DemoAppLifecycles : IAppLifecycles {
// flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin); // flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin);
val intent = Intent(application, PlayService::class.java) val intent = Intent(application, PlayService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
application.startForegroundService(intent)
}else{
application.startService(intent) application.startService(intent)
}
// application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle()); // application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
Stetho.initializeWithDefaults(application) Stetho.initializeWithDefaults(application)
......
...@@ -21,9 +21,9 @@ import java.util.List; ...@@ -21,9 +21,9 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
public static String appEnv = YDLConstants.ENV_TEST; // public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库 // public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
// public static String appEnv = YDLConstants.ENV_PROD; public static String appEnv = YDLConstants.ENV_PROD;
@Override @Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) { public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
lifecycles.add(new DemoAppLifecycles()); lifecycles.add(new DemoAppLifecycles());
......
...@@ -215,12 +215,11 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -215,12 +215,11 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
tvArtist.setText(music.getArtist()); tvArtist.setText(music.getArtist());
sbProgress.setProgress((int) AudioPlayer.Companion.get().getAudioPosition()); sbProgress.setProgress((int) AudioPlayer.Companion.get().getAudioPosition());
sbProgress.setSecondaryProgress(0); sbProgress.setSecondaryProgress(0);
sbProgress.setMax((int) AudioPlayer.Companion.get().getDuration()); // sbProgress.setMax((int) AudioPlayer.Companion.get().getDuration());
mLastProgress = 0; mLastProgress = 0;
tvCurrentTime.setText(R.string.play_time_start); tvCurrentTime.setText(R.string.play_time_start);
tvTotalTime.setText(formatTime(AudioPlayer.Companion.get().getDuration())); // tvTotalTime.setText(formatTime(AudioPlayer.Companion.get().getDuration()));
setCoverAndBg(music); setCoverAndBg(music);
if (AudioPlayer.Companion.get().isPlaying() || AudioPlayer.Companion.get().isPreparing()) { if (AudioPlayer.Companion.get().isPlaying() || AudioPlayer.Companion.get().isPreparing()) {
ivPlay.setSelected(true); ivPlay.setSelected(true);
......
...@@ -14,9 +14,9 @@ ext { ...@@ -14,9 +14,9 @@ ext {
"m-dynamic" : "0.0.7.34", "m-dynamic" : "0.0.7.34",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
"m-muse" : "0.0.28.24", "m-muse" : "0.0.28.27",
"m-tests" : "0.0.24.15", "m-tests" : "0.0.24.15",
"m-course" : "0.0.42.65", "m-course" : "0.0.43.32",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
...@@ -33,14 +33,14 @@ ext { ...@@ -33,14 +33,14 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.40.48", "ydl-platform" : "0.0.40.50",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.47", "ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.10", "ydl-media" : "0.0.21.37",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.41", "m-audioim" : "0.0.49.29.41",
"ydl-flutter-base": "0.0.14.29", "ydl-flutter-base": "0.0.14.32",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
...@@ -88,18 +88,18 @@ ext { ...@@ -88,18 +88,18 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.13", "m-confide" : "0.0.49.17",
"m-consultant" : "0.0.60.01", "m-consultant" : "0.0.59.93",
"m-fm" : "0.0.30.04", "m-fm" : "0.0.30.07",
"m-user" : "0.0.61.81", "m-user" : "0.0.61.71",
"m-home" : "0.0.22.82", "m-home" : "0.0.22.74",
"m-im" : "0.0.20.06", "m-im" : "0.0.19.80",
"m-dynamic" : "0.0.7.34", "m-dynamic" : "0.0.7.29",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
"m-muse" : "0.0.28.24", "m-muse" : "0.0.28.27",
"m-tests" : "0.0.24.15", "m-tests" : "0.0.24.15",
"m-course" : "0.0.42.65", "m-course" : "0.0.43.32",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.11", "m-confide-api" : "0.0.2.11",
...@@ -115,14 +115,14 @@ ext { ...@@ -115,14 +115,14 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.40.48", "ydl-platform" : "0.0.40.50",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.47", "ydl-webview" : "0.0.38.47",
"ydl-media" : "0.0.21.10", "ydl-media" : "0.0.21.37",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.41", "m-audioim" : "0.0.49.29.41",
"ydl-flutter-base": "0.0.14.29", "ydl-flutter-base": "0.0.14.32",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
...@@ -220,7 +220,7 @@ ext { ...@@ -220,7 +220,7 @@ ext {
"systembartint" : "com.readystatesoftware.systembartint:systembartint:1.0.3", "systembartint" : "com.readystatesoftware.systembartint:systembartint:1.0.3",
"cube" : "in.srain.cube:cube-sdk:1.0.44@aar", "cube" : "in.srain.cube:cube-sdk:1.0.44@aar",
"support-multidex" : 'androidx.multidex:multidex:2.0.0', "support-multidex" : 'androidx.multidex:multidex:2.0.0',
"ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.5", "ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.29",
"robust" : "com.meituan.robust:robust:0.4.87", "robust" : "com.meituan.robust:robust:0.4.87",
"walle" : "com.meituan.android.walle:library:1.1.5", "walle" : "com.meituan.android.walle:library:1.1.5",
"jpush" : "cn.jiguang.sdk:jpush:3.3.6", "jpush" : "cn.jiguang.sdk:jpush:3.3.6",
...@@ -261,7 +261,7 @@ ext { ...@@ -261,7 +261,7 @@ ext {
"free_reflection" : "me.weishu:free_reflection:2.0.0", "free_reflection" : "me.weishu:free_reflection:2.0.0",
"imagepicker" : "com.ydl:imagepicker:1.0.8.2", "imagepicker" : "com.ydl:imagepicker:1.0.8.2",
"pictureselector" : "com.ydl:pictureselector:1.2.0", "pictureselector" : "com.ydl:pictureselector:1.2.0",
"protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar", "protector" : "com.ydl:protector:1.0.11@aar",
"blankUtil" : "com.blankj:utilcode:1.25.9", "blankUtil" : "com.blankj:utilcode:1.25.9",
"ydl-hnet" : "com.ydl:h-net:0.0.8", "ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar", "ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
...@@ -271,7 +271,7 @@ ext { ...@@ -271,7 +271,7 @@ ext {
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块 //flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块 "ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.33@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 // "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号 //基础组件 <<--- 先发这个,发完改这里的版本号
......
...@@ -66,6 +66,7 @@ dependencies { ...@@ -66,6 +66,7 @@ dependencies {
api 'com.github.princekin-f:EasyFloat:1.3.2' api 'com.github.princekin-f:EasyFloat:1.3.2'
api rootProject.ext.dependencies["ydl-user-router"] api rootProject.ext.dependencies["ydl-user-router"]
api rootProject.ext.dependencies["butterknife"] api rootProject.ext.dependencies["butterknife"]
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
//开发时使用 //开发时使用
implementation modularPublication('com.ydl:m-consultant-api') implementation modularPublication('com.ydl:m-consultant-api')
......
...@@ -9,7 +9,8 @@ com.netease.nimlib.avchat, ...@@ -9,7 +9,8 @@ com.netease.nimlib.avchat,
com.netease.nimlib.nrtc, com.netease.nimlib.nrtc,
com.netease.nimlib.chatroom, com.netease.nimlib.chatroom,
com.netease.nimlib.lucene, com.netease.nimlib.lucene,
com.netease.nimlib.push com.netease.nimlib.push,
tv.danmaku.ijk.media.player_arm64
"/> "/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
......
...@@ -101,11 +101,7 @@ public class MyCourseActivity extends BaseActivity { ...@@ -101,11 +101,7 @@ public class MyCourseActivity extends BaseActivity {
Class<?> tabLayout = tabs.getClass(); Class<?> tabLayout = tabs.getClass();
Field tabStrip = null; Field tabStrip = null;
try { try {
tabStrip = tabLayout.getDeclaredField("mTabStrip"); tabStrip = tabLayout.getClass().getDeclaredField("mTabStrip");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
tabStrip.setAccessible(true); tabStrip.setAccessible(true);
LinearLayout llTab = null; LinearLayout llTab = null;
try { try {
...@@ -126,6 +122,11 @@ public class MyCourseActivity extends BaseActivity { ...@@ -126,6 +122,11 @@ public class MyCourseActivity extends BaseActivity {
child.setLayoutParams(params); child.setLayoutParams(params);
child.invalidate(); child.invalidate();
} }
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
} }
static class MyCourseFragmentAdapter extends FragmentPagerAdapter { static class MyCourseFragmentAdapter extends FragmentPagerAdapter {
......
...@@ -154,7 +154,7 @@ class CoursePlayActivity : BaseActivity() { ...@@ -154,7 +154,7 @@ class CoursePlayActivity : BaseActivity() {
recy_list?.layoutManager = recy_list?.layoutManager =
LinearLayoutManager( LinearLayoutManager(
this, this,
OrientationHelper.VERTICAL, LinearLayoutManager.VERTICAL,
false false
) )
adapter = adapter =
...@@ -284,6 +284,7 @@ class CoursePlayActivity : BaseActivity() { ...@@ -284,6 +284,7 @@ class CoursePlayActivity : BaseActivity() {
} }
override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
var new_course_id = 0 var new_course_id = 0
if (intent != null) { if (intent != null) {
new_course_id = intent.getIntExtra("course_id", 0) new_course_id = intent.getIntExtra("course_id", 0)
...@@ -547,11 +548,10 @@ class CoursePlayActivity : BaseActivity() { ...@@ -547,11 +548,10 @@ class CoursePlayActivity : BaseActivity() {
play_type = 1 play_type = 1
frame_video_play.visibility = View.VISIBLE frame_video_play.visibility = View.VISIBLE
frame_audio_play.visibility = View.GONE frame_audio_play.visibility = View.GONE
(playVideoView as CoursePlayItemViewVideo)?.play(index)
if (AudioPlayer.get().isPlaying) { if (AudioPlayer.get().isPlaying) {
AudioPlayer.get().playPause() AudioPlayer.get().playPause()
} }
(playVideoView as CoursePlayItemViewVideo)?.play(index)
} }
this.index = index this.index = index
......
...@@ -6,6 +6,7 @@ import android.os.Handler ...@@ -6,6 +6,7 @@ import android.os.Handler
import android.os.PowerManager import android.os.PowerManager
import android.view.View import android.view.View
import android.widget.RelativeLayout import android.widget.RelativeLayout
import com.dou361.ijkplayer.widget.IjkVideoView
import com.dou361.ijkplayer.widget.PlayStateParams import com.dou361.ijkplayer.widget.PlayStateParams
import com.dou361.ijkplayer.widget.PlayerView import com.dou361.ijkplayer.widget.PlayerView
import com.ydl.media.audio.utils.PlayProgressUtil import com.ydl.media.audio.utils.PlayProgressUtil
...@@ -17,7 +18,9 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog ...@@ -17,7 +18,9 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.course.R import com.yidianling.course.R
import com.yidianling.course.bean.CourseExtraBean import com.yidianling.course.bean.CourseExtraBean
import com.yidianling.course.bean.CourseMediaBean import com.yidianling.course.bean.CourseMediaBean
import tv.danmaku.ijk.media.player.AndroidMediaPlayer
import tv.danmaku.ijk.media.player.IMediaPlayer import tv.danmaku.ijk.media.player.IMediaPlayer
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
...@@ -31,7 +34,6 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface { ...@@ -31,7 +34,6 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
private var playList: ArrayList<CourseMediaBean> = ArrayList() private var playList: ArrayList<CourseMediaBean> = ArrayList()
private var courseExtra: CourseExtraBean? = null private var courseExtra: CourseExtraBean? = null
var activity: CoursePlayActivity? = null var activity: CoursePlayActivity? = null
var videoUrl: String? = null var videoUrl: String? = null
//播放模式 //播放模式
...@@ -163,11 +165,12 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface { ...@@ -163,11 +165,12 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
// url = url.replace("https", "http") // url = url.replace("https", "http")
videoUrl = url videoUrl = url
var hisTime = PlayProgressUtil.getProgress(context, url) var hisTime = PlayProgressUtil.getProgress(context, url)
try { try {
activity?.videoView = PlayerView(activity) /* activity?.videoView = PlayerView(activity)
.setScaleType(PlayStateParams.fitparent) .setScaleType(PlayStateParams.fitparent)
.hideMenu(true) .hideMenu(true)
.hideRotation(true) .hideRotation(true)
...@@ -178,6 +181,7 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface { ...@@ -178,6 +181,7 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
.forbidTouch(false) .forbidTouch(false)
.setOnInfoListener(object : IMediaPlayer.OnInfoListener { .setOnInfoListener(object : IMediaPlayer.OnInfoListener {
override fun onInfo(mp: IMediaPlayer, what: Int, extra: Int): Boolean { override fun onInfo(mp: IMediaPlayer, what: Int, extra: Int): Boolean {
LogUtil.e("课程播放--状态-$what") LogUtil.e("课程播放--状态-$what")
if (what == PlayStateParams.MEDIA_INFO_VIDEO_INTERRUPT) { if (what == PlayStateParams.MEDIA_INFO_VIDEO_INTERRUPT) {
activity?.videoView?.startPlay() activity?.videoView?.startPlay()
...@@ -242,37 +246,18 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface { ...@@ -242,37 +246,18 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
.into(ivThumbnail) .into(ivThumbnail)
} }
} }
.setPlaySource(url) .setPlaySource(url)
.startPlay()
.seekTo(hisTime) .seekTo(hisTime)
// try { activity?.videoView?.setPlaySource(url)
// var videoViewField = activity?.videoView?.startPlay()
// activity?.videoView.run { javaClass.getDeclaredField("videoView") }
// videoViewField.isAccessible = true
//
// var ijkVideoView = videoViewField.get(activity?.videoView) as IjkVideoView
// var mMediaPlayerField = ijkVideoView.javaClass.getDeclaredField("mMediaPlayer")
//
// var mMediaPlayerObject = mMediaPlayerField.get(ijkVideoView)
// if (mMediaPlayerObject is IjkMediaPlayer) {
// mMediaPlayerObject.setOption(
// IjkMediaPlayer.OPT_CATEGORY_FORMAT,
// "dns_cache_clear",
// 1
// )
// }
// } catch (e: java.lang.Exception) {
//
// }
//
// activity?.videoView?.startPlay()?.seekTo(hisTime)
val layout = activity?.window?.attributes val layout = activity?.window?.attributes
layout?.screenBrightness = -1f layout?.screenBrightness = -1f
activity?.window?.attributes = layout activity?.window?.attributes = layout*/
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
LogUtil.e("aaaaaaaaa:"+e.message)
} }
} }
} }
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:background="@null" android:background="@null"
android:gravity="start" android:gravity="start"
android:hint="评价返28元课程兑换券" android:hint="评价"
android:maxLength="500" android:maxLength="500"
android:paddingBottom="45dp" android:paddingBottom="45dp"
android:textColor="@color/course_color_242424" android:textColor="@color/course_color_242424"
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
android:drawableLeft="@drawable/course_ico_comment_write" android:drawableLeft="@drawable/course_ico_comment_write"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:hint="评价返28元课程兑换券" android:hint="评价"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:textColor="@color/white" android:textColor="@color/white"
android:textColorHint="#999999" android:textColorHint="#999999"
......
...@@ -6,19 +6,19 @@ ...@@ -6,19 +6,19 @@
android:background="@color/white" android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/course_layout_title_bar"/> <include layout="@layout/course_layout_title_bar" />
<com.yidianling.course.widget.CourseRedPacketView <com.yidianling.course.widget.CourseRedPacketView
android:id="@+id/courseRedPacketView" android:id="@+id/courseRedPacketView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone" />
<com.yidianling.course.widget.SearchBarView <com.yidianling.course.widget.SearchBarView
android:id="@+id/search_bar" android:id="@+id/search_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content" />
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/my_courses_tabs" android:id="@+id/my_courses_tabs"
...@@ -27,14 +27,15 @@ ...@@ -27,14 +27,15 @@
android:background="@color/white" android:background="@color/white"
app:tabGravity="fill" app:tabGravity="fill"
app:tabIndicatorColor="@color/platform_main_theme" app:tabIndicatorColor="@color/platform_main_theme"
app:tabIndicatorFullWidth="false"
app:tabMode="fixed" app:tabMode="fixed"
app:tabSelectedTextColor="@color/platform_main_theme" app:tabSelectedTextColor="@color/platform_main_theme"
app:tabTextColor="#333"/> app:tabTextColor="#333" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/my_course_vp" android:id="@+id/my_course_vp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -128,6 +128,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -128,6 +128,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override @Override
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (null == intent) { if (null == intent) {
finish(); finish();
return; return;
...@@ -311,7 +312,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -311,7 +312,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration())); // allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration()));
int current = seekBar.getProgress() * allTime / 1000; int current = seekBar.getProgress() * allTime / 1000;
tv_allTime.setText(formatter.format(allTime)); tv_allTime.setText(formatter.format(allTime));
tv_currentTime.setText(formatter.format(current)); tv_currentTime.setText(formatter.format(current));
...@@ -326,7 +327,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -326,7 +327,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) {
allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration())); // allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration()));
int current = seekBar.getProgress() * allTime / 1000; int current = seekBar.getProgress() * allTime / 1000;
tv_allTime.setText(formatter.format(allTime)); tv_allTime.setText(formatter.format(allTime));
tv_currentTime.setText(formatter.format(current)); tv_currentTime.setText(formatter.format(current));
...@@ -538,12 +539,11 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -538,12 +539,11 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
public void updateThread() { public void updateThread() {
runOnUiThread(() -> { runOnUiThread(() -> {
allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration())); // allTime = Integer.parseInt(String.valueOf(AudioPlayer.Companion.get().getDuration()));
currentTime.setTime(time - 8 * 60 * 60 * 1000); currentTime.setTime(time - 8 * 60 * 60 * 1000);
int percent = (int) (1000.0 * time / allTime); int percent = (int) (1000.0 * time / allTime);
fm_progress.setProgress(percent); fm_progress.setProgress(percent);
tv_currentTime.setText(formatter.format(currentTime)); tv_currentTime.setText(formatter.format(currentTime));
tv_allTime.setText(formatter.format(allTime));
}); });
} }
...@@ -622,7 +622,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -622,7 +622,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
@Override @Override
public void onPrepared(long duration) { public void onPrepared(long duration) {
this.allTime = Integer.parseInt(String.valueOf(duration)); this.allTime = Integer.parseInt(String.valueOf(duration));
tv_allTime.setText(formatter.format(allTime));
iv_play.setVisibility(View.VISIBLE); iv_play.setVisibility(View.VISIBLE);
refresh_icon.setVisibility(View.GONE); refresh_icon.setVisibility(View.GONE);
anim.cancel(); anim.cancel();
......
...@@ -38,7 +38,7 @@ android { ...@@ -38,7 +38,7 @@ android {
flavorDimensions "versionCode"//Flavor 维度信息 flavorDimensions "versionCode"//Flavor 维度信息
ndk { ndk {
abiFilters "armeabi-v7a" abiFilters "arm64-v8a"
} }
} }
......
...@@ -66,6 +66,7 @@ class MusePlugin : MethodChannel.MethodCallHandler { ...@@ -66,6 +66,7 @@ class MusePlugin : MethodChannel.MethodCallHandler {
} }
// 播放音乐 // 播放音乐
ACTION_PLAY_MUSIC -> { ACTION_PLAY_MUSIC -> {
try {
var musicUrl: String? = methodCall.argument<String>("url") var musicUrl: String? = methodCall.argument<String>("url")
var mContinue: Boolean = methodCall.argument<Boolean>("mContinue")!! var mContinue: Boolean = methodCall.argument<Boolean>("mContinue")!!
...@@ -82,6 +83,9 @@ class MusePlugin : MethodChannel.MethodCallHandler { ...@@ -82,6 +83,9 @@ class MusePlugin : MethodChannel.MethodCallHandler {
PlayerFloatHelper.playingType = PlayTypeEnum.PLAY_TYPE_MUSE PlayerFloatHelper.playingType = PlayTypeEnum.PLAY_TYPE_MUSE
AudioPlayer.get().singleCirclePlay(music) AudioPlayer.get().singleCirclePlay(music)
} }
}catch (e: Exception){
e.printStackTrace()
}
} }
// 暂停音乐 // 暂停音乐
ACTION_PAUSE_MUSIC -> { ACTION_PAUSE_MUSIC -> {
......
...@@ -52,7 +52,7 @@ abstract class BaseFlutterActivity : FlutterActivity() { ...@@ -52,7 +52,7 @@ abstract class BaseFlutterActivity : FlutterActivity() {
public override fun onCreate( savedInstanceState: Bundle?) { public override fun onCreate( savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this) // GeneratedPluginRegistrant.registerWith(this)
/** /**
* 获取统一路由传递过来的参数并初始化交互通道 * 获取统一路由传递过来的参数并初始化交互通道
......
...@@ -97,7 +97,7 @@ public final class Flutter { ...@@ -97,7 +97,7 @@ public final class Flutter {
arguments.bundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext()); arguments.bundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
arguments.entrypoint = "main"; arguments.entrypoint = "main";
flutterView.runFromBundle(arguments); flutterView.runFromBundle(arguments);
GeneratedPluginRegistrant.registerWith(flutterView.getPluginRegistry()); // GeneratedPluginRegistrant.registerWith(flutterView.getPluginRegistry());
} }
@OnLifecycleEvent(Lifecycle.Event.ON_START) @OnLifecycleEvent(Lifecycle.Event.ON_START)
......
...@@ -39,7 +39,8 @@ dependencies { ...@@ -39,7 +39,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api(rootProject.ext.dependencies["ydl-ijkplayer-jjdxm"]) { api(rootProject.ext.dependencies["" +
"ydl-ijkplayer-jjdxm"]) {
exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'appcompat-v7'
} }
......
package com.ydl.media.audio package com.ydl.media.audio
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.Service import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Binder import android.os.Binder
import android.os.Build
import android.os.IBinder import android.os.IBinder
import android.util.Log import android.util.Log
import androidx.core.app.NotificationCompat
import com.ydl.media.audio.constants.Extras import com.ydl.media.audio.constants.Extras
import com.ydl.media.audio.manager.MediaSessionManager import com.ydl.media.audio.manager.MediaSessionManager
import com.ydl.media.audio.manager.NotifyManager import com.ydl.media.audio.manager.NotifyManager
...@@ -23,6 +27,15 @@ class PlayService : Service() { ...@@ -23,6 +27,15 @@ class PlayService : Service() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
var nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager;
//数字是随便写的“40”,
nm.createNotificationChannel( NotificationChannel("40", "App Service", NotificationManager.IMPORTANCE_DEFAULT));
var builder = NotificationCompat.Builder(this, "40");
//其中的2,是也随便写的,正式项目也是随便写
startForeground(2 ,builder.build());
}
Log.i(TAG, "onCreate: " + javaClass.simpleName) Log.i(TAG, "onCreate: " + javaClass.simpleName)
AudioPlayer.get().init(this) AudioPlayer.get().init(this)
MediaSessionManager.get().init(this) MediaSessionManager.get().init(this)
......
...@@ -23,7 +23,7 @@ android { ...@@ -23,7 +23,7 @@ android {
flavorDimensions "versionCode" flavorDimensions "versionCode"
ndk { ndk {
abiFilters "armeabi-v7a" abiFilters "arm64-v8a"
} }
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
......
...@@ -26,7 +26,7 @@ android { ...@@ -26,7 +26,7 @@ android {
} }
ndk { ndk {
abiFilters "armeabi" abiFilters "arm64-v8a"
} }
} }
......
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