fix: 修复视频播放调整音量时偶现闪退
This commit is contained in:
parent
6b6f61c2ff
commit
a311f75327
|
|
@ -3,6 +3,7 @@ package com.huanchengfly.tieba.post.ui.widgets;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.media.AudioManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
|
@ -130,17 +131,21 @@ public class VideoPlayerStandard extends JzvdStd {
|
||||||
.setOnCancelListener(DialogInterface::dismiss).create().show();
|
.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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
if (v.getId() == R.id.download_btn) {
|
||||||
case R.id.download_btn:
|
|
||||||
String url = (String) jzDataSource.getCurrentUrl();
|
String url = (String) jzDataSource.getCurrentUrl();
|
||||||
FileUtil.downloadBySystem(getContext(), FileUtil.FILE_TYPE_VIDEO, url);
|
FileUtil.downloadBySystem(getContext(), FileUtil.FILE_TYPE_VIDEO, url);
|
||||||
Toast.makeText(getContext(), R.string.toast_start_download, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), R.string.toast_start_download, Toast.LENGTH_SHORT).show();
|
||||||
break;
|
} else {
|
||||||
default:
|
|
||||||
super.onClick(v);
|
super.onClick(v);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue