Commit a8b2a28e by konghaorui

新增电台播放页面 PlayerFloatView 点击监听

parent 4b2e2b1a
...@@ -26,6 +26,7 @@ import com.ydl.media.audio.AudioPlayer; ...@@ -26,6 +26,7 @@ import com.ydl.media.audio.AudioPlayer;
import com.ydl.media.audio.OnPlayerEventListener; import com.ydl.media.audio.OnPlayerEventListener;
import com.ydl.media.audio.model.Music; import com.ydl.media.audio.model.Music;
import com.ydl.media.view.PlayerFloatHelper; import com.ydl.media.view.PlayerFloatHelper;
import com.ydl.media.view.PlayerFloatView;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydl_image.transform.GlideCircleRingTransform; import com.ydl.ydl_image.transform.GlideCircleRingTransform;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
...@@ -222,11 +223,27 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen ...@@ -222,11 +223,27 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
iv_next.setOnClickListener(this); iv_next.setOnClickListener(this);
iv_last.setOnClickListener(this); iv_last.setOnClickListener(this);
iv_share.setOnClickListener(this); iv_share.setOnClickListener(this);
initRefreshAnimate(); initRefreshAnimate();
init(); init();
initSurfaceView(); initSurfaceView();
initImg(); initImg();
PlayerFloatHelper.Companion.addClickListener(new PlayerFloatView.FloatViewPlayListener() {
@Override
public void onPauseClick() {
iv_play.setImageResource(R.drawable.fm_play_2);
fmSurfaceView.stopTimer();
}
@Override
public void onStartClick() {
iv_play.setImageResource(R.drawable.fm_stop_2);
fmSurfaceView.playTimer();
}
@Override
public void onPlayFinish() {
}
});
} }
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
......
...@@ -6,6 +6,7 @@ import android.content.Intent ...@@ -6,6 +6,7 @@ import android.content.Intent
import android.graphics.PixelFormat import android.graphics.PixelFormat
import android.graphics.Point import android.graphics.Point
import android.os.Bundle import android.os.Bundle
import android.support.v4.view.ViewCompat
import android.text.TextUtils import android.text.TextUtils
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
...@@ -141,7 +142,12 @@ class PlayerFloatHelper { ...@@ -141,7 +142,12 @@ class PlayerFloatHelper {
private fun addFloatToWm(context: Context) { private fun addFloatToWm(context: Context) {
if (wm != null && !TextUtils.isEmpty(showingPageName)) { if (wm != null && !TextUtils.isEmpty(showingPageName)) {
wm?.removeViewImmediate(mPlayerFloatView) if (ViewCompat.isAttachedToWindow(mPlayerFloatView)){
// if (context is Activity && !(context.isFinishing)){
// wm?.removeViewImmediate(mPlayerFloatView)
// }
wm?.removeViewImmediate(mPlayerFloatView)
}
wm = null wm = null
} }
//获取WindowManager //获取WindowManager
......
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