Commit 76274a58 by 严久程

课程、支付

parent 1d422b3c
......@@ -141,6 +141,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
PlayerFloatHelper.playingType = PlayTypeEnum.PLAY_TYPE_COURSE
music.path = url
PlayerFloatHelper.show(mFragment!!.activity)
AudioPlayer.get().singlePlay(music)
}
if (demoType == 2) {
......
......@@ -54,7 +54,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
private var listeners: CopyOnWriteArraySet<FloatViewPlayListener> = CopyOnWriteArraySet()
private var mStateChangeListener: OnPlayerEventListener? = null
private var playData:HashMap<String,String> = hashMapOf<String,String>()
private var playData: HashMap<String, String> = hashMapOf<String, String>()
init {
init(context)
......@@ -72,7 +72,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
@SuppressLint("ClickableViewAccessibility")
private fun init(context: Context) {
wm = getContext().getSystemService(Context.WINDOW_SERVICE) as WindowManager
mTouchSlop = ViewConfiguration.get(getContext()).scaledTouchSlop + 8
mTouchSlop = (ViewConfiguration.get(getContext()).scaledTouchSlop + 8) * 3
val view = View.inflate(context, R.layout.item_playing_float_btn, this)
mAudioLayout = view.findViewById(R.id.ll_audio_layout)
mInfoLayout = view.findViewById(R.id.rl_info)
......@@ -88,10 +88,10 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
if (!TextUtils.isEmpty(AudioPlayer.get().playMusic?.coverPath)) {
GlideApp.with(context.applicationContext)
.load(AudioPlayer.get().playMusic?.coverPath)
.transform(GlideRoundTransform(context, 4))
.error(R.drawable.ico_play_float_pic)
.into(playHead!!)
.load(AudioPlayer.get().playMusic?.coverPath)
.transform(GlideRoundTransform(context, 4))
.error(R.drawable.ico_play_float_pic)
.into(playHead!!)
}
myHandler = MyHandler()
......@@ -113,11 +113,12 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent.ACTION_UP -> {
if (Math.abs(event.x - mTouchStartX) > mTouchSlop ||
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove) {
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove
) {
updateViewPosition()
} else {
if (!isMove) {
if (PlayerFloatHelper.isCanClick){
if (PlayerFloatHelper.isCanClick) {
PlayerFloatHelper.startPlayingActivity(context)
}
}
......@@ -147,11 +148,12 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent.ACTION_UP -> {
if (Math.abs(event.x - mTouchStartX) > mTouchSlop ||
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove) {
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove
) {
updateViewPosition()
} else {
if (!isMove) {
if (PlayerFloatHelper.isCanClick){
if (PlayerFloatHelper.isCanClick) {
PlayerFloatHelper.startPlayingActivity(context)
}
}
......@@ -181,11 +183,12 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent.ACTION_UP -> {
if (Math.abs(event.x - mTouchStartX) > mTouchSlop ||
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove) {
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove
) {
updateViewPosition()
} else {
if (!isMove) {
if (PlayerFloatHelper.isCanClick){
if (PlayerFloatHelper.isCanClick) {
PlayerFloatHelper.startPlayingActivity(context)
}
}
......@@ -215,10 +218,16 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent.ACTION_UP -> {
if (Math.abs(event.x - mTouchStartX) > mTouchSlop ||
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove) {
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove
) {
updateViewPosition()
} else {
if (!isMove) {
for (listener in listeners) {
//数据重新设置回调
listener.onPauseClick()
}
this@PlayerFloatView.visibility = View.GONE
PlayerFloatHelper.removeView(mContext)
PlayerFloatHelper.playTempData.clear()
......@@ -250,7 +259,8 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
MotionEvent.ACTION_UP -> {
if (Math.abs(event.x - mTouchStartX) > mTouchSlop ||
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove) {
Math.abs(event.y - mTouchStartY) > mTouchSlop || isMove
) {
updateViewPosition()
} else {
if (!isMove) {
......@@ -280,7 +290,7 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
}
if (mStateChangeListener == null) {
mStateChangeListener = object : OnPlayerEventListener{
mStateChangeListener = object : OnPlayerEventListener {
override fun onComplete() {
myHandler?.sendEmptyMessage(UPDATE_VIEW_COMPLETE)
}
......@@ -316,10 +326,10 @@ class PlayerFloatView(var mContext: Context) : FrameLayout(mContext) {
private fun resetAudioView() {
if (!TextUtils.isEmpty(AudioPlayer.get().playMusic?.coverPath)) {
GlideApp.with(context.applicationContext)
.load(AudioPlayer.get().playMusic?.coverPath)
.transform(GlideRoundTransform(context, 4))
.error(R.drawable.ico_play_float_pic)
.into(playHead!!)
.load(AudioPlayer.get().playMusic?.coverPath)
.transform(GlideRoundTransform(context, 4))
.error(R.drawable.ico_play_float_pic)
.into(playHead!!)
}
if (TextUtils.isEmpty(AudioPlayer.get().playMusic?.title)) {
......
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