fix: 修复视频播放调整音量时偶现闪退

This commit is contained in:
HuanCheng65 2023-03-10 14:39:07 +08:00
parent 6b6f61c2ff
commit a311f75327
No known key found for this signature in database
GPG Key ID: E9031EF91A805148
1 changed files with 14 additions and 9 deletions

View File

@ -3,6 +3,7 @@ package com.huanchengfly.tieba.post.ui.widgets;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.media.AudioManager;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;
@ -130,17 +131,21 @@ public class VideoPlayerStandard extends JzvdStd {
.setOnCancelListener(DialogInterface::dismiss).create().show();
}
@Override
protected void touchActionMove(float x, float y) {
if (mAudioManager == null)
mAudioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
super.touchActionMove(x, y);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.download_btn:
if (v.getId() == R.id.download_btn) {
String url = (String) jzDataSource.getCurrentUrl();
FileUtil.downloadBySystem(getContext(), FileUtil.FILE_TYPE_VIDEO, url);
Toast.makeText(getContext(), R.string.toast_start_download, Toast.LENGTH_SHORT).show();
break;
default:
} else {
super.onClick(v);
break;
}
}
}