...
|
...
|
@@ -685,6 +685,26 @@ public class ZytjActivity extends BaseActivity { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 上传录音前的准备工作
|
|
|
* 录音如果很长不会马上保存完成,需要等一会,用这个定时任务来处理,activity销毁一定要removeCallbacksAndMessages
|
|
|
*/
|
|
|
AudioUtils audioUtils = new AudioUtils(ZytjActivity.this);
|
|
|
Handler uploadhandler = new Handler();
|
|
|
Runnable uploadRunnable = new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
//要做的事情
|
|
|
if (audioUtils.getFilePath() != null) {
|
|
|
DebugLog.e("哈哈");
|
|
|
postFile(audioUtils.getFilePath(), 3, "");
|
|
|
} else {
|
|
|
DebugLog.e("哈哈null");
|
|
|
uploadhandler.postDelayed(this, 1000);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
/*--------------------------------------------录音PopWindow----------------------------------------------------------*/
|
|
|
private Handler handler = new Handler();
|
|
|
CircularProgressBar Circular_bar;
|
...
|
...
|
@@ -738,7 +758,6 @@ public class ZytjActivity extends BaseActivity { |
|
|
setBackgroundAlpha(0.5f);//设置屏幕透明度
|
|
|
popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, M.getNavigationBarHeight(this));
|
|
|
Circular_bar.setVisibility(View.GONE);
|
|
|
AudioUtils audioUtils = new AudioUtils(ZytjActivity.this);
|
|
|
luyi_rl.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
...
|
...
|
@@ -759,7 +778,7 @@ public class ZytjActivity extends BaseActivity { |
|
|
Circular_bar.setVisibility(View.GONE);
|
|
|
audioUtils.EndAudio();
|
|
|
String filePath = audioUtils.getFilePath();
|
|
|
postFile(filePath, 3, "");
|
|
|
uploadhandler.postDelayed(uploadRunnable, 1000);
|
|
|
ly_style.setText("点击录音");
|
|
|
handler.removeCallbacks(runnable);
|
|
|
endTime();
|
...
|
...
|
@@ -906,165 +925,6 @@ public class ZytjActivity extends BaseActivity { |
|
|
}
|
|
|
|
|
|
/*--------------------------------------------查看大图详情----------------------------------------------------------*/
|
|
|
float x1 = 0, x2 = 0; // 滑动坐标轴
|
|
|
int pageSze; // 页数
|
|
|
StandardGSYVideoPlayer player;
|
|
|
GSYVideoOptionBuilder gsyVideoOption;
|
|
|
|
|
|
private boolean isPlay;
|
|
|
|
|
|
private void imgPop(List<JxtImageEntity> imgList, int pageSze1) {
|
|
|
this.pageSze = pageSze1;
|
|
|
View view = LayoutInflater.from(ZytjActivity.this).inflate(R.layout.pop_zpgl_image, null);
|
|
|
ImageView pop_back = view.findViewById(R.id.pop_image_back);
|
|
|
ImageView pop_img = view.findViewById(R.id.pop_zpgl_image_img);
|
|
|
TextView pop_value = view.findViewById(R.id.pop_zpgl_image_value);
|
|
|
player = view.findViewById(R.id.videoplay);
|
|
|
View player_gs = view.findViewById(R.id.player_gs);
|
|
|
|
|
|
player.getBackButton().setVisibility(View.GONE);
|
|
|
gsyVideoOption = new GSYVideoOptionBuilder();
|
|
|
|
|
|
// 初始值
|
|
|
pop_value.setText((pageSze + 1) + "/" + imgList.size());
|
|
|
if (!TextUtils.isEmpty(imgList.get(pageSze1).getMinPath())) {
|
|
|
pop_img.setVisibility(View.GONE);
|
|
|
player.setVisibility(View.VISIBLE);
|
|
|
player_gs.setVisibility(View.VISIBLE);
|
|
|
setplay(gsyVideoOption, imgList.get(pageSze1).getPath());
|
|
|
} else {
|
|
|
M.Glide(imgList.get(pageSze).getPath(), pop_img, activity);
|
|
|
}
|
|
|
|
|
|
// 弹窗
|
|
|
final PopupWindow popupWindow = new PopupWindow(view, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
|
|
popupWindow.setOutsideTouchable(true);
|
|
|
popupWindow.setTouchable(true);
|
|
|
popupWindow.setFocusable(true);
|
|
|
popupWindow.setBackgroundDrawable(getResources().getDrawable(R.color.color_tm));
|
|
|
popupWindow.showAsDropDown(view);
|
|
|
|
|
|
// back
|
|
|
pop_back.setOnClickListener(v -> {
|
|
|
if (player.isInPlayingState()) {
|
|
|
player.getCurrentPlayer().release();
|
|
|
}
|
|
|
popupWindow.dismiss();
|
|
|
});
|
|
|
|
|
|
popupWindow.setOnDismissListener(() -> {
|
|
|
if (popupWindow.isShowing() == false) {
|
|
|
if (player != null && player.isInPlayingState()) {
|
|
|
player.getCurrentPlayer().onVideoPause();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
|
|
Display defaultDisplay = windowManager.getDefaultDisplay();
|
|
|
int width = defaultDisplay.getWidth();
|
|
|
|
|
|
M.log("pageSze", pageSze + "");
|
|
|
view.setOnTouchListener(new View.OnTouchListener() {
|
|
|
@Override
|
|
|
public boolean onTouch(View v, MotionEvent event) {
|
|
|
|
|
|
switch (event.getAction()) {
|
|
|
case MotionEvent.ACTION_DOWN: // down
|
|
|
x1 = event.getX();
|
|
|
break;
|
|
|
case MotionEvent.ACTION_UP:
|
|
|
x2 = event.getX();
|
|
|
if ((x2 - x1) > (width / 3)) {
|
|
|
if ((pageSze - 1) >= 0) {
|
|
|
pageSze--;
|
|
|
if (!TextUtils.isEmpty(imgList.get(pageSze).getMinPath())) {
|
|
|
pop_img.setVisibility(View.GONE);
|
|
|
pop_img.setVisibility(View.GONE);
|
|
|
player.setVisibility(View.VISIBLE);
|
|
|
player_gs.setVisibility(View.VISIBLE);
|
|
|
if (gsyVideoOption == null) {
|
|
|
gsyVideoOption = new GSYVideoOptionBuilder();
|
|
|
}
|
|
|
setplay(gsyVideoOption, imgList.get(pageSze).getPath());
|
|
|
pop_value.setText((pageSze + 1) + "/" + imgList.size());
|
|
|
} else {
|
|
|
pop_img.setVisibility(View.VISIBLE);
|
|
|
player.setVisibility(View.GONE);
|
|
|
player_gs.setVisibility(View.GONE);
|
|
|
M.Glide(imgList.get(pageSze).getPath(), pop_img, activity);
|
|
|
pop_value.setText((pageSze + 1) + "/" + imgList.size());
|
|
|
}
|
|
|
|
|
|
M.log("video", imgList.get(pageSze));
|
|
|
} else {
|
|
|
M.toast(activity, "已是第一页");
|
|
|
}
|
|
|
} else if ((x1 - x2) > (width / 3)) {
|
|
|
if ((pageSze + 1) < imgList.size()) {
|
|
|
pageSze++;
|
|
|
if (!TextUtils.isEmpty(imgList.get(pageSze).getMinPath())) {
|
|
|
pop_img.setVisibility(View.GONE);
|
|
|
pop_img.setVisibility(View.GONE);
|
|
|
player.setVisibility(View.VISIBLE);
|
|
|
player_gs.setVisibility(View.VISIBLE);
|
|
|
if (gsyVideoOption == null) {
|
|
|
gsyVideoOption = new GSYVideoOptionBuilder();
|
|
|
}
|
|
|
setplay(gsyVideoOption, imgList.get(pageSze).getPath());
|
|
|
pop_value.setText((pageSze + 1) + "/" + imgList.size());
|
|
|
} else {
|
|
|
pop_img.setVisibility(View.VISIBLE);
|
|
|
player.setVisibility(View.GONE);
|
|
|
player_gs.setVisibility(View.GONE);
|
|
|
M.Glide(imgList.get(pageSze).getPath(), pop_img, activity);
|
|
|
pop_value.setText((pageSze + 1) + "/" + imgList.size());
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
M.toast(activity, "已是最后一页");
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
private void setplay(GSYVideoOptionBuilder gsyVideoOption, String url) {
|
|
|
gsyVideoOption
|
|
|
.setIsTouchWiget(true)
|
|
|
.setRotateViewAuto(false)
|
|
|
.setLockLand(false)
|
|
|
.setAutoFullWithSize(true)
|
|
|
.setShowFullAnimation(false)
|
|
|
.setNeedLockFull(true)
|
|
|
.setUrl(url)
|
|
|
.setCacheWithPlay(false) // .setVideoTitle("测试视频")
|
|
|
.setVideoAllCallBack(new GSYSampleCallBack() {
|
|
|
@Override
|
|
|
public void onPrepared(String url, Object... objects) {
|
|
|
super.onPrepared(url, objects);
|
|
|
//开始播放了才能旋转和全屏
|
|
|
isPlay = true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onQuitFullscreen(String url, Object... objects) {
|
|
|
super.onQuitFullscreen(url, objects);
|
|
|
}
|
|
|
}).setLockClickListener(new LockClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view, boolean lock) {
|
|
|
|
|
|
}
|
|
|
}).build(player);
|
|
|
|
|
|
player.startPlayLogic();
|
|
|
|
|
|
}
|
|
|
|
|
|
public void setBackgroundAlpha(float bgAlpha) {
|
|
|
WindowManager.LayoutParams lp = getWindow()
|
...
|
...
|
@@ -1072,5 +932,18 @@ public class ZytjActivity extends BaseActivity { |
|
|
lp.alpha = bgAlpha;
|
|
|
getWindow().setAttributes(lp);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
if (mediaPlayer != null) {
|
|
|
mediaPlayer.stop();
|
|
|
mediaPlayer.release();
|
|
|
mediaPlayer = null;
|
|
|
}
|
|
|
uploadhandler.removeCallbacksAndMessages(null);
|
|
|
handler.removeCallbacksAndMessages(null);
|
|
|
myHandler.removeCallbacksAndMessages(null);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|