...
|
...
|
@@ -41,7 +41,6 @@ import androidx.recyclerview.widget.LinearLayoutManager; |
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.donkingliang.imageselector.utils.ImageSelector;
|
...
|
...
|
@@ -53,7 +52,6 @@ import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer; |
|
|
import com.yinhebairong.clasmanage.Config;
|
|
|
import com.yinhebairong.clasmanage.R;
|
|
|
import com.yinhebairong.clasmanage.adapter.imageselect.SquareImageView;
|
|
|
import com.yinhebairong.clasmanage.adapter.jxtadapter.TzMbAdatper;
|
|
|
import com.yinhebairong.clasmanage.adapter.jxtadapter.TztjmbAdapter;
|
|
|
import com.yinhebairong.clasmanage.base.BaseActivity;
|
|
|
import com.yinhebairong.clasmanage.base.instant.Layout;
|
...
|
...
|
@@ -65,9 +63,6 @@ import com.yinhebairong.clasmanage.entity.PostFiel; |
|
|
import com.yinhebairong.clasmanage.entity.VideoEntity;
|
|
|
import com.yinhebairong.clasmanage.m.M;
|
|
|
import com.yinhebairong.clasmanage.network.ApiService;
|
|
|
import com.yinhebairong.clasmanage.ui.jxt.activity.Fbzy_Activity;
|
|
|
import com.yinhebairong.clasmanage.ui.jxt.activity.Jsbj_Activity;
|
|
|
import com.yinhebairong.clasmanage.ui.jxt.activity.Jsbj_Activity_ViewBinding;
|
|
|
import com.yinhebairong.clasmanage.ui.jxt.fragment.Jl.JsjlActivity;
|
|
|
import com.yinhebairong.clasmanage.utils.AudioUtils;
|
|
|
import com.yinhebairong.clasmanage.widget.CircularProgressBar;
|
...
|
...
|
@@ -130,10 +125,11 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
String teacherIds = "";
|
|
|
String content = "";
|
|
|
private final static int STRAT_ID = 1998;
|
|
|
private final static int HDXZ_ID = 1999;
|
|
|
private final static int TZXZ_ID = 1999;
|
|
|
@BindView(R.id.et_tzzt)
|
|
|
EditText etTzzt;
|
|
|
TzMbBean.DataBean.ItemBean tzmb_item = new TzMbBean.DataBean.ItemBean();
|
|
|
TzMbBean.DataBean.ItemBean itemBean;
|
|
|
List<String> links_list = new ArrayList<>();
|
|
|
String audio = "";
|
|
|
String img = "";
|
...
|
...
|
@@ -160,6 +156,11 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
TztjmbAdapter tzMbAdatper;
|
|
|
String title;
|
|
|
String contextText;
|
|
|
@BindView(R.id.select_text)
|
|
|
TextView selectText;
|
|
|
@BindView(R.id.tv_xbjf)
|
|
|
TextView tvXbjf;
|
|
|
|
|
|
@Override
|
|
|
protected void initData() {
|
|
|
title = getIntent().getStringExtra("title");
|
...
|
...
|
@@ -176,177 +177,19 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
// mediaPlayer.setVolume(0.5f, 0.5f);
|
|
|
getMbDAta();
|
|
|
includeName.setText("发布通知");
|
|
|
includeBack.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
finish();
|
|
|
}
|
|
|
});
|
|
|
classSelect.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(FbtzA_ctivity.this, JsjlActivity.class);
|
|
|
startActivityForResult(intent, STRAT_ID);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
addTzmb.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
Intent intent = new Intent(FbtzA_ctivity.this, Tzmb_Activity.class);
|
|
|
startActivity(intent);
|
|
|
startActivityForResult(intent, HDXZ_ID);
|
|
|
}
|
|
|
});
|
|
|
fabutzBut.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
if (!classId.equals("")) {
|
|
|
if (!parentIds.equals("")) {
|
|
|
name = etTzzt.getText().toString();
|
|
|
if (!name.equals("")) {
|
|
|
content = contentEd.getText().toString();
|
|
|
if (!content.equals("")) {
|
|
|
WaitDialog.show(FbtzA_ctivity.this, "请稍候...");
|
|
|
ArrayList<String> videos = new ArrayList<>();
|
|
|
for (int i = 0; i < frequencyUrl.size(); i++) {
|
|
|
videos.add(frequencyUrl.get(i).getVideoPath());
|
|
|
}
|
|
|
audio = TextUtils.join(",", videos);
|
|
|
img = TextUtils.join(",",ImagesUrl);
|
|
|
video = TextUtils.join(",",videoUrl);
|
|
|
links = TextUtils.join(",",links_list);
|
|
|
Log.i("录音", "onClick: " + audio);
|
|
|
Api().fbtz(Config.Token, classId, teacherIds, parentIds, name, content, tzmb_item.getCall(), tzmb_item.getInscription(), img, audio, video,links).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<FbtzEntity>() {
|
|
|
@Override
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onNext(FbtzEntity fbtzEntity) {
|
|
|
if (fbtzEntity.getCode() == M.success) {
|
|
|
finish();
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "" + fbtzEntity.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
WaitDialog.dismiss();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(Throwable e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onComplete() {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请输入通知内容", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请输入通知的标题", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请选择接收通知的家长", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请选择接受的班级", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
addTzmb.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(FbtzA_ctivity.this, Tzmb_Activity.class);
|
|
|
startActivityForResult(intent, HDXZ_ID);
|
|
|
}
|
|
|
});
|
|
|
imageAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
imgPop(picAndVideo, position);
|
|
|
}
|
|
|
});
|
|
|
audioAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
text_time = view.findViewById(R.id.text_time);
|
|
|
List<VideoEntity> data = audioAdapter.getData();
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
data.get(i).setChecked(false);
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
if (mediaPlayer.isPlaying()) {
|
|
|
mediaPlayer.reset();
|
|
|
data.get(position).setChecked(true);
|
|
|
mediaPlayer.setDataSource(data.get(position).getVideoPath());
|
|
|
mediaPlayer.prepare();
|
|
|
mediaPlayer.start();
|
|
|
updateDescTv();
|
|
|
} else {
|
|
|
mediaPlayer.reset();
|
|
|
mediaPlayer.setDataSource(data.get(position).getVideoPath());
|
|
|
mediaPlayer.prepare();
|
|
|
mediaPlayer.start();
|
|
|
updateDescTv();
|
|
|
}
|
|
|
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
|
|
@Override
|
|
|
public void onCompletion(MediaPlayer mediaPlayer) {
|
|
|
int duration = mediaPlayer.getDuration();
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
|
|
|
Date date = new Date(duration);
|
|
|
String format = simpleDateFormat.format(date);
|
|
|
text_time.setText(format);
|
|
|
}
|
|
|
});
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
adapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
audioAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
|
|
@Override
|
|
|
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
List<VideoEntity> data = audioAdapter.getData();
|
|
|
data.remove(position);
|
|
|
mediaPlayer.stop();
|
|
|
audioAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
imgRecycle.setLayoutManager(new GridLayoutManager(this, 3));
|
|
|
imgRecycle.setAdapter(imageAdapter);
|
|
|
imageAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
|
|
@Override
|
|
|
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
switch (view.getId()) {
|
|
|
case R.id.v_delete:
|
|
|
if (picAndVideo.get(position).getType() == 1) {
|
|
|
ImagesUrl.remove(picAndVideo.get(position).getPath());
|
|
|
} else if (picAndVideo.get(position).getType() == 2) {
|
|
|
videoUrl.remove(picAndVideo.get(position).getPath());
|
|
|
} else if (picAndVideo.get(position).getType() == 3) {
|
|
|
frequencyUrl.remove(picAndVideo.get(position).getPath());
|
|
|
}
|
|
|
picAndVideo.remove(position);
|
|
|
adapter.notifyDataSetChanged();
|
|
|
break;
|
|
|
case R.id.item_select_pic_video:
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// @Override
|
|
|
// protected void onResume() {
|
|
|
// super.onResume();
|
|
|
// if (getIntent().getExtras() != null) {
|
|
|
// Intent intent = getIntent();
|
|
|
// Bundle tzmb_item = intent.getExtras();
|
|
|
// itemBean = (TzMbBean.DataBean.ItemBean) tzmb_item.getSerializable("tzmb_item");
|
|
|
// classType.setText(itemBean.getTitle());
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
private void getMbDAta() {
|
|
|
Api().tjmb(Config.Token)
|
|
|
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
...
|
...
|
@@ -358,27 +201,27 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
|
|
|
@Override
|
|
|
public void onNext(TztjmbBean tztjmbBean) {
|
|
|
if (tztjmbBean.getCode() == M.success){
|
|
|
if (tzMbAdatper==null){
|
|
|
tzMbAdatper = new TztjmbAdapter(R.layout.item_fbhdxqtem,tztjmbBean.getData());
|
|
|
if (tztjmbBean.getCode() == M.success) {
|
|
|
if (tzMbAdatper == null) {
|
|
|
tzMbAdatper = new TztjmbAdapter(R.layout.item_fbhdxqtem, tztjmbBean.getData());
|
|
|
moBanRv.setAdapter(tzMbAdatper);
|
|
|
tzMbAdatper.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
TextView hdtext = view.findViewById(R.id.hdtext);
|
|
|
if (tzMbAdatper.getData().get(position).isChecked()){
|
|
|
if (tzMbAdatper.getData().get(position).isChecked()) {
|
|
|
hdtext.setEnabled(false);
|
|
|
tzMbAdatper.getData().get(position).setChecked(false);
|
|
|
tzMbAdatper.getData().get(position).getContent();
|
|
|
etTzzt.setText(tzMbAdatper.getData().get(position).getTitle());
|
|
|
contentEd.setText(tzMbAdatper.getData().get(position).getContent());
|
|
|
}else {
|
|
|
} else {
|
|
|
tzMbAdatper.getData().get(position).setChecked(true);
|
|
|
hdtext.setEnabled(true);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}else {
|
|
|
} else {
|
|
|
tzMbAdatper.setNewData(tztjmbBean.getData());
|
|
|
tzMbAdatper.notifyDataSetChanged();
|
|
|
}
|
...
|
...
|
@@ -498,11 +341,11 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
|
|
|
|
|
|
private void AudioPop() {
|
|
|
View view = LayoutInflater.from(FbtzA_ctivity.this).inflate(R.layout.pop_ly_window,null);
|
|
|
View view = LayoutInflater.from(FbtzA_ctivity.this).inflate(R.layout.pop_ly_window, null);
|
|
|
// 弹窗
|
|
|
final PopupWindow popupWindow = new PopupWindow(view, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
|
|
ImageView ly_but = view.findViewById(R.id.ly_but);
|
|
|
time_text= view.findViewById(R.id.time_text);
|
|
|
time_text = view.findViewById(R.id.time_text);
|
|
|
TextView ly_style = view.findViewById(R.id.ly_style);
|
|
|
Circular_bar = view.findViewById(R.id.Circular_bar);
|
|
|
Circular_bar.setMax(600);
|
...
|
...
|
@@ -510,13 +353,13 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
RelativeLayout luyi_rl = view.findViewById(R.id.luyi_rl);
|
|
|
LinearLayout ly_li = view.findViewById(R.id.ly_li);
|
|
|
ViewGroup.LayoutParams layoutParams = ly_li.getLayoutParams();
|
|
|
layoutParams.height = layoutParams.height+M.getNavigationBarHeight(this);
|
|
|
layoutParams.height = layoutParams.height + M.getNavigationBarHeight(this);
|
|
|
ly_li.setLayoutParams(layoutParams);
|
|
|
popupWindow.setOutsideTouchable(true);
|
|
|
popupWindow.setTouchable(true);
|
|
|
popupWindow.setFocusable(true);
|
|
|
setBackgroundAlpha(0.5f);//设置屏幕透明度
|
|
|
popupWindow.showAtLocation(view,Gravity.BOTTOM,0,M.getNavigationBarHeight(this));
|
|
|
popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, M.getNavigationBarHeight(this));
|
|
|
Circular_bar.setVisibility(View.GONE);
|
|
|
AudioUtils audioUtils = new AudioUtils(FbtzA_ctivity.this);
|
|
|
luyi_rl.setOnClickListener(new View.OnClickListener() {
|
...
|
...
|
@@ -527,8 +370,8 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
int checkSelfPermission = ContextCompat.checkSelfPermission(FbtzA_ctivity.this,
|
|
|
Manifest.permission.RECORD_AUDIO);
|
|
|
if (permission == PackageManager.PERMISSION_GRANTED) {
|
|
|
if (checkSelfPermission==PackageManager.PERMISSION_GRANTED){
|
|
|
if (ly_but.isEnabled()){
|
|
|
if (checkSelfPermission == PackageManager.PERMISSION_GRANTED) {
|
|
|
if (ly_but.isEnabled()) {
|
|
|
ly_but.setEnabled(false);
|
|
|
Circular_bar.setVisibility(View.VISIBLE);
|
|
|
ly_style.setText("点击结束录音");
|
...
|
...
|
@@ -536,18 +379,18 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
audioUtils.StratAudio();
|
|
|
popupWindow.dismiss();
|
|
|
|
|
|
}else {
|
|
|
} else {
|
|
|
ly_but.setEnabled(true);
|
|
|
Circular_bar.setVisibility(View.GONE);
|
|
|
audioUtils.EndAudio();
|
|
|
String filePath = audioUtils.getFilePath();
|
|
|
postFile(filePath,3,"");
|
|
|
postFile(filePath, 3, "");
|
|
|
ly_style.setText("点击录音");
|
|
|
// Log.i(TAG, "onClick: "+filePath);
|
|
|
handler.removeCallbacks(runnable);
|
|
|
endTime();
|
|
|
}
|
|
|
}else {
|
|
|
} else {
|
|
|
//没有权限,申请权限。
|
|
|
ActivityCompat.requestPermissions(FbtzA_ctivity.this,
|
|
|
new String[]{Manifest.permission.RECORD_AUDIO}, 1);
|
...
|
...
|
@@ -576,7 +419,6 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------查看大图详情----------------------------------------------------------*/
|
|
|
float x1 = 0, x2 = 0; // 滑动坐标轴
|
|
|
int pageSze; // 页数
|
...
|
...
|
@@ -741,8 +583,175 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
|
|
|
@Override
|
|
|
protected void setEvent() {
|
|
|
includeBack.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
finish();
|
|
|
}
|
|
|
});
|
|
|
classSelect.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(FbtzA_ctivity.this, JsjlActivity.class);
|
|
|
startActivityForResult(intent, STRAT_ID);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
addTzmb.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
Intent intent = new Intent(FbtzA_ctivity.this, Tzmb_Activity.class);
|
|
|
startActivity(intent);
|
|
|
startActivityForResult(intent, TZXZ_ID);
|
|
|
}
|
|
|
});
|
|
|
fabutzBut.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
if (!classId.equals("")) {
|
|
|
if (!parentIds.equals("")) {
|
|
|
name = etTzzt.getText().toString();
|
|
|
if (!name.equals("")) {
|
|
|
content = contentEd.getText().toString();
|
|
|
if (!content.equals("")) {
|
|
|
WaitDialog.show(FbtzA_ctivity.this, "请稍候...");
|
|
|
ArrayList<String> videos = new ArrayList<>();
|
|
|
for (int i = 0; i < frequencyUrl.size(); i++) {
|
|
|
videos.add(frequencyUrl.get(i).getVideoPath());
|
|
|
}
|
|
|
audio = TextUtils.join(",", videos);
|
|
|
img = TextUtils.join(",", ImagesUrl);
|
|
|
video = TextUtils.join(",", videoUrl);
|
|
|
links = TextUtils.join(",", links_list);
|
|
|
Log.i("录音", "onClick: " + audio);
|
|
|
Api().fbtz(Config.Token, classId, teacherIds, parentIds, name, content, tzmb_item.getCall(), tzmb_item.getInscription(), img, audio, video, links).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<FbtzEntity>() {
|
|
|
@Override
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onNext(FbtzEntity fbtzEntity) {
|
|
|
if (fbtzEntity.getCode() == M.success) {
|
|
|
finish();
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "" + fbtzEntity.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
WaitDialog.dismiss();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(Throwable e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onComplete() {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请输入通知内容", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请输入通知的标题", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请选择接收通知的家长", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
} else {
|
|
|
Toast.makeText(ctx, "请选择接受的班级", Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
addTzmb.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
Intent intent = new Intent();
|
|
|
intent.setClass(FbtzA_ctivity.this, Tzmb_Activity.class);
|
|
|
startActivityForResult(intent, TZXZ_ID);
|
|
|
}
|
|
|
});
|
|
|
imageAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
imgPop(picAndVideo, position);
|
|
|
}
|
|
|
});
|
|
|
audioAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
text_time = view.findViewById(R.id.text_time);
|
|
|
List<VideoEntity> data = audioAdapter.getData();
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
data.get(i).setChecked(false);
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
if (mediaPlayer.isPlaying()) {
|
|
|
mediaPlayer.reset();
|
|
|
data.get(position).setChecked(true);
|
|
|
mediaPlayer.setDataSource(data.get(position).getVideoPath());
|
|
|
mediaPlayer.prepare();
|
|
|
mediaPlayer.start();
|
|
|
updateDescTv();
|
|
|
} else {
|
|
|
mediaPlayer.reset();
|
|
|
mediaPlayer.setDataSource(data.get(position).getVideoPath());
|
|
|
mediaPlayer.prepare();
|
|
|
mediaPlayer.start();
|
|
|
updateDescTv();
|
|
|
}
|
|
|
mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
|
|
@Override
|
|
|
public void onCompletion(MediaPlayer mediaPlayer) {
|
|
|
int duration = mediaPlayer.getDuration();
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
|
|
|
Date date = new Date(duration);
|
|
|
String format = simpleDateFormat.format(date);
|
|
|
text_time.setText(format);
|
|
|
}
|
|
|
});
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
adapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
audioAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
|
|
@Override
|
|
|
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
List<VideoEntity> data = audioAdapter.getData();
|
|
|
data.remove(position);
|
|
|
mediaPlayer.stop();
|
|
|
audioAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
imgRecycle.setLayoutManager(new GridLayoutManager(this, 3));
|
|
|
imgRecycle.setAdapter(imageAdapter);
|
|
|
imageAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
|
|
@Override
|
|
|
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
switch (view.getId()) {
|
|
|
case R.id.v_delete:
|
|
|
if (picAndVideo.get(position).getType() == 1) {
|
|
|
ImagesUrl.remove(picAndVideo.get(position).getPath());
|
|
|
} else if (picAndVideo.get(position).getType() == 2) {
|
|
|
videoUrl.remove(picAndVideo.get(position).getPath());
|
|
|
} else if (picAndVideo.get(position).getType() == 3) {
|
|
|
frequencyUrl.remove(picAndVideo.get(position).getPath());
|
|
|
}
|
|
|
picAndVideo.remove(position);
|
|
|
adapter.notifyDataSetChanged();
|
|
|
break;
|
|
|
case R.id.item_select_pic_video:
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
...
|
...
|
@@ -827,9 +836,6 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------图片适配器----------------------------------------------------------------*/
|
|
|
class ImageAdapter extends BaseQuickAdapter<JxtImageEntity, BaseViewHolder> {
|
|
|
public ImageAdapter(int layoutResId, @Nullable List<JxtImageEntity> data) {
|
...
|
...
|
@@ -897,6 +903,7 @@ public class FbtzA_ctivity extends BaseActivity { |
|
|
String format = simpleDateFormat.format(date);
|
|
|
time_text.setText(format);
|
|
|
}
|
|
|
|
|
|
private void endTime() {
|
|
|
time = 0;
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
|
...
|
...
|
|